CVS commit: src/sys/kern

2020-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 21 02:04:40 UTC 2020

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

Log Message:
OOPS -- fix mistake in previous commit.

bbusy really needs to return the error; otherwise things are very
bad!


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/kern/vfs_bio.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_bio.c
diff -u src/sys/kern/vfs_bio.c:1.288 src/sys/kern/vfs_bio.c:1.289
--- src/sys/kern/vfs_bio.c:1.288	Thu Feb 20 15:48:38 2020
+++ src/sys/kern/vfs_bio.c	Fri Feb 21 02:04:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.288 2020/02/20 15:48:38 riastradh Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.289 2020/02/21 02:04:40 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.288 2020/02/20 15:48:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.289 2020/02/21 02:04:40 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -2225,7 +2225,7 @@ bbusy(buf_t *bp, bool intr, int timo, km
 
 out:	SDT_PROBE5(io, kernel, , bbusy__done,
 	bp, intr, timo, interlock, error);
-	return 0;
+	return error;
 }
 
 /*



CVS commit: src

2020-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Feb 21 00:26:23 UTC 2020

Modified Files:
src/external/bsd/libevent/dist/test: regress_http.c regress_ssl.c
src/external/bsd/wpa/dist/src/radius: radius_client.c
src/external/cddl/osnet/dist/tools/ctf/cvt: iidesc.c
src/sys/arch/x86/x86: spectre.c tsc.c
src/sys/dev: clockctl.c
src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c
src/sys/dist/pf/net: pf_ioctl.c
src/sys/external/bsd/ipf/netinet: ip_fil_netbsd.c
src/sys/kern: kern_ktrace.c kern_proc.c kern_resource.c kern_veriexec.c
sys_pset.c sysv_ipc.c uipc_socket.c vfs_init.c
src/sys/net: if.c
src/sys/netsmb: smb_conn.c
src/sys/secmodel/extensions: secmodel_extensions.c
src/sys/secmodel/keylock: secmodel_keylock.c
src/sys/secmodel/securelevel: secmodel_securelevel.c
src/sys/secmodel/suser: secmodel_suser.c

Log Message:
Explicitly cast pointers to uintptr_t before casting to enums. They are
not necessarily the same size. Don't cast pointers to bool, check for
NULL instead.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libevent/dist/test/regress_http.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libevent/dist/test/regress_ssl.c
cvs rdiff -u -r1.1.1.7 -r1.2 \
src/external/bsd/wpa/dist/src/radius/radius_client.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/iidesc.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x86/x86/tsc.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/clockctl.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dist/pf/net/pf_ioctl.c
cvs rdiff -u -r1.33 -r1.34 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
cvs rdiff -u -r1.174 -r1.175 src/sys/kern/kern_ktrace.c
cvs rdiff -u -r1.240 -r1.241 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.185 -r1.186 src/sys/kern/kern_resource.c
cvs rdiff -u -r1.22 -r1.23 src/sys/kern/kern_veriexec.c \
src/sys/kern/sys_pset.c
cvs rdiff -u -r1.40 -r1.41 src/sys/kern/sysv_ipc.c
cvs rdiff -u -r1.286 -r1.287 src/sys/kern/uipc_socket.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/vfs_init.c
cvs rdiff -u -r1.472 -r1.473 src/sys/net/if.c
cvs rdiff -u -r1.30 -r1.31 src/sys/netsmb/smb_conn.c
cvs rdiff -u -r1.10 -r1.11 src/sys/secmodel/extensions/secmodel_extensions.c
cvs rdiff -u -r1.9 -r1.10 src/sys/secmodel/keylock/secmodel_keylock.c
cvs rdiff -u -r1.32 -r1.33 \
src/sys/secmodel/securelevel/secmodel_securelevel.c
cvs rdiff -u -r1.50 -r1.51 src/sys/secmodel/suser/secmodel_suser.c

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

Modified files:

Index: src/external/bsd/libevent/dist/test/regress_http.c
diff -u src/external/bsd/libevent/dist/test/regress_http.c:1.5 src/external/bsd/libevent/dist/test/regress_http.c:1.6
--- src/external/bsd/libevent/dist/test/regress_http.c:1.5	Tue Jan 31 23:17:40 2017
+++ src/external/bsd/libevent/dist/test/regress_http.c	Fri Feb 21 00:26:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: regress_http.c,v 1.5 2017/01/31 23:17:40 christos Exp $	*/
+/*	$NetBSD: regress_http.c,v 1.6 2020/02/21 00:26:21 joerg Exp $	*/
 /*
  * Copyright (c) 2003-2007 Niels Provos 
  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
@@ -35,7 +35,7 @@
 
 #include "event2/event-config.h"
 #include 
-__RCSID("$NetBSD: regress_http.c,v 1.5 2017/01/31 23:17:40 christos Exp $");
+__RCSID("$NetBSD: regress_http.c,v 1.6 2020/02/21 00:26:21 joerg Exp $");
 
 #include 
 #include 
@@ -1426,7 +1426,7 @@ http_cancel_test(void *arg)
 	struct event_base *base_to_fill = data->base;
 
 	enum http_cancel_test_type type =
-		(enum http_cancel_test_type)data->setup_data;
+		(enum http_cancel_test_type)(uintptr_t)data->setup_data;
 	struct evhttp *http = http_setup(, data->base, 0);
 
 	if (type & BY_HOST) {

Index: src/external/bsd/libevent/dist/test/regress_ssl.c
diff -u src/external/bsd/libevent/dist/test/regress_ssl.c:1.3 src/external/bsd/libevent/dist/test/regress_ssl.c:1.4
--- src/external/bsd/libevent/dist/test/regress_ssl.c:1.3	Tue Jan 31 23:17:40 2017
+++ src/external/bsd/libevent/dist/test/regress_ssl.c	Fri Feb 21 00:26:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: regress_ssl.c,v 1.3 2017/01/31 23:17:40 christos Exp $	*/
+/*	$NetBSD: regress_ssl.c,v 1.4 2020/02/21 00:26:21 joerg Exp $	*/
 /*
  * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
  *
@@ -265,7 +265,7 @@ respond_to_number(struct bufferevent *be
 	int n;
 
 	enum regress_openssl_type type;
-	type = (enum regress_openssl_type)ctx;
+	type = (enum regress_openssl_type)(uintptr_t)ctx;
 
 	line = evbuffer_readln(b, NULL, EVBUFFER_EOL_LF);
 	if (! line)
@@ -306,7 +306,7 @@ static void
 eventcb(struct bufferevent *bev, short what, void *ctx)
 {
 	enum regress_openssl_type type;
-	type = (enum 

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

2020-02-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb 20 23:57:16 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_x86_wait.h

Log Message:
Refactor dbregs_dont_inherit_lwp()

Switch from native LWP calls to pthread(3) calls.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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_ptrace_x86_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.23 src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.24
--- src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.23	Fri Feb 14 04:20:59 2020
+++ src/tests/lib/libc/sys/t_ptrace_x86_wait.h	Thu Feb 20 23:57:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_x86_wait.h,v 1.23 2020/02/14 04:20:59 christos Exp $	*/
+/*	$NetBSD: t_ptrace_x86_wait.h,v 1.24 2020/02/20 23:57:16 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -1617,13 +1617,11 @@ ATF_TC_BODY(dbregs_dr3_trap_code, tc)
 }
 #endif
 
-volatile lwpid_t x86_the_lwp_id = 0;
-
-static void __used
-x86_lwp_main_func(void *arg)
+static void * __used
+x86_main_func(void *arg)
 {
-	x86_the_lwp_id = _lwp_self();
-	_lwp_exit();
+
+	return arg;
 }
 
 static void
@@ -1639,10 +1637,8 @@ dbregs_dont_inherit_lwp(int reg)
 	const int slen = sizeof(state);
 	ptrace_event_t event;
 	const int elen = sizeof(event);
-	ucontext_t uc;
+	pthread_t t;
 	lwpid_t lid;
-	static const size_t ssize = 16*1024;
-	void *stack;
 	size_t i;
 	struct dbreg r1;
 	struct dbreg r2;
@@ -1661,22 +1657,10 @@ dbregs_dont_inherit_lwp(int reg)
 		DPRINTF("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		DPRINTF("Before allocating memory for stack in child\n");
-		FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
+		FORKEE_ASSERT(!pthread_create(, NULL, x86_main_func, NULL));
 
-		DPRINTF("Before making context for new lwp in child\n");
-		_lwp_makecontext(, x86_lwp_main_func, NULL, NULL, stack,
-		ssize);
-
-		DPRINTF("Before creating new in child\n");
-		FORKEE_ASSERT(_lwp_create(, 0, ) == 0);
-
-		DPRINTF("Before waiting for lwp %d to exit\n", lid);
-		FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
-
-		DPRINTF("Before verifying that reported %d and running lid %d "
-		"are the same\n", lid, x86_the_lwp_id);
-		FORKEE_ASSERT_EQ(lid, x86_the_lwp_id);
+		DPRINTF("Before waiting for thread to exit\n");
+		FORKEE_ASSERT(!pthread_join(t, NULL));
 
 		DPRINTF("Before exiting of the child process\n");
 		_exit(exitval);



CVS commit: src/sys/rump

2020-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 22:52:11 UTC 2020

Modified Files:
src/sys/rump: Makefile.rump
src/sys/rump/librump/rumpkern: kobj_rename.c

Log Message:
The global offset table is spelled .TOC. on PPC64, so preserve that symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/rump/Makefile.rump
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/librump/rumpkern/kobj_rename.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/rump/Makefile.rump
diff -u src/sys/rump/Makefile.rump:1.124 src/sys/rump/Makefile.rump:1.125
--- src/sys/rump/Makefile.rump:1.124	Sat Mar  3 22:46:30 2018
+++ src/sys/rump/Makefile.rump	Thu Feb 20 22:52:10 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rump,v 1.124 2018/03/03 22:46:30 christos Exp $
+#	$NetBSD: Makefile.rump,v 1.125 2020/02/20 22:52:10 joerg Exp $
 #
 
 .if !defined(_RUMP_MK)
@@ -235,7 +235,7 @@ __archivebuild: .USE
 .endif
 	for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \
 		${NM} -go $${renameobj} | ${TOOL_AWK} ' \
-		$$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}'${RUMP_SYM_NORENAME:D|${RUMP_SYM_NORENAME}})/ \
+		$$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE|\.TOC\.'${_SYMQUIRK}'${RUMP_SYM_NORENAME:D|${RUMP_SYM_NORENAME}})/ \
 		  {s=$$NF;sub(/^'${_PQ}'/, "_", s); print $$NF, s}'\
 		| sort | uniq  > renametab.$${renameobj}; \
 		${OBJCOPY} --preserve-dates --redefine-syms \

Index: src/sys/rump/librump/rumpkern/kobj_rename.c
diff -u src/sys/rump/librump/rumpkern/kobj_rename.c:1.2 src/sys/rump/librump/rumpkern/kobj_rename.c:1.3
--- src/sys/rump/librump/rumpkern/kobj_rename.c:1.2	Fri Apr 25 18:31:35 2014
+++ src/sys/rump/librump/rumpkern/kobj_rename.c	Thu Feb 20 22:52:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_rename.c,v 1.2 2014/04/25 18:31:35 pooka Exp $	*/
+/*	$NetBSD: kobj_rename.c,v 1.3 2020/02/20 22:52:10 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobj_rename.c,v 1.2 2014/04/25 18:31:35 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_rename.c,v 1.3 2020/02/20 22:52:10 joerg Exp $");
 
 #define ELFSIZE ARCH_ELFSIZE
 
@@ -49,6 +49,7 @@ const char *norentab[] = {
 	"rump",
 	"__",
 	"_GLOBAL_OFFSET_TABLE",
+	".TOC.",
 };
 static int
 norename(const char *name)



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

2020-02-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb 20 22:38:54 UTC 2020

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

Log Message:
Minor changes to t_ptrace_wait*

Add check for security.models.extensions.user_set_dbregs in the
concurrent event tests.

Use unconditionally atf_tc_skip(); as the test is racy.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/tests/lib/libc/sys/t_ptrace_wait.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_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.163 src/tests/lib/libc/sys/t_ptrace_wait.c:1.164
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.163	Wed Feb 19 17:13:00 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 20 22:38:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.163 2020/02/19 17:13:00 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.164 2020/02/20 22:38:54 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.163 2020/02/19 17:13:00 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.164 2020/02/20 22:38:54 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -2488,6 +2488,7 @@ ATF_TC_BODY(tracer_sees_terminaton_befor
 ATF_TC(tracer_sysctl_lookup_without_duplicates);
 ATF_TC_HEAD(tracer_sysctl_lookup_without_duplicates, tc)
 {
+	atf_tc_set_md_var(tc, "timeout", "15");
 	atf_tc_set_md_var(tc, "descr",
 	"Assert that await_zombie() in attach1 always finds a single "
 	"process and no other error is reported");
@@ -7541,6 +7542,8 @@ ATF_TC_BODY(syscall1, tc)
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
 }
 
+/// 
+
 ATF_TC(syscallemu1);
 ATF_TC_HEAD(syscallemu1, tc)
 {
@@ -8728,10 +8731,14 @@ thread_concurrent_test(enum thread_concu
 	ptrace_event_t event;
 	int i;
 
-	if (signal_handle == TCSH_SIG_IGN)
-		atf_tc_expect_fail("PR kern/54960");
-	else if (signal_handle == TCSH_HANDLER)
-		atf_tc_skip("PR kern/54960");
+#if defined(HAVE_DBREGS)
+	if (!can_we_set_dbregs()) {
+		atf_tc_skip("Either run this test as root or set sysctl(3) "
+		"security.models.extensions.user_set_dbregs to 1");
+}
+#endif
+
+	atf_tc_skip("PR kern/54960");
 
 	/* Protect against out-of-bounds array access. */
 	ATF_REQUIRE(breakpoint_threads <= THREAD_CONCURRENT_BREAKPOINT_NUM);



