CVS commit: src/sys/miscfs/procfs

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 08:38:54 UTC 2020

Modified Files:
src/sys/miscfs/procfs: procfs_linux.c

Log Message:
struct statvfs is too large for stack. Use malloc(9) instead.

XXX
Switch to kmem(9) for entire this file.

Frame size, e.g. for m68k, becomes:
3292 --> 12


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/miscfs/procfs/procfs_linux.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/procfs/procfs_linux.c
diff -u src/sys/miscfs/procfs/procfs_linux.c:1.83 src/sys/miscfs/procfs/procfs_linux.c:1.84
--- src/sys/miscfs/procfs/procfs_linux.c:1.83	Sat May 23 23:42:43 2020
+++ src/sys/miscfs/procfs/procfs_linux.c	Sun May 31 08:38:54 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: procfs_linux.c,v 1.83 2020/05/23 23:42:43 ad Exp $  */
+/*  $NetBSD: procfs_linux.c,v 1.84 2020/05/31 08:38:54 rin Exp $  */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.83 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.84 2020/05/31 08:38:54 rin Exp $");
 
 #include 
 #include 
@@ -611,18 +611,19 @@ procfs_domounts(struct lwp *curl, struct
 	struct mount *mp;
 	int error = 0, root = 0;
 	struct cwdinfo *cwdi = curl->l_proc->p_cwdi;
+	struct statvfs *sfs;
 
 	bf = malloc(LBFSZ, M_TEMP, M_WAITOK);
 
+	sfs = malloc(sizeof(*sfs), M_TEMP, M_WAITOK);
 	mountlist_iterator_init();
 	while ((mp = mountlist_iterator_next(iter)) != NULL) {
-		struct statvfs sfs;
-
-		if ((error = dostatvfs(mp, , curl, MNT_WAIT, 0)) == 0)
+		if ((error = dostatvfs(mp, sfs, curl, MNT_WAIT, 0)) == 0)
 			root |= procfs_format_sfs(, , bf, LBFSZ,
-			, curl, 0);
+			sfs, curl, 0);
 	}
 	mountlist_iterator_destroy(iter);
+	free(sfs, M_TEMP);
 
 	/*
 	 * If we are inside a chroot that is not itself a mount point,



CVS commit: src/sys/ddb

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 09:42:46 UTC 2020

Modified Files:
src/sys/ddb: db_kernel.c

Log Message:
XXX
DDB can be running in the interrupt context, e.g., when activated from
console. Therefore, we use kmem_intr_alloc(9) and friends in order to
avoid assertion failure.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/ddb/db_kernel.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/ddb/db_kernel.c
diff -u src/sys/ddb/db_kernel.c:1.2 src/sys/ddb/db_kernel.c:1.3
--- src/sys/ddb/db_kernel.c:1.2	Sun Mar  8 11:40:00 2009
+++ src/sys/ddb/db_kernel.c	Sun May 31 09:42:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_kernel.c,v 1.2 2009/03/08 11:40:00 mrg Exp $	*/
+/*	$NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,32 +30,37 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.2 2009/03/08 11:40:00 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $");
 
 #include 
-#include 
-#include 
-#include 
+#include 
 
 #include 
 
+/*
+ * XXX
+ * DDB can be running in the interrupt context, e.g., when activated from
+ * console. Therefore, we use kmem_intr_alloc(9) and friends here to avoid
+ * assertion failure.
+ */
+
 void *
 db_alloc(size_t sz)
 {
 
-	return malloc(sz, M_TEMP, M_WAITOK);
+	return kmem_intr_alloc(sz, KM_NOSLEEP);
 }
 
 void *
 db_zalloc(size_t sz)
 {
 
-	return malloc(sz, M_TEMP, M_WAITOK | M_ZERO);
+	return kmem_intr_zalloc(sz, KM_NOSLEEP);
 }
 
 void
 db_free(void *p, size_t sz)
 {
 
-	free(p, M_TEMP);
+	kmem_intr_free(p, sz);
 }



CVS commit: src/sys/arch/mips/cavium/dev

2020-05-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun May 31 06:23:49 UTC 2020

Removed Files:
src/sys/arch/mips/cavium/dev: octeon_tim.c octeon_timreg.h

Log Message:
Remove unused Timer Unit register definitions and stubs.  Can be
resurrected from the attic in the unlikely event we'll ever have
a driver for this device.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/sys/arch/mips/cavium/dev/octeon_tim.c \
src/sys/arch/mips/cavium/dev/octeon_timreg.h

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



CVS commit: src/sys/ddb

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 09:40:09 UTC 2020

Modified Files:
src/sys/ddb: db_command.h ddb.h
Added Files:
src/sys/ddb: db_alloc.h

Log Message:
Introduce db_alloc.h.

Provide db_alloc() and friends to userland, i.e., crash(8).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/ddb/db_alloc.h
cvs rdiff -u -r1.36 -r1.37 src/sys/ddb/db_command.h
cvs rdiff -u -r1.3 -r1.4 src/sys/ddb/ddb.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/ddb/db_command.h
diff -u src/sys/ddb/db_command.h:1.36 src/sys/ddb/db_command.h:1.37
--- src/sys/ddb/db_command.h:1.36	Tue Mar 10 15:58:37 2020
+++ src/sys/ddb/db_command.h	Sun May 31 09:40:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.h,v 1.36 2020/03/10 15:58:37 christos Exp $	*/
+/*	$NetBSD: db_command.h,v 1.37 2020/05/31 09:40:09 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@@ -144,10 +144,6 @@ struct db_command {
 #endif
 };
 
-void	*db_alloc(size_t);
-void	*db_zalloc(size_t);
-void	db_free(void *, size_t);
-
 #ifndef _KERNEL
 #define db_kernelonly() \
 db_printf("%s: can only be used in-kernel.\n", __func__)

Index: src/sys/ddb/ddb.h
diff -u src/sys/ddb/ddb.h:1.3 src/sys/ddb/ddb.h:1.4
--- src/sys/ddb/ddb.h:1.3	Sun Mar  4 07:14:50 2018
+++ src/sys/ddb/ddb.h	Sun May 31 09:40:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddb.h,v 1.3 2018/03/04 07:14:50 mlelstv Exp $	*/
+/*	$NetBSD: ddb.h,v 1.4 2020/05/31 09:40:09 rin Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -50,5 +50,6 @@
 #include 
 #include 
 #include 
+#include 
 
 #endif	/* _DDB_DDB_H_ */

Added files:

Index: src/sys/ddb/db_alloc.h
diff -u /dev/null src/sys/ddb/db_alloc.h:1.1
--- /dev/null	Sun May 31 09:40:10 2020
+++ src/sys/ddb/db_alloc.h	Sun May 31 09:40:09 2020
@@ -0,0 +1,42 @@
+/*	$NetBSD: db_alloc.h,v 1.1 2020/05/31 09:40:09 rin Exp $	*/
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DDB_ALLOC_
+#define _DDB_ALLOC_
+
+#ifdef _KERNEL
+void	*db_alloc(size_t);
+void	*db_zalloc(size_t);
+void	db_free(void *, size_t);
+#else
+#define db_alloc(sz)	malloc(size)
+#define db_zalloc(sz)	calloc(1, (size))
+#define db_free(p, sz)	free(p)
+#endif
+
+#endif /* _DDB_ALLOC_ */



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2020-05-31 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 31 06:17:24 UTC 2020

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: bta2dpd.c

Log Message:
Avoid running of the end of the array if a file cannot be opened.

