CVS commit: src/sys/kern

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:12:33 UTC 2023

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

Log Message:
Fix a ~16 year old perf regression: when creating a socket, add a reference
to the caller's credentials rather than copying them.  On an 80486DX2/66 this
seems to ~halve the time taken to create a socket.


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/sys/kern/uipc_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/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.303 src/sys/kern/uipc_socket.c:1.304
--- src/sys/kern/uipc_socket.c:1.303	Sat Aug  5 09:25:39 2023
+++ src/sys/kern/uipc_socket.c	Thu Sep  7 20:12:33 2023
@@ -1,7 +1,7 @@
-/*	$NetBSD: uipc_socket.c,v 1.303 2023/08/05 09:25:39 andvar Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.304 2023/09/07 20:12:33 ad Exp $	*/
 
 /*
- * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2002, 2007, 2008, 2009, 2023 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.303 2023/08/05 09:25:39 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.304 2023/09/07 20:12:33 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -559,7 +559,7 @@ socreate(int dom, struct socket **aso, i
 		sofree(so);
 		return error;
 	}
-	so->so_cred = kauth_cred_dup(l->l_cred);
+	kauth_cred_hold(so->so_cred = l->l_cred);
 	sounlock(so);
 
 	*aso = so;



CVS commit: src/sys/kern

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:12:33 UTC 2023

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

Log Message:
Fix a ~16 year old perf regression: when creating a socket, add a reference
to the caller's credentials rather than copying them.  On an 80486DX2/66 this
seems to ~halve the time taken to create a socket.


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/sys/kern/uipc_socket.c

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



CVS commit: src/sys/dev/i2o

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:07:04 UTC 2023

Modified Files:
src/sys/dev/i2o: dpti.c iop.c

Log Message:
Make the I2O management cdevs MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/i2o/dpti.c
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/i2o/iop.c

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



CVS commit: src/sys/dev/i2o

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:07:04 UTC 2023

Modified Files:
src/sys/dev/i2o: dpti.c iop.c

Log Message:
Make the I2O management cdevs MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/i2o/dpti.c
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/i2o/iop.c

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

Modified files:

Index: src/sys/dev/i2o/dpti.c
diff -u src/sys/dev/i2o/dpti.c:1.50 src/sys/dev/i2o/dpti.c:1.51
--- src/sys/dev/i2o/dpti.c:1.50	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/i2o/dpti.c	Thu Sep  7 20:07:03 2023
@@ -1,7 +1,7 @@
-/*	$NetBSD: dpti.c,v 1.50 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: dpti.c,v 1.51 2023/09/07 20:07:03 ad Exp $	*/
 
 /*-
- * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001, 2007, 2023 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.50 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.51 2023/09/07 20:07:03 ad Exp $");
 
 #include 
 #include 
@@ -66,7 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.5
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -150,7 +150,7 @@ const struct cdevsw dpti_cdevsw = {
 	.d_mmap = nommap,
 	.d_kqfilter = nokqfilter,
 	.d_discard = nodiscard,
-	.d_flag = D_OTHER,
+	.d_flag = D_OTHER | D_MPSAFE,
 };
 
 CFATTACH_DECL_NEW(dpti, sizeof(struct dpti_softc),
@@ -242,6 +242,7 @@ dptiioctl(dev_t dev, u_long cmd, void *d
 		linux = 0;
 	}
 
+	mutex_enter(>sc_conflock);
 	switch (cmd) {
 	case DPT_SIGNATURE:
 		if (size > sizeof(dpti_sig))
@@ -283,13 +284,11 @@ dptiioctl(dev_t dev, u_long cmd, void *d
 		if (rv)
 			break;
 
-		mutex_enter(>sc_conflock);
 		if (linux) {
 			rv = dpti_passthrough(sc, data, l->l_proc);
 		} else {
 			rv = dpti_passthrough(sc, *(void **)data, l->l_proc);
 		}
-		mutex_exit(>sc_conflock);
 		break;
 
 	case DPT_I2ORESETCMD:
@@ -299,15 +298,14 @@ dptiioctl(dev_t dev, u_long cmd, void *d
 		break;
 
 	case DPT_I2ORESCANCMD:
-		mutex_enter(>sc_conflock);
 		rv = iop_reconfigure(iop, 0);
-		mutex_exit(>sc_conflock);
 		break;
 
 	default:
 		rv = ENOTTY;
 		break;
 	}
+	mutex_exit(>sc_conflock);
 
 	return (rv);
 }
@@ -644,13 +642,7 @@ dpti_passthrough(struct dpti_softc *sc, 
 			}
 
 			bufs[nbuf].db_size = sz;
-			bufs[nbuf].db_ptr = malloc(sz, M_DEVBUF, M_WAITOK);
-			if (bufs[nbuf].db_ptr == NULL) {
-DPRINTF(("%s: allocation failure\n",
-device_xname(sc->sc_dev)));
-rv = ENOMEM;
-goto bad;
-			}
+			bufs[nbuf].db_ptr = kmem_zalloc(sz, KM_SLEEP);
 
 			for (i = 0, sz = 0; i < bufs[nbuf].db_nfrag; i++) {
 rv = copyin(bufs[nbuf].db_frags[i].iov_base,
@@ -744,7 +736,7 @@ dpti_passthrough(struct dpti_softc *sc, 
 		}
 
 		if (bufs[i].db_ptr != NULL)
-			free(bufs[i].db_ptr, M_DEVBUF);
+			kmem_free(bufs[i].db_ptr, bufs[i].db_size);
 	}
 
 	return (rv);

Index: src/sys/dev/i2o/iop.c
diff -u src/sys/dev/i2o/iop.c:1.92 src/sys/dev/i2o/iop.c:1.93
--- src/sys/dev/i2o/iop.c:1.92	Sat Aug  7 16:19:11 2021
+++ src/sys/dev/i2o/iop.c	Thu Sep  7 20:07:03 2023
@@ -1,7 +1,7 @@
-/*	$NetBSD: iop.c,v 1.92 2021/08/07 16:19:11 thorpej Exp $	*/
+/*	$NetBSD: iop.c,v 1.93 2023/09/07 20:07:03 ad Exp $	*/
 
 /*-
- * Copyright (c) 2000, 2001, 2002, 2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 2000, 2001, 2002, 2007, 2023 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.92 2021/08/07 16:19:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.93 2023/09/07 20:07:03 ad Exp $");
 
 #include "iop.h"
 
@@ -106,7 +106,7 @@ const struct cdevsw iop_cdevsw = {
 	.d_mmap = nommap,
 	.d_kqfilter = nokqfilter,
 	.d_discard = nodiscard,
-	.d_flag = D_OTHER,
+	.d_flag = D_OTHER | D_MPSAFE,
 };
 
 #define	IC_CONFIGURE	0x01
@@ -2438,16 +2438,23 @@ int
 iopopen(dev_t dev, int flag, int mode, struct lwp *l)
 {
 	struct iop_softc *sc;
+	int rv;
 
 	if ((sc = device_lookup_private(_cd, minor(dev))) == NULL)
 		return (ENXIO);
+
+	mutex_enter(>sc_conflock);
 	if ((sc->sc_flags & IOP_ONLINE) == 0)
-		return (ENXIO);
-	if ((sc->sc_flags & IOP_OPEN) != 0)
-		return (EBUSY);
-	sc->sc_flags |= IOP_OPEN;
+		rv = ENXIO;
+	else if ((sc->sc_flags & IOP_OPEN) != 0)
+		rv = EBUSY;
+	else {
+		sc->sc_flags |= IOP_OPEN;
+		rv = 0;
+	}
+	mutex_exit(>sc_conflock);
 
-	return (0);
+	return (rv);
 }
 
 int
@@ -2457,7 +2464,10 @@ iopclose(dev_t dev, int flag, int mode,
 	struct iop_softc *sc;
 
 	sc = device_lookup_private(_cd, minor(dev));
+
+	mutex_enter(>sc_conflock);
 	sc->sc_flags &= ~IOP_OPEN;
+	mutex_exit(>sc_conflock);
 
 	return (0);
 }
@@ -2472,14 +2482,19 @@ iopioctl(dev_t dev, u_long cmd, 

CVS commit: src/sys

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:05:42 UTC 2023

Modified Files:
src/sys/kern: kern_mutex.c kern_rwlock.c
src/sys/sys: mutex.h rwlock.h

Log Message:
Remove dodgy and unused mutex_owner_running() & rw_owner_running().


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/kern/kern_mutex.c
cvs rdiff -u -r1.71 -r1.72 src/sys/kern/kern_rwlock.c
cvs rdiff -u -r1.27 -r1.28 src/sys/sys/mutex.h
cvs rdiff -u -r1.18 -r1.19 src/sys/sys/rwlock.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/kern/kern_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.108 src/sys/kern/kern_mutex.c:1.109
--- src/sys/kern/kern_mutex.c:1.108	Mon Jul 17 12:54:29 2023
+++ src/sys/kern/kern_mutex.c	Thu Sep  7 20:05:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.108 2023/07/17 12:54:29 riastradh Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.109 2023/09/07 20:05:42 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.108 2023/07/17 12:54:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.109 2023/09/07 20:05:42 ad Exp $");
 
 #include 
 #include 
@@ -752,6 +752,8 @@ mutex_vector_exit(kmutex_t *mtx)
 	 * Avoid having to take the turnstile chain lock every time
 	 * around.  Raise the priority level to splhigh() in order
 	 * to disable preemption and so make the following atomic.
+	 * This also blocks out soft interrupts that could set the
+	 * waiters bit.
 	 */
 	{
 		int s = splhigh();
@@ -842,31 +844,6 @@ mutex_owner(wchan_t wchan)
 }
 
 /*
- * mutex_owner_running:
- *
- *	Return true if an adaptive mutex is unheld, or held and the owner is
- *	running on a CPU.  For the pagedaemon only - do not document or use
- *	in other code.
- */
-bool
-mutex_owner_running(const kmutex_t *mtx)
-{
-#ifdef MULTIPROCESSOR
-	uintptr_t owner;
-	bool rv;
-
-	MUTEX_ASSERT(mtx, MUTEX_ADAPTIVE_P(mtx->mtx_owner));
-	kpreempt_disable();
-	owner = mtx->mtx_owner;
-	rv = !MUTEX_OWNED(owner) || mutex_oncpu(MUTEX_OWNER(owner));
-	kpreempt_enable();
-	return rv;
-#else
-	return mutex_owner(mtx) == curlwp;
-#endif
-}
-
-/*
  * mutex_ownable:
  *
  *	When compiled with DEBUG and LOCKDEBUG defined, ensure that

Index: src/sys/kern/kern_rwlock.c
diff -u src/sys/kern/kern_rwlock.c:1.71 src/sys/kern/kern_rwlock.c:1.72
--- src/sys/kern/kern_rwlock.c:1.71	Mon Jul 17 12:54:29 2023
+++ src/sys/kern/kern_rwlock.c	Thu Sep  7 20:05:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rwlock.c,v 1.71 2023/07/17 12:54:29 riastradh Exp $	*/
+/*	$NetBSD: kern_rwlock.c,v 1.72 2023/09/07 20:05:42 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019, 2020
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.71 2023/07/17 12:54:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.72 2023/09/07 20:05:42 ad Exp $");
 
 #include "opt_lockdebug.h"
 
@@ -586,7 +586,7 @@ rw_vector_tryenter(krwlock_t *rw, const 
 void
 rw_downgrade(krwlock_t *rw)
 {
-	uintptr_t owner, curthread, newown, next;
+	uintptr_t owner, newown, next, curthread __diagused;
 	turnstile_t *ts;
 	int rcnt, wcnt;
 	lwp_t *l;
@@ -597,9 +597,6 @@ rw_downgrade(krwlock_t *rw)
 	RW_ASSERT(rw, (rw->rw_owner & RW_WRITE_LOCKED) != 0);
 	RW_ASSERT(rw, RW_OWNER(rw) == curthread);
 	RW_UNLOCKED(rw, RW_WRITER);
-#if !defined(DIAGNOSTIC)
-	__USE(curthread);
-#endif
 
 	membar_release();
 	for (owner = rw->rw_owner;; owner = next) {
@@ -801,26 +798,3 @@ rw_owner(wchan_t obj)
 
 	return (void *)(owner & RW_THREAD);
 }
-
-/*
- * rw_owner_running:
- *
- *	Return true if a RW lock is unheld, or write held and the owner is
- *	running on a CPU.  For the pagedaemon.
- */
-bool
-rw_owner_running(const krwlock_t *rw)
-{
-#ifdef MULTIPROCESSOR
-	uintptr_t owner;
-	bool rv;
-
-	kpreempt_disable();
-	owner = rw->rw_owner;
-	rv = (owner & RW_THREAD) == 0 || rw_oncpu(owner);
-	kpreempt_enable();
-	return rv;
-#else
-	return rw_owner(rw) == curlwp;
-#endif
-}