CVS commit: src/sys/kern

2020-02-20 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Feb 20 21:14:23 UTC 2020

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

Log Message:
protect deferred lists' manipulation by config_misc_lock, same as
config_pending semaphore itself; right now this also covers
DVF_ATTACH_INPROGRESS flag


To generate a diff of this commit:
cvs rdiff -u -r1.265 -r1.266 src/sys/kern/subr_autoconf.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/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.265 src/sys/kern/subr_autoconf.c:1.266
--- src/sys/kern/subr_autoconf.c:1.265	Sat Dec  1 02:08:16 2018
+++ src/sys/kern/subr_autoconf.c	Thu Feb 20 21:14:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.265 2018/12/01 02:08:16 msaitoh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.266 2020/02/20 21:14:23 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.265 2018/12/01 02:08:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.266 2020/02/20 21:14:23 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -443,16 +443,23 @@ config_interrupts_thread(void *cookie)
 {
 	struct deferred_config *dc;
 
+	mutex_enter(_misc_lock);
 	while ((dc = TAILQ_FIRST(_config_queue)) != NULL) {
 		TAILQ_REMOVE(_config_queue, dc, dc_queue);
+		mutex_exit(_misc_lock);
+
 		(*dc->dc_func)(dc->dc_dev);
-		dc->dc_dev->dv_flags &= ~DVF_ATTACH_INPROGRESS;
 		if (!device_pmf_is_registered(dc->dc_dev))
 			aprint_debug_dev(dc->dc_dev,
 			"WARNING: power management not supported\n");
 		config_pending_decr(dc->dc_dev);
 		kmem_free(dc, sizeof(*dc));
+
+		mutex_enter(_misc_lock);
+		dc->dc_dev->dv_flags &= ~DVF_ATTACH_INPROGRESS;
 	}
+	mutex_exit(_misc_lock);
+
 	kthread_exit(0);
 }
 
@@ -462,7 +469,7 @@ config_create_interruptthreads(void)
 	int i;
 
 	for (i = 0; i < interrupt_config_threads; i++) {
-		(void)kthread_create(PRI_NONE, 0, NULL,
+		(void)kthread_create(PRI_NONE, 0/*XXXSMP */, NULL,
 		config_interrupts_thread, NULL, NULL, "configintr");
 	}
 }
@@ -472,11 +479,18 @@ config_mountroot_thread(void *cookie)
 {
 	struct deferred_config *dc;
 
+	mutex_enter(_misc_lock);
 	while ((dc = TAILQ_FIRST(_config_queue)) != NULL) {
 		TAILQ_REMOVE(_config_queue, dc, dc_queue);
+		mutex_exit(_misc_lock);
+
 		(*dc->dc_func)(dc->dc_dev);
 		kmem_free(dc, sizeof(*dc));
+
+		mutex_enter(_misc_lock);
 	}
+	mutex_exit(_misc_lock);
+
 	kthread_exit(0);
 }
 