Found by plunky@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.6 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.7
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.6	Sat Jul 27 20:10:29 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c	Sun May 31 06:17:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.6 2019/07/27 20:10:29 nakayama Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.7 2020/05/31 06:17:23 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -844,6 +844,7 @@ do_interrupt(int fd, short ev, void *arg
 	len = stream(fd, sc, channel_mode, frequency, bands, blocks,
 	alloc_method, bitpool, mtu, volume);
 
+next_file:
 	if (len == -1 && currentFileInd >= numfiles -1) {
 		event_del(_ev);
 		close(fd);
@@ -851,7 +852,6 @@ do_interrupt(int fd, short ev, void *arg
 		exit(1);
 	} else if (len == -1) {
 		close(fd);
-next_file:
 		currentFileInd++;
 		audfile = open(files2open[currentFileInd], O_RDONLY);
 		if (audfile < 0) {



CVS commit: src/sys/dev/usb

2020-05-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun May 31 07:53:38 UTC 2020

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

Log Message:
Add comments.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/vhci.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/vhci.c
diff -u src/sys/dev/usb/vhci.c:1.18 src/sys/dev/usb/vhci.c:1.19
--- src/sys/dev/usb/vhci.c:1.18	Thu May 21 05:58:00 2020
+++ src/sys/dev/usb/vhci.c	Sun May 31 07:53:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vhci.c,v 1.18 2020/05/21 05:58:00 maxv Exp $ */
+/*	$NetBSD: vhci.c,v 1.19 2020/05/31 07:53:38 maxv Exp $ */
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.18 2020/05/21 05:58:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.19 2020/05/31 07:53:38 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -832,6 +832,10 @@ vhci_usb_attach(vhci_fd_t *vfd)
 	}
 	KASSERT(xfer->ux_status == USBD_IN_PROGRESS);
 
+	/*
+	 * Mark our port has having changed state. Uhub will then fetch
+	 * status/change and see it needs to perform an attach.
+	 */
 	p = xfer->ux_buf;
 	memset(p, 0, xfer->ux_length);
 	p[0] = __BIT(vfd->port); /* TODO-bitmap */
@@ -917,9 +921,13 @@ vhci_usb_detach(vhci_fd_t *vfd)
 	port->status = 0;
 	port->change = UPS_C_CONNECT_STATUS | UPS_C_PORT_RESET;
 
+	/*
+	 * Mark our port has having changed state. Uhub will then fetch
+	 * status/change and see it needs to perform a detach.
+	 */
 	p = xfer->ux_buf;
 	memset(p, 0, xfer->ux_length);
-	p[0] = __BIT(vfd->port);
+	p[0] = __BIT(vfd->port); /* TODO-bitmap */
 	xfer->ux_actlen = xfer->ux_length;
 	xfer->ux_status = USBD_NORMAL_COMPLETION;
 



CVS commit: src/sys/dev/usb

2020-05-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun May 31 08:05:31 UTC 2020

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

Log Message:
sc_statuspend is allocated with kmem_zalloc, so no need to memset it.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/dev/usb/uhub.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/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.145 src/sys/dev/usb/uhub.c:1.146
--- src/sys/dev/usb/uhub.c:1.145	Fri May 15 12:34:52 2020
+++ src/sys/dev/usb/uhub.c	Sun May 31 08:05:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.145 2020/05/15 12:34:52 maxv Exp $	*/
+/*	$NetBSD: uhub.c,v 1.146 2020/05/31 08:05:30 maxv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 /*	$OpenBSD: uhub.c,v 1.86 2015/06/29 18:27:40 mpi Exp $ */
 
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.145 2020/05/15 12:34:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.146 2020/05/31 08:05:30 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -365,7 +365,6 @@ uhub_attach(device_t parent, device_t se
 	sc->sc_statuspend = kmem_zalloc(sc->sc_statuslen, KM_SLEEP);
 	sc->sc_status = kmem_alloc(sc->sc_statuslen, KM_SLEEP);
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB);
-	memset(sc->sc_statuspend, 0, sc->sc_statuslen);
 
 	/* force initial scan */
 	memset(sc->sc_status, 0xff, sc->sc_statuslen);



CVS commit: src/sys/kern

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 08:33:48 UTC 2020

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

Log Message:
db_show_callout(): struct callout_cpu and cpu_info are too much for stack.

XXX
DDB can be running in the interrupt context, e.g., when activated from
console. Therefore, use kmem_intr_alloc(9) instead of kmem_alloc(9).

Frame size, e.g. for m68k, becomes:
9212 (oops!) --> 0


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/kern_timeout.c

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

Modified files:

Index: src/sys/kern/kern_timeout.c
diff -u src/sys/kern/kern_timeout.c:1.61 src/sys/kern/kern_timeout.c:1.62
--- src/sys/kern/kern_timeout.c:1.61	Sun Apr 19 20:35:29 2020
+++ src/sys/kern/kern_timeout.c	Sun May 31 08:33:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_timeout.c,v 1.61 2020/04/19 20:35:29 ad Exp $	*/
+/*	$NetBSD: kern_timeout.c,v 1.62 2020/05/31 08:33:47 rin Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.61 2020/04/19 20:35:29 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.62 2020/05/31 08:33:47 rin Exp $");
 
 /*
  * Timeouts are kept in a hierarchical timing wheel.  The c_time is the
@@ -834,8 +834,9 @@ db_show_callout_bucket(struct callout_cp
 void
 db_show_callout(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
 {
-	struct callout_cpu *cc, ccb;
-	struct cpu_info *ci, cib;
+	struct callout_cpu *cc, *ccp;
+	struct cpu_info *ci, *cip;
+	const size_t ccs = sizeof(*cc), cis = sizeof(*ci);
 	int b;
 
 #ifndef CRASH
@@ -843,25 +844,40 @@ db_show_callout(db_expr_t addr, bool had
 #endif
 	db_printf("ticks  wheel   arg  func\n");
 
+	ccp = kmem_intr_alloc(ccs, KM_NOSLEEP); /* XXX ddb */
+	if (ccp == NULL) {
+		db_printf("%s: cannot allocate callout_cpu\n", __func__);
+		return;
+	}
+	cip = kmem_intr_alloc(cis, KM_NOSLEEP); /* XXX ddb */
+	if (cip == NULL) {
+		kmem_intr_free(ccp, ccs);
+		db_printf("%s: cannot allocate cpu_info\n", __func__);
+		return;
+	}
+
 	/*
 	 * Don't lock the callwheel; all the other CPUs are paused
 	 * anyhow, and we might be called in a circumstance where
 	 * some other CPU was paused while holding the lock.
 	 */
 	for (ci = db_cpu_first(); ci != NULL; ci = db_cpu_next(ci)) {
-		db_read_bytes((db_addr_t)ci, sizeof(cib), (char *));
-		cc = cib.ci_data.cpu_callout;
-		db_read_bytes((db_addr_t)cc, sizeof(ccb), (char *));
-		db_show_callout_bucket(, >cc_todo, _todo);
+		db_read_bytes((db_addr_t)ci, cis, (char *)cip);
+		cc = cip->ci_data.cpu_callout;
+		db_read_bytes((db_addr_t)cc, ccs, (char *)ccp);
+		db_show_callout_bucket(ccp, >cc_todo, >cc_todo);
 	}
 	for (b = 0; b < BUCKETS; b++) {
 		for (ci = db_cpu_first(); ci != NULL; ci = db_cpu_next(ci)) {
-			db_read_bytes((db_addr_t)ci, sizeof(cib), (char *));
-			cc = cib.ci_data.cpu_callout;
-			db_read_bytes((db_addr_t)cc, sizeof(ccb), (char *));
-			db_show_callout_bucket(, >cc_wheel[b],
-			_wheel[b]);
+			db_read_bytes((db_addr_t)ci, cis, (char *)cip);
+			cc = cip->ci_data.cpu_callout;
+			db_read_bytes((db_addr_t)cc, ccs, (char *)ccp);
+			db_show_callout_bucket(ccp, >cc_wheel[b],
+			>cc_wheel[b]);
 		}
 	}
+
+	kmem_intr_free(ccp, ccs);
+	kmem_intr_free(cip, cis);
 }
 #endif /* DDB */



CVS commit: src/sys/arch/mac68k/obio

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 08:59:40 UTC 2020

Modified Files:
src/sys/arch/mac68k/obio: wdc_obio.c

Log Message:
For wdc_obio_match(), struct wdc_regs is too large for stack.
Use kmem_alloc(9) instead.

Frame size becomes:
3088 --> 0


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mac68k/obio/wdc_obio.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/mac68k/obio/wdc_obio.c
diff -u src/sys/arch/mac68k/obio/wdc_obio.c:1.29 src/sys/arch/mac68k/obio/wdc_obio.c:1.30
--- src/sys/arch/mac68k/obio/wdc_obio.c:1.29	Fri Oct 20 07:06:07 2017
+++ src/sys/arch/mac68k/obio/wdc_obio.c	Sun May 31 08:59:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_obio.c,v 1.29 2017/10/20 07:06:07 jdolecek Exp $ */
+/*	$NetBSD: wdc_obio.c,v 1.30 2020/05/31 08:59:40 rin Exp $ */
 
 /*
  * Copyright (c) 2002 Takeshi Shibagaki  All rights reserved.
@@ -32,14 +32,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.29 2017/10/20 07:06:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.30 2020/05/31 08:59:40 rin Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -87,45 +87,49 @@ int
 wdc_obio_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct obio_attach_args *oa = (struct obio_attach_args *) aux;
-	struct wdc_regs wdr;
+	struct wdc_regs *wdr;
 	int i, result = 0;
 
+	wdr = kmem_alloc(sizeof(struct wdc_regs), KM_SLEEP);
+
 	switch (current_mac_model->machineid) {
 	case MACH_MACPB150:
 	case MACH_MACPB190:
 	case MACH_MACPB190CS:
 	case MACH_MACP580:
 	case MACH_MACQ630:
-		wdr.cmd_iot = wdr.ctl_iot = oa->oa_tag;
+		wdr->cmd_iot = wdr->ctl_iot = oa->oa_tag;
 
-		if (bus_space_map(wdr.cmd_iot, IDEBase, WDC_OBIO_REG_NPORTS,
-0, _baseioh))
-			return 0;
+		if (bus_space_map(wdr->cmd_iot, IDEBase, WDC_OBIO_REG_NPORTS,
+0, >cmd_baseioh))
+			goto out;
 
-		mac68k_bus_space_handle_swapped(wdr.cmd_iot, _baseioh);
+		mac68k_bus_space_handle_swapped(wdr->cmd_iot,
+		>cmd_baseioh);
 
 		for (i = 0; i < WDC_NREG; i++) {
-			if (bus_space_subregion(wdr.cmd_iot, wdr.cmd_baseioh,
-	4 * i, 4, _iohs[i]) != 0) {
-return 0;
-			}
+			if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
+	4 * i, 4, >cmd_iohs[i]) != 0)
+goto out;
 		}
-		wdc_init_shadow_regs();
+		wdc_init_shadow_regs(wdr);
 
 
-		if (bus_space_subregion(wdr.cmd_iot, wdr.cmd_baseioh,
+		if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
 WDC_OBIO_AUXREG_OFFSET,
 	WDC_OBIO_AUXREG_NPORTS,
-	_ioh))
-			return 0;
+	>ctl_ioh))
+			goto out;
 
-		result = wdcprobe();
+		result = wdcprobe(wdr);
 
-		bus_space_unmap(wdr.cmd_iot, wdr.cmd_baseioh, WDC_OBIO_REG_NPORTS);
+		bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh,
+		WDC_OBIO_REG_NPORTS);
 
-		return (result);
+		goto out;
 	}
-	return 0;
+out:	kmem_free(wdr, sizeof(struct wdc_regs));
+	return result;
 }
 
 void



CVS commit: src/sys/arch/mac68k/dev

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 09:00:25 UTC 2020

Modified Files:
src/sys/arch/mac68k/dev: adbsysasm.s

Log Message:
#ifdef out debug garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mac68k/dev/adbsysasm.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/mac68k/dev/adbsysasm.s
diff -u src/sys/arch/mac68k/dev/adbsysasm.s:1.12 src/sys/arch/mac68k/dev/adbsysasm.s:1.13
--- src/sys/arch/mac68k/dev/adbsysasm.s:1.12	Sun Nov  1 01:51:35 2009
+++ src/sys/arch/mac68k/dev/adbsysasm.s	Sun May 31 09:00:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: adbsysasm.s,v 1.12 2009/11/01 01:51:35 snj Exp $	*/
+/*	$NetBSD: adbsysasm.s,v 1.13 2020/05/31 09:00:25 rin Exp $	*/
 
 /*-
  * Copyright (C) 1994	Bradley A. Grantham
@@ -64,11 +64,11 @@ GLOBAL(adb_ms_asmcomplete)
 #endif
 	rts
 
-
+#if defined(ADB_DEBUG) && 0
 GLOBAL(adb_jadbprochello)
 	.asciz	"adb: hello from adbproc\n"
 	.even
-
+#endif
 
 GLOBAL(adb_jadbproc)
 #if defined(ADB_DEBUG) && 0



CVS commit: src/sys/ddb

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 09:51:55 UTC 2020

Modified Files:
src/sys/ddb: db_command.h ddb.h
Removed Files:
src/sys/ddb: db_alloc.h

Log Message:
Revert introduction of db_alloc.h.

db_alloc() and friends are already provided in crash.c.
Sorry for confusing you...


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/sys/ddb/db_alloc.h
cvs rdiff -u -r1.37 -r1.38 src/sys/ddb/db_command.h
cvs rdiff -u -r1.4 -r1.5 src/sys/ddb/ddb.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/ddb/db_command.h
diff -u src/sys/ddb/db_command.h:1.37 src/sys/ddb/db_command.h:1.38
--- src/sys/ddb/db_command.h:1.37	Sun May 31 09:40:09 2020
+++ src/sys/ddb/db_command.h	Sun May 31 09:51:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.h,v 1.37 2020/05/31 09:40:09 rin Exp $	*/
+/*	$NetBSD: db_command.h,v 1.38 2020/05/31 09:51:55 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@@ -144,6 +144,10 @@ struct db_command {
 #endif
 };
 
+void	*db_alloc(size_t);
+void	*db_zalloc(size_t);
+void	db_free(void *, size_t);
+
 #ifndef _KERNEL
 #define db_kernelonly() \
 db_printf("%s: can only be used in-kernel.\n", __func__)

Index: src/sys/ddb/ddb.h
diff -u src/sys/ddb/ddb.h:1.4 src/sys/ddb/ddb.h:1.5
--- src/sys/ddb/ddb.h:1.4	Sun May 31 09:40:09 2020
+++ src/sys/ddb/ddb.h	Sun May 31 09:51:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddb.h,v 1.4 2020/05/31 09:40:09 rin Exp $	*/
+/*	$NetBSD: ddb.h,v 1.5 2020/05/31 09:51:55 rin Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -50,6 +50,5 @@
 #include 
 #include 
 #include 
-#include 
 
 #endif	/* _DDB_DDB_H_ */



CVS commit: src/sys/dev/usb

2020-05-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun May 31 11:12:36 UTC 2020

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

Log Message:
make bwfm_usb_bus_ops static and const


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/usb/if_bwfm_usb.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_bwfm_usb.c
diff -u src/sys/dev/usb/if_bwfm_usb.c:1.12 src/sys/dev/usb/if_bwfm_usb.c:1.13
--- src/sys/dev/usb/if_bwfm_usb.c:1.12	Sat May 30 19:23:25 2020
+++ src/sys/dev/usb/if_bwfm_usb.c	Sun May 31 11:12:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_usb.c,v 1.12 2020/05/30 19:23:25 jdolecek Exp $ */
+/* $NetBSD: if_bwfm_usb.c,v 1.13 2020/05/31 11:12:36 jdolecek Exp $ */
 /* $OpenBSD: if_bwfm_usb.c,v 1.2 2017/10/15 14:55:13 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.12 2020/05/30 19:23:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.13 2020/05/31 11:12:36 jdolecek Exp $");
 
 #include 
 #include 
@@ -234,7 +234,7 @@ struct mbuf *	 bwfm_usb_newbuf(void);
 void		 bwfm_usb_rxeof(struct usbd_xfer *, void *, usbd_status);
 void		 bwfm_usb_txeof(struct usbd_xfer *, void *, usbd_status);
 
-struct bwfm_bus_ops bwfm_usb_bus_ops = {
+static const struct bwfm_bus_ops bwfm_usb_bus_ops = {
 	.bs_init = NULL,
 	.bs_stop = NULL,
 	.bs_txcheck = bwfm_usb_txcheck,



CVS commit: src/common/lib/libc/arch/m68k/gen

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 12:37:07 UTC 2020

Modified Files:
src/common/lib/libc/arch/m68k/gen: muldi3.S

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/m68k/gen/muldi3.S

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/m68k/gen/muldi3.S
diff -u src/common/lib/libc/arch/m68k/gen/muldi3.S:1.1 src/common/lib/libc/arch/m68k/gen/muldi3.S:1.2
--- src/common/lib/libc/arch/m68k/gen/muldi3.S:1.1	Sun May 31 11:43:37 2020
+++ src/common/lib/libc/arch/m68k/gen/muldi3.S	Sun May 31 12:37:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: muldi3.S,v 1.1 2020/05/31 11:43:37 rin Exp $	*/
+/*	$NetBSD: muldi3.S,v 1.2 2020/05/31 12:37:07 rin Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-RCSID("$NetBSD: muldi3.S,v 1.1 2020/05/31 11:43:37 rin Exp $")
+RCSID("$NetBSD: muldi3.S,v 1.2 2020/05/31 12:37:07 rin Exp $")
 
 | int64_t __muldi3(int64_t X, int64_t Y);
 |
@@ -110,6 +110,6 @@ ENTRY(__muldi3)
 	addl	%d2, %d0	| E += C
 	addl	%d3, %d0	| %d0 = E + F
 
-	moveml	(%sp)+, %d2-%d4	| pop %d2-%d6
+	moveml	(%sp)+, %d2-%d4	| pop %d2-%d4
 	rts
 END(__muldi3)



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

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:27:26 UTC 2020

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

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

sys/dev/usb/usb.c: revision 1.187

Don't allow open of /dev/usb if there are no attached busses.
PR kern/55303 mutex_vector_enter,512: uninitialized lock


To generate a diff of this commit:
cvs rdiff -u -r1.165.6.5 -r1.165.6.6 src/sys/dev/usb/usb.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/usb.c
diff -u src/sys/dev/usb/usb.c:1.165.6.5 src/sys/dev/usb/usb.c:1.165.6.6
--- src/sys/dev/usb/usb.c:1.165.6.5	Sat Nov 16 16:30:09 2019
+++ src/sys/dev/usb/usb.c	Sun May 31 10:27:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.165.6.5 2019/11/16 16:30:09 martin Exp $	*/
+/*	$NetBSD: usb.c,v 1.165.6.6 2020/05/31 10:27:26 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.165.6.5 2019/11/16 16:30:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.165.6.6 2020/05/31 10:27:26 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -179,6 +179,11 @@ Static void	usb_create_event_thread(devi
 Static void	usb_event_thread(void *);
 Static void	usb_task_thread(void *);
 
+/*
+ * Count of USB busses
+ */
+int nusbbusses = 0;
+
 #define USB_MAX_EVENTS 100
 struct usb_event_q {
 	struct usb_event ue;
@@ -331,6 +336,9 @@ usb_doattach(device_t self)
 
 	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
+	/* Protected by KERNEL_LOCK */
+	nusbbusses++;
+
 	sc->sc_bus->ub_usbctl = self;
 	sc->sc_port.up_power = USB_MAX_POWER;
 
@@ -639,6 +647,9 @@ usbopen(dev_t dev, int flag, int mode, s
 	int unit = minor(dev);
 	struct usb_softc *sc;
 
+	if (nusbbusses == 0)
+		return ENXIO;
+
 	if (unit == USB_DEV_MINOR) {
 		if (usb_dev_open)
 			return EBUSY;



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

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:25:58 UTC 2020

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

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

sys/dev/usb/usb.c: revision 1.187

Don't allow open of /dev/usb if there are no attached busses.
PR kern/55303 mutex_vector_enter,512: uninitialized lock


To generate a diff of this commit:
cvs rdiff -u -r1.179.2.2 -r1.179.2.3 src/sys/dev/usb/usb.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/usb.c
diff -u src/sys/dev/usb/usb.c:1.179.2.2 src/sys/dev/usb/usb.c:1.179.2.3
--- src/sys/dev/usb/usb.c:1.179.2.2	Sun Mar  1 12:35:16 2020
+++ src/sys/dev/usb/usb.c	Sun May 31 10:25:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.179.2.2 2020/03/01 12:35:16 martin Exp $	*/
+/*	$NetBSD: usb.c,v 1.179.2.3 2020/05/31 10:25:58 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.179.2.2 2020/03/01 12:35:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.179.2.3 2020/05/31 10:25:58 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -182,6 +182,11 @@ Static void	usb_create_event_thread(devi
 Static void	usb_event_thread(void *);
 Static void	usb_task_thread(void *);
 
+/*
+ * Count of USB busses
+ */
+int nusbbusses = 0;
+
 #define USB_MAX_EVENTS 100
 struct usb_event_q {
 	struct usb_event ue;
@@ -330,6 +335,9 @@ usb_doattach(device_t self)
 
 	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
+	/* Protected by KERNEL_LOCK */
+	nusbbusses++;
+
 	sc->sc_bus->ub_usbctl = self;
 	sc->sc_port.up_power = USB_MAX_POWER;
 
@@ -660,6 +668,9 @@ usbopen(dev_t dev, int flag, int mode, s
 	int unit = minor(dev);
 	struct usb_softc *sc;
 
+	if (nusbbusses == 0)
+		return ENXIO;
+
 	if (unit == USB_DEV_MINOR) {
 		if (usb_dev_open)
 			return EBUSY;



CVS commit: src/sys/arch/powerpc/oea

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 10:49:39 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
Stop returning while PMAP_LOCK() (= KERNEL_LOCK(1, NULL)) is held.

Kernel freeze with heavy load is significantly mitigated (fixed?),
in which I could not even enter DDB from console.

XXX
There is still inconsistency in usage of two PVO pools.
I will send-pr later.

XXX
pullup to netbsd-[987]


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/powerpc/oea/pmap.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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.95 src/sys/arch/powerpc/oea/pmap.c:1.96
--- src/sys/arch/powerpc/oea/pmap.c:1.95	Sat Jan 27 23:07:36 2018
+++ src/sys/arch/powerpc/oea/pmap.c	Sun May 31 10:49:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.95 2018/01/27 23:07:36 chs Exp $	*/
+/*	$NetBSD: pmap.c,v 1.96 2020/05/31 10:49:39 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.95 2018/01/27 23:07:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.96 2020/05/31 10:49:39 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -991,6 +991,7 @@ pmap_pte_spill(struct pmap *pm, vaddr_t 
 			}
 			source_pvo = pvo;
 			if (exec && !PVO_EXECUTABLE_P(source_pvo)) {
+PMAP_UNLOCK();
 return 0;
 			}
 			if (victim_pvo != NULL)
@@ -2162,6 +2163,7 @@ pmap_extract(pmap_t pm, vaddr_t va, padd
 return true;
 			}
 		}
+		PMAP_UNLOCK();
 		return false;
 #elif defined (PMAP_OEA64_BRIDGE)
 	if (va >= SEGMENT_LENGTH)



CVS commit: [netbsd-9] src/doc

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:46:21 UTC 2020

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

Log Message:
Tickets #933 - #937


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.62 -r1.1.2.63 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.62 src/doc/CHANGES-9.1:1.1.2.63
--- src/doc/CHANGES-9.1:1.1.2.62	Mon May 25 17:31:36 2020
+++ src/doc/CHANGES-9.1	Sun May 31 10:46:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.62 2020/05/25 17:31:36 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.63 2020/05/31 10:46:21 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -2741,3 +2741,48 @@ usr.sbin/npf/npfctl/npf_scan.l			1.31
 	PR/55288: npfctl: change parameter syntax to be more permissive.
 	[rmind, ticket #932]
 
+distrib/amd64/Makefile1.14
+distrib/amd64/installimage/Makefile		1.11
+distrib/amd64/uefi-installimage/Makefile	delete
+distrib/amd64/uefi-installimage/Makefile.bootimage delete
+distrib/amd64/uefi-installimage/Makefile.installimage delete
+distrib/amd64/uefi-installimage/boot.cfg.in	delete
+distrib/amd64/uefi-installimage/etc.rc		delete
+distrib/amd64/uefi-installimage/etc.ttys	delete
+distrib/amd64/uefi-installimage/install.sh	delete
+distrib/amd64/uefi-installimage/spec.inst	delete
+
+	Rename amd64 uefi-installimage to be just installimage, it works
+	for both UEFI and BIOS installations.
+	[maya, ticket #933]
+
+sys/dev/usb/usb.c1.187
+
+	PR 55303: do not allow open of /dev/usb if there are no attached
+	busses.
+	[skrll, ticket #934]
+
+sys/arch/x86/include/pmap.h			1.121 (patch)
+sys/arch/x86/x86/pmap.c1.394 (patch)
+sys/arch/xen/include/xenio.h			1.12 (patch)
+sys/arch/xen/include/xenpmap.h			1.44 (patch)
+sys/arch/xen/x86/x86_xpmap.c			1.89 (patch)
+sys/arch/xen/xen/privcmd.c			1.58 (patch)
+sys/external/mit/xen-include-public/dist/xen/include/public/memory.h 1.2 (patch)
+
+	Support Xen 4.13:
+	implement new ioctls: IOCTL_PRIVCMD_MMAPBATCH_V2,
+	IOCTL_PRIVCMD_MMAP_RESOURCE, IOCTL_GNTDEV_MMAP_GRANT_REF and
+	IOCTL_GNTDEV_ALLOC_GRANT_REF
+	[bouyer, ticket #935]
+
+lib/libterminfo/curterm.c			1.14
+
+	terminfo: test strlcpy result against space free, not string length.
+	[roy, ticket #936]
+
+usr.sbin/bta2dpd/bta2dpd/bta2dpd.c		1.7
+
+	Avoid running of the end of the array if a file cannot be opened.
+	[nat, ticket #937]
+



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

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:43:05 UTC 2020

Modified Files:
src/lib/libterminfo [netbsd-8]: curterm.c

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

lib/libterminfo/curterm.c: revision 1.14

terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.2.1 src/lib/libterminfo/curterm.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/libterminfo/curterm.c
diff -u src/lib/libterminfo/curterm.c:1.13 src/lib/libterminfo/curterm.c:1.13.2.1
--- src/lib/libterminfo/curterm.c:1.13	Thu May  4 09:42:23 2017
+++ src/lib/libterminfo/curterm.c	Sun May 31 10:43:05 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $ */
+/* $NetBSD: curterm.c,v 1.13.2.1 2020/05/31 10:43:05 martin Exp $ */
 
 /*
  * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $");
+__RCSID("$NetBSD: curterm.c,v 1.13.2.1 2020/05/31 10:43:05 martin Exp $");
 
 #include 
 #include 
@@ -99,21 +99,21 @@ set_curterm(TERMINAL *nterm)
 
 		p = ttytype;
 		l = sizeof(ttytype);
-		if ((n = strlcpy(p, nterm->name, l)) == strlen(p)) {
+		if ((n = strlcpy(p, nterm->name, l)) < l) {
 			p += n;
 			l -= n;
 			*p++ = '|';
 			l--;
-			if (nterm->_alias  &&
-(n = strlcpy(p, nterm->_alias, l)) == strlen(p))
+			if (nterm->_alias != NULL &&
+			(n = strlcpy(p, nterm->_alias, l)) < l)
 			{
 p += n;
 l -= n;
 *p++ = '|';
 l--;
 			}
-			if (nterm->desc  &&
-(n = strlcpy(p, nterm->desc, l)) == strlen(p))
+			if (nterm->desc != NULL &&
+			(n = strlcpy(p, nterm->desc, l)) < l)
 			{
 p += n;
 l -= n;



CVS commit: [netbsd-8] src/usr.sbin/bta2dpd/bta2dpd

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:47:02 UTC 2020

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd [netbsd-8]: bta2dpd.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1553):

usr.sbin/bta2dpd/bta2dpd/bta2dpd.c: revision 1.7

Avoid running of the end of the array if a file cannot be opened.
Found by plunky@.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3.2.2 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3.2.3
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3.2.2	Tue Jan 16 13:09:59 2018
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c	Sun May 31 10:47:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.3.2.2 2018/01/16 13:09:59 martin Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.3.2.3 2020/05/31 10:47:02 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -823,6 +823,7 @@ do_interrupt(int fd, short ev, void *arg
 	len = stream(fd, sc, channel_mode, frequency, bands, blocks,
 	alloc_method, bitpool, mtu, volume);
 
+next_file:
 	if (len == -1 && currentFileInd >= numfiles -1) {
 		event_del(_ev);
 		close(fd);
@@ -830,7 +831,6 @@ do_interrupt(int fd, short ev, void *arg
 		exit(1);
 	} else if (len == -1) {
 		close(fd);
-next_file:
 		currentFileInd++;
 		audfile = open(files2open[currentFileInd], O_RDONLY);
 		if (audfile < 0) {



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

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:41:40 UTC 2020

Modified Files:
src/lib/libterminfo [netbsd-9]: curterm.c

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

lib/libterminfo/curterm.c: revision 1.14

terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.12.1 src/lib/libterminfo/curterm.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/libterminfo/curterm.c
diff -u src/lib/libterminfo/curterm.c:1.13 src/lib/libterminfo/curterm.c:1.13.12.1
--- src/lib/libterminfo/curterm.c:1.13	Thu May  4 09:42:23 2017
+++ src/lib/libterminfo/curterm.c	Sun May 31 10:41:39 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $ */
+/* $NetBSD: curterm.c,v 1.13.12.1 2020/05/31 10:41:39 martin Exp $ */
 
 /*
  * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $");
+__RCSID("$NetBSD: curterm.c,v 1.13.12.1 2020/05/31 10:41:39 martin Exp $");
 
 #include 
 #include 
@@ -99,21 +99,21 @@ set_curterm(TERMINAL *nterm)
 
 		p = ttytype;
 		l = sizeof(ttytype);
-		if ((n = strlcpy(p, nterm->name, l)) == strlen(p)) {
+		if ((n = strlcpy(p, nterm->name, l)) < l) {
 			p += n;
 			l -= n;
 			*p++ = '|';
 			l--;
-			if (nterm->_alias  &&
-(n = strlcpy(p, nterm->_alias, l)) == strlen(p))
+			if (nterm->_alias != NULL &&
+			(n = strlcpy(p, nterm->_alias, l)) < l)
 			{
 p += n;
 l -= n;
 *p++ = '|';
 l--;
 			}
-			if (nterm->desc  &&
-(n = strlcpy(p, nterm->desc, l)) == strlen(p))
+			if (nterm->desc != NULL &&
+			(n = strlcpy(p, nterm->desc, l)) < l)
 			{
 p += n;
 l -= n;



CVS commit: [netbsd-8] src/doc

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:48:27 UTC 2020

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

Log Message:
Tickets #1551 - #1553


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/doc/CHANGES-8.3

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.11 src/doc/CHANGES-8.3:1.1.2.12
--- src/doc/CHANGES-8.3:1.1.2.11	Mon May 25 17:49:03 2020
+++ src/doc/CHANGES-8.3	Sun May 31 10:48:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.11 2020/05/25 17:49:03 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.12 2020/05/31 10:48:27 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -152,3 +152,19 @@ sys/netinet/igmp.c1.70
 	Fix uninitialized memory access.
 	[christos, ticket #1549]
 
+sys/dev/usb/usb.c1.187
+
+	PR 55303: do not allow open of /dev/usb if there are no attached
+	busses.
+	[skrll, ticket #1551]
+
+lib/libterminfo/curterm.c			1.14
+
+	terminfo: test strlcpy result against space free, not string length.
+	[roy, ticket #1552]
+
+usr.sbin/bta2dpd/bta2dpd/bta2dpd.c		1.7
+
+	Avoid running of the end of the array if a file cannot be opened.
+	[nat, ticket #1553]
+



CVS commit: [netbsd-9] src/usr.sbin/bta2dpd/bta2dpd

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:45:04 UTC 2020

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd [netbsd-9]: bta2dpd.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #937):

usr.sbin/bta2dpd/bta2dpd/bta2dpd.c: revision 1.7

Avoid running of the end of the array if a file cannot be opened.
Found by plunky@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c

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

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.6 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.6.2.1
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.6	Sat Jul 27 20:10:29 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c	Sun May 31 10:45:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.6 2019/07/27 20:10:29 nakayama Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.6.2.1 2020/05/31 10:45:04 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -844,6 +844,7 @@ do_interrupt(int fd, short ev, void *arg
 	len = stream(fd, sc, channel_mode, frequency, bands, blocks,
 	alloc_method, bitpool, mtu, volume);
 
+next_file:
 	if (len == -1 && currentFileInd >= numfiles -1) {
 		event_del(_ev);
 		close(fd);
@@ -851,7 +852,6 @@ do_interrupt(int fd, short ev, void *arg
 		exit(1);
 	} else if (len == -1) {
 		close(fd);
-next_file:
 		currentFileInd++;
 		audfile = open(files2open[currentFileInd], O_RDONLY);
 		if (audfile < 0) {



CVS import: src/external/bsd/dhcpcd/dist

2020-05-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun May 31 12:50:48 UTC 2020

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv20226

Log Message:
Update to dhcpcd-9.1.0 with the following changes:

 * Leases are stored outside the chroot again
 * The chroot directory can now be (and should be) empty [1]
 * ARP is now per address rather than per interface
 * Filter allowed ioctls in the privileged actioneer
 * Filter allowed UDP ports used by sendto(2) in the privileged actioneer
 * Filter allowed file paths in the privileged actioneer
 * route socket is now drained on overflow as it cannot be
   re-opened by the unpriviledged user

 * hostname can no longer be clobbered by SLAAC
 * grep is no longer used by the test hook
 * Interface hardware address type changes are now picked up
 * Fixed some RA timing issues
 * Fixed nd_* option parsing in dhcpcd.conf
 * Allow SIGPIPE in scripts
 * Default dhcpcd.conf no longer sends the current hostname
 * Default dhcpcd.conf no longer sends a vendorclassid


Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-9_1_0

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
C src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
C src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
C src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
C src/external/bsd/dhcpcd/dist/src/if-bsd.c
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
C src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
C src/external/bsd/dhcpcd/dist/src/ipv6.c
C src/external/bsd/dhcpcd/dist/src/ipv6nd.c
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
C src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
C src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
U src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/30-hostname.in
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in

14 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



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

2020-05-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun May 31 13:00:48 UTC 2020

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

Log Message:
We don't install any chroot subdirs for dhcpcd anymore


To generate a diff of this commit:
cvs rdiff -u -r1.1246 -r1.1247 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.1246 src/distrib/sets/lists/base/mi:1.1247
--- src/distrib/sets/lists/base/mi:1.1246	Sat May 30 20:47:58 2020
+++ src/distrib/sets/lists/base/mi	Sun May 31 13:00:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1246 2020/05/30 20:47:58 christos Exp $
+# $NetBSD: mi,v 1.1247 2020/05/31 13:00:48 roy Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -6049,11 +6049,6 @@
 ./var/backups	base-sys-root
 ./var/chroot	base-sys-root
 ./var/chroot/dhcpcdbase-dhcpcd-root
-./var/chroot/dhcpcd/etcbase-dhcpcd-root
-./var/chroot/dhcpcd/varbase-dhcpcd-root
-./var/chroot/dhcpcd/var/run			base-dhcpcd-root
-./var/chroot/dhcpcd/var/db			base-dhcpcd-root
-./var/chroot/dhcpcd/var/db/dhcpcd		base-dhcpcd-root
 ./var/chroot/ftp-proxybase-sys-root
 ./var/chroot/namedbase-bind-root
 ./var/chroot/named/devbase-bind-root



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

2020-05-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun May 31 13:07:50 UTC 2020

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

Log Message:
Revert prior - mark dirs as obsolete.

Thanks wiz@


To generate a diff of this commit:
cvs rdiff -u -r1.1247 -r1.1248 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.1247 src/distrib/sets/lists/base/mi:1.1248
--- src/distrib/sets/lists/base/mi:1.1247	Sun May 31 13:00:48 2020
+++ src/distrib/sets/lists/base/mi	Sun May 31 13:07:50 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1247 2020/05/31 13:00:48 roy Exp $
+# $NetBSD: mi,v 1.1248 2020/05/31 13:07:50 roy Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -6049,6 +6049,11 @@
 ./var/backups	base-sys-root
 ./var/chroot	base-sys-root
 ./var/chroot/dhcpcdbase-dhcpcd-root
+./var/chroot/dhcpcd/etcbase-obsolete		obsolete
+./var/chroot/dhcpcd/varbase-obsolete		obsolete
+./var/chroot/dhcpcd/var/run			base-obsolete		obsolete
+./var/chroot/dhcpcd/var/db			base-obsolete		obsolete
+./var/chroot/dhcpcd/var/db/dhcpcd		base-obsolete		obsolete
 ./var/chroot/ftp-proxybase-sys-root
 ./var/chroot/namedbase-bind-root
 ./var/chroot/named/devbase-bind-root



CVS commit: src/usr.sbin/postinstall

2020-05-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun May 31 13:45:47 UTC 2020

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: Move files out of dhcpcd chroot


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/postinstall/postinstall.in

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.21 src/usr.sbin/postinstall/postinstall.in:1.22
--- src/usr.sbin/postinstall/postinstall.in:1.21	Fri May 15 16:33:38 2020
+++ src/usr.sbin/postinstall/postinstall.in	Sun May 31 13:45:47 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.21 2020/05/15 16:33:38 christos Exp $
+# $NetBSD: postinstall.in,v 1.22 2020/05/31 13:45:47 roy Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -945,57 +945,65 @@ do_dhcpcd()
 	populate_dir "$op" true "${dir}" "${DEST_DIR}/etc" 644 dhcpcd.conf
 	failed=$(( ${failed} + $? ))
 
-	dstdir="${DEST_DIR}/var/chroot/dhcpcd"
-
-	check_dir "${op}" "${dstdir}/var/db/dhcpcd" 755
+	check_dir "${op}" "${DEST_DIR}/var/db/dhcpcd" 755
 	failed=$(( ${failed} + $? ))
 
 	move_file "${op}" \
 		"${DEST_DIR}/etc/dhcpcd.duid" \
-		"${dstdir}/var/db/dhcpcd/duid"
+		"${DEST_DIR}/var/db/dhcpcd/duid"
 	failed=$(( ${failed} + $? ))
 
 	move_file "${op}" \
 		"${DEST_DIR}/etc/dhcpcd.secret" \
-		"${dstdir}/var/db/dhcpcd/secret"
+		"${DEST_DIR}/var/db/dhcpcd/secret"
 	failed=$(( ${failed} + $? ))
 
 	move_file "${op}" \
 		"${DEST_DIR}/var/db/dhcpcd-rdm.monotonic" \
-		"${dstdir}/var/db/dhcpcd/rdm_monotonic"
+		"${DEST_DIR}/var/db/dhcpcd/rdm_monotonic"
 	failed=$(( ${failed} + $? ))
 
 	for lease in "${DEST_DIR}/var/db/dhcpcd-"*.lease*; do
 		[ -f "${lease}" ] || continue
 		new_lease=$(basename "${lease}" | ${SED} -e 's/dhcpcd-//')
-		new_lease="${dstdir}/var/db/dhcpcd/${new_lease}"
+		new_lease="${DEST_DIR}/var/db/dhcpcd/${new_lease}"
 		move_file "${op}" "${lease}" "${new_lease}"
 		failed=$(( ${failed} + $? ))
 	done
 
+	chroot_dir="${DEST_DIR}/var/chroot/dhcpcd"
 	move_file "${op}" \
-		"${DEST_DIR}/var/db/dhcpcd/duid" \
-		"${dstdir}/var/db/dhcpcd/duid"
+		"${chroot_dir}/var/db/dhcpcd/duid" \
+		"${DEST_DIR}/var/db/dhcpcd/duid"
 	failed=$(( ${failed} + $? ))
 
 	move_file "${op}" \
-		"${DEST_DIR}/var/db/dhcpcd/secret" \
-		"${dstdir}/var/db/dhcpcd/secret"
+		"${chroot_dir}/var/db/dhcpcd/secret" \
+		"${DEST_DIR}/var/db/dhcpcd/secret"
 	failed=$(( ${failed} + $? ))
 
 	move_file "${op}" \
-		"${DEST_DIR}/var/db/dhcpcd/rdm_monotonic" \
-		"${dstdir}/var/db/dhcpcd/rdm_monotonic"
+		"${chroot_dir}/var/db/dhcpcd/rdm_monotonic" \
+		"${DEST_DIR}/var/db/dhcpcd/rdm_monotonic"
 	failed=$(( ${failed} + $? ))
 
-	for lease in "${DEST_DIR}/var/db/dhcpcd/"*.lease*; do
+	for lease in "${chroot_dir}/var/db/dhcpcd/"*.lease*; do
 		[ -f "${lease}" ] || continue
-		new_lease="${dstdir}/var/db/dhcpcd/$(basename ${lease})"
+		new_lease="${DEST_DIR}/var/db/dhcpcd/$(basename ${lease})"
 		move_file "${op}" "${lease}" "${new_lease}"
 		failed=$(( ${failed} + $? ))
 	done
 
-	contents_owner "${op}" "${dstdir}/var/db/dhcpcd" _dhcpcd _dhcpcd
+	# Ensure chroot is now empty
+	for dir in \
+		$(find ${chroot_dir} -type f) \
+		$(find ${chroot_dir} -type d -mindepth 1 | sort -r)
+	do
+		echo "/var/chroot/dhcpcd${dir##${chroot_dir}}"
+	done | obsolete_paths "${op}"
+	failed=$(( ${failed} + $? ))
+
+	contents_owner "${op}" "${DEST_DIR}/var/db/dhcpcd" root wheel
 	failed=$(( ${failed} + $? ))
 
 	return ${failed}



CVS commit: [netbsd-9] src/sys

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:39:35 UTC 2020

Modified Files:
src/sys/arch/x86/include [netbsd-9]: pmap.h
src/sys/arch/x86/x86 [netbsd-9]: pmap.c
src/sys/arch/xen/include [netbsd-9]: xenio.h xenpmap.h
src/sys/arch/xen/x86 [netbsd-9]: x86_xpmap.c
src/sys/arch/xen/xen [netbsd-9]: privcmd.c
src/sys/external/mit/xen-include-public/dist/xen/include/public 
[netbsd-9]:
memory.h

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #935):

sys/arch/xen/x86/x86_xpmap.c: revision 1.89
sys/arch/x86/include/pmap.h: revision 1.121
sys/arch/xen/xen/privcmd.c: revision 1.58
sys/external/mit/xen-include-public/dist/xen/include/public/memory.h: 
revision 1.2
sys/arch/xen/include/xenpmap.h: revision 1.44
sys/arch/xen/include/xenio.h: revision 1.12
sys/arch/x86/x86/pmap.c: revision 1.394
(all via patch)

Ajust pmap_enter_ma() for upcoming new Xen privcmd ioctl:
pass flags to xpq_update_foreign()

Introduce a pmap MD flag: PMAP_MD_XEN_NOTR, which cause xpq_update_foreign()
to use the MMU_PT_UPDATE_NO_TRANSLATE flag.
make xpq_update_foreign() return the raw Xen error. This will cause
pmap_enter_ma() to return a negative error number in this case, but the
only user of this code path is privcmd.c and it can deal with it.

Add pmap_enter_gnt()m which maps a set of Xen grant entries at the
specified va in the specified pmap. Use the hooks implemented for EPT to
keep track of mapped grand entries in the pmap, and unmap them
when pmap_remove() is called. This requires pmap_remove() to be split
into a pmap_remove_locked(), to be called from pmap_remove_gnt().

Implement new ioctl, needed by Xen 4.13:
IOCTL_PRIVCMD_MMAPBATCH_V2
IOCTL_PRIVCMD_MMAP_RESOURCE
IOCTL_GNTDEV_MMAP_GRANT_REF
IOCTL_GNTDEV_ALLOC_GRANT_REF

Always enable declarations needed by privcmd.c


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.2.1 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.334.2.1 -r1.334.2.2 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.11 -r1.11.22.1 src/sys/arch/xen/include/xenio.h
cvs rdiff -u -r1.41 -r1.41.4.1 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.84 -r1.84.4.1 src/sys/arch/xen/x86/x86_xpmap.c
cvs rdiff -u -r1.51 -r1.51.10.1 src/sys/arch/xen/xen/privcmd.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.6.1 \
src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.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/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.101 src/sys/arch/x86/include/pmap.h:1.101.2.1
--- src/sys/arch/x86/include/pmap.h:1.101	Wed May 29 16:54:41 2019
+++ src/sys/arch/x86/include/pmap.h	Sun May 31 10:39:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.101 2019/05/29 16:54:41 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.101.2.1 2020/05/31 10:39:34 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -272,7 +272,7 @@ struct pmap {
 	uint64_t pm_ncsw;		/* for assertions */
 	struct vm_page *pm_gc_ptp;	/* pages from pmap g/c */
 
-	/* Used by NVMM. */
+	/* Used by NVMM and Xen */
 	int (*pm_enter)(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int);
 	bool (*pm_extract)(struct pmap *, vaddr_t, paddr_t *);
 	void (*pm_remove)(struct pmap *, vaddr_t, vaddr_t);

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.334.2.1 src/sys/arch/x86/x86/pmap.c:1.334.2.2
--- src/sys/arch/x86/x86/pmap.c:1.334.2.1	Wed Apr 29 13:39:23 2020
+++ src/sys/arch/x86/x86/pmap.c	Sun May 31 10:39:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.334.2.1 2020/04/29 13:39:23 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.334.2.2 2020/05/31 10:39:35 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.1 2020/04/29 13:39:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.2 2020/05/31 10:39:35 martin Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -150,6 +150,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -2393,7 +2394,7 @@ pmap_create(void)
 	pmap->pm_flags = 0;
 	pmap->pm_gc_ptp = NULL;
 
-	/* Used by NVMM. */
+	/* Used by NVMM and Xen */
 	pmap->pm_enter = NULL;
 	pmap->pm_extract = NULL;
 	pmap->pm_remove = NULL;
@@ -3527,32 +3528,19 @@ pmap_remove_pte(struct pmap *pmap, struc
 	return true;
 }
 
-/*
- * pmap_remove: mapping removal function.
- *
- * => caller should not be holding any pmap locks
- */
-void
-pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva)
+static void
+pmap_remove_locked(struct pmap *pmap, vaddr_t sva, vaddr_t eva,
+pt_entry_t *ptes, pd_entry_t * const *pdes)
 {
-	pt_entry_t *ptes;
 	pd_entry_t pde;
-	pd_entry_t * const *pdes;
 	

CVS commit: src

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 11:43:38 UTC 2020

Modified Files:
src/lib/libc/arch/m68k/gen: Makefile.inc
src/sys/lib/libkern/arch/m68k: Makefile.inc
Added Files:
src/common/lib/libc/arch/m68k/gen: muldi3.S

Log Message:
Add m68k assembler version of __muldi3().

This is intended for 68060:
  - GCC does not emit __muldi3() for 68020-40, that have 32 * 32 --> 64 mulul
  - mulsl (and moveml), used in this code, are not implemented for 68010

In comparison with that from compiler_rt, this version saves:
  - 12% of processing time
  - 12 bytes of stack
  - 50 bytes of code size
Also, slightly faster, memory saving, and smaller than libgcc version.

By examining with evcnt(9), __muldi3() is invoked more than 1000 times per
sec by kernel, which should justify to introduce assembler version of this
function.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/m68k/gen/muldi3.S
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/arch/m68k/gen/Makefile.inc
cvs rdiff -u -r1.37 -r1.38 src/sys/lib/libkern/arch/m68k/Makefile.inc

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

Modified files:

Index: src/lib/libc/arch/m68k/gen/Makefile.inc
diff -u src/lib/libc/arch/m68k/gen/Makefile.inc:1.37 src/lib/libc/arch/m68k/gen/Makefile.inc:1.38
--- src/lib/libc/arch/m68k/gen/Makefile.inc:1.37	Wed Apr 22 11:28:56 2020
+++ src/lib/libc/arch/m68k/gen/Makefile.inc	Sun May 31 11:43:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.37 2020/04/22 11:28:56 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.38 2020/05/31 11:43:37 rin Exp $
 
 SRCS+=	alloca.S fabs.S
 
@@ -42,6 +42,9 @@ SRCS+=	fpfake.c
 
 .if ${MACHINE_ARCH} == "m68k"
 SRCS+=	mulsi3.S umulsi3.S
+SRCS+=	muldi3.S
+.else
+muldi3.o muldi3.po muldi3.pico muldi3.d: muldi3.c
 .endif
 
 SRCS+=	setjmp.S longjmp.c

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.37 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.38
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.37	Thu Jul 30 15:29:52 2015
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Sun May 31 11:43:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.37 2015/07/30 15:29:52 tsutsui Exp $
+#	$NetBSD: Makefile.inc,v 1.38 2020/05/31 11:43:37 rin Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -12,7 +12,8 @@ SRCS+=	ffs.S
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
 .endif
 .if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "m68k"
-SRCS+=	random.S
+SRCS+=	muldi3.S random.S
 .else
+muldi3.o muldi3.po muldi3.pico muldi3.d: muldi3.c
 random.o random.po random.pico random.d: random.c
 .endif

Added files:

Index: src/common/lib/libc/arch/m68k/gen/muldi3.S
diff -u /dev/null src/common/lib/libc/arch/m68k/gen/muldi3.S:1.1
--- /dev/null	Sun May 31 11:43:38 2020
+++ src/common/lib/libc/arch/m68k/gen/muldi3.S	Sun May 31 11:43:37 2020
@@ -0,0 +1,115 @@
+/*	$NetBSD: muldi3.S,v 1.1 2020/05/31 11:43:37 rin Exp $	*/
+
+/*
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Rin Okuyama.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+
+RCSID("$NetBSD: muldi3.S,v 1.1 2020/05/31 11:43:37 rin Exp $")
+
+| int64_t __muldi3(int64_t X, int64_t Y);
+|
+| * Return lower 64bit of (X * Y) into %d0:%d1.
+|
+| * Intended for 68060:
+|   - GCC does not emit __muldi3() for 68020-40, that have 32 * 32 --> 64 mulul.
+|   - mulsl (and moveml) are not implemented for 68010.
+|
+| * Notation:
+|   - H32:L32 --> higher:lower 32bit of variable
+| 

CVS commit: src/etc

2020-05-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun May 31 12:58:09 UTC 2020

Modified Files:
src/etc/defaults: rc.conf
src/etc/mtree: NetBSD.dist.base special
src/etc/rc.d: dhcpcd

Log Message:
dhcpcd: Empty the chroot

While here, set correct optional hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/etc/defaults/rc.conf
cvs rdiff -u -r1.217 -r1.218 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.167 -r1.168 src/etc/mtree/special
cvs rdiff -u -r1.8 -r1.9 src/etc/rc.d/dhcpcd

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

Modified files:

Index: src/etc/defaults/rc.conf
diff -u src/etc/defaults/rc.conf:1.155 src/etc/defaults/rc.conf:1.156
--- src/etc/defaults/rc.conf:1.155	Sun May 24 14:46:19 2020
+++ src/etc/defaults/rc.conf	Sun May 31 12:58:09 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: rc.conf,v 1.155 2020/05/24 14:46:19 jmcneill Exp $
+#	$NetBSD: rc.conf,v 1.156 2020/05/31 12:58:09 roy Exp $
 #
 # /etc/defaults/rc.conf --
 #	default configuration of /etc/rc.conf
@@ -193,7 +193,6 @@ auto_ifconfig=YES# config all avail.
 net_interfaces=""# used only if above is NO
 flushroutes=YES	# flush routes in netstart
 dhcpcd=NO		dhcpcd_flags="-qM"	# For ifconfig_XXX=dhcp.
-dhcpcd_chrootdir="/var/chroot/dhcpcd"
 ntpdate=NO  		ntpdate_flags="-b -s"	# May need '-u' thru firewall
 ppp=YES			ppp_peers=""		# /etc/ppp/peers to call
 ip6mode=host	# host, autohost or router

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.217 src/etc/mtree/NetBSD.dist.base:1.218
--- src/etc/mtree/NetBSD.dist.base:1.217	Sat May 30 20:47:59 2020
+++ src/etc/mtree/NetBSD.dist.base	Sun May 31 12:58:09 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.217 2020/05/30 20:47:59 christos Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.218 2020/05/31 12:58:09 roy Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -1276,11 +1276,6 @@
 ./var/backups
 ./var/chroot
 ./var/chroot/dhcpcd
-./var/chroot/dhcpcd/etc
-./var/chroot/dhcpcd/var
-./var/chroot/dhcpcd/var/run
-./var/chroot/dhcpcd/var/db
-./var/chroot/dhcpcd/var/db/dhcpcd	mode=0775 uname=_dhcpcd gname=_dhcpcd
 ./var/chroot/ftp-proxy		mode=0755
 ./var/chroot/named
 ./var/chroot/named/dev

Index: src/etc/mtree/special
diff -u src/etc/mtree/special:1.167 src/etc/mtree/special:1.168
--- src/etc/mtree/special:1.167	Sat May 11 19:31:03 2019
+++ src/etc/mtree/special	Sun May 31 12:58:09 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: special,v 1.167 2019/05/11 19:31:03 maxv Exp $
+#	$NetBSD: special,v 1.168 2020/05/31 12:58:09 roy Exp $
 #	@(#)special	8.2 (Berkeley) 1/23/94
 #
 # This file may be overwritten on upgrades.
@@ -64,8 +64,8 @@
 ./etc/defaults/security.conf	type=file mode=0444
 ./etc/defaults/weekly.conf	type=file mode=0444
 ./etc/dhcpcd.conf		type=file mode=0644
-./etc/dhcpcd.duid		type=file mode=0644 optional
-./etc/dhcpcd.hook		type=file mode=0644 optional
+./etc/dhcpcd.enter-hook		type=file mode=0644 optional
+./etc/dhcpcd.exit-hook		type=file mode=0644 optional
 ./etc/dhcpd.conf		type=file mode=0644 optional
 ./etc/dhcpd6.conf		type=file mode=0644 optional
 ./etc/disktab			type=file mode=0644

Index: src/etc/rc.d/dhcpcd
diff -u src/etc/rc.d/dhcpcd:1.8 src/etc/rc.d/dhcpcd:1.9
--- src/etc/rc.d/dhcpcd:1.8	Thu Apr  2 12:58:49 2020
+++ src/etc/rc.d/dhcpcd	Sun May 31 12:58:09 2020
@@ -1,11 +1,10 @@
 #!/bin/sh
 
-# $NetBSD: dhcpcd,v 1.8 2020/04/02 12:58:49 roy Exp $
+# $NetBSD: dhcpcd,v 1.9 2020/05/31 12:58:09 roy Exp $
 
 # PROVIDE: dhcpcd
 # REQUIRE: network mountcritlocal
 # BEFORE:  NETWORKING
-# KEYWORD: chrootdir
 
 $_rc_subr_loaded . /etc/rc.subr
 



CVS commit: src/sys/arch

2020-05-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun May 31 14:05:21 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: machdep.c
src/sys/arch/mips/cavium: octeon1p_iobus.c
src/sys/arch/mips/cavium/dev: octeon_uart.c

Log Message:
Finish rename of all Cavium Octeon device driver functions, structs etc from
"octeon_foo" to "octfoo" (missed octeon_uart + entries in iobus config).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/octeon1p_iobus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_uart.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/evbmips/cavium/machdep.c
diff -u src/sys/arch/evbmips/cavium/machdep.c:1.10 src/sys/arch/evbmips/cavium/machdep.c:1.11
--- src/sys/arch/evbmips/cavium/machdep.c:1.10	Wed Dec 28 03:27:08 2016
+++ src/sys/arch/evbmips/cavium/machdep.c	Sun May 31 14:05:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.10 2016/12/28 03:27:08 mrg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.11 2020/05/31 14:05:21 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -115,7 +115,7 @@
 #include "opt_cavium.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10 2016/12/28 03:27:08 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.11 2020/05/31 14:05:21 simonb Exp $");
 
 #include 
 #include 
@@ -314,7 +314,7 @@ mach_init_console(void)
 #if NCOM > 0
 	struct octeon_config *mcp = _configuration;
 	int status;
-	extern int octeon_uart_com_cnattach(bus_space_tag_t, int, int);
+	extern int octuart_com_cnattach(bus_space_tag_t, int, int);
 
 	/*
 	 * Delay to allow firmware putchars to complete.
@@ -323,7 +323,7 @@ mach_init_console(void)
 	 */
 	delay(64000 / comcnrate);
 
-	status = octeon_uart_com_cnattach(
+	status = octuart_com_cnattach(
 		>mc_iobus_bust,
 		0,	/* XXX port 0 */
 		comcnrate);

Index: src/sys/arch/mips/cavium/octeon1p_iobus.c
diff -u src/sys/arch/mips/cavium/octeon1p_iobus.c:1.3 src/sys/arch/mips/cavium/octeon1p_iobus.c:1.4
--- src/sys/arch/mips/cavium/octeon1p_iobus.c:1.3	Sun May 31 04:56:35 2020
+++ src/sys/arch/mips/cavium/octeon1p_iobus.c	Sun May 31 14:05:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon1p_iobus.c,v 1.3 2020/05/31 04:56:35 simonb Exp $	*/
+/*	$NetBSD: octeon1p_iobus.c,v 1.4 2020/05/31 14:05:21 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon1p_iobus.c,v 1.3 2020/05/31 04:56:35 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon1p_iobus.c,v 1.4 2020/05/31 14:05:21 simonb Exp $");
 
 #include 
 #include 
@@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: octeon1p_iob
 /*  UART */
 
 #include 
-static const struct iobus_unit iobus_units_octeon_uart[] = {
+static const struct iobus_unit iobus_units_octuart[] = {
 	{
 		.addr = MIO_UART0_BASE
 	},
@@ -52,95 +52,95 @@ static const struct iobus_unit iobus_uni
 	}
 };
 
-static const struct iobus_dev iobus_dev_octeon_uart = {
+static const struct iobus_dev iobus_dev_octuart = {
 	.name = "com",
 	.nunits = 2,
-	.units = iobus_units_octeon_uart
+	.units = iobus_units_octuart
 };
 
 /*  RNM */
 
 #include 
-static const struct iobus_unit iobus_units_octeon_rnm[] = {
+static const struct iobus_unit iobus_units_octrnm[] = {
 	{
 		.addr = RNM_BASE
 	}
 };
 
-static const struct iobus_dev iobus_dev_octeon_rnm = {
+static const struct iobus_dev iobus_dev_octrnm = {
 	.name = "octrnm",
 	.nunits = RNM_NUNITS,
-	.units = iobus_units_octeon_rnm
+	.units = iobus_units_octrnm
 };
 
 /*  TWSI */
 
 #include 
-static const struct iobus_unit iobus_units_octeon_twsi[] = {
+static const struct iobus_unit iobus_units_octtwsi[] = {
 	{
 		.addr = MIO_TWS_BASE_0
 	}
 };
 
-static const struct iobus_dev iobus_dev_octeon_twsi = {
+static const struct iobus_dev iobus_dev_octtwsi = {
 	.name = "octtwsi",
 	.nunits = MIO_TWS_NUNITS,
-	.units = iobus_units_octeon_twsi
+	.units = iobus_units_octtwsi
 };
 
 /*  MPI/SPI */
 
 #include 
-static const struct iobus_unit	iobus_units_octeon_mpi[] = {
+static const struct iobus_unit	iobus_units_octmpi[] = {
 	{
 		.addr = MPI_BASE
 	}
 };
 
-static const struct iobus_dev iobus_dev_octeon_mpi = {
+static const struct iobus_dev iobus_dev_octmpi = {
 	.name = "octmpi",
 	.nunits = MPI_NUNITS,
-	.units = iobus_units_octeon_mpi
+	.units = iobus_units_octmpi
 };
 /*  GMX */
 
 #include 
-static const struct iobus_unit	iobus_units_octeon_gmx[] = {
+static const struct iobus_unit	iobus_units_octgmx[] = {
 	{
 		.addr = GMX0_BASE_IF0
 	}
 };
 
-static const struct iobus_dev iobus_dev_octeon_gmx = {
+static const struct iobus_dev iobus_dev_octgmx = {
 	.name = "octgmx",
 	.nunits = GMX_IF_NUNITS,
-	.units = iobus_units_octeon_gmx
+	.units = iobus_units_octgmx
 };
 
 
 /*  USBN */
 #include 
-static const struct 

CVS commit: src/sys/kern

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 09:59:37 UTC 2020

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

Log Message:
Switch to db_alloc() from kmem_intr_alloc(9).

Fix build failure as a part of crash(8).
Noticed by tnn@, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/kern/kern_timeout.c

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

Modified files:

Index: src/sys/kern/kern_timeout.c
diff -u src/sys/kern/kern_timeout.c:1.62 src/sys/kern/kern_timeout.c:1.63
--- src/sys/kern/kern_timeout.c:1.62	Sun May 31 08:33:47 2020
+++ src/sys/kern/kern_timeout.c	Sun May 31 09:59:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_timeout.c,v 1.62 2020/05/31 08:33:47 rin Exp $	*/
+/*	$NetBSD: kern_timeout.c,v 1.63 2020/05/31 09:59:37 rin Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.62 2020/05/31 08:33:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.63 2020/05/31 09:59:37 rin Exp $");
 
 /*
  * Timeouts are kept in a hierarchical timing wheel.  The c_time is the
@@ -102,6 +102,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_timeout
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #endif
@@ -798,7 +799,7 @@ callout_softclock(void *v)
 	cc->cc_lwp = NULL;
 	mutex_spin_exit(cc->cc_lock);
 }
-#endif
+#endif /* !CRASH */
 
 #ifdef DDB
 static void
@@ -844,14 +845,14 @@ db_show_callout(db_expr_t addr, bool had
 #endif
 	db_printf("ticks  wheel   arg  func\n");
 
-	ccp = kmem_intr_alloc(ccs, KM_NOSLEEP); /* XXX ddb */
+	ccp = db_alloc(ccs);
 	if (ccp == NULL) {
 		db_printf("%s: cannot allocate callout_cpu\n", __func__);
 		return;
 	}
-	cip = kmem_intr_alloc(cis, KM_NOSLEEP); /* XXX ddb */
+	cip = db_alloc(cis);
 	if (cip == NULL) {
-		kmem_intr_free(ccp, ccs);
+		db_free(ccp, ccs);
 		db_printf("%s: cannot allocate cpu_info\n", __func__);
 		return;
 	}
@@ -877,7 +878,7 @@ db_show_callout(db_expr_t addr, bool had
 		}
 	}
 
-	kmem_intr_free(ccp, ccs);
-	kmem_intr_free(cip, cis);
+	db_free(ccp, ccs);
+	db_free(cip, cis);
 }
 #endif /* DDB */



CVS commit: [netbsd-9] src/distrib/amd64

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 10:21:35 UTC 2020

Modified Files:
src/distrib/amd64 [netbsd-9]: Makefile
src/distrib/amd64/installimage [netbsd-9]: Makefile
Removed Files:
src/distrib/amd64/uefi-installimage [netbsd-9]: Makefile
Makefile.bootimage Makefile.installimage boot.cfg.in etc.rc
etc.ttys install.sh spec.inst

Log Message:
Pull up following revision(s) (requested by maya in ticket #933):

distrib/amd64/uefi-installimage/spec.inst: file removal
distrib/amd64/uefi-installimage/etc.rc: file removal
distrib/amd64/uefi-installimage/Makefile.bootimage: file removal
distrib/amd64/uefi-installimage/Makefile.installimage: file removal
distrib/amd64/uefi-installimage/install.sh: file removal
distrib/amd64/uefi-installimage/etc.ttys: file removal
distrib/amd64/Makefile: revision 1.14
distrib/amd64/uefi-installimage/boot.cfg.in: file removal
distrib/amd64/uefi-installimage/Makefile: file removal
distrib/amd64/installimage/Makefile: revision 1.11

rename amd64 uefi-installimage to be just installimage.

Works for both purposes, no confusing name.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.12.1 src/distrib/amd64/Makefile
cvs rdiff -u -r1.10 -r1.10.2.1 src/distrib/amd64/installimage/Makefile
cvs rdiff -u -r1.6.2.1 -r0 src/distrib/amd64/uefi-installimage/Makefile
cvs rdiff -u -r1.11.2.2 -r0 \
src/distrib/amd64/uefi-installimage/Makefile.bootimage
cvs rdiff -u -r1.2.18.1 -r0 \
src/distrib/amd64/uefi-installimage/Makefile.installimage
cvs rdiff -u -r1.2 -r0 src/distrib/amd64/uefi-installimage/boot.cfg.in
cvs rdiff -u -r1.1 -r0 src/distrib/amd64/uefi-installimage/etc.rc \
src/distrib/amd64/uefi-installimage/etc.ttys \
src/distrib/amd64/uefi-installimage/install.sh \
src/distrib/amd64/uefi-installimage/spec.inst

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

Modified files:

Index: src/distrib/amd64/Makefile
diff -u src/distrib/amd64/Makefile:1.13 src/distrib/amd64/Makefile:1.13.12.1
--- src/distrib/amd64/Makefile:1.13	Sun May 21 15:28:37 2017
+++ src/distrib/amd64/Makefile	Sun May 31 10:21:34 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2017/05/21 15:28:37 riastradh Exp $
+#	$NetBSD: Makefile,v 1.13.12.1 2020/05/31 10:21:34 martin Exp $
 
 .include 
 
@@ -14,7 +14,6 @@ SUBDIR+=	.WAIT
 SUBDIR+=	cdroms
 SUBDIR+=	liveimage
 SUBDIR+=	installimage
-SUBDIR+=	uefi-installimage
 TARGETS+=	release 
 
 iso_image:
@@ -25,6 +24,5 @@ live_image:
 
 install_image:
 	${MAKEDIRTARGET} installimage install_image
-	${MAKEDIRTARGET} uefi-installimage install_image
 
 .include 

Index: src/distrib/amd64/installimage/Makefile
diff -u src/distrib/amd64/installimage/Makefile:1.10 src/distrib/amd64/installimage/Makefile:1.10.2.1
--- src/distrib/amd64/installimage/Makefile:1.10	Sat Dec 15 18:03:16 2018
+++ src/distrib/amd64/installimage/Makefile	Sun May 31 10:21:34 2020
@@ -1,16 +1,21 @@
-#	$NetBSD: Makefile,v 1.10 2018/12/15 18:03:16 gson Exp $
+#	$NetBSD: Makefile,v 1.10.2.1 2020/05/31 10:21:34 martin Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-amd64-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	1450			# for all installation binaries
+INSTIMAGEMB?=	1550			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot
 SECONDARY_BOOT_ARG=	# unnecessary
+EFIBOOT=		${WORKDIR}/usr/mdec/bootx64.efi
+EFIBOOT+=		${WORKDIR}/usr/mdec/bootia32.efi
+#EFIBOOT=		${.OBJDIR}/../../../sys/arch/i386/stand/efiboot/bootx64/bootx64.efi
+#EFIBOOT+=		${.OBJDIR}/../../../sys/arch/i386/stand/efiboot/bootia32/bootia32.efi
 
 USE_MBR=		yes
+USE_GPT=		yes
 
 CLEANFILES+=	boot.cfg
 
@@ -35,4 +40,4 @@ IMGFILE_EXTRA=\
 	${SYSINSTDIR}/sysinstmsgs.pl	.\
 	${SYSINSTDIR}/sysinst		.
 
-.include "${DISTRIBDIR}/common/bootimage/Makefile.installimage"
+.include "${NETBSDSRCDIR}/distrib/common/bootimage//Makefile.installimage"



CVS commit: src/sys/arch/sparc64/sparc64

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 11:28:52 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: db_trace.c

Log Message:
Avoid using excessive kernel stack.
XXX maybe we should unite all "static proc_t" and "static lwp_t" in ddb
into one global each?


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sparc64/sparc64/db_trace.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/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.54 src/sys/arch/sparc64/sparc64/db_trace.c:1.55
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.54	Tue Mar 10 15:54:52 2020
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Sun May 31 11:28:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.54 2020/03/10 15:54:52 christos Exp $ */
+/*	$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.54 2020/03/10 15:54:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $");
 
 #include 
 #include 
@@ -102,9 +102,10 @@ db_stack_trace_print(db_expr_t addr, boo
 #endif
 	} else {
 		if (trace_thread) {
-			proc_t p;
-			lwp_t l;
+			static proc_t p;
+			static lwp_t l;
 			struct pcb *pcb;
+
 			if (lwpaddr) {
 db_read_bytes(addr, sizeof(l), (char *));
 db_read_bytes((db_addr_t)l.l_proc,



CVS commit: src/external/bsd/dhcpcd/dist

2020-05-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun May 31 12:52:11 UTC 2020

Modified Files:
src/external/bsd/dhcpcd/dist/hooks: dhcpcd-run-hooks.in
src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.8.in
dhcpcd.c if-bsd.c if-options.c ipv6.c ipv6.h ipv6nd.c logerr.c
privsep.c script.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/bpf.c
cvs rdiff -u -r1.36 -r1.37 src/external/bsd/dhcpcd/dist/src/dhcp.c \
src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in \
src/external/bsd/dhcpcd/dist/src/script.c
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/if-bsd.c \
src/external/bsd/dhcpcd/dist/src/ipv6nd.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/ipv6.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/ipv6.h
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/logerr.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/src/privsep.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/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
diff -u src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in:1.5 src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in:1.6
--- src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in:1.5	Thu Apr  2 12:41:48 2020
+++ src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in	Sun May 31 12:52:11 2020
@@ -211,7 +211,7 @@ valid_domainname_list()
 }
 
 # With the advent of alternative init systems, it's possible to have
-# more than one installed. So we need to try and guess what one we're
+# more than one installed. So we need to try to guess what one we're
 # using unless overridden by configure.
 detect_init()
 {

Index: src/external/bsd/dhcpcd/dist/src/bpf.c
diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.14 src/external/bsd/dhcpcd/dist/src/bpf.c:1.15
--- src/external/bsd/dhcpcd/dist/src/bpf.c:1.14	Thu Apr  2 12:41:48 2020
+++ src/external/bsd/dhcpcd/dist/src/bpf.c	Sun May 31 12:52:11 2020
@@ -57,8 +57,6 @@
 #include "if.h"
 #include "logerr.h"
 
-#define	ARP_ADDRS_MAX	3
-
 /* BPF helper macros */
 #ifdef __linux__
 #define	BPF_WHOLEPACKET		0x7fff /* work around buggy LPF filters */
@@ -85,7 +83,7 @@ size_t
 bpf_frame_header_len(const struct interface *ifp)
 {
 
-	switch (ifp->family) {
+	switch (ifp->hwtype) {
 	case ARPHRD_ETHER:
 		return sizeof(struct ether_header);
 	default:
@@ -98,7 +96,7 @@ bpf_frame_header_src(const struct interf
 {
 	uint8_t *f = fh;
 
-	switch (ifp->family) {
+	switch (ifp->hwtype) {
 	case ARPHRD_ETHER:
 		*len = sizeof(((struct ether_header *)0)->ether_shost);
 		return f + offsetof(struct ether_header, ether_shost);
@@ -114,7 +112,7 @@ bpf_frame_header_dst(const struct interf
 {
 	uint8_t *f = fh;
 
-	switch (ifp->family) {
+	switch (ifp->hwtype) {
 	case ARPHRD_ETHER:
 		*len = sizeof(((struct ether_header *)0)->ether_dhost);
 		return f + offsetof(struct ether_header, ether_dhost);
@@ -129,12 +127,12 @@ static const uint8_t etherbcastaddr[] =
 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
 int
-bpf_frame_bcast(const struct interface *ifp, const char *frame)
+bpf_frame_bcast(const struct interface *ifp, const void *frame)
 {
 
-	switch (ifp->family) {
+	switch (ifp->hwtype) {
 	case ARPHRD_ETHER:
-		return memcmp(frame +
+		return memcmp((const char *)frame +
 		offsetof(struct ether_header, ether_dhost),
 		etherbcastaddr, sizeof(etherbcastaddr));
 	default:
@@ -148,15 +146,15 @@ bpf_frame_bcast(const struct interface *
 
 const char *bpf_name = "Berkley Packet Filter";
 
-int
-bpf_open(struct interface *ifp, int (*filter)(struct interface *, int))
-{
-	struct ipv4_state *state;
-	int fd = -1;
-	struct ifreq ifr;
+struct bpf *
+bpf_open(const struct interface *ifp,
+int (*filter)(const struct bpf *, const struct in_addr *),
+const struct in_addr *ia)
+{
+	struct bpf *bpf;
+	struct bpf_version pv = { .bv_major = 0, .bv_minor = 0 };
+	struct ifreq ifr = { .ifr_flags = 0 };
 	int ibuf_len = 0;
-	size_t buf_len;
-	struct bpf_version pv;
 #ifdef BIOCIMMEDIATE
 	unsigned int flags;
 #endif
@@ -164,8 +162,13 @@ bpf_open(struct interface *ifp, int (*fi
 	int fd_opts;
 #endif
 
+	bpf = calloc(1, sizeof(*bpf));
+	if (bpf == NULL)
+		return NULL;
+	bpf->bpf_ifp = ifp;
+
 #ifdef _PATH_BPF
-	fd = open(_PATH_BPF, O_RDWR | O_NONBLOCK
+	bpf->bpf_fd = open(_PATH_BPF, O_RDWR | O_NONBLOCK
 #ifdef O_CLOEXEC
 		| O_CLOEXEC
 #endif
@@ -176,27 +179,24 @@ bpf_open(struct interface *ifp, int (*fi
 
 	do {
 		snprintf(device, sizeof(device), "/dev/bpf%d", n++);
-		fd = open(device, O_RDWR | O_NONBLOCK
+	

CVS commit: src/sys/dev/usb

2020-05-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun May 31 17:52:59 UTC 2020

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

Log Message:
If we failed because we didn't encounter an endpoint, do not attempt to
read 'ed', because its value is past the end of the buffer, and we thus
perform out-of-bounds accesses.

Detected thanks to vHCI+KASAN. First bug found by USB fuzzing.

Reported-by: syzbot+59e7f6b3f353584ac...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/dev/usb/usb_subr.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/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.244 src/sys/dev/usb/usb_subr.c:1.245
--- src/sys/dev/usb/usb_subr.c:1.244	Sat Mar 14 03:01:36 2020
+++ src/sys/dev/usb/usb_subr.c	Sun May 31 17:52:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.244 2020/03/14 03:01:36 christos Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.245 2020/05/31 17:52:58 maxv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.244 2020/03/14 03:01:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.245 2020/05/31 17:52:58 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -447,10 +447,17 @@ usbd_fill_iface_data(struct usbd_device 
 break;
 		}
 		/* passed end, or bad desc */
-		printf("usbd_fill_iface_data: bad descriptor(s): %s\n",
-		   ed->bLength == 0 ? "0 length" :
-		   ed->bDescriptorType == UDESC_INTERFACE ? "iface desc":
-		   "out of data");
+		if (p < end) {
+			if (ed->bLength == 0) {
+printf("%s: bad descriptor: 0 length\n",
+__func__);
+			} else {
+printf("%s: bad descriptor: iface desc\n",
+__func__);
+			}
+		} else {
+			printf("%s: no desc found\n", __func__);
+		}
 		goto bad;
 	found:
 		ifc->ui_endpoints[endpt].ue_edesc = ed;



CVS commit: src/sys/dev/usb

2020-05-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun May 31 18:20:24 UTC 2020

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

Log Message:
also set ifc->ui_endpoints to NULL in usbd_free_iface_data() when the value
is freed, to make it impossible to re-enter this by mistake

very likely has no effect for the syzbot problem, but good to do nevetheless

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


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/sys/dev/usb/usb_subr.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/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.245 src/sys/dev/usb/usb_subr.c:1.246
--- src/sys/dev/usb/usb_subr.c:1.245	Sun May 31 17:52:58 2020
+++ src/sys/dev/usb/usb_subr.c	Sun May 31 18:20:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.245 2020/05/31 17:52:58 maxv Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.246 2020/05/31 18:20:23 jdolecek Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.245 2020/05/31 17:52:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.246 2020/05/31 18:20:23 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -507,6 +507,7 @@ usbd_free_iface_data(struct usbd_device 
 		int nendpt = ifc->ui_idesc->bNumEndpoints;
 		size_t sz = nendpt * sizeof(struct usbd_endpoint);
 		kmem_free(ifc->ui_endpoints, sz);
+		ifc->ui_endpoints = NULL;
 	}
 }
 



CVS commit: src/sys/dev/usb

2020-05-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun May 31 18:33:09 UTC 2020

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

Log Message:
Reset ud_ifaces and ud_cdesc to NULL, to prevent use-after-free in
usb_free_device().

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


To generate a diff of this commit:
cvs rdiff -u -r1.246 -r1.247 src/sys/dev/usb/usb_subr.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/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.246 src/sys/dev/usb/usb_subr.c:1.247
--- src/sys/dev/usb/usb_subr.c:1.246	Sun May 31 18:20:23 2020
+++ src/sys/dev/usb/usb_subr.c	Sun May 31 18:33:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.246 2020/05/31 18:20:23 jdolecek Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.247 2020/05/31 18:33:08 maxv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.246 2020/05/31 18:20:23 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.247 2020/05/31 18:33:08 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -734,14 +734,21 @@ usbd_set_config_index(struct usbd_device
 		if (err) {
 			while (--ifcidx >= 0)
 usbd_free_iface_data(dev, ifcidx);
+			kmem_free(dev->ud_ifaces,
+			nifc * sizeof(struct usbd_interface));
+			dev->ud_ifaces = NULL;
 			goto bad;
 		}
 	}
 
 	return USBD_NORMAL_COMPLETION;
 
- bad:
+bad:
+	/* XXX Use usbd_set_config() to reset the config? */
+	/* XXX Should we forbid USB_UNCONFIG_NO from bConfigurationValue? */
+	dev->ud_config = USB_UNCONFIG_NO;
 	kmem_free(cdp, len);
+	dev->ud_cdesc = NULL;
 	if (bdp != NULL) {
 		kmem_free(bdp, UGETW(bdp->wTotalLength));
 		dev->ud_bdesc = NULL;



CVS commit: src/external/mpl/bind/dist/lib/isc/unix

2020-05-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 31 17:45:02 UTC 2020

Modified Files:
src/external/mpl/bind/dist/lib/isc/unix: socket.c

Log Message:
sync with regular socket code (no effect)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/mpl/bind/dist/lib/isc/unix/socket.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/mpl/bind/dist/lib/isc/unix/socket.c
diff -u src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.14 src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.15
--- src/external/mpl/bind/dist/lib/isc/unix/socket.c:1.14	Sun May 24 15:46:27 2020
+++ src/external/mpl/bind/dist/lib/isc/unix/socket.c	Sun May 31 13:45:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.c,v 1.14 2020/05/24 19:46:27 christos Exp $	*/
+/*	$NetBSD: socket.c,v 1.15 2020/05/31 17:45:02 christos Exp $	*/
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -5739,13 +5739,17 @@ isc_socket_fdwatchcreate(isc_socketmgr_t
 #if defined(USE_EPOLL)
 	manager->epoll_events[sock->fd] = 0;
 #endif
+#ifdef USE_DEVPOLL
+	INSIST(thread->fdpollinfo[sock->fd].want_read == 0 &&
+	   thread->fdpollinfo[sock->fd].want_write == 0);
+#endif /* ifdef USE_DEVPOLL */
 	UNLOCK(>fdlock[lockid]);
 
 	LOCK(>lock);
 	ISC_LIST_APPEND(manager->socklist, sock, link);
 #ifdef USE_SELECT
-	if (manager->maxfd < sock->fd)
-		manager->maxfd = sock->fd;
+	if (thread->maxfd < sock->fd)
+		thread->maxfd = sock->fd;
 #endif
 	UNLOCK(>lock);
 



CVS commit: src/usr.sbin/npf

2020-05-31 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun May 31 15:57:15 UTC 2020

Modified Files:
src/usr.sbin/npf: npf-params.7

Log Message:
npf-params(7): fix the state.key defaults.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npf-params.7

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

Modified files:

Index: src/usr.sbin/npf/npf-params.7
diff -u src/usr.sbin/npf/npf-params.7:1.4 src/usr.sbin/npf/npf-params.7:1.5
--- src/usr.sbin/npf/npf-params.7:1.4	Sat May 30 14:16:56 2020
+++ src/usr.sbin/npf/npf-params.7	Sun May 31 15:57:15 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: npf-params.7,v 1.4 2020/05/30 14:16:56 rmind Exp $
+.\" $NetBSD: npf-params.7,v 1.5 2020/05/31 15:57:15 rmind Exp $
 .\"
 .\" Copyright (c) 2019 Mindaugas Rasiukevicius 
 .\" All rights reserved.
@@ -94,10 +94,10 @@ some of the information in (from) the ke
 .It Li interface
 Include interface identifier into the keys, making the connection
 state strictly per-interface.
-Default: 0.
+Default: 1.
 .It Li direction
 Include packet direction into the keys.
-Default: 0.
+Default: 1.
 .El
 .\" ---
 .It Li state.generic



CVS commit: src/usr.sbin/npf

2020-05-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun May 31 16:32:07 UTC 2020

Modified Files:
src/usr.sbin/npf: npf-params.7

Log Message:
npf-params.7: s/filer/filter/


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npf-params.7

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

Modified files:

Index: src/usr.sbin/npf/npf-params.7
diff -u src/usr.sbin/npf/npf-params.7:1.5 src/usr.sbin/npf/npf-params.7:1.6
--- src/usr.sbin/npf/npf-params.7:1.5	Sun May 31 15:57:15 2020
+++ src/usr.sbin/npf/npf-params.7	Sun May 31 16:32:07 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: npf-params.7,v 1.5 2020/05/31 15:57:15 rmind Exp $
+.\" $NetBSD: npf-params.7,v 1.6 2020/05/31 16:32:07 tnn Exp $
 .\"
 .\" Copyright (c) 2019 Mindaugas Rasiukevicius 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 30, 2020
+.Dd May 31, 2020
 .Dt NPF-PARAMS 7
 .Os
 .Sh NAME
@@ -60,7 +60,7 @@ Perform IPv4 reassembly before inspectin
 Fragmentation is considered very harmful, so most networks are expected
 to prevent it; therefore, reassembly is disabled by default.
 However, while the packet should generally be reassembled at the receiver,
-reassembly by the packet filer might be necessary in order to perform state
+reassembly by the packet filter might be necessary in order to perform state
 tracking.
 Default: 0.
 .It Li ip6.reassembly



CVS commit: src/tests/include/sys

2020-05-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun May 31 16:36:07 UTC 2020

Modified Files:
src/tests/include/sys: Makefile

Log Message:
Mask NULL + 0 LLVM UBSan reports in the ATF test: t_pslist.c

Pass -fno-delete-null-pointer-checks for Clang for the
MKSANITIZER/MKLIBCSANITIZER build


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/include/sys/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/include/sys/Makefile
diff -u src/tests/include/sys/Makefile:1.15 src/tests/include/sys/Makefile:1.16
--- src/tests/include/sys/Makefile:1.15	Sun Mar  1 18:08:15 2020
+++ src/tests/include/sys/Makefile	Sun May 31 16:36:07 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2020/03/01 18:08:15 christos Exp $
+# $NetBSD: Makefile,v 1.16 2020/05/31 16:36:07 kamil Exp $
 
 NOMAN=		# defined
 
@@ -14,6 +14,13 @@ TESTS_C+=		t_pslist
 TESTS_C+=		t_tree
 TESTS_C+=		t_types
 
+# NULL + 0 arithmetic raises LLVM UBSan warnings, specially in sys/pslist.h
+# in the type-safe macros _PSLIST_VALIDATE_PTRS and _PSLIST_VALIDATE_CONTAINER.
+# See also src/sys/rump/Makefile.rump
+.if ${MKSANITIZER:Uno} == "yes" || ${MKLIBCSANITIZER:Uno} == "yes"
+COPTS.t_pslist.c+=	${${ACTIVE_CC} == "clang":? -fno-delete-null-pointer-checks :}
+.endif
+
 CPPFLAGS.t_pslist.c+=	-I${NETBSDSRCDIR}/sys
 LDADD.t_bitops+=	-lm
 



CVS commit: src/sys/kern

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 23:24:20 UTC 2020

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

Log Message:
Stop allocating buffers dynamically in a DDB session, in order not to
disturb on-going debugged state of kernel datastructures.

Since DDB is running on 1 CPU at a time, static buffers are enough.

Increase in BSS section is:
  52552 for amd64 (LP64)
   9152 for m68k  (ILP32)

Requested by thorpej@ and mrg@.
Also suggested by ryo@.
Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/kern/kern_timeout.c

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

Modified files:

Index: src/sys/kern/kern_timeout.c
diff -u src/sys/kern/kern_timeout.c:1.63 src/sys/kern/kern_timeout.c:1.64
--- src/sys/kern/kern_timeout.c:1.63	Sun May 31 09:59:37 2020
+++ src/sys/kern/kern_timeout.c	Sun May 31 23:24:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_timeout.c,v 1.63 2020/05/31 09:59:37 rin Exp $	*/
+/*	$NetBSD: kern_timeout.c,v 1.64 2020/05/31 23:24:20 rin Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.63 2020/05/31 09:59:37 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.64 2020/05/31 23:24:20 rin Exp $");
 
 /*
  * Timeouts are kept in a hierarchical timing wheel.  The c_time is the
@@ -102,9 +102,11 @@ __KERNEL_RCSID(0, "$NetBSD: kern_timeout
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+
+static struct callout_cpu ccb;
+static struct cpu_info cib;
 #endif
 
 #define BUCKETS		1024
@@ -835,9 +837,8 @@ db_show_callout_bucket(struct callout_cp
 void
 db_show_callout(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
 {
-	struct callout_cpu *cc, *ccp;
-	struct cpu_info *ci, *cip;
-	const size_t ccs = sizeof(*cc), cis = sizeof(*ci);
+	struct callout_cpu *cc;
+	struct cpu_info *ci;
 	int b;
 
 #ifndef CRASH
@@ -845,40 +846,25 @@ db_show_callout(db_expr_t addr, bool had
 #endif
 	db_printf("ticks  wheel   arg  func\n");
 
-	ccp = db_alloc(ccs);
-	if (ccp == NULL) {
-		db_printf("%s: cannot allocate callout_cpu\n", __func__);
-		return;
-	}
-	cip = db_alloc(cis);
-	if (cip == NULL) {
-		db_free(ccp, ccs);
-		db_printf("%s: cannot allocate cpu_info\n", __func__);
-		return;
-	}
-
 	/*
 	 * Don't lock the callwheel; all the other CPUs are paused
 	 * anyhow, and we might be called in a circumstance where
 	 * some other CPU was paused while holding the lock.
 	 */
 	for (ci = db_cpu_first(); ci != NULL; ci = db_cpu_next(ci)) {
-		db_read_bytes((db_addr_t)ci, cis, (char *)cip);
-		cc = cip->ci_data.cpu_callout;
-		db_read_bytes((db_addr_t)cc, ccs, (char *)ccp);
-		db_show_callout_bucket(ccp, >cc_todo, >cc_todo);
+		db_read_bytes((db_addr_t)ci, sizeof(cib), (char *));
+		cc = cib.ci_data.cpu_callout;
+		db_read_bytes((db_addr_t)cc, sizeof(ccb), (char *));
+		db_show_callout_bucket(, >cc_todo, _todo);
 	}
 	for (b = 0; b < BUCKETS; b++) {
 		for (ci = db_cpu_first(); ci != NULL; ci = db_cpu_next(ci)) {
-			db_read_bytes((db_addr_t)ci, cis, (char *)cip);
-			cc = cip->ci_data.cpu_callout;
-			db_read_bytes((db_addr_t)cc, ccs, (char *)ccp);
-			db_show_callout_bucket(ccp, >cc_wheel[b],
-			>cc_wheel[b]);
+			db_read_bytes((db_addr_t)ci, sizeof(cib), (char *));
+			cc = cib.ci_data.cpu_callout;
+			db_read_bytes((db_addr_t)cc, sizeof(ccb), (char *));
+			db_show_callout_bucket(, >cc_wheel[b],
+			_wheel[b]);
 		}
 	}
-
-	db_free(ccp, ccs);
-	db_free(cip, cis);
 }
 #endif /* DDB */



CVS commit: src/lib/libedit

2020-05-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 31 23:24:24 UTC 2020

Modified Files:
src/lib/libedit: terminal.c tty.c

Log Message:
use strlcpy() instead of strncpy() for gcc happiness


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libedit/terminal.c
cvs rdiff -u -r1.68 -r1.69 src/lib/libedit/tty.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/libedit/terminal.c
diff -u src/lib/libedit/terminal.c:1.41 src/lib/libedit/terminal.c:1.42
--- src/lib/libedit/terminal.c:1.41	Tue Nov 12 15:59:46 2019
+++ src/lib/libedit/terminal.c	Sun May 31 19:24:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: terminal.c,v 1.41 2019/11/12 20:59:46 christos Exp $	*/
+/*	$NetBSD: terminal.c,v 1.42 2020/05/31 23:24:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)term.c	8.2 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: terminal.c,v 1.41 2019/11/12 20:59:46 christos Exp $");
+__RCSID("$NetBSD: terminal.c,v 1.42 2020/05/31 23:24:23 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1319,10 +1319,8 @@ terminal_settc(EditLine *el, int argc __
 	if (argv == NULL || argv[1] == NULL || argv[2] == NULL)
 		return -1;
 
-	strncpy(what, ct_encode_string(argv[1], >el_scratch), sizeof(what));
-	what[sizeof(what) - 1] = '\0';
-	strncpy(how,  ct_encode_string(argv[2], >el_scratch), sizeof(how));
-	how[sizeof(how) - 1] = '\0';
+	strlcpy(what, ct_encode_string(argv[1], >el_scratch), sizeof(what));
+	strlcpy(how,  ct_encode_string(argv[2], >el_scratch), sizeof(how));
 
 	/*
  * Do the strings first

Index: src/lib/libedit/tty.c
diff -u src/lib/libedit/tty.c:1.68 src/lib/libedit/tty.c:1.69
--- src/lib/libedit/tty.c:1.68	Sun Dec  2 11:58:13 2018
+++ src/lib/libedit/tty.c	Sun May 31 19:24:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $	*/
+/*	$NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)tty.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $");
+__RCSID("$NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1163,8 +1163,7 @@ tty_stty(EditLine *el, int argc __attrib
 
 	if (argv == NULL)
 		return -1;
-	strncpy(name, ct_encode_string(*argv++, >el_scratch), sizeof(name));
-name[sizeof(name) - 1] = '\0';
+	strlcpy(name, ct_encode_string(*argv++, >el_scratch), sizeof(name));
 
 	while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0')
 		switch (argv[0][1]) {



CVS commit: src/sys/ddb

2020-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 31 23:34:34 UTC 2020

Modified Files:
src/sys/ddb: db_kernel.c

Log Message:
Switch from kmem_intr_alloc(sz, KM_NOSLEEP) to kmem_alloc(sz, KM_SLEEP).

Clearly document these functions are *not* for DDB session, but for
permanent data storage when initializing DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/ddb/db_kernel.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/ddb/db_kernel.c
diff -u src/sys/ddb/db_kernel.c:1.3 src/sys/ddb/db_kernel.c:1.4
--- src/sys/ddb/db_kernel.c:1.3	Sun May 31 09:42:46 2020
+++ src/sys/ddb/db_kernel.c	Sun May 31 23:34:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $	*/
+/*	$NetBSD: db_kernel.c,v 1.4 2020/05/31 23:34:34 rin Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.4 2020/05/31 23:34:34 rin Exp $");
 
 #include 
 #include 
@@ -39,28 +39,33 @@ __KERNEL_RCSID(0, "$NetBSD: db_kernel.c,
 
 /*
  * XXX
- * DDB can be running in the interrupt context, e.g., when activated from
- * console. Therefore, we use kmem_intr_alloc(9) and friends here to avoid
- * assertion failure.
+ * These routines are *not* intended for a DDB session:
+ *
+ * - It disturbes on-going debugged kernel datastructures.
+ *
+ * - DDB can be running in the interrupt context, e.g., when activated from
+ *   console. This results in assertion failures in the allocator.
+ *
+ * Use these only for permanent data storage when initializing DDB.
  */
 
 void *
 db_alloc(size_t sz)
 {
 
-	return kmem_intr_alloc(sz, KM_NOSLEEP);
+	return kmem_alloc(sz, KM_SLEEP);
 }
 
 void *
 db_zalloc(size_t sz)
 {
 
-	return kmem_intr_zalloc(sz, KM_NOSLEEP);
+	return kmem_zalloc(sz, KM_SLEEP);
 }
 
 void
 db_free(void *p, size_t sz)
 {
 
-	kmem_intr_free(p, sz);
+	kmem_free(p, sz);
 }



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

2020-05-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun May 31 23:52:19 UTC 2020

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_bsc_fdt.c bcm2835_emmc.c
bcm2835_sdhost.c

Log Message:
Remove superfluous checking for a "disable" property in the device_t
properties dictionary.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/broadcom/bcm2835_emmc.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm2835_sdhost.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/broadcom/bcm2835_bsc_fdt.c
diff -u src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.1 src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.2
--- src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.1	Tue Mar 31 12:23:17 2020
+++ src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c	Sun May 31 23:52:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_bsc_fdt.c,v 1.1 2020/03/31 12:23:17 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_bsc_fdt.c,v 1.2 2020/05/31 23:52:19 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2019 Jason R. Thorpe
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc_fdt.c,v 1.1 2020/03/31 12:23:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc_fdt.c,v 1.2 2020/05/31 23:52:19 thorpej Exp $");
 
 #include 
 #include 
@@ -67,8 +67,6 @@ bsciic_fdt_attach(device_t parent, devic
 	struct bsciic_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	prop_dictionary_t prop = device_properties(self);
-	bool disable = false;
 
 	bus_addr_t addr;
 	bus_size_t size;
@@ -82,13 +80,6 @@ bsciic_fdt_attach(device_t parent, devic
 		return;
 	}
 
-	prop_dictionary_get_bool(prop, "disable", );
-	if (disable) {
-		aprint_naive(": disabled\n");
-		aprint_normal(": disabled\n");
-		return;
-	}
-
 	/* Enable clock */
 	sc->sc_clk = fdtbus_clock_get_index(phandle, 0);
 	if (sc->sc_clk == NULL) {

Index: src/sys/arch/arm/broadcom/bcm2835_emmc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.36 src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.37
--- src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.36	Thu Feb 20 01:44:06 2020
+++ src/sys/arch/arm/broadcom/bcm2835_emmc.c	Sun May 31 23:52:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_emmc.c,v 1.36 2020/02/20 01:44:06 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_emmc.c,v 1.37 2020/05/31 23:52:19 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.36 2020/02/20 01:44:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.37 2020/05/31 23:52:19 thorpej Exp $");
 
 #include "bcmdmac.h"
 
@@ -117,9 +117,7 @@ bcmemmc_attach(device_t parent, device_t
 {
 	struct bcmemmc_softc *sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
-	prop_dictionary_t dict = device_properties(self);
 	const int phandle = faa->faa_phandle;
-	bool disable = false;
 	enum bcmemmc_type type;
 	int error;
 
@@ -138,13 +136,6 @@ bcmemmc_attach(device_t parent, device_t
 	sc->sc.sc_clkbase = 5;	/* Default to 50MHz */
 	sc->sc_iot = faa->faa_bst;
 
-	prop_dictionary_get_bool(dict, "disable", );
-	if (disable) {
-		aprint_naive(": disabled\n");
-		aprint_normal(": disabled\n");
-		return;
-	}
-
 	bus_addr_t addr;
 	bus_size_t size;
 

Index: src/sys/arch/arm/broadcom/bcm2835_sdhost.c
diff -u src/sys/arch/arm/broadcom/bcm2835_sdhost.c:1.4 src/sys/arch/arm/broadcom/bcm2835_sdhost.c:1.5
--- src/sys/arch/arm/broadcom/bcm2835_sdhost.c:1.4	Sun Dec 10 21:38:26 2017
+++ src/sys/arch/arm/broadcom/bcm2835_sdhost.c	Sun May 31 23:52:19 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_sdhost.c,v 1.4 2017/12/10 21:38:26 skrll Exp $ */
+/* $NetBSD: bcm2835_sdhost.c,v 1.5 2020/05/31 23:52:19 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_sdhost.c,v 1.4 2017/12/10 21:38:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_sdhost.c,v 1.5 2020/05/31 23:52:19 thorpej Exp $");
 
 #include "bcmdmac.h"
 
@@ -191,8 +191,6 @@ sdhost_attach(device_t parent, device_t 
 {
 	struct sdhost_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
-	prop_dictionary_t dict = device_properties(self);
-	bool disable = false;
 
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
@@ -220,12 +218,6 @@ sdhost_attach(device_t parent, device_t 
 	aprint_naive("\n");
 	aprint_normal(": SD HOST controller\n");
 
-	prop_dictionary_get_bool(dict, "disable", );
-	if (disable) {
-		aprint_naive(": disabled\n");
-		aprint_normal(": disabled\n");
-		return;
-	}
 	/* Enable clocks */
 	struct clk *clk;
 	for (int i = 0; (clk = fdtbus_clock_get_index(phandle, i)); i++) {



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

2020-05-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun May 31 23:55:18 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: sni_emmc.c sni_exiu.c sni_gpio.c sni_i2c.c

Log Message:
Remove superfluous checking for a "disable" property in the device_t
properties dictionary.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sociox/sni_emmc.c \
src/sys/arch/arm/sociox/sni_i2c.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sociox/sni_exiu.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sociox/sni_gpio.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/sociox/sni_emmc.c
diff -u src/sys/arch/arm/sociox/sni_emmc.c:1.6 src/sys/arch/arm/sociox/sni_emmc.c:1.7
--- src/sys/arch/arm/sociox/sni_emmc.c:1.6	Wed Mar 25 23:20:38 2020
+++ src/sys/arch/arm/sociox/sni_emmc.c	Sun May 31 23:55:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sni_emmc.c,v 1.6 2020/03/25 23:20:38 nisimura Exp $	*/
+/*	$NetBSD: sni_emmc.c,v 1.7 2020/05/31 23:55:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sni_emmc.c,v 1.6 2020/03/25 23:20:38 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_emmc.c,v 1.7 2020/05/31 23:55:18 thorpej Exp $");
 
 #include 
 #include 
@@ -100,20 +100,12 @@ sniemmc_fdt_attach(device_t parent, devi
 {
 	struct sniemmc_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
-	prop_dictionary_t dict = device_properties(self);
 	const int phandle = faa->faa_phandle;
 	bus_space_handle_t ioh;
 	bus_addr_t addr;
 	bus_size_t size;
 	char intrstr[128];
-	_Bool disable;
 
-	prop_dictionary_get_bool(dict, "disable", );
-	if (disable) {
-		aprint_naive(": disabled\n");
-		aprint_normal(": disabled\n");
-		return;
-	}
 	if (fdtbus_get_reg(phandle, 0, , ) != 0
 	|| bus_space_map(faa->faa_bst, addr, size, 0, ) != 0) {
 		aprint_error(": unable to map device\n");
Index: src/sys/arch/arm/sociox/sni_i2c.c
diff -u src/sys/arch/arm/sociox/sni_i2c.c:1.6 src/sys/arch/arm/sociox/sni_i2c.c:1.7
--- src/sys/arch/arm/sociox/sni_i2c.c:1.6	Wed Mar 25 23:20:38 2020
+++ src/sys/arch/arm/sociox/sni_i2c.c	Sun May 31 23:55:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sni_i2c.c,v 1.6 2020/03/25 23:20:38 nisimura Exp $	*/
+/*	$NetBSD: sni_i2c.c,v 1.7 2020/05/31 23:55:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.6 2020/03/25 23:20:38 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.7 2020/05/31 23:55:18 thorpej Exp $");
 
 #include 
 #include 
@@ -123,14 +123,7 @@ sniiic_fdt_attach(device_t parent, devic
 	bus_addr_t addr;
 	bus_size_t size;
 	char intrstr[128];
-	_Bool disable;
 
-	prop_dictionary_get_bool(dict, "disable", );
-	if (disable) {
-		aprint_naive(": disabled\n");
-		aprint_normal(": disabled\n");
-		return;
-	}
 	if (fdtbus_get_reg(phandle, 0, , ) != 0
 	|| bus_space_map(faa->faa_bst, addr, size, 0, ) != 0) {
 		aprint_error(": unable to map device\n");

Index: src/sys/arch/arm/sociox/sni_exiu.c
diff -u src/sys/arch/arm/sociox/sni_exiu.c:1.3 src/sys/arch/arm/sociox/sni_exiu.c:1.4
--- src/sys/arch/arm/sociox/sni_exiu.c:1.3	Wed Mar 25 23:29:39 2020
+++ src/sys/arch/arm/sociox/sni_exiu.c	Sun May 31 23:55:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sni_exiu.c,v 1.3 2020/03/25 23:29:39 nisimura Exp $	*/
+/*	$NetBSD: sni_exiu.c,v 1.4 2020/05/31 23:55:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sni_exiu.c,v 1.3 2020/03/25 23:29:39 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_exiu.c,v 1.4 2020/05/31 23:55:18 thorpej Exp $");
 
 #include 
 #include 
@@ -91,20 +91,12 @@ sniexiu_fdt_attach(device_t parent, devi
 {
 	struct sniexiu_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
-	prop_dictionary_t dict = device_properties(self);
 	const int phandle = faa->faa_phandle;
 	bus_space_handle_t ioh;
 	bus_addr_t addr;
 	bus_size_t size;
 	char intrstr[128];
-	_Bool disable;
 
-	prop_dictionary_get_bool(dict, "disable", );
-	if (disable) {
-		aprint_naive(": disabled\n");
-		aprint_normal(": disabled\n");
-		return;
-	}
 	if (fdtbus_get_reg(phandle, 0, , ) != 0
 	|| bus_space_map(faa->faa_bst, addr, size, 0, ) != 0) {
 		aprint_error(": unable to map device\n");

Index: src/sys/arch/arm/sociox/sni_gpio.c
diff -u src/sys/arch/arm/sociox/sni_gpio.c:1.7 src/sys/arch/arm/sociox/sni_gpio.c:1.8
--- src/sys/arch/arm/sociox/sni_gpio.c:1.7	Wed Mar 25 23:31:19 2020
+++ src/sys/arch/arm/sociox/sni_gpio.c	Sun May 31 23:55:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sni_gpio.c,v 1.7 2020/03/25 23:31:19 nisimura Exp $	*/
+/*	$NetBSD: sni_gpio.c,v 1.8 2020/05/31 23:55:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */

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

2020-05-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jun  1 00:00:37 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: sni_i2c.c

Log Message:
Oops, missed a line in the last change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sociox/sni_i2c.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/sociox/sni_i2c.c
diff -u src/sys/arch/arm/sociox/sni_i2c.c:1.7 src/sys/arch/arm/sociox/sni_i2c.c:1.8
--- src/sys/arch/arm/sociox/sni_i2c.c:1.7	Sun May 31 23:55:18 2020
+++ src/sys/arch/arm/sociox/sni_i2c.c	Mon Jun  1 00:00:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sni_i2c.c,v 1.7 2020/05/31 23:55:18 thorpej Exp $	*/
+/*	$NetBSD: sni_i2c.c,v 1.8 2020/06/01 00:00:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.7 2020/05/31 23:55:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.8 2020/06/01 00:00:37 thorpej Exp $");
 
 #include 
 #include 
@@ -117,7 +117,6 @@ sniiic_fdt_attach(device_t parent, devic
 {
 	struct sniiic_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
-	prop_dictionary_t dict = device_properties(self);
 	const int phandle = faa->faa_phandle;
 	bus_space_handle_t ioh;
 	bus_addr_t addr;



CVS commit: src/external/gpl2/lvm2

2020-05-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun  1 00:34:25 UTC 2020

Modified Files:
src/external/gpl2/lvm2: lvm2tools.mk
src/external/gpl2/lvm2/dist/include: lib.h
src/external/gpl2/lvm2/dist/lib/misc: lib.h

Log Message:
Avoid redefining _REENTRANT under sanitizers

Switch away from -Wno-macro-redefined which was Clang specific.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/lvm2/lvm2tools.mk
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/lvm2/dist/include/lib.h
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/lvm2/dist/lib/misc/lib.h

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

Modified files:

Index: src/external/gpl2/lvm2/lvm2tools.mk
diff -u src/external/gpl2/lvm2/lvm2tools.mk:1.6 src/external/gpl2/lvm2/lvm2tools.mk:1.7
--- src/external/gpl2/lvm2/lvm2tools.mk:1.6	Sat Feb  8 00:11:18 2020
+++ src/external/gpl2/lvm2/lvm2tools.mk	Mon Jun  1 00:34:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: lvm2tools.mk,v 1.6 2020/02/08 00:11:18 kamil Exp $
+#	$NetBSD: lvm2tools.mk,v 1.7 2020/06/01 00:34:25 kamil Exp $
 
 .include 
 
@@ -24,7 +24,3 @@ CPPFLAGS+=-DDM_DEVICE_UID=0 -DDM_DEVICE_
 #.endif
 #
 #LVM2.liblvm=	${LVM2OBJDIR.liblvm}/liblvm.a
-
-.if ${MKSANITIZER:Uno} == "yes" || ${MKLIBCSANITIZER:Uno} == "yes"
-CFLAGS+=	-Wno-macro-redefined # _REENTRANT redefined in lib.h
-.endif

Index: src/external/gpl2/lvm2/dist/include/lib.h
diff -u src/external/gpl2/lvm2/dist/include/lib.h:1.1.1.1 src/external/gpl2/lvm2/dist/include/lib.h:1.2
--- src/external/gpl2/lvm2/dist/include/lib.h:1.1.1.1	Mon Dec 22 00:18:44 2008
+++ src/external/gpl2/lvm2/dist/include/lib.h	Mon Jun  1 00:34:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lib.h,v 1.1.1.1 2008/12/22 00:18:44 haad Exp $	*/
+/*	$NetBSD: lib.h,v 1.2 2020/06/01 00:34:25 kamil Exp $	*/
 
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
@@ -23,7 +23,9 @@
 
 #include "configure.h"
 
+#ifndef _REENTRANT
 #define _REENTRANT
+#endif
 #define _GNU_SOURCE
 #define _FILE_OFFSET_BITS 64
 

Index: src/external/gpl2/lvm2/dist/lib/misc/lib.h
diff -u src/external/gpl2/lvm2/dist/lib/misc/lib.h:1.1.1.1 src/external/gpl2/lvm2/dist/lib/misc/lib.h:1.2
--- src/external/gpl2/lvm2/dist/lib/misc/lib.h:1.1.1.1	Mon Dec 22 00:18:12 2008
+++ src/external/gpl2/lvm2/dist/lib/misc/lib.h	Mon Jun  1 00:34:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lib.h,v 1.1.1.1 2008/12/22 00:18:12 haad Exp $	*/
+/*	$NetBSD: lib.h,v 1.2 2020/06/01 00:34:25 kamil Exp $	*/
 
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
@@ -23,7 +23,9 @@
 
 #include "configure.h"
 
+#ifndef _REENTRANT
 #define _REENTRANT
+#endif
 #define _GNU_SOURCE
 #define _FILE_OFFSET_BITS 64
 



CVS commit: src/external/bsd/fetch

2020-05-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun  1 00:55:25 UTC 2020

Modified Files:
src/external/bsd/fetch/dist/libfetch: http.c
src/external/bsd/fetch/lib: Makefile

Log Message:
Avoid redefining _REENTRANT under sanitizers

Switch away from -Wno-macro-redefined which was Clang/LLVM specific.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/fetch/dist/libfetch/http.c
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/fetch/lib/Makefile

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

Modified files:

Index: src/external/bsd/fetch/dist/libfetch/http.c
diff -u src/external/bsd/fetch/dist/libfetch/http.c:1.3 src/external/bsd/fetch/dist/libfetch/http.c:1.4
--- src/external/bsd/fetch/dist/libfetch/http.c:1.3	Tue Jan  7 02:13:00 2014
+++ src/external/bsd/fetch/dist/libfetch/http.c	Mon Jun  1 00:55:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: http.c,v 1.3 2014/01/07 02:13:00 joerg Exp $	*/
+/*	$NetBSD: http.c,v 1.4 2020/06/01 00:55:24 kamil Exp $	*/
 /*-
  * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
  * Copyright (c) 2003 Thomas Klausner 
@@ -68,8 +68,10 @@
 #define _GNU_SOURCE
 #endif
 
+#ifndef _REENTRANT
 /* Needed for gmtime_r on Interix */
 #define _REENTRANT
+#endif
 
 #if HAVE_CONFIG_H
 #include "config.h"

Index: src/external/bsd/fetch/lib/Makefile
diff -u src/external/bsd/fetch/lib/Makefile:1.16 src/external/bsd/fetch/lib/Makefile:1.17
--- src/external/bsd/fetch/lib/Makefile:1.16	Sat Feb  8 00:11:18 2020
+++ src/external/bsd/fetch/lib/Makefile	Mon Jun  1 00:55:24 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.16 2020/02/08 00:11:18 kamil Exp $
+# $NetBSD: Makefile,v 1.17 2020/06/01 00:55:24 kamil Exp $
 
 LIB=		fetch
 SRCS=		fetch.c common.c ftp.c http.c file.c
@@ -32,10 +32,6 @@ httperr.h: ${LIBFETCHDIR}/http.errors ${
 	${HOST_SH} ${LIBFETCHDIR}/errlist.sh http_errlist HTTP \
 	${LIBFETCHDIR}/http.errors > ${.TARGET}
 
-.if ${MKSANITIZER:Uno} == "yes" || ${MKLIBCSANITIZER:Uno} == "yes"
-CFLAGS+=	-Wno-macro-redefined # _REENTRANT redefined
-.endif
-
 COPTS.http.c+=	${GCC_NO_STRINGOP_TRUNCATION}
 
 .include 



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

2020-05-31 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun  1 01:03:21 UTC 2020

Modified Files:
src/tests/lib/libc/net: Makefile h_nsd_recurse.c

Log Message:
Avoid redefining _REENTRANT under sanitizers

Switch away from -Wno-macro-redefined which was Clang specific.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libc/net/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/net/h_nsd_recurse.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/net/Makefile
diff -u src/tests/lib/libc/net/Makefile:1.13 src/tests/lib/libc/net/Makefile:1.14
--- src/tests/lib/libc/net/Makefile:1.13	Sat Feb  8 00:11:18 2020
+++ src/tests/lib/libc/net/Makefile	Mon Jun  1 01:03:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2020/02/08 00:11:18 kamil Exp $
+# $NetBSD: Makefile,v 1.14 2020/06/01 01:03:21 kamil Exp $
 
 .include 
 
@@ -41,8 +41,4 @@ LDADD.h_nsd_recurse+=	-lpthread
 
 CLEANFILES+=	aton_ether_subr.c
 
-.if ${MKSANITIZER:Uno} == "yes" || ${MKLIBCSANITIZER:Uno} == "yes"
-COPTS.h_nsd_recurse.c+=	-Wno-macro-redefined # _REENTRANT redefined
-.endif
-
 .include 

Index: src/tests/lib/libc/net/h_nsd_recurse.c
diff -u src/tests/lib/libc/net/h_nsd_recurse.c:1.2 src/tests/lib/libc/net/h_nsd_recurse.c:1.3
--- src/tests/lib/libc/net/h_nsd_recurse.c:1.2	Thu Jan 13 02:24:51 2011
+++ src/tests/lib/libc/net/h_nsd_recurse.c	Mon Jun  1 01:03:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_nsd_recurse.c,v 1.2 2011/01/13 02:24:51 pgoyette Exp $ */
+/*	$NetBSD: h_nsd_recurse.c,v 1.3 2020/06/01 01:03:21 kamil Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,9 +32,11 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: h_nsd_recurse.c,v 1.2 2011/01/13 02:24:51 pgoyette Exp $");
+__RCSID("$NetBSD: h_nsd_recurse.c,v 1.3 2020/06/01 01:03:21 kamil Exp $");
 
+#ifndef	_REENTRANT
 #define	_REENTRANT
+#endif
 
 #include 
 #include 



CVS commit: src/etc

2020-05-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun  1 01:41:40 UTC 2020

Modified Files:
src/etc: Makefile
Removed Files:
src/etc: motd.stable

Log Message:
Use the default motd for stable builds


To generate a diff of this commit:
cvs rdiff -u -r1.445 -r1.446 src/etc/Makefile
cvs rdiff -u -r1.5 -r0 src/etc/motd.stable

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

Modified files:

Index: src/etc/Makefile
diff -u src/etc/Makefile:1.445 src/etc/Makefile:1.446
--- src/etc/Makefile:1.445	Mon May 18 21:19:34 2020
+++ src/etc/Makefile	Mon Jun  1 01:41:40 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.445 2020/05/18 21:19:34 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.446 2020/06/01 01:41:40 jmcneill Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -177,8 +177,6 @@ MOTD_SOURCE=	motd.current
 MOTD_SOURCE=	motd.beta
 .elif !empty(DISTRIBVER:M*RC*)
 MOTD_SOURCE=	motd.rc
-.elif !empty(DISTRIBVER:M*STABLE*)
-MOTD_SOURCE=	motd.stable
 .else
 MOTD_SOURCE=	motd.default
 .endif



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

2020-05-31 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Jun  1 03:37:40 UTC 2020

Added Files:
src/sys/modules/examples/ddbping: Makefile ddbping.c

Log Message:
Example of a kernel module that registers DDB commands.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/modules/examples/ddbping/Makefile \
src/sys/modules/examples/ddbping/ddbping.c

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

Added files:

Index: src/sys/modules/examples/ddbping/Makefile
diff -u /dev/null src/sys/modules/examples/ddbping/Makefile:1.1
--- /dev/null	Mon Jun  1 03:37:40 2020
+++ src/sys/modules/examples/ddbping/Makefile	Mon Jun  1 03:37:40 2020
@@ -0,0 +1,9 @@
+#	$NetBSD: Makefile,v 1.1 2020/06/01 03:37:40 uwe Exp $
+
+# set in nbmake-$machine wrapper:
+# NETBSDSRCDIR?=/usr/src
+
+KMOD=	ddbping
+SRCS=	ddbping.c
+
+.include 
Index: src/sys/modules/examples/ddbping/ddbping.c
diff -u /dev/null src/sys/modules/examples/ddbping/ddbping.c:1.1
--- /dev/null	Mon Jun  1 03:37:40 2020
+++ src/sys/modules/examples/ddbping/ddbping.c	Mon Jun  1 03:37:40 2020
@@ -0,0 +1,126 @@
+/*	$NetBSD: ddbping.c,v 1.1 2020/06/01 03:37:40 uwe Exp $ */
+/*
+ * Copyright (c) 2020 Valery Ushakov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Example of a kernel module that registers DDB commands.
+ */
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ddbping.c,v 1.1 2020/06/01 03:37:40 uwe Exp $");
+
+#include 
+#include 
+
+#include 
+
+/* XXX: db_command.h should provide something like these */
+#define DB_CMD_TBL_END { DDB_ADD_CMD(NULL, NULL, 0, NULL, NULL, NULL) }
+typedef void db_cmdfn_t(db_expr_t, bool, db_expr_t, const char *);
+
+
+static db_cmdfn_t db_ping;
+static db_cmdfn_t db_show_ping;
+
+
+static const struct db_command db_ping_base_tbl[] = {
+	{ DDB_ADD_CMD("ping", db_ping, 0,
+		  "Example command",
+		  NULL, NULL) },
+	DB_CMD_TBL_END
+};
+
+static const struct db_command db_ping_show_tbl[] = {
+	{ DDB_ADD_CMD("ping", db_show_ping, 0,
+		  "Example command stats",
+		  NULL, NULL) },
+	DB_CMD_TBL_END
+};
+
+
+static unsigned int ping_count;
+static unsigned int ping_count_modif;
+static unsigned int ping_count_addr;
+static unsigned int ping_count_count;
+
+
+static void
+db_ping(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
+{
+	db_printf("pong");
+	++ping_count;
+
+	if (modif != NULL && *modif != '\0') {
+		db_printf("/%s", modif);
+		++ping_count_modif;
+	}
+
+	if (have_addr) {
+		db_printf(" 0x%zx", (size_t)addr);
+		++ping_count_addr;
+	}
+
+	if (count > 0) {
+		db_printf(", 0t%zu", (size_t)count);
+		++ping_count_count;
+	}
+
+	db_printf("\n");
+}
+
+
+static void
+db_show_ping(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
+{
+	db_printf("total\t\t%u\n", ping_count);
+	db_printf("with modifiers\t%u\n", ping_count_modif);
+	db_printf("with address\t%u\n", ping_count_addr);
+	db_printf("with count\t%u\n", ping_count_count);
+}
+
+
+
+MODULE(MODULE_CLASS_MISC, ddbping, NULL);
+
+static int
+ddbping_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+		db_register_tbl(DDB_BASE_CMD, db_ping_base_tbl);
+		db_register_tbl(DDB_SHOW_CMD, db_ping_show_tbl);
+		break;
+
+	case MODULE_CMD_FINI:
+		db_unregister_tbl(DDB_BASE_CMD, db_ping_base_tbl);
+		db_unregister_tbl(DDB_SHOW_CMD, db_ping_show_tbl);
+		break;
+
+	case MODULE_CMD_STAT:	/* FALLTHROUGH */
+	default:
+		return ENOTTY;
+	}
+
+	return 0;
+}



CVS commit: src/tests/net

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun  1 04:38:37 UTC 2020

Modified Files:
src/tests/net/if_ipsec: t_ipsec_natt.sh
src/tests/net/ipsec: t_ipsec_natt.sh

Log Message:
Typo in error message


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_ipsec/t_ipsec_natt.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/net/ipsec/t_ipsec_natt.sh

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

Modified files:

Index: src/tests/net/if_ipsec/t_ipsec_natt.sh
diff -u src/tests/net/if_ipsec/t_ipsec_natt.sh:1.3 src/tests/net/if_ipsec/t_ipsec_natt.sh:1.4
--- src/tests/net/if_ipsec/t_ipsec_natt.sh:1.3	Mon Aug 19 03:22:05 2019
+++ src/tests/net/if_ipsec/t_ipsec_natt.sh	Mon Jun  1 04:38:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_natt.sh,v 1.3 2019/08/19 03:22:05 ozaki-r Exp $
+#	$NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $
 #
 # Copyright (c) 2018 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -389,7 +389,7 @@ test_ipsecif_natt_transport()
 	port_a=$($HIJACKING_NPF npfctl list | grep $ip_local_a | awk -F 'shmif1:' '/4500/ {print $2;}')
 	$DEBUG && echo port_a=$port_a
 	if [ -z "$port_a" ]; then
-		atf_fail "Failed to get a traslated port on NAPT"
+		atf_fail "Failed to get a translated port on NAPT"
 	fi
 
 	# Setup ESP-UDP ipsecif(4) for first client under NAPT
@@ -444,7 +444,7 @@ test_ipsecif_natt_transport()
 	port_b=$($HIJACKING_NPF npfctl list | grep $ip_local_b | awk -F 'shmif1:' '/4500/ {print $2;}')
 	$DEBUG && echo port_b=$port_b
 	if [ -z "$port_b" ]; then
-		atf_fail "Failed to get a traslated port on NAPT"
+		atf_fail "Failed to get a translated port on NAPT"
 	fi
 
 	# Setup ESP-UDP ipsecif(4) for first client under NAPT

Index: src/tests/net/ipsec/t_ipsec_natt.sh
diff -u src/tests/net/ipsec/t_ipsec_natt.sh:1.3 src/tests/net/ipsec/t_ipsec_natt.sh:1.4
--- src/tests/net/ipsec/t_ipsec_natt.sh:1.3	Mon Aug 19 03:22:05 2019
+++ src/tests/net/ipsec/t_ipsec_natt.sh	Mon Jun  1 04:38:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_natt.sh,v 1.3 2019/08/19 03:22:05 ozaki-r Exp $
+#	$NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -328,7 +328,7 @@ test_ipsec_natt_transport_ipv4()
 	port=$($HIJACKING_NPF npfctl list | awk -F 'shmif1:' '/4500/ {print $2;}')
 	$DEBUG && echo port=$port
 	if [ -z "$port" ]; then
-		atf_fail "Failed to get a traslated port on NAPT"
+		atf_fail "Failed to get a translated port on NAPT"
 	fi
 
 	# Create ESP-UDP IPsec connections



CVS commit: src/sbin/modload

2020-05-31 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Jun  1 03:18:36 UTC 2020

Modified Files:
src/sbin/modload: modload.8

Log Message:
Make -f description actually use the word "force" so that it can be
found when searched for.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sbin/modload/modload.8

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

Modified files:

Index: src/sbin/modload/modload.8
diff -u src/sbin/modload/modload.8:1.47 src/sbin/modload/modload.8:1.48
--- src/sbin/modload/modload.8:1.47	Tue Jul 18 19:50:54 2017
+++ src/sbin/modload/modload.8	Mon Jun  1 03:18:36 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: modload.8,v 1.47 2017/07/18 19:50:54 wiz Exp $
+.\" $NetBSD: modload.8,v 1.48 2020/06/01 03:18:36 uwe Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -85,6 +85,7 @@ from the
 .Ar plist
 specified.
 .It Fl f
+Force the module to be loaded.
 When a module is loaded, the kernel checks if the module is compatible
 with the running kernel and will refuse to load modules that are
 potentially incompatible.



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

2020-05-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Jun  1 02:42:24 UTC 2020

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

Log Message:
no need to make the PTE writable to do icache_sync, enough to accessible.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/aarch64/aarch64/pmap.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/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.75 src/sys/arch/aarch64/aarch64/pmap.c:1.76
--- src/sys/arch/aarch64/aarch64/pmap.c:1.75	Fri May 15 05:39:15 2020
+++ src/sys/arch/aarch64/aarch64/pmap.c	Mon Jun  1 02:42:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.75 2020/05/15 05:39:15 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.76 2020/06/01 02:42:24 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.75 2020/05/15 05:39:15 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2020/06/01 02:42:24 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -171,17 +171,13 @@ PMAP_COUNTER(unwire_failure, "pmap_unwir
 	} while (0/*CONSTCOND*/)
 
 /*
- * aarch64 require write permission in pte to invalidate instruction cache.
- * changing pte to writable temporarly before cpu_icache_sync_range().
+ * require access permission in pte to invalidate instruction cache.
+ * change the pte to accessible temporarly before cpu_icache_sync_range().
  * this macro modifies PTE (*ptep). need to update PTE after this.
  */
 #define PTE_ICACHE_SYNC_PAGE(pte, ptep, pm, va, ll)			\
 	do {\
-		pt_entry_t tpte;	\
-		tpte = (pte) & ~(LX_BLKPAG_AF|LX_BLKPAG_AP);		\
-		tpte |= (LX_BLKPAG_AF|LX_BLKPAG_AP_RW);			\
-		tpte |= (LX_BLKPAG_UXN|LX_BLKPAG_PXN);			\
-		atomic_swap_64((ptep), tpte);\
+		atomic_swap_64((ptep), (pte) | LX_BLKPAG_AF);		\
 		AARCH64_TLBI_BY_ASID_VA((pm)->pm_asid, (va), (ll));	\
 		cpu_icache_sync_range((va), PAGE_SIZE);			\
 	} while (0/*CONSTCOND*/)
@@ -1328,7 +1324,7 @@ pmap_protect(struct pmap *pm, vaddr_t sv
 			UVMHIST_LOG(pmaphist, "icache_sync: "
 			"pm=%p, va=%016lx, pte: %016lx -> %016lx",
 			pm, va, opte, pte);
-			if (!l3pte_writable(pte)) {
+			if (!l3pte_readable(pte)) {
 PTE_ICACHE_SYNC_PAGE(pte, ptep, pm, va, true);
 atomic_swap_64(ptep, pte);
 AARCH64_TLBI_BY_ASID_VA(pm->pm_asid, va, true);
@@ -1889,7 +1885,7 @@ _pmap_enter(struct pmap *pm, vaddr_t va,
 		UVMHIST_LOG(pmaphist,
 		"icache_sync: pm=%p, va=%016lx, pte: %016lx -> %016lx",
 		pm, va, opte, pte);
-		if (!l3pte_writable(pte)) {
+		if (!l3pte_readable(pte)) {
 			PTE_ICACHE_SYNC_PAGE(pte, ptep, pm, va, l3only);
 			atomic_swap_64(ptep, pte);
 			AARCH64_TLBI_BY_ASID_VA(pm->pm_asid, va ,true);