Index: src/sys/sys/mutex.h
diff -u src/sys/sys/mutex.h:1.27 src/sys/sys/mutex.h:1.28
--- src/sys/sys/mutex.h:1.27	Wed Apr 12 06:35:40 2023
+++ src/sys/sys/mutex.h	Thu Sep  7 20:05:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.27 2023/04/12 06:35:40 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.28 2023/09/07 20:05:41 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -199,7 +199,6 @@ int	mutex_tryenter(kmutex_t *);
 
 int	mutex_owned(const kmutex_t *);
 int	mutex_ownable(const kmutex_t *);
-bool	mutex_owner_running(const kmutex_t *);
 
 void	mutex_obj_init(void);
 kmutex_t *mutex_obj_alloc(kmutex_type_t, int);

Index: src/sys/sys/rwlock.h
diff -u src/sys/sys/rwlock.h:1.18 src/sys/sys/rwlock.h:1.19
--- src/sys/sys/rwlock.h:1.18	Sun Jul  9 16:32:28 2023
+++ 

CVS commit: src/sys

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:05:42 UTC 2023

Modified Files:
src/sys/kern: kern_mutex.c kern_rwlock.c
src/sys/sys: mutex.h rwlock.h

Log Message:
Remove dodgy and unused mutex_owner_running() & rw_owner_running().


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/kern/kern_mutex.c
cvs rdiff -u -r1.71 -r1.72 src/sys/kern/kern_rwlock.c
cvs rdiff -u -r1.27 -r1.28 src/sys/sys/mutex.h
cvs rdiff -u -r1.18 -r1.19 src/sys/sys/rwlock.h

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