@@ -495,8 +509,8 @@ config_create_mountrootthreads(void)
 	KASSERT(mountroot_config_lwpids);
 	for (i = 0; i < mountroot_config_threads; i++) {
 		mountroot_config_lwpids[i] = 0;
-		(void)kthread_create(PRI_NONE, KTHREAD_MUSTJOIN, NULL,
- config_mountroot_thread, NULL,
+		(void)kthread_create(PRI_NONE, KTHREAD_MUSTJOIN/* XXXSMP */,
+ NULL, config_mountroot_thread, NULL,
  _config_lwpids[i],
  "configroot");
 	}
@@ -1958,18 +1972,22 @@ config_defer(device_t dev, void (*func)(
 	if (dev->dv_parent == NULL)
 		panic("config_defer: can't defer config of a root device");
 
+	dc = kmem_alloc(sizeof(*dc), KM_SLEEP);
+
+	config_pending_incr(dev);
+
+	mutex_enter(_misc_lock);
 #ifdef DIAGNOSTIC
-	TAILQ_FOREACH(dc, _config_queue, dc_queue) {
-		if (dc->dc_dev == dev)
+	struct deferred_config *odc;
+	TAILQ_FOREACH(odc, _config_queue, dc_queue) {
+		if (odc->dc_dev == dev)
 			panic("config_defer: deferred twice");
 	}
 #endif
-
-	dc = kmem_alloc(sizeof(*dc), KM_SLEEP);
 	dc->dc_dev = dev;
 	dc->dc_func = func;
 	TAILQ_INSERT_TAIL(_config_queue, dc, dc_queue);
-	config_pending_incr(dev);
+	mutex_exit(_misc_lock);
 }
 
 /*
@@ -1989,19 +2007,23 @@ config_interrupts(device_t dev, void (*f
 		return;
 	}
 
+	dc = kmem_alloc(sizeof(*dc), KM_SLEEP);
+
+	config_pending_incr(dev);
+
+	mutex_enter(_misc_lock);
 #ifdef DIAGNOSTIC
-	TAILQ_FOREACH(dc, _config_queue, dc_queue) {
-		if (dc->dc_dev == dev)
+	struct deferred_config *odc;
+	TAILQ_FOREACH(odc, _config_queue, dc_queue) {
+		if (odc->dc_dev == dev)
 			panic("config_interrupts: deferred twice");
 	}
 #endif
-
-	dc = kmem_alloc(sizeof(*dc), KM_SLEEP);
 	dc->dc_dev = dev;
 	dc->dc_func = func;
 	TAILQ_INSERT_TAIL(_config_queue, dc, dc_queue);
-	config_pending_incr(dev);
 	dev->dv_flags |= DVF_ATTACH_INPROGRESS;
+	mutex_exit(_misc_lock);
 }
 
 /*
@@ -2021,17 +2043,21 @@ config_mountroot(device_t dev, void (*fu
 		return;
 	}
 
+	dc = kmem_alloc(sizeof(*dc), KM_SLEEP);
+
+	mutex_enter(_misc_lock);
 #ifdef DIAGNOSTIC
-	TAILQ_FOREACH(dc, _config_queue, dc_queue) {
-		if (dc->dc_dev == dev)
+	struct deferred_config *odc;
+	TAILQ_FOREACH(odc, _config_queue, dc_queue) {
+		if (odc->dc_dev == dev)
 			panic("%s: deferred twice", __func__);
 	}
 #endif
 
-	dc = kmem_alloc(sizeof(*dc), KM_SLEEP);
 	dc->dc_dev = dev;
 	dc->dc_func = func;
 	TAILQ_INSERT_TAIL(_config_queue, dc, dc_queue);
+	

CVS commit: src/external/historical/nawk/dist

2020-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 20 19:59:12 UTC 2020

Modified Files:
src/external/historical/nawk/dist: lex.c lib.c main.c proto.h run.c

Log Message:
Fix failing unittests (by restoring old changes).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/historical/nawk/dist/lex.c
cvs rdiff -u -r1.10 -r1.11 src/external/historical/nawk/dist/lib.c \
src/external/historical/nawk/dist/main.c \
src/external/historical/nawk/dist/proto.h
cvs rdiff -u -r1.11 -r1.12 src/external/historical/nawk/dist/run.c

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

Modified files:

Index: src/external/historical/nawk/dist/lex.c
diff -u src/external/historical/nawk/dist/lex.c:1.6 src/external/historical/nawk/dist/lex.c:1.7
--- src/external/historical/nawk/dist/lex.c:1.6	Tue Feb 18 16:12:21 2020
+++ src/external/historical/nawk/dist/lex.c	Thu Feb 20 14:59:12 2020
@@ -401,6 +401,7 @@ int string(void)
 		case '\\':
 			c = input();
 			switch (c) {
+			case '\n': break;
 			case '"': *bp++ = '"'; break;
 			case 'n': *bp++ = '\n'; break;
 			case 't': *bp++ = '\t'; break;

Index: src/external/historical/nawk/dist/lib.c
diff -u src/external/historical/nawk/dist/lib.c:1.10 src/external/historical/nawk/dist/lib.c:1.11
--- src/external/historical/nawk/dist/lib.c:1.10	Tue Feb 18 16:12:21 2020
+++ src/external/historical/nawk/dist/lib.c	Thu Feb 20 14:59:12 2020
@@ -39,6 +39,7 @@ THIS SOFTWARE.
 
 char	EMPTY[] = { '\0' };
 FILE	*infile	= NULL;
+bool	innew;		/* true = infile has not been read by readrec */
 char	*file	= EMPTY;
 char	*record;
 int	recsize	= RECSIZE;
@@ -110,6 +111,7 @@ void initgetrec(void)
 		argno++;
 	}
 	infile = stdin;		/* no filenames, so use stdin */
+	innew = true;
 }
 
 /*
@@ -179,7 +181,9 @@ int getrec(char **pbuf, int *pbufsize, b
 FATAL("can't open file %s", file);
 			setfval(fnrloc, 0.0);
 		}
-		c = readrec(, , infile);
+		c = readrec(, , infile, innew);
+		if (innew)
+			innew = false;
 		if (c != 0 || buf[0] != '\0') {	/* normal record */
 			if (isrecord) {
 if (freeable(fldtab[0]))
@@ -217,7 +221,7 @@ void nextfile(void)
 	argno++;
 }
 
-int readrec(char **pbuf, int *pbufsize, FILE *inf)	/* read one record into buf */
+int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag)	/* read one record into buf */
 {
 	int sep, c, isrec;
 	char *rr, *buf = *pbuf;
@@ -228,7 +232,14 @@ int readrec(char **pbuf, int *pbufsize, 
 		bool found;
 
 		fa *pfa = makedfa(rs, 1);
-		found = fnematch(pfa, inf, , , recsize);
+		if (newflag)
+			found = fnematch(pfa, inf, , , recsize);
+		else {
+			int tempstat = pfa->initstat;
+			pfa->initstat = 2;
+			found = fnematch(pfa, inf, , , recsize);
+			pfa->initstat = tempstat;
+		}
 		if (found)
 			setptr(patbeg, '\0');
 	} else {
Index: src/external/historical/nawk/dist/main.c
diff -u src/external/historical/nawk/dist/main.c:1.10 src/external/historical/nawk/dist/main.c:1.11
--- src/external/historical/nawk/dist/main.c:1.10	Tue Feb 18 16:12:21 2020
+++ src/external/historical/nawk/dist/main.c	Thu Feb 20 14:59:12 2020
@@ -218,7 +218,9 @@ int main(int argc, char *argv[])
 	if (!safe)
 		envinit(environ);
 	yyparse();
+#if 0
 	setlocale(LC_NUMERIC, ""); /* back to whatever it is locally */
+#endif
 	if (fs)
 		*FS = qstring(fs, '\0');
 	   dprintf( ("errorflag=%d\n", errorflag) );
Index: src/external/historical/nawk/dist/proto.h
diff -u src/external/historical/nawk/dist/proto.h:1.10 src/external/historical/nawk/dist/proto.h:1.11
--- src/external/historical/nawk/dist/proto.h:1.10	Tue Feb 18 16:12:21 2020
+++ src/external/historical/nawk/dist/proto.h	Thu Feb 20 14:59:12 2020
@@ -124,7 +124,7 @@ extern	void	growfldtab(int n);
 extern	void	savefs(void);
 extern	int	getrec(char **, int *, bool);
 extern	void	nextfile(void);
-extern	int	readrec(char **, int *, FILE *);
+extern	int	readrec(char **, int *, FILE *, bool);
 extern	char	*getargv(int);
 extern	void	setclvar(char *);
 extern	void	fldbld(void);
@@ -193,7 +193,7 @@ extern	Cell	*bltin(Node **, int);
 extern	Cell	*printstat(Node **, int);
 extern	Cell	*nullproc(Node **, int);
 extern	FILE	*redirect(int, Node *);
-extern	FILE	*openfile(int, const char *);
+extern	FILE	*openfile(int, const char *, bool *);
 extern	const char	*filename(FILE *);
 extern	Cell	*closefile(Node **, int);
 extern	void	closeall(void);

Index: src/external/historical/nawk/dist/run.c
diff -u src/external/historical/nawk/dist/run.c:1.11 src/external/historical/nawk/dist/run.c:1.12
--- src/external/historical/nawk/dist/run.c:1.11	Tue Feb 18 16:12:21 2020
+++ src/external/historical/nawk/dist/run.c	Thu Feb 20 14:59:12 2020
@@ -409,6 +409,7 @@ Cell *awkgetline(Node **a, int n)	/* get
 	char *buf;
 	int bufsize = recsize;
 	int mode;
+	bool newflag;
 
 	if ((buf = malloc(bufsize)) == NULL)
 		FATAL("out of memory in getline");
@@ -420,12 +421,12 @@ Cell *awkgetline(Node **a, int n)	/* get
 		mode = 

CVS commit: src/bin/sh

2020-02-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Feb 20 18:24:21 UTC 2020

Modified Files:
src/bin/sh: sh.1

Log Message:
Typo: s/./,/


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.223 src/bin/sh/sh.1:1.224
--- src/bin/sh/sh.1:1.223	Mon Apr 22 04:10:33 2019
+++ src/bin/sh/sh.1	Thu Feb 20 18:24:20 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.223 2019/04/22 04:10:33 kre Exp $
+.\"	$NetBSD: sh.1,v 1.224 2020/02/20 18:24:20 pgoyette Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,7 +31,7 @@
 .\"
 .\"	@(#)sh.1	8.6 (Berkeley) 5/4/95
 .\"
-.Dd April 22, 2019
+.Dd February 20, 2020
 .Dt SH 1
 .\" everything except c o and s (keep them ordered)
 .ds flags abCEeFfhIiLmnpquVvXx
@@ -4436,7 +4436,7 @@ and un-exportable attributes set.
 .Ss Dv LINENO
 .Dv LINENO
 is in many respects a normal shell variable, containing an
-integer value. and can be expanded using any of the forms
+integer value, and can be expanded using any of the forms
 mentioned above which can be used for any other variable.
 .Pp
 .Dv LINENO



CVS commit: src/lib/libp2k

2020-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 20 15:48:52 UTC 2020

Modified Files:
src/lib/libp2k: p2k.c

Log Message:
Fix kassert in lfs by initializing vp first.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libp2k/p2k.c

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

Modified files:

Index: src/lib/libp2k/p2k.c
diff -u src/lib/libp2k/p2k.c:1.71 src/lib/libp2k/p2k.c:1.72
--- src/lib/libp2k/p2k.c:1.71	Mon Sep 23 12:00:57 2019
+++ src/lib/libp2k/p2k.c	Thu Feb 20 15:48:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: p2k.c,v 1.71 2019/09/23 12:00:57 christos Exp $	*/
+/*	$NetBSD: p2k.c,v 1.72 2020/02/20 15:48:52 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009  Antti Kantee.  All Rights Reserved.
@@ -791,7 +791,7 @@ do_makenode(struct puffs_usermount *pu, 
 	struct p2k_node *p2n;
 	struct componentname *cn;
 	struct vattr *va_x;
-	struct vnode *vp;
+	struct vnode *vp = NULL;
 	int rv;
 
 	p2n = malloc(sizeof(*p2n));



CVS commit: src/sys/kern

2020-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 20 15:48:38 UTC 2020

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

Log Message:
Buffer cache SDT probes.


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/sys/kern/vfs_bio.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_bio.c
diff -u src/sys/kern/vfs_bio.c:1.287 src/sys/kern/vfs_bio.c:1.288
--- src/sys/kern/vfs_bio.c:1.287	Fri Jan 17 19:33:14 2020
+++ src/sys/kern/vfs_bio.c	Thu Feb 20 15:48:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.287 2020/01/17 19:33:14 ad Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.288 2020/02/20 15:48:38 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.287 2020/01/17 19:33:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.288 2020/02/20 15:48:38 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -154,6 +154,28 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 
 
 #include 
 
+SDT_PROVIDER_DEFINE(io);
+
+SDT_PROBE_DEFINE4(io, kernel, , bbusy__start,
+"struct buf *"/*bp*/,
+"bool"/*intr*/, "int"/*timo*/, "kmutex_t *"/*interlock*/);
+SDT_PROBE_DEFINE5(io, kernel, , bbusy__done,
+"struct buf *"/*bp*/,
+"bool"/*intr*/,
+"int"/*timo*/,
+"kmutex_t *"/*interlock*/,
+"int"/*error*/);
+SDT_PROBE_DEFINE0(io, kernel, , getnewbuf__start);
+SDT_PROBE_DEFINE1(io, kernel, , getnewbuf__done,  "struct buf *"/*bp*/);
+SDT_PROBE_DEFINE3(io, kernel, , getblk__start,
+"struct vnode *"/*vp*/, "daddr_t"/*blkno*/, "int"/*size*/);
+SDT_PROBE_DEFINE4(io, kernel, , getblk__done,
+"struct vnode *"/*vp*/, "daddr_t"/*blkno*/, "int"/*size*/,
+"struct buf *"/*bp*/);
+SDT_PROBE_DEFINE2(io, kernel, , brelse, "struct buf *"/*bp*/, "int"/*set*/);
+SDT_PROBE_DEFINE1(io, kernel, , wait__start, "struct buf *"/*bp*/);
+SDT_PROBE_DEFINE1(io, kernel, , wait__done, "struct buf *"/*bp*/);
+
 #ifndef	BUFPAGES
 # define BUFPAGES 0
 #endif
@@ -1027,6 +1049,8 @@ brelsel(buf_t *bp, int set)
 	struct bqueue *bufq;
 	struct vnode *vp;
 
+	SDT_PROBE2(io, kernel, , brelse,  bp, set);
+
 	KASSERT(bp != NULL);
 	KASSERT(mutex_owned(_lock));
 	KASSERT(!cv_has_waiters(>b_done));
@@ -1211,6 +1235,7 @@ getblk(struct vnode *vp, daddr_t blkno, 
 	buf_t *bp;
 
 	mutex_enter(_lock);
+	SDT_PROBE3(io, kernel, , getblk__start,  vp, blkno, size);
  loop:
 	bp = incore(vp, blkno);
 	if (bp != NULL) {
@@ -1219,6 +1244,8 @@ getblk(struct vnode *vp, daddr_t blkno, 
 			if (err == EPASSTHROUGH)
 goto loop;
 			mutex_exit(_lock);
+			SDT_PROBE4(io, kernel, , getblk__done,
+			vp, blkno, size, NULL);
 			return (NULL);
 		}
 		KASSERT(!cv_has_waiters(>b_done));
@@ -1260,10 +1287,13 @@ getblk(struct vnode *vp, daddr_t blkno, 
 			LIST_REMOVE(bp, b_hash);
 			brelsel(bp, BC_INVAL);
 			mutex_exit(_lock);
+			SDT_PROBE4(io, kernel, , getblk__done,
+			vp, blkno, size, NULL);
 			return NULL;
 		}
 	}
 	BIO_SETPRIO(bp, BPRIO_DEFAULT);
+	SDT_PROBE4(io, kernel, , getblk__done,  vp, blkno, size, bp);
 	return (bp);
 }
 
@@ -1382,6 +1412,8 @@ getnewbuf(int slpflag, int slptimeo, int
 	struct vnode *vp;
 	struct mount *transmp = NULL;
 
+	SDT_PROBE0(io, kernel, , getnewbuf__start);
+
  start:
 	KASSERT(mutex_owned(_lock));
 
@@ -1399,6 +1431,7 @@ getnewbuf(int slpflag, int slptimeo, int
 #if defined(DIAGNOSTIC)
 			bp->b_freelistindex = -1;
 #endif /* defined(DIAGNOSTIC) */
+			SDT_PROBE1(io, kernel, , getnewbuf__done,  bp);
 			return (bp);
 		}
 		mutex_enter(_lock);
@@ -1441,6 +1474,7 @@ getnewbuf(int slpflag, int slptimeo, int
 (void)cv_timedwait(_cv,
 _lock, slptimeo);
 		}
+		SDT_PROBE1(io, kernel, , getnewbuf__done,  NULL);
 		return (NULL);
 	}
 
@@ -1479,6 +1513,7 @@ getnewbuf(int slpflag, int slptimeo, int
 		KASSERT(transmp != NULL);
 		fstrans_done(transmp);
 		mutex_enter(_lock);
+		SDT_PROBE1(io, kernel, , getnewbuf__done,  NULL);
 		return (NULL);
 	}
 
@@ -1508,6 +1543,7 @@ getnewbuf(int slpflag, int slptimeo, int
 		mutex_exit(vp->v_interlock);
 	}
 
+	SDT_PROBE1(io, kernel, , getnewbuf__done,  bp);
 	return (bp);
 }
 
@@ -1557,11 +1593,6 @@ buf_drain(int n)
 	return size;
 }
 
-SDT_PROVIDER_DEFINE(io);
-
-SDT_PROBE_DEFINE1(io, kernel, , wait__start, "struct buf *"/*bp*/);
-SDT_PROBE_DEFINE1(io, kernel, , wait__done, "struct buf *"/*bp*/);
-
 /*
  * Wait for operations on the buffer to complete.
  * When they do, extract and return the I/O's error value.
@@ -2163,9 +2194,13 @@ bbusy(buf_t *bp, bool intr, int timo, km
 
 	KASSERT(mutex_owned(_lock));
 
+	SDT_PROBE4(io, kernel, , bbusy__start,  bp, intr, timo, interlock);
+
 	if ((bp->b_cflags & BC_BUSY) != 0) {
-		if (curlwp == uvm.pagedaemon_lwp)
-			return EDEADLK;
+		if (curlwp == uvm.pagedaemon_lwp) {
+			error = EDEADLK;
+			goto out;
+		}
 		bp->b_cflags |= BC_WANTED;
 		bref(bp);
 		if 

CVS commit: src/sys/miscfs/deadfs

2020-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 20 15:48:05 UTC 2020

Modified Files:
src/sys/miscfs/deadfs: dead_vnops.c

Log Message:
Use vn_bwrite, not genfs_nullop, for VOP_BWRITE.

VOP_BWRITE is responsible for calling biodone; can't just leave it
hanging.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/miscfs/deadfs/dead_vnops.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/miscfs/deadfs/dead_vnops.c
diff -u src/sys/miscfs/deadfs/dead_vnops.c:1.61 src/sys/miscfs/deadfs/dead_vnops.c:1.62
--- src/sys/miscfs/deadfs/dead_vnops.c:1.61	Wed Apr 26 03:02:49 2017
+++ src/sys/miscfs/deadfs/dead_vnops.c	Thu Feb 20 15:48:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dead_vnops.c,v 1.61 2017/04/26 03:02:49 riastradh Exp $	*/
+/*	$NetBSD: dead_vnops.c,v 1.62 2020/02/20 15:48:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dead_vnops.c,v 1.61 2017/04/26 03:02:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dead_vnops.c,v 1.62 2020/02/20 15:48:05 riastradh Exp $");
 
 #include 
 #include 
@@ -48,7 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: dead_vnops.c
 /*
  * Prototypes for dead operations on vnodes.
  */