CVS commit: src/sys/dev/usb

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:04:18 UTC 2023

Modified Files:
src/sys/dev/usb: usbdevs usbdevs.h usbdevs_data.h

Log Message:
Add USB device TOPPING DX3 Pro.


To generate a diff of this commit:
cvs rdiff -u -r1.808 -r1.809 src/sys/dev/usb/usbdevs
cvs rdiff -u -r1.800 -r1.801 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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



CVS commit: src/sys/dev/i2o

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:03:25 UTC 2023

Modified Files:
src/sys/dev/i2o: i2o.h

Log Message:
Remove unused I2O LAN class defs (the LAN driver was deleted years ago).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/i2o/i2o.h

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

Modified files:

Index: src/sys/dev/i2o/i2o.h
diff -u src/sys/dev/i2o/i2o.h:1.17 src/sys/dev/i2o/i2o.h:1.18
--- src/sys/dev/i2o/i2o.h:1.17	Mon May 30 09:56:04 2022
+++ src/sys/dev/i2o/i2o.h	Thu Sep  7 20:03:25 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2o.h,v 1.17 2022/05/30 09:56:04 andvar Exp $	*/
+/*	$NetBSD: i2o.h,v 1.18 2023/09/07 20:03:25 ad Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,8 @@
 /*
  * Structures and constants, as presented by the I2O specification revision
  * 1.5 (obtainable from http://www.intelligent-io.com/).  Currently, only
- * what's useful to us is defined in this file.
+ * what's useful to us is defined in this file.  LAN defs used to be here
+ * but were removed as they're useless.
  */
 
 #ifndef	_I2O_I2O_H_