-#define dead_bwrite	genfs_nullop
+#define	dead_bwrite	vn_bwrite
 int	dead_lookup(void *);
 int	dead_open(void *);
 #define dead_close	genfs_nullop



CVS commit: src/doc

2020-02-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 20 15:04:53 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Fix two entries.


To generate a diff of this commit:
cvs rdiff -u -r1.2650 -r1.2651 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2650 src/doc/CHANGES:1.2651
--- src/doc/CHANGES:1.2650	Tue Feb 18 21:14:16 2020
+++ src/doc/CHANGES	Thu Feb 20 15:04:53 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2650 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2651 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -133,8 +133,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	strip(4): Removed from the tree. [thorpej 20200118]
 	hippi and esh(4): Removed from the tree. [thorpej 20200118]
 	de(4): Removed from the tree. [thorpej 20200119]
-	token ring and tr(4): Removed from the tree. [20200119]
-	fddi, fpa(4), fta(4), fea(4): Removed from the tree. [20200120]
+	token ring and tr(4): Removed from the tree. [thorpej 20200119]
+	fddi, fpa(4), fta(4), fea(4): Removed from the tree. [thorpej 20200120]
 	OpenSSL: Imported 1.1.1d. [christos 20200122]
 	dhcpcd(8): Import dhcpcd-8.1.6 [roy 20200127]
 	openresolv(8): Import openresolv-3.10.0 [roy 20200127]



CVS commit: [netbsd-9] src/doc

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:54:22 UTC 2020

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