@@ -681,11 +682,6 @@ struct i2o_util_event_register_reply {
 #define	I2O_EVENT_EXEC_MODIFIED_LCT		0x0200
 #define	I2O_EVENT_EXEC_DDM_AVAILIBILITY		0x0400
 
-/* LAN class events. */
-#define	I2O_EVENT_LAN_LINK_DOWN			0x0001
-#define	I2O_EVENT_LAN_LINK_UP			0x0002
-#define	I2O_EVENT_LAN_MEDIA_CHANGE		0x0004
-
 /*
  * = Utility parameter groups =
  */
@@ -1006,363 +1002,4 @@ struct i2o_param_scsi_device_info {
 	u_int64_t	negsyncrate;
 } __packed;
 
-/*
- * = LAN class messages =
- */
-
-#define	I2O_LAN_PACKET_SEND		0x3b
-struct i2o_lan_packet_send {
-	u_int32_t	msgflags;
-	u_int32_t	msgfunc;
-	u_int32_t	msgictx;
-	u_int32_t	tcw;
-
-	/* SGL follows */
-} __packed;
-
-#define	I2O_LAN_TCW_ACCESS_PRI_MASK	0x0007
-#define	I2O_LAN_TCW_SUPPRESS_CRC	0x0008
-#define	I2O_LAN_TCW_SUPPRESS_LOOPBACK	0x0010
-#define	I2O_LAN_TCW_CKSUM_NETWORK	0x0020
-#define	I2O_LAN_TCW_CKSUM_TRANSPORT	0x0040
-#define	I2O_LAN_TCW_REPLY_BATCH		0x
-#define	I2O_LAN_TCW_REPLY_IMMEDIATELY	0x4000
-#define	I2O_LAN_TCW_REPLY_UNSUCCESSFUL	0x8000
-#define	I2O_LAN_TCW_REPLY_NONE		0xc000
-
-#define	I2O_LAN_SDU_SEND		0x3d
-struct i2o_lan_sdu_send {
-	u_int32_t	msgflags;
-	u_int32_t	msgfunc;
-	u_int32_t	msgictx;
-	u_int32_t	tcw;		/* As per PACKET_SEND. */
-
-	/* SGL follows */
-} __packed;
-
-struct i2o_lan_send_reply {
-	u_int32_t	msgflags;
-	u_int32_t	msgfunc;
-	u_int32_t	msgictx;
-	u_int32_t	trl;
-	u_int16_t	detail;
-	u_int8_t	reserved;
-	u_int8_t	reqstatus;
-	u_int32_t	tctx[1];
-} __packed;
-
-#define	I2O_LAN_RECEIVE_POST		0x3e
-struct i2o_lan_receive_post {
-	u_int32_t	msgflags;
-	u_int32_t	msgfunc;
-	u_int32_t	msgictx;
-	u_int32_t	bktcnt;
-
-	/* SGL follows */
-} __packed;
-
-struct i2o_lan_receive_reply {
-	u_int32_t	msgflags;
-	u_int32_t	msgfunc;
-	u_int32_t	msgictx;
-	u_int8_t	trlcount;
-	u_int8_t	trlesize;
-	u_int8_t	reserved;
-	u_int8_t	trlflags;
-	u_int32_t	bucketsleft;
-} __packed;
-
-#define	I2O_LAN_RECEIVE_REPLY_PDB	0x80
-
-#define	I2O_LAN_PDB_ERROR_NONE		0x00
-#define	I2O_LAN_PDB_ERROR_BAD_CRC	0x01
-#define	I2O_LAN_PDB_ERROR_ALIGNMENT	0x02
-#define	I2O_LAN_PDB_ERROR_TOO_LONG	0x03
-#define	I2O_LAN_PDB_ERROR_TOO_SHORT	0x04
-#define	I2O_LAN_PDB_ERROR_RX_OVERRUN	0x05
-#define	I2O_LAN_PDB_ERROR_L3_CKSUM_BAD	0x40
-#define	I2O_LAN_PDB_ERROR_L4_CKSUM_BAD	0x80
-#define	I2O_LAN_PDB_ERROR_CKSUM_MASK	0xc0
-#define	I2O_LAN_PDB_ERROR_OTHER		0xff
-
-#define	I2O_LAN_RESET			0x35
-struct i2o_lan_reset {
-	u_int32_t	msgflags;
-	u_int32_t	msgfunc;
-	u_int32_t	msgictx;
-	u_int16_t	reserved;
-	u_int16_t	resrcflags;
-} __packed;
-
-#define	I2O_LAN_RESRC_RETURN_BUCKETS	0x0001
-#define	I2O_LAN_RESRC_RETURN_XMITS	0x0002
-
-#define	I2O_LAN_SUSPEND			0x37
-struct i2o_lan_suspend {
-	u_int32_t	msgflags;
-	u_int32_t	msgfunc;
-	u_int32_t	msgictx;
-	u_int16_t	reserved;
-	u_int16_t	resrcflags;	/* As per RESET. */
-} __packed;
-
-#define	I2O_LAN_DSC_SUCCESS			0x00
-#define	I2O_LAN_DSC_DEVICE_FAILURE		0x01
-#define	I2O_LAN_DSC_DESTINATION_NOT_FOUND	0x02
-#define	I2O_LAN_DSC_TRANSMIT_ERROR		0x03
-#define	I2O_LAN_DSC_TRANSMIT_ABORTED		0x04
-#define	I2O_LAN_DSC_RECEIVE_ERROR		0x05
-#define	I2O_LAN_DSC_RECEIVE_ABORTED		0x06
-#define	I2O_LAN_DSC_DMA_ERROR			0x07
-#define	I2O_LAN_DSC_BAD_PACKET_DETECTED		0x08
-#define	I2O_LAN_DSC_OUT_OF_MEMORY		0x09
-#define	I2O_LAN_DSC_BUCKET_OVERRUN		0x0a
-#define	I2O_LAN_DSC_IOP_INTERNAL_ERROR		0x0b
-#define	I2O_LAN_DSC_CANCELED			0x0c
-#define	I2O_LAN_DSC_INVALID_TRANSACTION_CONTEXT	0x0d
-#define	I2O_LAN_DSC_DEST_ADDRESS_DETECTED	0x0e
-#define	I2O_LAN_DSC_DEST_ADDRESS_OMITTED	0x0f
-#define	I2O_LAN_DSC_PARTIAL_PACKET_RETURNED	0x10
-#define	I2O_LAN_DSC_TEMP_SUSPENDED_STATE	0x11
-
-/*
- * = LAN class parameter groups 

CVS commit: src/sys/dev/i2o

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:03:25 UTC 2023

Modified Files:
src/sys/dev/i2o: i2o.h

Log Message:
Remove unused I2O LAN class defs (the LAN driver was deleted years ago).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/i2o/i2o.h

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



CVS commit: src/share/man/man9

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:01:43 UTC 2023

Modified Files:
src/share/man/man9: condvar.9

Log Message:
Permit calling cv_signal()/cv_broadcast() after mutex release.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/condvar.9

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



CVS commit: src/share/man/man9

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 20:01:43 UTC 2023

Modified Files:
src/share/man/man9: condvar.9

Log Message:
Permit calling cv_signal()/cv_broadcast() after mutex release.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/condvar.9

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

Modified files:

Index: src/share/man/man9/condvar.9
diff -u src/share/man/man9/condvar.9:1.30 src/share/man/man9/condvar.9:1.31
--- src/share/man/man9/condvar.9:1.30	Thu Aug 27 14:14:00 2020
+++ src/share/man/man9/condvar.9	Thu Sep  7 20:01:43 2023
@@ -1,6 +1,6 @@
-.\"	$NetBSD: condvar.9,v 1.30 2020/08/27 14:14:00 fcambus Exp $
+.\"	$NetBSD: condvar.9,v 1.31 2023/09/07 20:01:43 ad Exp $
 .\"
-.\" Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2006, 2007, 2008, 2020, 2023 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 2, 2020
+.Dd September 7, 2023
 .Dt CONDVAR 9
 .Os
 .Sh NAME
@@ -265,10 +265,12 @@ LWP may be awoken.
 This can be used to avoid a "thundering herd" problem, where a large
 number of LWPs are awoken following an event, but only one LWP can
 process the event.
+.Pp
 The mutex passed to the wait function
 .Po Fa mtx Pc
-must also be held when calling
-.Fn cv_signal .
+should be held or have been released immediately before
+.Fn cv_signal
+is called.
 .Pp
 (Note that
 .Fn cv_signal
@@ -277,10 +279,14 @@ sense to LWPs waiting on a CV.)
 .It Fn cv_broadcast "cv"
 .Pp
 Awaken all LWPs waiting on the specified condition variable.
-The mutex passed to the wait function
+.Pp
+As with
+.Fn cv_signal ,
+the mutex passed to the wait function
 .Po Fa mtx Pc
-must also be held when calling
-.Fn cv_broadcast .
+should be held or have been released immediately before
+.Fn cv_broadcast
+is called.
 .It Fn cv_has_waiters "cv"
 .Pp
 Return



CVS commit: src/lib/libpthread

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 19:59:20 UTC 2023

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
raise() has understood threads for a long time, don't reimplment it.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/lib/libpthread/pthread.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/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.182 src/lib/libpthread/pthread.c:1.183
--- src/lib/libpthread/pthread.c:1.182	Fri Mar 24 14:18:18 2023
+++ src/lib/libpthread/pthread.c	Thu Sep  7 19:59:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.182 2023/03/24 14:18:18 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.183 2023/09/07 19:59:20 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.182 2023/03/24 14:18:18 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.183 2023/09/07 19:59:20 ad Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -1125,7 +1125,7 @@ pthread__errorfunc(const char *file, int
 		syslog(LOG_DEBUG | LOG_USER, "%s", buf);
 
 	if (pthread__diagassert & DIAGASSERT_ABORT) {
-		(void)_lwp_kill(_lwp_self(), SIGABRT);
+		(void)raise(SIGABRT);
 		_exit(1);
 	}
 }



CVS commit: src/lib/libpthread

2023-09-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Sep  7 19:59:20 UTC 2023

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
raise() has understood threads for a long time, don't reimplment it.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/lib/libpthread/pthread.c

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



CVS commit: src/usr.sbin/sysinst

2023-09-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep  7 16:38:08 UTC 2023

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
sysinst(1): Run `certctl rehash' on fresh installs.

It has come to my attention that sysinst does not, in fact, run
postinstall(8) post-install -- only post-upgrade.

Perhaps we should change this so that postinstall serves the purpose
it says on the box -- make postinstall mandatory for new
installations.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.sbin/sysinst/util.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/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.72 src/usr.sbin/sysinst/util.c:1.73
--- src/usr.sbin/sysinst/util.c:1.72	Sat Jun 24 05:25:04 2023
+++ src/usr.sbin/sysinst/util.c	Thu Sep  7 16:38:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.72 2023/06/24 05:25:04 msaitoh Exp $	*/
+/*	$NetBSD: util.c,v 1.73 2023/09/07 16:38:08 riastradh Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1524,8 +1524,13 @@ get_and_unpack_sets(int update, msg setu
 	}
 
 	/* Configure the system */
-	if (set_status[SET_BASE] & SET_INSTALLED)
+	if (set_status[SET_BASE] & SET_INSTALLED) {
 		run_makedev();
+		if (!update) {
+			run_program(RUN_CHROOT|RUN_DISPLAY,
+			"/usr/sbin/certctl rehash");
+		}
+	}
 
 	if (!update) {
 		struct stat sb1, sb2;



CVS commit: src/usr.sbin/sysinst

2023-09-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep  7 16:38:08 UTC 2023

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
sysinst(1): Run `certctl rehash' on fresh installs.

It has come to my attention that sysinst does not, in fact, run
postinstall(8) post-install -- only post-upgrade.

Perhaps we should change this so that postinstall serves the purpose
it says on the box -- make postinstall mandatory for new
installations.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.sbin/sysinst/util.c

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



CVS commit: src/sys/arch/riscv/riscv

2023-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep  7 12:48:49 UTC 2023

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

Log Message:
Handle CAUSE_LOAD_PAGE_FAULT in trap_pagefault_fixup


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/riscv/riscv/trap.c

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



CVS commit: src/sys/arch/riscv/riscv

2023-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep  7 12:48:49 UTC 2023

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

Log Message:
Handle CAUSE_LOAD_PAGE_FAULT in trap_pagefault_fixup


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/riscv/riscv/trap.c

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

Modified files:

Index: src/sys/arch/riscv/riscv/trap.c
diff -u src/sys/arch/riscv/riscv/trap.c:1.23 src/sys/arch/riscv/riscv/trap.c:1.24
--- src/sys/arch/riscv/riscv/trap.c:1.23	Tue Aug 22 07:11:15 2023
+++ src/sys/arch/riscv/riscv/trap.c	Thu Sep  7 12:48:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.23 2023/08/22 07:11:15 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.24 2023/09/07 12:48:49 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	__PMAP_PRIVATE
 #define	__UFETCHSTORE_PRIVATE
 
-__RCSID("$NetBSD: trap.c,v 1.23 2023/08/22 07:11:15 rin Exp $");
+__RCSID("$NetBSD: trap.c,v 1.24 2023/09/07 12:48:49 skrll Exp $");
 
 #include 
 
@@ -358,6 +358,12 @@ trap_pagefault_fixup(struct trapframe *t
 		npte = opte;
 
 		switch (cause) {
+		case CAUSE_LOAD_PAGE_FAULT:
+			if ((npte & PTE_R) == 0) {
+npte |= PTE_A;
+attr |= VM_PAGEMD_REFERENCED;
+			}
+			break;
 		case CAUSE_STORE_ACCESS:
 			if ((npte & PTE_W) != 0) {
 npte |= PTE_A | PTE_D;
@@ -380,8 +386,8 @@ trap_pagefault_fixup(struct trapframe *t
 #endif
 			break;
 		default:
-			panic("%s: Unhandled cause! 0x%016lx (%s)", __func__,
-			(long)cause, cause_name(cause));
+			panic("%s: Unhandled cause (%#" PRIxREGISTER
+			") for addr %lx", __func__, cause, addr);
 		}
 		if (attr == 0)
 			return false;



CVS commit: src/lib/libpam/modules/pam_ksu

2023-09-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep  7 11:27:57 UTC 2023

Modified Files:
src/lib/libpam/modules/pam_ksu: pam_ksu.c

Log Message:
pam_ksu(8): Allow homedir access during kuserok.

Otherwise, the default kuserok logic to look at ~targetuser/.k5login
would be blocked by the security measure to thwart NetBSD-SA2023-005.

(There are other ways, e.g. setting SYSTEM-K5LOGIN in /etc/krb5.conf
so the file is /etc/k5login.d/user instead of ~user/.k5login, but
that's not the default configuration and there are plenty of
deployments that rely on ~user/.k5login today.)

I reviewed libkrb5 for homedir access checks.  There are three:

1. krb5_config_parse_file_multi, called only by:
   - verify_krb5_conf -- not relevant
   - krb5_config_parse_file -- not used here as far as I can tell,
 only by libhdb ldap logic and test code in heimdal
   - krb5_set_config_files -- used here only via krb5_init_context,
 which is done at this point

2. plugin_get_hosts in krbhst.c, used to look up hosts for KDC I/O,
   which shouldn't be happening at this point, so this is almost
   certainly unreachable; also it only appears to control whether
   some old plugin API can be used, long after we have read the krb5
   config controlling which plugins are available, so this is
   probably harmless

3. krb5_kuserok, which is the one we want to allow

Note: This will have to be updated again in the next Heimdal update,
which eliminates the global homedir access flag in favour of making
the default per-context homedir access flag conditional on !issuid.

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libpam/modules/pam_ksu/pam_ksu.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/libpam/modules/pam_ksu/pam_ksu.c
diff -u src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.10 src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.11
--- src/lib/libpam/modules/pam_ksu/pam_ksu.c:1.10	Tue Jun 20 22:17:09 2023
+++ src/lib/libpam/modules/pam_ksu/pam_ksu.c	Thu Sep  7 11:27:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ksu.c,v 1.10 2023/06/20 22:17:09 riastradh Exp $	*/
+/*	$NetBSD: pam_ksu.c,v 1.11 2023/09/07 11:27:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002 Jacques A. Vidrine 
@@ -29,7 +29,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ksu/pam_ksu.c,v 1.5 2004/02/10 10:13:21 des Exp $");
 #else
-__RCSID("$NetBSD: pam_ksu.c,v 1.10 2023/06/20 22:17:09 riastradh Exp $");
+__RCSID("$NetBSD: pam_ksu.c,v 1.11 2023/09/07 11:27:57 riastradh Exp $");
 #endif
 
 #include 
@@ -92,7 +92,9 @@ pam_sm_authenticate(pam_handle_t *pamh, 
 		goto out;
 	}
 	PAM_LOG("kuserok: %s -> %s", su_principal_name, user);
+	(void)krb5_set_home_dir_access(NULL, TRUE); /* ~user/.k5login */
 	rv = krb5_kuserok(context, su_principal, user);
+	(void)krb5_set_home_dir_access(NULL, FALSE);
 	pamret = rv ? auth_krb5(pamh, context, su_principal_name, su_principal) : PAM_AUTH_ERR;
 	free(su_principal_name);
 	krb5_free_principal(context, su_principal);



CVS commit: src/lib/libpam/modules/pam_ksu

2023-09-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep  7 11:27:57 UTC 2023

Modified Files:
src/lib/libpam/modules/pam_ksu: pam_ksu.c

Log Message:
pam_ksu(8): Allow homedir access during kuserok.

Otherwise, the default kuserok logic to look at ~targetuser/.k5login
would be blocked by the security measure to thwart NetBSD-SA2023-005.

(There are other ways, e.g. setting SYSTEM-K5LOGIN in /etc/krb5.conf
so the file is /etc/k5login.d/user instead of ~user/.k5login, but
that's not the default configuration and there are plenty of
deployments that rely on ~user/.k5login today.)

I reviewed libkrb5 for homedir access checks.  There are three:

1. krb5_config_parse_file_multi, called only by:
   - verify_krb5_conf -- not relevant
   - krb5_config_parse_file -- not used here as far as I can tell,
 only by libhdb ldap logic and test code in heimdal
   - krb5_set_config_files -- used here only via krb5_init_context,
 which is done at this point

2. plugin_get_hosts in krbhst.c, used to look up hosts for KDC I/O,
   which shouldn't be happening at this point, so this is almost
   certainly unreachable; also it only appears to control whether
   some old plugin API can be used, long after we have read the krb5
   config controlling which plugins are available, so this is
   probably harmless

3. krb5_kuserok, which is the one we want to allow

Note: This will have to be updated again in the next Heimdal update,
which eliminates the global homedir access flag in favour of making
the default per-context homedir access flag conditional on !issuid.

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libpam/modules/pam_ksu/pam_ksu.c

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



CVS commit: [netbsd-10] src/doc

2023-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  7 08:22:19 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #353 and #355


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.118 -r1.1.2.119 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/doc

2023-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  7 08:22:19 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #353 and #355


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.118 -r1.1.2.119 src/doc/CHANGES-10.0

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

Modified files:

Index: src/doc/CHANGES-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.118 src/doc/CHANGES-10.0:1.1.2.119
--- src/doc/CHANGES-10.0:1.1.2.118	Wed Sep  6 15:14:20 2023
+++ src/doc/CHANGES-10.0	Thu Sep  7 08:22:19 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.118 2023/09/06 15:14:20 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.119 2023/09/07 08:22:19 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -11793,3 +11793,14 @@ distrib/sets/lists/xdebug/md.i386		1.61 
 	lists: more shlib obsolete fixes
 	[riastradh, ticket #352]
 
+tests/rump/kernspace/workqueue.c		1.10
+
+	workqueue(9) tests: PR 5757: fix mistake in test.
+	[riastradh, ticket #353]
+
+sys/arch/arm/dts/rk3328-nanopi-r2s.dts		1.1
+
+	Enable rkv1crypto on nanopi-r2s.
+	[gutteridge, ticket #355]
+
+



CVS commit: [netbsd-10] src/sys/arch/arm/dts

2023-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  7 08:20:20 UTC 2023

Added Files:
src/sys/arch/arm/dts [netbsd-10]: rk3328-nanopi-r2s.dts

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #355):

sys/arch/arm/dts/rk3328-nanopi-r2s.dts: revision 1.1

Enable rkv1crypto on nanopi-r2s

Follow the example of rock64. Tested by myself.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts

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

Added files:

Index: src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts
diff -u /dev/null src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts:1.1.2.2
--- /dev/null	Thu Sep  7 08:20:20 2023
+++ src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts	Thu Sep  7 08:20:20 2023
@@ -0,0 +1,32 @@
+/* $NetBSD: rk3328-nanopi-r2s.dts,v 1.1.2.2 2023/09/07 08:20:20 martin Exp $ */
+
+/*-
+ * Copyright (c) 2023 David H. Gutteridge
+ * 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.
+ */
+
+/* Include the crypto block in RK3328. */
+
+#include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts"
+#include "rk3328-crypto.dtsi"



CVS commit: [netbsd-10] src/sys/arch/arm/dts

2023-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  7 08:20:20 UTC 2023

Added Files:
src/sys/arch/arm/dts [netbsd-10]: rk3328-nanopi-r2s.dts

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #355):

sys/arch/arm/dts/rk3328-nanopi-r2s.dts: revision 1.1

Enable rkv1crypto on nanopi-r2s

Follow the example of rock64. Tested by myself.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts

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



CVS commit: [netbsd-10] src/tests/rump/kernspace

2023-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  7 08:05:14 UTC 2023

Modified Files:
src/tests/rump/kernspace [netbsd-10]: workqueue.c

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

tests/rump/kernspace/workqueue.c: revision 1.10

workqueue(9) tests: Fix mistake in rev. 1.9.

Somehow, despite manually verifying a build/install/test of every
revision in my patch series, I managed to commit the wrong version of
the file for what became rev. 1.9, so the test was just broken when
it went in and remained broken in the commit where I fixed the real
bug and removed the xfail marker on the test.

PR kern/5757


To generate a diff of this commit:
cvs rdiff -u -r1.6.16.1 -r1.6.16.2 src/tests/rump/kernspace/workqueue.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/rump/kernspace/workqueue.c
diff -u src/tests/rump/kernspace/workqueue.c:1.6.16.1 src/tests/rump/kernspace/workqueue.c:1.6.16.2
--- src/tests/rump/kernspace/workqueue.c:1.6.16.1	Mon Sep  4 16:57:56 2023
+++ src/tests/rump/kernspace/workqueue.c	Thu Sep  7 08:05:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: workqueue.c,v 1.6.16.1 2023/09/04 16:57:56 martin Exp $	*/
+/*	$NetBSD: workqueue.c,v 1.6.16.2 2023/09/07 08:05:13 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: workqueue.c,v 1.6.16.1 2023/09/04 16:57:56 martin Exp $");
+__RCSID("$NetBSD: workqueue.c,v 1.6.16.2 2023/09/07 08:05:13 martin Exp $");
 #endif /* !lint */
 
 #include 
@@ -162,10 +162,11 @@ rumptest_workqueue_wait_pause(void)
 		workqueue_enqueue(sc->wq, >wk, NULL);
 		kpause("tstwk2", /*intr*/false, /*timo*/1, /*lock*/NULL);
 		workqueue_wait(sc->wq, >wk);
-		KASSERT(sc->counter == (i + 1));
+		workqueue_wait(sc->wq, );
+		KASSERT(sc->counter == (i + 2));
 	}
 
-	KASSERT(sc->counter == ITERATIONS);
+	KASSERT(sc->counter == 2*ITERATIONS);
 
 	/* Wait for a work that is not enqueued. Just return immediately. */
 	workqueue_wait(sc->wq, );



CVS commit: [netbsd-10] src/tests/rump/kernspace

2023-09-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  7 08:05:14 UTC 2023

Modified Files:
src/tests/rump/kernspace [netbsd-10]: workqueue.c

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

tests/rump/kernspace/workqueue.c: revision 1.10

workqueue(9) tests: Fix mistake in rev. 1.9.

Somehow, despite manually verifying a build/install/test of every
revision in my patch series, I managed to commit the wrong version of
the file for what became rev. 1.9, so the test was just broken when
it went in and remained broken in the commit where I fixed the real
bug and removed the xfail marker on the test.

PR kern/5757


To generate a diff of this commit:
cvs rdiff -u -r1.6.16.1 -r1.6.16.2 src/tests/rump/kernspace/workqueue.c

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



CVS commit: src/libexec/httpd

2023-09-07 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Thu Sep  7 06:40:56 UTC 2023

Modified Files:
src/libexec/httpd: bozohttpd.c

Log Message:
Fix memory leaks in bozo_cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/libexec/httpd/bozohttpd.c

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

Modified files:

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.143 src/libexec/httpd/bozohttpd.c:1.144
--- src/libexec/httpd/bozohttpd.c:1.143	Wed Jun  7 20:12:31 2023
+++ src/libexec/httpd/bozohttpd.c	Thu Sep  7 06:40:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.143 2023/06/07 20:12:31 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.144 2023/09/07 06:40:56 shm Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -2728,6 +2728,11 @@ bozo_cleanup(bozohttpd_t *httpd, bozopre
 	free(httpd->errorbuf);
 	free(httpd->getln_buffer);
 	free(httpd->slashdir);
+	free(httpd->bindport);
+	free(httpd->pidfile);
+	free(httpd->cgibin);
+	free(httpd->virtbase);
+	free(httpd->dynamic_content_map);
 #define bozo_unconst(x) ((void *)(uintptr_t)x)
 	free(bozo_unconst(httpd->server_software));
 	free(bozo_unconst(httpd->index_html));



CVS commit: src/libexec/httpd

2023-09-07 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Thu Sep  7 06:40:56 UTC 2023

Modified Files:
src/libexec/httpd: bozohttpd.c

Log Message:
Fix memory leaks in bozo_cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/libexec/httpd/bozohttpd.c

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



CVS commit: src/tests/usr.bin/xlint/xlint

2023-09-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep  7 06:24:31 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/xlint: t_xlint.sh

Log Message:
tests/lint: allow lint libraries to be installed


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/xlint/t_xlint.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/usr.bin/xlint/xlint/t_xlint.sh
diff -u src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.3 src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.4
--- src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.3	Fri Jul  7 19:45:22 2023
+++ src/tests/usr.bin/xlint/xlint/t_xlint.sh	Thu Sep  7 06:24:31 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_xlint.sh,v 1.3 2023/07/07 19:45:22 rillig Exp $
+# $NetBSD: t_xlint.sh,v 1.4 2023/09/07 06:24:31 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -105,9 +105,12 @@ run_lint2_body()
 
 	# Most of the command line options are not relevant for lint2,
 	# so they are effectively ignored.  The option '-i' is absent.
+	#
+	# Depending on whether the lint libraries are installed or not, there
+	# may be a warning 'cannot find llib-lc.ln' on stderr.
 	atf_check \
 	-o 'inline:function defined( input.c(4) ), but never used\n' \
-	-e 'inline:lint: cannot find llib-lc.ln\n' \
+	-e 'ignore' \
 	"$lint" -aabceghprSTxz input.ln
 }
 



CVS commit: src/tests/usr.bin/xlint/xlint

2023-09-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep  7 06:24:31 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/xlint: t_xlint.sh

Log Message:
tests/lint: allow lint libraries to be installed


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/xlint/t_xlint.sh

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



CVS commit: src/tests/usr.bin/xlint/lint1

2023-09-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep  7 06:17:35 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_196.c

Log Message:
tests/lint: test case labels with out-of-bounds values


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_196.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/usr.bin/xlint/lint1/msg_196.c
diff -u src/tests/usr.bin/xlint/lint1/msg_196.c:1.3 src/tests/usr.bin/xlint/lint1/msg_196.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_196.c:1.3	Thu Jun 16 16:58:36 2022
+++ src/tests/usr.bin/xlint/lint1/msg_196.c	Thu Sep  7 06:17:35 2023
@@ -1,8 +1,20 @@
-/*	$NetBSD: msg_196.c,v 1.3 2022/06/16 16:58:36 rillig Exp $	*/
+/*	$NetBSD: msg_196.c,v 1.4 2023/09/07 06:17:35 rillig Exp $	*/
 # 3 "msg_196.c"
 
 // Test for message: case label affected by conversion [196]
 
-/* expect+1: error: syntax error ':' [249] */
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -X 351 */
+
+void
+switch_int_unsigned(int x)
+{
+	switch (x) {
+		/* expect+1: warning: case label affected by conversion [196] */
+	case (unsigned int)-1:
+		/* expect+1: warning: case label affected by conversion [196] */
+	case -2U:
+		/* expect+1: warning: case label affected by conversion [196] */
+	case 0x1000200030004000ULL:
+		return;
+	}
+}



CVS commit: src/tests/usr.bin/xlint/lint1

2023-09-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep  7 06:17:35 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_196.c

Log Message:
tests/lint: test case labels with out-of-bounds values


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_196.c

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