Log Message:
Tickets #711 - #716


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 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.1 src/doc/CHANGES-9.1:1.1.2.2
--- src/doc/CHANGES-9.1:1.1.2.1	Sun Feb 16 12:21:24 2020
+++ src/doc/CHANGES-9.1	Thu Feb 20 14:54:22 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.1 2020/02/16 12:21:24 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.2 2020/02/20 14:54:22 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -19,3 +19,36 @@ external/cddl/osnet/dist/uts/common/fs/z
 	Teach zfs to revoke vnodes the usual way.
 	[riastradh, ticket #710]
 
+sys/arch/arm/ti/if_cpsw.c			1.9
+
+	Fix KERNHIST build (and simplify).
+	[skrll, ticket #711]
+
+sys/arch/hpcmips/hpcmips/hpcapm_machdep.c	1.6
+
+	Fix spelling in comments.
+	[sevan, ticket #712]
+
+lib/libdm/libdm_ioctl.c1.4
+
+	Do not write temporary files to fixed paths in /tmp.
+	[riastradh, ticket #713]
+
+crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c 1.14
+
+	Open /dev/urandom with O_CLOEXEC to avoid leaking filedescriptors
+	into child processes.
+	[riastradh, ticket #714]
+
+external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c	1.5
+
+	zpool: The NetBSD specific ioctl needs to include sys/ioctl.h.
+	[riastradh, ticket #715]
+
+sys/dev/usb/usbdi.c1.194
+
+	Fix a race in USB abort, so that a transfer on an interrupt
+	pipe whose callback is currently running at the moment the
+	pipe is aborted will not be restarted afterward.
+	[riastradh, ticket #716]
+



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

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:53:09 UTC 2020

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdi.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #716):

sys/dev/usb/usbdi.c: revision 1.194

When aborting a pipe, set pipe->up_running = 0.

This prevents any concurrent usb_transfer_complete from restarting
the pipe with usbd_start_next.


To generate a diff of this commit:
cvs rdiff -u -r1.182.4.1 -r1.182.4.2 src/sys/dev/usb/usbdi.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/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.182.4.1 src/sys/dev/usb/usbdi.c:1.182.4.2
--- src/sys/dev/usb/usbdi.c:1.182.4.1	Sun Sep  1 13:00:37 2019
+++ src/sys/dev/usb/usbdi.c	Thu Feb 20 14:53:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.182.4.1 2019/09/01 13:00:37 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.182.4.2 2020/02/20 14:53:09 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.182.4.1 2019/09/01 13:00:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.182.4.2 2020/02/20 14:53:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -876,6 +876,7 @@ usbd_ar_pipe(struct usbd_pipe *pipe)
 		usbd_dump_queue(pipe);
 #endif
 	pipe->up_repeat = 0;
+	pipe->up_running = 0;
 	pipe->up_aborting = 1;
 	while ((xfer = SIMPLEQ_FIRST(>up_queue)) != NULL) {
 		USBHIST_LOG(usbdebug, "pipe = %#jx xfer = %#jx "



CVS commit: [netbsd-9] src/external/cddl/osnet/dist/cmd/zpool

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:49:47 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/cmd/zpool [netbsd-9]: zpool_vdev.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #715):

external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c: revision 1.5

zpool: The NetBSD specific ioctl needs to include sys/ioctl.h


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.4.1 \
src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c

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

Modified files:

Index: src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c
diff -u src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.4 src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.4.4.1
--- src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c:1.4	Mon May 28 21:05:04 2018
+++ src/external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c	Thu Feb 20 14:49:47 2020
@@ -80,6 +80,7 @@
 #endif
 #ifdef __NetBSD__
 #include 
+#include 
 #endif
 
 #include "zpool_util.h"



CVS commit: [netbsd-9] src/crypto/external/bsd/openssl/dist/crypto/rand

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:48:19 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/rand [netbsd-9]:
rand_unix.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #714):

crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c: revision 1.14

Open /dev/urandom with O_CLOEXEC.

Let's avoid bleeding file descriptors into our clients' children,
shall we?

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 \
src/crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c:1.12.2.1 src/crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c:1.12.2.2
--- src/crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c:1.12.2.1	Mon Jan 27 07:21:42 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/rand/rand_unix.c	Thu Feb 20 14:48:19 2020
@@ -479,7 +479,7 @@ static int get_random_device(size_t n)
 return rd->fd;
 
 /* open the random device ... */
-if ((rd->fd = open(random_device_paths[n], O_RDONLY)) == -1)
+if ((rd->fd = open(random_device_paths[n], O_RDONLY|O_CLOEXEC)) == -1)
 return rd->fd;
 
 /* ... and cache its relevant stat(2) data */



CVS commit: [netbsd-9] src/lib/libdm

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:42:30 UTC 2020

Modified Files:
src/lib/libdm [netbsd-9]: libdm_ioctl.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #713):

lib/libdm/libdm_ioctl.c: revision 1.4

Let's not write temporary files to fixed paths in /tmp, shall we?
XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.2.1 src/lib/libdm/libdm_ioctl.c

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

Modified files:

Index: src/lib/libdm/libdm_ioctl.c
diff -u src/lib/libdm/libdm_ioctl.c:1.3 src/lib/libdm/libdm_ioctl.c:1.3.2.1
--- src/lib/libdm/libdm_ioctl.c:1.3	Thu Dec 27 14:05:54 2018
+++ src/lib/libdm/libdm_ioctl.c	Thu Feb 20 14:42:30 2020
@@ -171,14 +171,12 @@ libdm_task_run(libdm_task_t libdm_task)
 	}
 	dict = prop_dictionary_internalize(prefp.pref_plist);
 #else
-	prop_dictionary_externalize_to_file(libdm_task->ldm_task, "/tmp/libdm_in");
 	error = prop_dictionary_sendrecv_ioctl(libdm_task->ldm_task,
 	libdm_control_fd, NETBSD_DM_IOCTL, );
 	if ( error != 0) {
 		libdm_control_close(libdm_control_fd);
 		return error;
 	}
-	prop_dictionary_externalize_to_file(dict, "/tmp/libdm_out");
 #endif
 
 	libdm_control_close(libdm_control_fd);



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

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:38:29 UTC 2020

Modified Files:
src/sys/arch/hpcmips/hpcmips [netbsd-9]: hpcapm_machdep.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #712):

sys/arch/hpcmips/hpcmips/hpcapm_machdep.c: revision 1.6

spelling


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.60.1 src/sys/arch/hpcmips/hpcmips/hpcapm_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/hpcmips/hpcmips/hpcapm_machdep.c
diff -u src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5 src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5.60.1
--- src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5	Wed Mar 16 13:23:41 2011
+++ src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c	Thu Feb 20 14:38:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcapm_machdep.c,v 1.5 2011/03/16 13:23:41 tsutsui Exp $	*/
+/*	$NetBSD: hpcapm_machdep.c,v 1.5.60.1 2020/02/20 14:38:29 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 Takemura Shin
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.5 2011/03/16 13:23:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.5.60.1 2020/02/20 14:38:29 martin Exp $");
 
 #include 
 #include 
@@ -67,8 +67,8 @@ machine_standby(void)
 		vrip_splpiu();
 
 		/*
-		 * STANDBY instruction puts the CPU into power saveing
-		 * state until some interrupt occuer.
+		 * STANDBY instruction puts the CPU into power saving
+		 * state until some interrupt occurs.
 		 * It sleeps until you push the power button.
 		 */
 		__asm(".set noreorder");
@@ -99,8 +99,8 @@ machine_sleep(void)
 		vrip_splpiu();
 
 		/*
-		 * SUSPEND instruction puts the CPU into power saveing
-		 * state until some interrupt occuer.
+		 * SUSPEND instruction puts the CPU into power saving
+		 * state until some interrupt occurs.
 		 * It sleeps until you push the power button.
 		 */
 		__asm(".set noreorder");



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

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:36:38 UTC 2020

Modified Files:
src/sys/arch/arm/ti [netbsd-9]: if_cpsw.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #711):

sys/arch/arm/ti/if_cpsw.c: revision 1.9

Fix KERNHIST build (and simplify)


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/arch/arm/ti/if_cpsw.c

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

Modified files:

Index: src/sys/arch/arm/ti/if_cpsw.c
diff -u src/sys/arch/arm/ti/if_cpsw.c:1.6.2.2 src/sys/arch/arm/ti/if_cpsw.c:1.6.2.3
--- src/sys/arch/arm/ti/if_cpsw.c:1.6.2.2	Tue Jan 28 11:01:37 2020
+++ src/sys/arch/arm/ti/if_cpsw.c	Thu Feb 20 14:36:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $	*/
+/*	$NetBSD: if_cpsw.c,v 1.6.2.3 2020/02/20 14:36:38 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.3 2020/02/20 14:36:38 martin Exp $");
 
 #include 
 #include 
@@ -174,19 +174,14 @@ static int cpsw_ale_update_addresses(str
 CFATTACH_DECL_NEW(cpsw, sizeof(struct cpsw_softc),
 cpsw_match, cpsw_attach, cpsw_detach, NULL);
 
-#undef KERNHIST
 #include 
 KERNHIST_DEFINE(cpswhist);
 
-#ifdef KERNHIST
-#define KERNHIST_CALLED_5(NAME, i, j, k, l) \
-do { \
-	_kernhist_call = atomic_inc_uint_nv(&_kernhist_cnt); \
-	KERNHIST_LOG(NAME, "called! %x %x %x %x", i, j, k, l); \
-} while (/*CONSTCOND*/ 0)
-#else
-#define KERNHIST_CALLED_5(NAME, i, j, k, l)
-#endif
+#define CPSWHIST_CALLARGS(A,B,C,D)	do {	\
+	KERNHIST_CALLARGS(cpswhist, "%jx %jx %jx %jx",			\
+		(uintptr_t)(A), (uintptr_t)(B), (uintptr_t)(C), (uintptr_t)(D));\
+	} while (0)
+
 
 static inline u_int
 cpsw_txdesc_adjust(u_int x, int y)
@@ -219,7 +214,7 @@ cpsw_set_txdesc_next(struct cpsw_softc *
 	const bus_size_t o = sizeof(struct cpsw_cpdma_bd) * i + 0;
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, i, n, 0);
+	CPSWHIST_CALLARGS(sc, i, n, 0);
 
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh_txdescs, o, n);
 }
@@ -230,7 +225,7 @@ cpsw_set_rxdesc_next(struct cpsw_softc *
 	const bus_size_t o = sizeof(struct cpsw_cpdma_bd) * i + 0;
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, i, n, 0);
+	CPSWHIST_CALLARGS(sc, i, n, 0);
 
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh_rxdescs, o, n);
 }
@@ -244,7 +239,7 @@ cpsw_get_txdesc(struct cpsw_softc * cons
 	const bus_size_t c = __arraycount(bdp->word);
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0);
+	CPSWHIST_CALLARGS(sc, i, bdp, 0);
 
 	bus_space_read_region_4(sc->sc_bst, sc->sc_bsh_txdescs, o, dp, c);
 	KERNHIST_LOG(cpswhist, "%08x %08x %08x %08x\n",
@@ -260,7 +255,7 @@ cpsw_set_txdesc(struct cpsw_softc * cons
 	const bus_size_t c = __arraycount(bdp->word);
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0);
+	CPSWHIST_CALLARGS(sc, i, bdp, 0);
 	KERNHIST_LOG(cpswhist, "%08x %08x %08x %08x\n",
 	dp[0], dp[1], dp[2], dp[3]);
 
@@ -276,7 +271,7 @@ cpsw_get_rxdesc(struct cpsw_softc * cons
 	const bus_size_t c = __arraycount(bdp->word);
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0);
+	CPSWHIST_CALLARGS(sc, i, bdp, 0);
 
 	bus_space_read_region_4(sc->sc_bst, sc->sc_bsh_rxdescs, o, dp, c);
 
@@ -293,7 +288,7 @@ cpsw_set_rxdesc(struct cpsw_softc * cons
 	const bus_size_t c = __arraycount(bdp->word);
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, i, bdp, 0);
+	CPSWHIST_CALLARGS(sc, i, bdp, 0);
 	KERNHIST_LOG(cpswhist, "%08x %08x %08x %08x\n",
 	dp[0], dp[1], dp[2], dp[3]);
 
@@ -607,7 +602,7 @@ cpsw_start(struct ifnet *ifp)
 	u_int mlen;
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, 0, 0, 0);
+	CPSWHIST_CALLARGS(sc, 0, 0, 0);
 
 	if (__predict_false((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) !=
 	IFF_RUNNING)) {
@@ -1140,7 +1135,7 @@ cpsw_rxintr(void *arg)
 	u_int len, off;
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, 0, 0, 0);
+	CPSWHIST_CALLARGS(sc, 0, 0, 0);
 
 	for (;;) {
 		KASSERT(sc->sc_rxhead < CPSW_NRXDESCS);
@@ -1225,7 +1220,7 @@ cpsw_txintr(void *arg)
 	u_int cpi;
 
 	KERNHIST_FUNC(__func__);
-	KERNHIST_CALLED_5(cpswhist, sc, 0, 0, 0);
+	CPSWHIST_CALLARGS(sc, 0, 0, 0);
 
 	KASSERT(sc->sc_txrun);
 



CVS commit: [netbsd-8] src/doc

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:32:21 UTC 2020

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

Log Message:
Ticket #1506


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

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

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.98 src/doc/CHANGES-8.2:1.1.2.99
--- src/doc/CHANGES-8.2:1.1.2.98	Thu Feb 13 19:38:52 2020
+++ src/doc/CHANGES-8.2	Thu Feb 20 14:32:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.98 2020/02/13 19:38:52 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.99 2020/02/20 14:32:21 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -2046,3 +2046,8 @@ sys/net/if_pppoe.c1.149
 	Safely extract character sequences from packet for printing.
 	[mlelstv, ticket #1505]
 
+sys/arch/hpcmips/hpcmips/hpcapm_machdep.c	1.6
+
+	Fix spelling in commments.
+	[sevan, ticket #1506]
+



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

2020-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 14:31:46 UTC 2020

Modified Files:
src/sys/arch/hpcmips/hpcmips [netbsd-8]: hpcapm_machdep.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1506):

sys/arch/hpcmips/hpcmips/hpcapm_machdep.c: revision 1.6

spelling


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.48.1 src/sys/arch/hpcmips/hpcmips/hpcapm_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/hpcmips/hpcmips/hpcapm_machdep.c
diff -u src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5 src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5.48.1
--- src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c:1.5	Wed Mar 16 13:23:41 2011
+++ src/sys/arch/hpcmips/hpcmips/hpcapm_machdep.c	Thu Feb 20 14:31:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcapm_machdep.c,v 1.5 2011/03/16 13:23:41 tsutsui Exp $	*/
+/*	$NetBSD: hpcapm_machdep.c,v 1.5.48.1 2020/02/20 14:31:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 Takemura Shin
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.5 2011/03/16 13:23:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcapm_machdep.c,v 1.5.48.1 2020/02/20 14:31:46 martin Exp $");
 
 #include 
 #include 
@@ -67,8 +67,8 @@ machine_standby(void)
 		vrip_splpiu();
 
 		/*
-		 * STANDBY instruction puts the CPU into power saveing
-		 * state until some interrupt occuer.
+		 * STANDBY instruction puts the CPU into power saving
+		 * state until some interrupt occurs.
 		 * It sleeps until you push the power button.
 		 */
 		__asm(".set noreorder");
@@ -99,8 +99,8 @@ machine_sleep(void)
 		vrip_splpiu();
 
 		/*
-		 * SUSPEND instruction puts the CPU into power saveing
-		 * state until some interrupt occuer.
+		 * SUSPEND instruction puts the CPU into power saving
+		 * state until some interrupt occurs.
 		 * It sleeps until you push the power button.
 		 */
 		__asm(".set noreorder");



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

2020-02-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Feb 20 12:15:33 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: trap.c

Log Message:
When emulating obsoleted arm32 instructions, use ufetch(9) rather than
dereference tf_pc directly to retrieve an instruction.

Even if tf_pc is valid when processor decodes the instruction, someone
can unmap its page before tf_pc is read in the exception handler.

Now, SIGSEGV is delivered correctly to the process in this case, rather
than kernel panic.

Pointed out by maxv.
Discussed with ryo and skrll.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/aarch64/aarch64/trap.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/trap.c
diff -u src/sys/arch/aarch64/aarch64/trap.c:1.25 src/sys/arch/aarch64/aarch64/trap.c:1.26
--- src/sys/arch/aarch64/aarch64/trap.c:1.25	Fri Jan 31 09:23:58 2020
+++ src/sys/arch/aarch64/aarch64/trap.c	Thu Feb 20 12:15:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.25 2020/01/31 09:23:58 maxv Exp $ */
+/* $NetBSD: trap.c,v 1.26 2020/02/20 12:15:33 rin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.25 2020/01/31 09:23:58 maxv Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.26 2020/02/20 12:15:33 rin Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
@@ -362,30 +362,36 @@ fetch_arm_insn(struct trapframe *tf, uin
 		uint16_t *pc = (uint16_t *)(tf->tf_pc & ~1UL); /* XXX */
 		uint16_t hi, lo;
 
-		hi = *pc;
+		if (ufetch_16(pc, ))
+			return -1;
+
 		if (!THUMB_32BIT(hi)) {
 			/* 16-bit Thumb instruction */
 			*insn = hi;
 			return 2;
 		}
 
-		/*
-		 * 32-bit Thumb instruction:
-		 * We can safely retrieve the lower-half word without
-		 * consideration of a page fault; If present, it must
-		 * have occurred already in the decode stage.
-		 */
-		lo = *(pc + 1);
+		/* 32-bit Thumb instruction */
+		if (ufetch_16(pc + 1, ))
+			return -1;
 
 		*insn = ((uint32_t)hi << 16) | lo;
 		return 4;
 	}
 
-	*insn = *(uint32_t *)tf->tf_pc;
+	if (ufetch_32((uint32_t *)tf->tf_pc, insn))
+		return -1;
+
 	return 4;
 }
 
-static int
+enum emul_arm_result {
+	EMUL_ARM_SUCCESS = 0,
+	EMUL_ARM_UNKNOWN,
+	EMUL_ARM_FAULT,
+};
+
+static enum emul_arm_result
 emul_arm_insn(struct trapframe *tf)
 {
 	uint32_t insn;
@@ -432,14 +438,16 @@ emul_arm_insn(struct trapframe *tf)
 			break;
 		}
 		break;
+	default:
+		return EMUL_ARM_FAULT;
 	}
 
 	/* unknown, or unsupported instruction */
-	return 1;
+	return EMUL_ARM_UNKNOWN;
 
  emulated:
 	tf->tf_pc += insn_size;
-	return 0;
+	return EMUL_ARM_SUCCESS;
 }
 #endif /* COMPAT_NETBSD32 */
 
@@ -494,8 +502,16 @@ trap_el0_32sync(struct trapframe *tf)
 		break;
 
 	case ESR_EC_UNKNOWN:
-		if (emul_arm_insn(tf))
+		switch (emul_arm_insn(tf)) {
+		case EMUL_ARM_SUCCESS:
+			break;
+		case EMUL_ARM_UNKNOWN:
 			goto unknown;
+		case EMUL_ARM_FAULT:
+			do_trapsignal(l, SIGSEGV, SEGV_MAPERR,
+			(void *)tf->tf_pc, esr);
+			break;
+		}
 		userret(l);
 		break;
 



CVS commit: src/sys/external/bsd/drm2/include/drm

2020-02-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 20 09:07:39 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h

Log Message:
in bus_dmamap_load_pglist() try a 32-element array of
bus_dma_segment_t's before attempting to allocate.

this hopefully avoids hangs i've had in X since updating
from netbsd-8 to netbsd-9 that i've tracked down to this
function failing with ENOMEM.

XXX: maybe can avoid the alloc entirely by batching these
calls in 32 segments each.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h
diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.19 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.20
--- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.19	Wed Jan 22 07:53:45 2020
+++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h	Thu Feb 20 09:07:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma_hacks.h,v 1.19 2020/01/22 07:53:45 jmcneill Exp $	*/
+/*	$NetBSD: bus_dma_hacks.h,v 1.20 2020/02/20 09:07:39 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -118,12 +118,15 @@ bus_dmatag_bounces_paddr(bus_dma_tag_t d
 #endif
 }
 
+#define MAX_STACK_SEGS 32	/* XXXMRG: 512 bytes on 16 byte seg platforms */
+
 static inline int
 bus_dmamap_load_pglist(bus_dma_tag_t tag, bus_dmamap_t map,
 struct pglist *pglist, bus_size_t size, int flags)
 {
 	km_flag_t kmflags;
 	bus_dma_segment_t *segs;
+	bus_dma_segment_t stacksegs[MAX_STACK_SEGS];
 	int nsegs, seg;
 	struct vm_page *page;
 	int error;
@@ -136,14 +139,23 @@ bus_dmamap_load_pglist(bus_dma_tag_t tag
 	}
 
 	KASSERT(nsegs <= (SIZE_MAX / sizeof(segs[0])));
-	switch (flags & (BUS_DMA_WAITOK|BUS_DMA_NOWAIT)) {
-	case BUS_DMA_WAITOK:	kmflags = KM_SLEEP;	break;
-	case BUS_DMA_NOWAIT:	kmflags = KM_NOSLEEP;	break;
-	default:		panic("invalid flags: %d", flags);
-	}
-	segs = kmem_alloc((nsegs * sizeof(segs[0])), kmflags);
-	if (segs == NULL)
-		return ENOMEM;
+	if (nsegs > MAX_STACK_SEGS) {
+		switch (flags & (BUS_DMA_WAITOK|BUS_DMA_NOWAIT)) {
+		case BUS_DMA_WAITOK:
+			kmflags = KM_SLEEP;
+			break;
+		case BUS_DMA_NOWAIT:
+			kmflags = KM_NOSLEEP;
+			break;
+		default:
+			panic("invalid flags: %d", flags);
+		}
+		segs = kmem_alloc((nsegs * sizeof(segs[0])), kmflags);
+		if (segs == NULL)
+			return ENOMEM;
+	} else {
+		segs = stacksegs;
+	}
 
 	seg = 0;
 	TAILQ_FOREACH(page, pglist, pageq.queue) {
@@ -166,7 +178,10 @@ bus_dmamap_load_pglist(bus_dma_tag_t tag
 fail1: __unused
 	bus_dmamap_unload(tag, map);
 fail0:	KASSERT(error);
-out:	kmem_free(segs, (nsegs * sizeof(segs[0])));
+out:	if (segs != stacksegs) {
+		KASSERT(nsegs > MAX_STACK_SEGS);
+		kmem_free(segs, (nsegs * sizeof(segs[0])));
+	}
 	return error;
 }
 



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

2020-02-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Feb 20 08:31:18 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: files.rpi

Log Message:
Pull in arm_generic_dma.c to RPI kernel for arm_generic_dma_tag, which is
required by fdt_dma_machdep.c.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/conf/files.rpi

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

Modified files:

Index: src/sys/arch/evbarm/conf/files.rpi
diff -u src/sys/arch/evbarm/conf/files.rpi:1.11 src/sys/arch/evbarm/conf/files.rpi:1.12
--- src/sys/arch/evbarm/conf/files.rpi:1.11	Thu Oct 18 09:01:54 2018
+++ src/sys/arch/evbarm/conf/files.rpi	Thu Feb 20 08:31:17 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.rpi,v 1.11 2018/10/18 09:01:54 skrll Exp $
+#	$NetBSD: files.rpi,v 1.12 2020/02/20 08:31:17 rin Exp $
 #
 # Raspberry Pi
 #
@@ -14,7 +14,7 @@ file	arch/arm/arm32/arm32_reboot.c			arm
 file	arch/arm/arm32/irq_dispatch.S			arm32
 file	arch/arm/arm32/armv7_generic_space.c		arm32
 file	arch/arm/arm/bus_space_a4x.S			arm32
-#file	arch/arm/arm/arm_generic_dma.c
+file	arch/arm/arm/arm_generic_dma.c
 
 # CPU support and integrated peripherals
 include "arch/arm/broadcom/files.bcm2835"



CVS commit: src/sys/arch

2020-02-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 20 08:27:40 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: genassym.cf
src/sys/arch/alpha/alpha: genassym.cf
src/sys/arch/amiga/amiga: genassym.cf
src/sys/arch/atari/atari: genassym.cf
src/sys/arch/cesfic/cesfic: genassym.cf
src/sys/arch/hp300/hp300: genassym.cf
src/sys/arch/hppa/hppa: genassym.cf
src/sys/arch/luna68k/luna68k: genassym.cf
src/sys/arch/mac68k/mac68k: genassym.cf
src/sys/arch/mips/mips: genassym.cf
src/sys/arch/mvme68k/mvme68k: genassym.cf
src/sys/arch/news68k/news68k: genassym.cf
src/sys/arch/next68k/next68k: genassym.cf
src/sys/arch/sparc/sparc: genassym.cf
src/sys/arch/sun2/sun2: genassym.cf
src/sys/arch/sun3/sun3: genassym.cf
src/sys/arch/sun3/sun3x: genassym.cf
src/sys/arch/vax/vax: genassym.cf
src/sys/arch/x68k/x68k: genassym.cf

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/genassym.cf
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/amiga/amiga/genassym.cf
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/atari/atari/genassym.cf
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/cesfic/cesfic/genassym.cf
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/hp300/hp300/genassym.cf
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/hppa/genassym.cf
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/luna68k/luna68k/genassym.cf
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/mac68k/mac68k/genassym.cf
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/mips/genassym.cf
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mvme68k/mvme68k/genassym.cf
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/news68k/news68k/genassym.cf
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/next68k/genassym.cf
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sparc/sparc/genassym.cf
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sun2/sun2/genassym.cf
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sun3/sun3/genassym.cf
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sun3/sun3x/genassym.cf
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/vax/vax/genassym.cf
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x68k/x68k/genassym.cf

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/genassym.cf
diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.21 src/sys/arch/aarch64/aarch64/genassym.cf:1.22
--- src/sys/arch/aarch64/aarch64/genassym.cf:1.21	Wed Jan 29 19:29:23 2020
+++ src/sys/arch/aarch64/aarch64/genassym.cf	Thu Feb 20 08:27:38 2020
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.21 2020/01/29 19:29:23 skrll Exp $
+# $NetBSD: genassym.cf,v 1.22 2020/02/20 08:27:38 skrll Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -144,9 +144,6 @@ define	PGSHIFT			PGSHIFT
 # Important offsets into the lwp and proc structs & associated constants
 define	L_PCB			offsetof(struct lwp, l_addr)
 define	L_CPU			offsetof(struct lwp, l_cpu)
-define	L_PRIORITY		offsetof(struct lwp, l_priority)
-define	L_WCHAN			offsetof(struct lwp, l_wchan)
-define	L_STAT			offsetof(struct lwp, l_stat)
 define	L_PROC			offsetof(struct lwp, l_proc)
 define	L_PRIVATE		offsetof(struct lwp, l_private)
 define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)

Index: src/sys/arch/alpha/alpha/genassym.cf
diff -u src/sys/arch/alpha/alpha/genassym.cf:1.21 src/sys/arch/alpha/alpha/genassym.cf:1.22
--- src/sys/arch/alpha/alpha/genassym.cf:1.21	Sat Apr  6 03:06:24 2019
+++ src/sys/arch/alpha/alpha/genassym.cf	Thu Feb 20 08:27:38 2020
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.21 2019/04/06 03:06:24 thorpej Exp $
+# $NetBSD: genassym.cf,v 1.22 2020/02/20 08:27:38 skrll Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -140,10 +140,8 @@ define	ALPHA_PTE_KW		ALPHA_PTE_KW
 
 # Important offsets into the lwp and proc structs & associated constants
 define	L_PCB			offsetof(struct lwp, l_addr)
-define	L_STAT			offsetof(struct lwp, l_stat)
 define	L_CPU			offsetof(struct lwp, l_cpu)
 define	L_PROC			offsetof(struct lwp, l_proc)
-define	L_PRIORITY		offsetof(struct lwp, l_priority)
 define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
 define	L_MD_PCBPADDR		offsetof(struct lwp, l_md.md_pcbpaddr)
 define	L_MD_TF			offsetof(struct lwp, l_md.md_tf)

Index: src/sys/arch/amiga/amiga/genassym.cf
diff -u src/sys/arch/amiga/amiga/genassym.cf:1.32 src/sys/arch/amiga/amiga/genassym.cf:1.33
--- src/sys/arch/amiga/amiga/genassym.cf:1.32	Mon Feb 17 09:09:48 2020
+++ src/sys/arch/amiga/amiga/genassym.cf	Thu Feb 20 08:27:38 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.32 2020/02/17 09:09:48 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.33 2020/02/20 08:27:38 skrll Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -86,9 +86,6 @@ endif
 
 # lwp & proc fields and values
 define	L_PCB			offsetof(struct lwp, l_addr)
-define	L_PRIORITY		

CVS commit: src/sys/rump/net/lib/libshmif

2020-02-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Feb 20 08:06:15 UTC 2020

Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c

Log Message:
shmif: use cprng_strong32 to generate random bytes for a MAC address

cprng_fast32 sometimes returns indentical bytes, which look
"20:0e:11:33" in a MAC address, on different rump_server instances.
That leads MAC address duplications resulting in a test failure.

Fix it by using cprng_strong32 instead of cprng_fast32.  However
we should rather fix cprng_fast32 (or rump itself) somehow.

The fix mitigates PR kern/54897 but test failures due to other
causes still remain.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/rump/net/lib/libshmif/if_shmem.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/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.77 src/sys/rump/net/lib/libshmif/if_shmem.c:1.78
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.77	Sat Feb  1 22:38:31 2020
+++ src/sys/rump/net/lib/libshmif/if_shmem.c	Thu Feb 20 08:06:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_shmem.c,v 1.77 2020/02/01 22:38:31 thorpej Exp $	*/
+/*	$NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.77 2020/02/01 22:38:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $");
 
 #include 
 #include 
@@ -166,7 +166,7 @@ allocif(int unit, struct shmif_sc **scp)
 	uint32_t randnum;
 	int error;
 
-	randnum = cprng_fast32();
+	randnum = cprng_strong32();
 	memcpy([2], , sizeof(randnum));
 
 	sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);



CVS commit: src/tests/net

2020-02-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Feb 20 08:02:26 UTC 2020

Modified Files:
src/tests/net: net_common.sh

Log Message:
tests: abort if MAC address duplication found


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/net/net_common.sh

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

Modified files:

Index: src/tests/net/net_common.sh
diff -u src/tests/net/net_common.sh:1.38 src/tests/net/net_common.sh:1.39
--- src/tests/net/net_common.sh:1.38	Thu Feb 20 07:58:19 2020
+++ src/tests/net/net_common.sh	Thu Feb 20 08:02:26 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: net_common.sh,v 1.38 2020/02/20 07:58:19 ozaki-r Exp $
+#	$NetBSD: net_common.sh,v 1.39 2020/02/20 08:02:26 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -183,6 +183,7 @@ CRYPTO_NPF_LIBS="$CRYPTO_LIBS -lrumpvfs 
 _rump_server_socks=./.__socks
 _rump_server_ifaces=./.__ifaces
 _rump_server_buses=./.__buses
+_rump_server_macaddrs=./.__macaddrs
 
 DEBUG_SYSCTL_ENTRIES="net.inet.arp.debug net.inet6.icmp6.nd6_debug \
 net.inet.ipsec.debug"
@@ -318,14 +319,21 @@ rump_server_add_iface()
 	local ifname=$2
 	local bus=$3
 	local backup=$RUMP_SERVER
+	local macaddr=
 
 	export RUMP_SERVER=$sock
 	atf_check -s exit:0 rump.ifconfig $ifname create
 	if [ -n "$bus" ]; then
 		atf_check -s exit:0 rump.ifconfig $ifname linkstr $bus
 	fi
+	macaddr=$(get_macaddr $sock $ifname)
 	export RUMP_SERVER=$backup
 
+	if [ -f $_rump_server_macaddrs ]; then
+		atf_check -s not-exit:0 grep -q $macaddr $_rump_server_macaddrs
+	fi
+	echo $macaddr >> $_rump_server_macaddrs
+
 	echo $sock $ifname >> $_rump_server_ifaces
 	$DEBUG && cat $_rump_server_ifaces