CVS commit: src/sys/arch

2024-04-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 21 14:11:12 UTC 2024

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
apei(4), acpihed(4): Enable in x86 GENERIC.

Let's just see how this works out in practice.  Might need to reduce
the overhead of each GHES on machines with thousands of them, but
we'll see.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.610 -r1.611 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1254 -r1.1255 src/sys/arch/i386/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.610 src/sys/arch/amd64/conf/GENERIC:1.611
--- src/sys/arch/amd64/conf/GENERIC:1.610	Tue Apr  2 22:56:50 2024
+++ src/sys/arch/amd64/conf/GENERIC	Sun Apr 21 14:11:12 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.610 2024/04/02 22:56:50 charlotte Exp $
+# $NetBSD: GENERIC,v 1.611 2024/04/21 14:11:12 riastradh Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.610 $"
+#ident		"GENERIC-$Revision: 1.611 $"
 
 maxusers	64		# estimated number of users
 
@@ -333,6 +333,7 @@ acpidalb*	at acpi?		# ACPI Direct Applic
 acpiec* 	at acpi?		# ACPI Embedded Controller (late)
 acpiecdt*	at acpi?		# ACPI Embedded Controller (early)
 acpifan*	at acpi?		# ACPI Fan
+acpihed*	at acpi?		# ACPI Hardware Error Device
 acpilid*	at acpi?		# ACPI Lid Switch
 #acpipmtr*	at acpi?		# ACPI Power Meter (experimental)
 #acpismbus*	at acpi?		# ACPI SMBus CMI (experimental)
@@ -341,6 +342,7 @@ acpivga*	at acpi?		# ACPI Display Adapte
 acpiout*	at acpivga?		# ACPI Display Output Device
 acpiwdrt*	at acpi?		# ACPI Watchdog Resource Table
 acpiwmi*	at acpi?		# ACPI WMI Mapper
+apei*		at apeibus?		# ACPI Platform Error Interfaces
 
 # Mainboard devices
 aibs*		at acpi?		# ASUSTeK AI Booster hardware monitor

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1254 src/sys/arch/i386/conf/GENERIC:1.1255
--- src/sys/arch/i386/conf/GENERIC:1.1254	Tue Apr  2 22:56:50 2024
+++ src/sys/arch/i386/conf/GENERIC	Sun Apr 21 14:11:12 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1254 2024/04/02 22:56:50 charlotte Exp $
+# $NetBSD: GENERIC,v 1.1255 2024/04/21 14:11:12 riastradh Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1254 $"
+#ident		"GENERIC-$Revision: 1.1255 $"
 
 maxusers	64		# estimated number of users
 
@@ -317,6 +317,7 @@ acpidalb*	at acpi?		# ACPI Direct Applic
 acpiec* 	at acpi?		# ACPI Embedded Controller (late)
 acpiecdt*	at acpi?		# ACPI Embedded Controller (early)
 acpifan*	at acpi?		# ACPI Fan
+acpihed*	at acpi?		# ACPI Hardware Error Device
 acpilid*	at acpi?		# ACPI Lid Switch
 #acpipmtr*	at acpi?		# ACPI Power Meter (experimental)
 #acpismbus*	at acpi?		# ACPI SMBus CMI (experimental)
@@ -325,6 +326,7 @@ acpivga*	at acpi?		# ACPI Display Adapte
 acpiout*	at acpivga?		# ACPI Display Output Device
 acpiwdrt*	at acpi?		# ACPI Watchdog Resource Table
 acpiwmi*	at acpi?		# ACPI WMI Mapper
+apei*		at apeibus?		# ACPI Platform Error Interfaces
 
 # Mainboard devices
 aibs*		at acpi?		# ASUSTeK AI Booster hardware monitor



CVS commit: src/sys/arch

2024-04-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 21 14:11:12 UTC 2024

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
apei(4), acpihed(4): Enable in x86 GENERIC.

Let's just see how this works out in practice.  Might need to reduce
the overhead of each GHES on machines with thousands of them, but
we'll see.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.610 -r1.611 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1254 -r1.1255 src/sys/arch/i386/conf/GENERIC

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



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

2024-04-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 21 03:02:51 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_ioctl.c

Log Message:
drm: Allow DRM_IOCTL_GET_UNIQUE on render nodes.

On NetBSD, libdrm uses this to discover what kind of bus the device
is on, without which it refuses to expose the render node at all,
rendering it useless.  With this change, libdrm is able to use render
nodes on NetBSD.

Since this is just reading out information about the bus type and
bus/dev/func numbers, I don't think it's problematic to expose to
render nodes.

This requires tweaking the access path to the master.

PR kern/58180


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c:1.24 src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c:1.25
--- src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c:1.24	Sat Oct 15 15:19:28 2022
+++ src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c	Sun Apr 21 03:02:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_ioctl.c,v 1.24 2022/10/15 15:19:28 riastradh Exp $	*/
+/*	$NetBSD: drm_ioctl.c,v 1.25 2024/04/21 03:02:51 riastradh Exp $	*/
 
 /*
  * Created: Fri Jan  8 09:01:26 1999 by fa...@valinux.com
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_ioctl.c,v 1.24 2022/10/15 15:19:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_ioctl.c,v 1.25 2024/04/21 03:02:51 riastradh Exp $");
 
 #include 
 #include 
@@ -129,19 +129,35 @@ int drm_getunique(struct drm_device *dev
 		  struct drm_file *file_priv)
 {
 	struct drm_unique *u = data;
-	struct drm_master *master = file_priv->master;
+	struct drm_master *master;
+	int ret;
 
-	mutex_lock(>dev->master_mutex);
-	if (u->unique_len >= master->unique_len) {
-		if (copy_to_user(u->unique, master->unique, master->unique_len)) {
-			mutex_unlock(>dev->master_mutex);
-			return -EFAULT;
-		}
+	mutex_lock(>master_mutex);
+	master = dev->master;
+	if (master == NULL) {
+		ret = -ENXIO;
+		goto out;
+	}
+
+	/*
+	 * Copy out only if the user allocated enough space.  Either
+	 * way, on success, report the actual size -- so the user can
+	 * allocate enough space if they didn't before, or so they know
+	 * exactly how much we copied out.
+	 */
+	if (u->unique_len < master->unique_len) {
+		ret = 0;
+	} else {
+		ret = copy_to_user(u->unique, master->unique,
+		master->unique_len);
+		if (ret)
+			goto out;
 	}
 	u->unique_len = master->unique_len;
-	mutex_unlock(>dev->master_mutex);
 
-	return 0;
+out:	mutex_unlock(>master_mutex);
+
+	return ret;
 }
 
 static void
@@ -597,7 +613,7 @@ EXPORT_SYMBOL(drm_ioctl_permit);
 /* Ioctl table */
 static const struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0),
+	DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY),
 



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

2024-04-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 21 03:02:51 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_ioctl.c

Log Message:
drm: Allow DRM_IOCTL_GET_UNIQUE on render nodes.

On NetBSD, libdrm uses this to discover what kind of bus the device
is on, without which it refuses to expose the render node at all,
rendering it useless.  With this change, libdrm is able to use render
nodes on NetBSD.

Since this is just reading out information about the bus type and
bus/dev/func numbers, I don't think it's problematic to expose to
render nodes.

This requires tweaking the access path to the master.

PR kern/58180


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c

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



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

2024-04-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 21 03:02:39 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/drm: drm_cdevsw.c

Log Message:
drm(4): Fix st_rdev in stat.

dminor->index already has the 64*type adjustment, as allocated in
drm_minor_alloc.

PR kern/58180


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/drm/drm_cdevsw.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/external/bsd/drm2/drm/drm_cdevsw.c
diff -u src/sys/external/bsd/drm2/drm/drm_cdevsw.c:1.30 src/sys/external/bsd/drm2/drm/drm_cdevsw.c:1.31
--- src/sys/external/bsd/drm2/drm/drm_cdevsw.c:1.30	Wed Jul  6 01:12:45 2022
+++ src/sys/external/bsd/drm2/drm/drm_cdevsw.c	Sun Apr 21 03:02:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_cdevsw.c,v 1.30 2022/07/06 01:12:45 riastradh Exp $	*/
+/*	$NetBSD: drm_cdevsw.c,v 1.31 2024/04/21 03:02:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_cdevsw.c,v 1.30 2022/07/06 01:12:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_cdevsw.c,v 1.31 2024/04/21 03:02:39 riastradh Exp $");
 
 #include 
 #include 
@@ -496,7 +496,7 @@ drm_stat(struct file *fp, struct stat *s
 	struct drm_file *const file = fp->f_data;
 	struct drm_minor *const dminor = file->minor;
 	const dev_t devno = makedev(cdevsw_lookup_major(_cdevsw),
-	64*dminor->type + dminor->index);
+	dminor->index);
 
 	(void)memset(st, 0, sizeof(*st));
 



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

2024-04-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 21 03:02:39 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/drm: drm_cdevsw.c

Log Message:
drm(4): Fix st_rdev in stat.

dminor->index already has the 64*type adjustment, as allocated in
drm_minor_alloc.

PR kern/58180


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/drm/drm_cdevsw.c

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



CVS commit: src/sys/netinet6

2024-04-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr 19 00:55:35 UTC 2024

Modified Files:
src/sys/netinet6: ip6_output.c

Log Message:
ip6_output: Initialize plen for ip6_hopopts_input.

This funny little block in ip6_process_hopopts assumes it is
initialized as and behaves differently depending on whether it's zero
or not:

https://nxr.netbsd.org/xref/src/sys/netinet6/ip6_input.c?r=1.227#976

In the other call site, it is initialized to ip6->ip6_plen:

https://nxr.netbsd.org/xref/src/sys/netinet6/ip6_input.c?r=1.227#561

Reported-by: syzbot+587e3b707bdfe5332...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?extid=587e3b707bdfe533283f


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/netinet6/ip6_output.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/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.234 src/sys/netinet6/ip6_output.c:1.235
--- src/sys/netinet6/ip6_output.c:1.234	Thu Aug  3 05:45:36 2023
+++ src/sys/netinet6/ip6_output.c	Fri Apr 19 00:55:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.234 2023/08/03 05:45:36 ozaki-r Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.235 2024/04/19 00:55:35 riastradh Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.234 2023/08/03 05:45:36 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.235 2024/04/19 00:55:35 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -754,7 +754,7 @@ ip6_output(
 	 * XXX Is this really necessary?
 	 */
 	if (ip6->ip6_nxt == IPPROTO_HOPOPTS) {
-		u_int32_t dummy1; /* XXX unused */
+		u_int32_t dummy1 = 0; /* XXX unused */
 		u_int32_t dummy2; /* XXX unused */
 		int hoff = sizeof(struct ip6_hdr);
 



CVS commit: src/sys/netinet6

2024-04-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr 19 00:55:35 UTC 2024

Modified Files:
src/sys/netinet6: ip6_output.c

Log Message:
ip6_output: Initialize plen for ip6_hopopts_input.

This funny little block in ip6_process_hopopts assumes it is
initialized as and behaves differently depending on whether it's zero
or not:

https://nxr.netbsd.org/xref/src/sys/netinet6/ip6_input.c?r=1.227#976

In the other call site, it is initialized to ip6->ip6_plen:

https://nxr.netbsd.org/xref/src/sys/netinet6/ip6_input.c?r=1.227#561

Reported-by: syzbot+587e3b707bdfe5332...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?extid=587e3b707bdfe533283f


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/netinet6/ip6_output.c

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



CVS commit: src/sys/kern

2024-04-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr 19 00:45:41 UTC 2024

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

Log Message:
dounmount: Avoid &((struct vnode_impl *)NULL)->vi_vnode.

Member access of a null pointer is undefined, even if the result
should also be null because vi_vnode is at the start of vnode_impl.

Reported-by: syzbot+a4b2d13c0d6d4dac2...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?extid=a4b2d13c0d6d4dac2d07


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/kern/vfs_mount.c

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

Modified files:

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.104 src/sys/kern/vfs_mount.c:1.105
--- src/sys/kern/vfs_mount.c:1.104	Wed Jan 17 10:17:29 2024
+++ src/sys/kern/vfs_mount.c	Fri Apr 19 00:45:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.104 2024/01/17 10:17:29 hannken Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.105 2024/04/19 00:45:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.104 2024/01/17 10:17:29 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.105 2024/04/19 00:45:41 riastradh Exp $");
 
 #include "veriexec.h"
 
@@ -936,7 +936,8 @@ err_mounted:
 int
 dounmount(struct mount *mp, int flags, struct lwp *l)
 {
-	vnode_t *coveredvp, *vp;
+	struct vnode *coveredvp, *vp;
+	struct vnode_impl *vip;
 	int error, async, used_syncer, used_extattr;
 	const bool was_suspended = fstrans_is_owner(mp);
 
@@ -1003,7 +1004,9 @@ dounmount(struct mount *mp, int flags, s
 		vfs_resume(mp);
 
 	mountlist_remove(mp);
-	if ((vp = VIMPL_TO_VNODE(TAILQ_FIRST(>mnt_vnodelist))) != NULL) {
+
+	if ((vip = TAILQ_FIRST(>mnt_vnodelist)) != NULL) {
+		vp = VIMPL_TO_VNODE(vip);
 		vprint("dangling", vp);
 		panic("unmount: dangling vnode");
 	}



CVS commit: src/sys/kern

2024-04-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr 19 00:45:41 UTC 2024

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

Log Message:
dounmount: Avoid &((struct vnode_impl *)NULL)->vi_vnode.

Member access of a null pointer is undefined, even if the result
should also be null because vi_vnode is at the start of vnode_impl.

Reported-by: syzbot+a4b2d13c0d6d4dac2...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?extid=a4b2d13c0d6d4dac2d07


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/kern/vfs_mount.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon

2024-04-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 18 23:33:15 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_acpi.c

Log Message:
radeon_acpi.c: ifdef out unused function on NetBSD.

Should fix syzkaller build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.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/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c:1.5 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c:1.5	Tue Apr 16 14:34:02 2024
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c	Thu Apr 18 23:33:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_acpi.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $	*/
+/*	$NetBSD: radeon_acpi.c,v 1.6 2024/04/18 23:33:15 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_acpi.c,v 1.5 2024/04/16 14:34:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_acpi.c,v 1.6 2024/04/18 23:33:15 riastradh Exp $");
 
 #include 
 #include 
@@ -50,11 +50,13 @@ ACPI_MODULE_NAME("radeon_acpi")
 #include 
 #endif
 
+#ifndef __NetBSD__		/* XXX radeon acpi */
 #if defined(CONFIG_VGA_SWITCHEROO)
 bool radeon_atpx_dgpu_req_power_for_displays(void);
 #else
 static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; }
 #endif
+#endif
 
 #define ACPI_AC_CLASS   "ac_adapter"
 



CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon

2024-04-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 18 23:33:15 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_acpi.c

Log Message:
radeon_acpi.c: ifdef out unused function on NetBSD.

Should fix syzkaller build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c

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



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:52:54 UTC 2024

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

Log Message:
tap(4): Just use mutex_enter.

PR kern/58167


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/net/if_tap.c

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

Modified files:

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.131 src/sys/net/if_tap.c:1.132
--- src/sys/net/if_tap.c:1.131	Wed Apr 17 18:52:39 2024
+++ src/sys/net/if_tap.c	Wed Apr 17 18:52:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.131 2024/04/17 18:52:39 riastradh Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.132 2024/04/17 18:52:54 riastradh Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.131 2024/04/17 18:52:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.132 2024/04/17 18:52:54 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -857,13 +857,7 @@ tap_dev_read(int unit, struct uio *uio, 
 	if ((ifp->if_flags & IFF_UP) == 0)
 		return EHOSTDOWN;
 
-	/* In the TAP_NBIO case, we have to make sure we won't be sleeping */
-	if ((sc->sc_flags & TAP_NBIO) != 0) {
-		if (!mutex_tryenter(>sc_lock))
-			return EWOULDBLOCK;
-	} else
-		mutex_enter(>sc_lock);
-
+	mutex_enter(>sc_lock);
 	if (IFQ_IS_EMPTY(>if_snd)) {
 		ifp->if_flags &= ~IFF_OACTIVE;
 		if (sc->sc_flags & TAP_NBIO)



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:52:54 UTC 2024

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

Log Message:
tap(4): Just use mutex_enter.

PR kern/58167


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/net/if_tap.c

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



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:52:39 UTC 2024

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

Log Message:
tap(4): Use DETACH_FORCE with config_detach.

It doesn't make a difference here, because tap_detach never fails,
but let's make it more obvious at the call site that failure is
forbidden here.

No functional change intended.

PR kern/58166


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_tap.c

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

Modified files:

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.130 src/sys/net/if_tap.c:1.131
--- src/sys/net/if_tap.c:1.130	Wed Apr 17 18:52:25 2024
+++ src/sys/net/if_tap.c	Wed Apr 17 18:52:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.130 2024/04/17 18:52:25 riastradh Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.131 2024/04/17 18:52:39 riastradh Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.130 2024/04/17 18:52:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.131 2024/04/17 18:52:39 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -641,7 +641,7 @@ tap_clone_destroyer(device_t dev)
 	cfdata_t cf = device_cfdata(dev);
 	int error;
 
-	error = config_detach(dev, 0);
+	error = config_detach(dev, DETACH_FORCE);
 	KASSERTMSG(error == 0, "error=%d", error);
 	kmem_free(cf, sizeof(*cf));
 }



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:52:39 UTC 2024

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

Log Message:
tap(4): Use DETACH_FORCE with config_detach.

It doesn't make a difference here, because tap_detach never fails,
but let's make it more obvious at the call site that failure is
forbidden here.

No functional change intended.

PR kern/58166


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_tap.c

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



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:52:25 UTC 2024

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

Log Message:
tap(4): Prune dead branches around tap_dev_destroyer.

No functional change intended.

PR kern/58166


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/net/if_tap.c

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



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:52:25 UTC 2024

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

Log Message:
tap(4): Prune dead branches around tap_dev_destroyer.

No functional change intended.

PR kern/58166


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/net/if_tap.c

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

Modified files:

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.129 src/sys/net/if_tap.c:1.130
--- src/sys/net/if_tap.c:1.129	Wed Apr 17 18:32:13 2024
+++ src/sys/net/if_tap.c	Wed Apr 17 18:52:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.129 2024/04/17 18:32:13 riastradh Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.130 2024/04/17 18:52:25 riastradh Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.129 2024/04/17 18:32:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.130 2024/04/17 18:52:25 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -210,7 +210,7 @@ struct if_clone tap_cloners = IF_CLONE_I
 
 /* Helper functions shared by the two cloning code paths */
 static struct tap_softc *	tap_clone_creator(int);
-int	tap_clone_destroyer(device_t);
+static void			tap_clone_destroyer(device_t);
 
 static struct sysctllog *tap_sysctl_clog;
 
@@ -625,33 +625,25 @@ tap_clone_creator(int unit)
 	return device_private(config_attach_pseudo(cf));
 }
 
-/*
- * The clean design of if_clone and autoconf(9) makes that part
- * really straightforward.  The second argument of config_detach
- * means neither QUIET nor FORCED.
- */
 static int
 tap_clone_destroy(struct ifnet *ifp)
 {
 	struct tap_softc *sc = ifp->if_softc;
-	int error = tap_clone_destroyer(sc->sc_dev);
 
-	if (error == 0)
-		atomic_dec_uint(_count);
-	return error;
+	tap_clone_destroyer(sc->sc_dev);
+	atomic_dec_uint(_count);
+	return 0;
 }
 
-int
+static void
 tap_clone_destroyer(device_t dev)
 {
 	cfdata_t cf = device_cfdata(dev);
 	int error;
 
-	if ((error = config_detach(dev, 0)) != 0)
-		aprint_error_dev(dev, "unable to detach instance\n");
+	error = config_detach(dev, 0);
+	KASSERTMSG(error == 0, "error=%d", error);
 	kmem_free(cf, sizeof(*cf));
-
-	return error;
 }
 
 /*
@@ -774,7 +766,6 @@ tap_fops_close(file_t *fp)
 {
 	struct tap_softc *sc;
 	int unit = fp->f_devunit;
-	int error;
 
 	sc = device_lookup_private(_cd, unit);
 	if (sc == NULL)
@@ -783,16 +774,16 @@ tap_fops_close(file_t *fp)
 	KERNEL_LOCK(1, NULL);
 	tap_dev_close(sc);
 
-	/* Destroy the device now that it is no longer useful,
-	 * unless it's already being destroyed. */
-	if ((sc->sc_flags & TAP_GOING) != 0) {
-		KERNEL_UNLOCK_ONE(NULL);
-		return 0;
-	}
+	/*
+	 * Destroy the device now that it is no longer useful, unless
+	 * it's already being destroyed.
+	 */
+	if ((sc->sc_flags & TAP_GOING) != 0)
+		goto out;
+	tap_clone_destroyer(sc->sc_dev);
 
-	error = tap_clone_destroyer(sc->sc_dev);
-	KERNEL_UNLOCK_ONE(NULL);
-	return error;
+out:	KERNEL_UNLOCK_ONE(NULL);
+	return 0;
 }
 
 static void



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:32:13 UTC 2024

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

Log Message:
tap(4): Prune dead branches around tap_dev_close.

No functional change intended.

PR kern/58166


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/net/if_tap.c

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

Modified files:

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.128 src/sys/net/if_tap.c:1.129
--- src/sys/net/if_tap.c:1.128	Fri Jan  6 01:54:22 2023
+++ src/sys/net/if_tap.c	Wed Apr 17 18:32:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.128 2023/01/06 01:54:22 ozaki-r Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.129 2024/04/17 18:32:13 riastradh Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.128 2023/01/06 01:54:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.129 2024/04/17 18:32:13 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -117,7 +117,7 @@ CFATTACH_DECL_NEW(tap, sizeof(struct tap
 extern struct cfdriver tap_cd;
 
 /* Real device access routines */
-static int	tap_dev_close(struct tap_softc *);
+static void	tap_dev_close(struct tap_softc *);
 static int	tap_dev_read(int, struct uio *, int);
 static int	tap_dev_write(int, struct uio *, int);
 static int	tap_dev_ioctl(int, u_long, void *, struct lwp *);
@@ -759,7 +759,8 @@ tap_cdev_close(dev_t dev, int flags, int
 	if (sc == NULL)
 		return ENXIO;
 
-	return tap_dev_close(sc);
+	tap_dev_close(sc);
+	return 0;
 }
 
 /*
@@ -779,13 +780,8 @@ tap_fops_close(file_t *fp)
 	if (sc == NULL)
 		return ENXIO;
 
-	/* tap_dev_close currently always succeeds, but it might not
-	 * always be the case. */
 	KERNEL_LOCK(1, NULL);
-	if ((error = tap_dev_close(sc)) != 0) {
-		KERNEL_UNLOCK_ONE(NULL);
-		return error;
-	}
+	tap_dev_close(sc);
 
 	/* Destroy the device now that it is no longer useful,
 	 * unless it's already being destroyed. */
@@ -799,7 +795,7 @@ tap_fops_close(file_t *fp)
 	return error;
 }
 
-static int
+static void
 tap_dev_close(struct tap_softc *sc)
 {
 	struct ifnet *ifp;
@@ -832,8 +828,6 @@ tap_dev_close(struct tap_softc *sc)
 	}
 	sc->sc_flags &= ~(TAP_INUSE | TAP_ASYNCIO);
 	if_link_state_change(ifp, LINK_STATE_DOWN);
-
-	return 0;
 }
 
 static int



CVS commit: src/sys/net

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:32:13 UTC 2024

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

Log Message:
tap(4): Prune dead branches around tap_dev_close.

No functional change intended.

PR kern/58166


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/net/if_tap.c

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



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

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:10:27 UTC 2024

Modified Files:
src/sys/modules/examples/fopsmapper: cmd_mapper.c fopsmapper.c

Log Message:
modules/examples/fopsmapper: KNF, sprinkle comments

Missing: MP-safety; this is a kind of broken example.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/examples/fopsmapper/cmd_mapper.c \
src/sys/modules/examples/fopsmapper/fopsmapper.c

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

Modified files:

Index: src/sys/modules/examples/fopsmapper/cmd_mapper.c
diff -u src/sys/modules/examples/fopsmapper/cmd_mapper.c:1.2 src/sys/modules/examples/fopsmapper/cmd_mapper.c:1.3
--- src/sys/modules/examples/fopsmapper/cmd_mapper.c:1.2	Wed Apr  1 13:07:32 2020
+++ src/sys/modules/examples/fopsmapper/cmd_mapper.c	Wed Apr 17 18:10:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmd_mapper.c,v 1.2 2020/04/01 13:07:32 kamil Exp $	*/
+/*	$NetBSD: cmd_mapper.c,v 1.3 2024/04/17 18:10:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: cmd_mapper.c,v 1.2 2020/04/01 13:07:32 kamil Exp $");
+__RCSID("$NetBSD: cmd_mapper.c,v 1.3 2024/04/17 18:10:27 riastradh Exp $");
 
 #include 
 
@@ -37,7 +37,7 @@ __RCSID("$NetBSD: cmd_mapper.c,v 1.2 202
 #include 
 #include 
 
-#define _PATH_DEV_MAPPER "/dev/fopsmapper"
+#define	_PATH_DEV_MAPPER	"/dev/fopsmapper"
 
 int main(int argc, char **argv)
 {
@@ -47,12 +47,11 @@ int main(int argc, char **argv)
 	if ((devfd = open(_PATH_DEV_MAPPER, O_RDONLY)) == -1)
 		err(EXIT_FAILURE, "Cannot open %s", _PATH_DEV_MAPPER);
 
-	map = (char *)(mmap(0, sysconf(_SC_PAGESIZE), PROT_READ, MAP_SHARED,
-devfd, 0));
+	map = mmap(0, sysconf(_SC_PAGESIZE), PROT_READ, MAP_SHARED, devfd, 0);
 	if (map == MAP_FAILED)
 		err(EXIT_FAILURE, "Mapping failed");
 
-	printf("Message from device: %s\n",map);
+	printf("Message from device: %s\n", map);
 
 	if (munmap(map, sysconf(_SC_PAGESIZE)) == -1)
 		err(EXIT_FAILURE, "Unmap failed");
Index: src/sys/modules/examples/fopsmapper/fopsmapper.c
diff -u src/sys/modules/examples/fopsmapper/fopsmapper.c:1.2 src/sys/modules/examples/fopsmapper/fopsmapper.c:1.3
--- src/sys/modules/examples/fopsmapper/fopsmapper.c:1.2	Wed Apr  1 11:45:53 2020
+++ src/sys/modules/examples/fopsmapper/fopsmapper.c	Wed Apr 17 18:10:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fopsmapper.c,v 1.2 2020/04/01 11:45:53 kamil Exp $	*/
+/*	$NetBSD: fopsmapper.c,v 1.3 2024/04/17 18:10:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,29 +27,30 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fopsmapper.c,v 1.2 2020/04/01 11:45:53 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fopsmapper.c,v 1.3 2024/04/17 18:10:27 riastradh Exp $");
 
-#include 
-#include 
-#include 
-#include 
+#include 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
+
 #include 
 
 /*
  * To use this module you need to:
  *
  * mknod /dev/fopsmapper c 351 0
- *
  */
 
-dev_type_open(fopsmapper_open);
+dev_open_t fopsmapper_open;
 
 const struct cdevsw fopsmapper_cdevsw = {
 	.d_open = fopsmapper_open,
@@ -66,9 +67,9 @@ const struct cdevsw fopsmapper_cdevsw = 
 	.d_flag = D_OTHER
 };
 
-static int fopsmapper_mmap(file_t *, off_t *, size_t,
-	   	int, int *, int *,struct uvm_object **, int *);
-static int fopsmapper_close(file_t *);
+static int fopsmapper_mmap(struct file *, off_t *, size_t, int, int *, int *,
+struct uvm_object **, int *);
+static int fopsmapper_close(struct file *);
 
 const struct fileops mapper_fileops = {
 	.fo_read = fbadop_read,
@@ -83,16 +84,16 @@ const struct fileops mapper_fileops = {
 	.fo_mmap = fopsmapper_mmap,
 };
 
-typedef struct fopsmapper_softc {
+struct fopsmapper_softc {
 	char *buf;
 	struct uvm_object *uobj;
 	size_t bufsize;
-} fops_t;
+};
 
 int
 fopsmapper_open(dev_t dev, int flag, int mode, struct lwp *l)
 {
-	fops_t *fo;
+	struct fopsmapper_softc *fo;
 	struct file *fp;
 	int fd, error;
 
@@ -105,11 +106,11 @@ fopsmapper_open(dev_t dev, int flag, int
 }
 
 int
-fopsmapper_mmap(file_t * fp, off_t * offp, size_t size, int prot,
-		int *flagsp, int *advicep, struct uvm_object **uobjp,
-		int *maxprotp)
+fopsmapper_mmap(struct file *fp, off_t *offp, size_t size, int prot,
+int *flagsp, int *advicep, struct uvm_object **uobjp, int *maxprotp)
 {
-	fops_t *fo;
+	struct fopsmapper_softc *fo;
+	vaddr_t va;
 	int error;
 
 	if (prot & PROT_EXEC)
@@ -125,32 +126,35 @@ fopsmapper_mmap(file_t * fp, off_t * off
 	fo->uobj = uao_create(size, 0);
 
 	fo->buf = NULL;
-	/* Map the uvm object into kernel */
-	error =	uvm_map(kernel_map, (vaddr_t *) >buf, fo->bufsize,
-	fo->uobj, 0, 0,
-	UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW,
-	UVM_INH_SHARE,UVM_ADV_RANDOM, 0));
 
+	/*
+	 * Map the uvm object into 

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

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:10:27 UTC 2024

Modified Files:
src/sys/modules/examples/fopsmapper: cmd_mapper.c fopsmapper.c

Log Message:
modules/examples/fopsmapper: KNF, sprinkle comments

Missing: MP-safety; this is a kind of broken example.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/examples/fopsmapper/cmd_mapper.c \
src/sys/modules/examples/fopsmapper/fopsmapper.c

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



CVS commit: src/sys/sys

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:01:29 UTC 2024

Modified Files:
src/sys/sys: conf.h

Log Message:
sys/conf.h: Need sys/types.h for dev_t, devmajor_t.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/sys/conf.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/sys/conf.h
diff -u src/sys/sys/conf.h:1.161 src/sys/sys/conf.h:1.162
--- src/sys/sys/conf.h:1.161	Mon Mar 28 12:39:18 2022
+++ src/sys/sys/conf.h	Wed Apr 17 18:01:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.161 2022/03/28 12:39:18 riastradh Exp $	*/
+/*	$NetBSD: conf.h,v 1.162 2024/04/17 18:01:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -43,8 +43,9 @@
  * Definitions of device driver entry switches
  */
 
-#include 
 #include 
+#include 
+#include 
 
 struct buf;
 struct knote;
@@ -109,7 +110,7 @@ struct cdevsw {
 extern kmutex_t device_lock;
 
 int devsw_attach(const char *, const struct bdevsw *, devmajor_t *,
-		 const struct cdevsw *, devmajor_t *);
+const struct cdevsw *, devmajor_t *);
 void devsw_detach(const struct bdevsw *, const struct cdevsw *);
 const struct bdevsw *bdevsw_lookup(dev_t);
 const struct cdevsw *cdevsw_lookup(dev_t);



CVS commit: src/sys/sys

2024-04-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 17 18:01:29 UTC 2024

Modified Files:
src/sys/sys: conf.h

Log Message:
sys/conf.h: Need sys/types.h for dev_t, devmajor_t.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/sys/conf.h

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



CVS commit: src/sys

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:34:03 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/amdgpu: files.amdgpu
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu.h amdgpu_acpi.c
src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr: amdgpu_hwmgr.c
amdgpu_smu7_hwmgr.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.h
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.h
intel_opregion.h
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_acpi.c
nouveau_acpi.h nouveau_display.c nouveau_drv.h
src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core: device.h
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device:
nouveau_nvkm_engine_device_acpi.c nouveau_nvkm_engine_device_base.c
nouveau_nvkm_engine_device_pci.c nouveau_nvkm_engine_device_tegra.c
priv.h
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios:
nouveau_nvkm_subdev_bios_shadowacpi.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm:
nouveau_nvkm_subdev_mxm_base.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon.h radeon_acpi.c
radeon_bios.c radeon_drv.h
src/sys/external/bsd/drm2/include/acpi: video.h
src/sys/external/bsd/drm2/include/linux: acpi.h nbsd-namespace-acpi.h
src/sys/external/bsd/drm2/nouveau: files.nouveau
src/sys/external/bsd/drm2/radeon: files.radeon
src/sys/modules/amdgpu: Makefile
Added Files:
src/sys/external/bsd/drm2/include/acpi: acpi_bus.h
src/sys/external/bsd/drm2/include/linux: mxm-wmi.h

Log Message:
drm: Set CONFIG_ACPI in linux/acpi.h and make it build.

Leave a little ACPI-related functionality disabled for now, like
getting EDID out of ACPI -- needs a bit more work to make this work,
and I don't have hardware to work on that.

Should help with failures of the forms:

- unable to locate a BIOS ROM
- bios: unable to locate usable image

on various machines.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_hwmgr.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c
cvs rdiff -u -r1.48 -r1.49 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.h
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drv.h
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.h
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/device.h
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c
 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/priv.h
cvs rdiff -u -r1.12 -r1.13 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c
cvs rdiff -u -r1.11 -r1.12 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowacpi.c
cvs rdiff -u -r1.4 -r1.5 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/include/acpi/acpi_bus.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/acpi/video.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/linux/acpi.h
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/include/linux/mxm-wmi.h
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h
cvs rdiff -u -r1.39 -r1.40 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r1.39 -r1.40 src/sys/external/bsd/drm2/radeon/files.radeon
cvs rdiff -u -r1.8 -r1.9 

CVS commit: src/sys

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:34:03 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/amdgpu: files.amdgpu
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu.h amdgpu_acpi.c
src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr: amdgpu_hwmgr.c
amdgpu_smu7_hwmgr.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.h
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.h
intel_opregion.h
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_acpi.c
nouveau_acpi.h nouveau_display.c nouveau_drv.h
src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core: device.h
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device:
nouveau_nvkm_engine_device_acpi.c nouveau_nvkm_engine_device_base.c
nouveau_nvkm_engine_device_pci.c nouveau_nvkm_engine_device_tegra.c
priv.h
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios:
nouveau_nvkm_subdev_bios_shadowacpi.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm:
nouveau_nvkm_subdev_mxm_base.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon.h radeon_acpi.c
radeon_bios.c radeon_drv.h
src/sys/external/bsd/drm2/include/acpi: video.h
src/sys/external/bsd/drm2/include/linux: acpi.h nbsd-namespace-acpi.h
src/sys/external/bsd/drm2/nouveau: files.nouveau
src/sys/external/bsd/drm2/radeon: files.radeon
src/sys/modules/amdgpu: Makefile
Added Files:
src/sys/external/bsd/drm2/include/acpi: acpi_bus.h
src/sys/external/bsd/drm2/include/linux: mxm-wmi.h

Log Message:
drm: Set CONFIG_ACPI in linux/acpi.h and make it build.

Leave a little ACPI-related functionality disabled for now, like
getting EDID out of ACPI -- needs a bit more work to make this work,
and I don't have hardware to work on that.

Should help with failures of the forms:

- unable to locate a BIOS ROM
- bios: unable to locate usable image

on various machines.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_hwmgr.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c
cvs rdiff -u -r1.48 -r1.49 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.h
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drv.h
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.h
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/device.h
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c
 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/priv.h
cvs rdiff -u -r1.12 -r1.13 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c
cvs rdiff -u -r1.11 -r1.12 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowacpi.c
cvs rdiff -u -r1.4 -r1.5 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/include/acpi/acpi_bus.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/acpi/video.h
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/linux/acpi.h
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/include/linux/mxm-wmi.h
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h
cvs rdiff -u -r1.39 -r1.40 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r1.39 -r1.40 src/sys/external/bsd/drm2/radeon/files.radeon
cvs rdiff -u -r1.8 -r1.9 

CVS commit: src/external/cddl/osnet/sys/sys

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:29:33 UTC 2024

Modified Files:
src/external/cddl/osnet/sys/sys: elf.h

Log Message:
opensolaris/sys/sys/elf.h: Omit needless __ELF_WORD_SIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/sys/sys/elf.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/cddl/osnet/sys/sys/elf.h
diff -u src/external/cddl/osnet/sys/sys/elf.h:1.7 src/external/cddl/osnet/sys/sys/elf.h:1.8
--- src/external/cddl/osnet/sys/sys/elf.h:1.7	Mon Apr  1 18:33:23 2024
+++ src/external/cddl/osnet/sys/sys/elf.h	Tue Apr 16 14:29:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf.h,v 1.7 2024/04/01 18:33:23 riastradh Exp $	*/
+/*	$NetBSD: elf.h,v 1.8 2024/04/16 14:29:33 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -51,6 +51,4 @@
 
 #define	EM_AMD64		EM_X86_64
 
-#define __ELF_WORD_SIZE ELFSIZE
-
 #endif /* !_SYS__ELF_SOLARIS_H_ */



CVS commit: src/external/cddl/osnet/sys/sys

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:29:33 UTC 2024

Modified Files:
src/external/cddl/osnet/sys/sys: elf.h

Log Message:
opensolaris/sys/sys/elf.h: Omit needless __ELF_WORD_SIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/sys/sys/elf.h

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



CVS commit: src/sys/external/bsd/drm2/nouveau

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:26:53 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau2netbsd

Log Message:
nouveau: Rework nouveau2netbsd hack to get ACPI stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/nouveau/nouveau2netbsd

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

Modified files:

Index: src/sys/external/bsd/drm2/nouveau/nouveau2netbsd
diff -u src/sys/external/bsd/drm2/nouveau/nouveau2netbsd:1.5 src/sys/external/bsd/drm2/nouveau/nouveau2netbsd:1.6
--- src/sys/external/bsd/drm2/nouveau/nouveau2netbsd:1.5	Mon Aug 27 00:46:21 2018
+++ src/sys/external/bsd/drm2/nouveau/nouveau2netbsd	Tue Apr 16 14:26:53 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-#	$NetBSD: nouveau2netbsd,v 1.5 2018/08/27 00:46:21 riastradh Exp $
+#	$NetBSD: nouveau2netbsd,v 1.6 2024/04/16 14:26:53 riastradh Exp $
 #
 # $ /path/to/nouveau2netbsd > /path/to/files.nouveau.new
 #
@@ -32,9 +32,13 @@ filemap="$(mktemp -t ${0##*/})"
 
 cat Kbuild\
 | sed -e 's,^include \(.*\)$,.include "\1",'\
-| sed -e 's,^ifdef \(.*\)$,.if !empty(\1:M[yY][eE][sS]),'		\
+| sed -e 's,^ifdef \(.*\)$,.if !empty(\1:M[yY]),'			\
 | sed -e 's,^endif$,.endif,'		\
-| make -f /dev/stdin -V '$(nouveau-y)' src=.\
+| env	\
+	env CONFIG_ACPI=y		\
+	env CONFIG_X86=y		\
+	env src=.			\
+	make -f /dev/stdin -V '$(nouveau-y)'\
 | tr ' ' '\n'\
 | sed -e 's,^$,,'			\
 | sort -u\



CVS commit: src/sys/external/bsd/drm2/nouveau

2024-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 16 14:26:53 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau2netbsd

Log Message:
nouveau: Rework nouveau2netbsd hack to get ACPI stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/nouveau/nouveau2netbsd

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



CVS commit: src/sys/kern

2024-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 11 13:51:36 UTC 2024

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

Log Message:
sys_futex.c: Fix illustration of futex(2).

In this illustration, we need to _set_ bit 1 to claim ownership, not
_clear_ bit 1 to claim ownership.

No functional change intended -- comment only.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/sys_futex.c

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



CVS commit: src/sys/kern

2024-04-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 11 13:51:36 UTC 2024

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

Log Message:
sys_futex.c: Fix illustration of futex(2).

In this illustration, we need to _set_ bit 1 to claim ownership, not
_clear_ bit 1 to claim ownership.

No functional change intended -- comment only.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/sys_futex.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/sys_futex.c
diff -u src/sys/kern/sys_futex.c:1.19 src/sys/kern/sys_futex.c:1.20
--- src/sys/kern/sys_futex.c:1.19	Fri Feb 24 11:02:27 2023
+++ src/sys/kern/sys_futex.c	Thu Apr 11 13:51:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_futex.c,v 1.19 2023/02/24 11:02:27 riastradh Exp $	*/
+/*	$NetBSD: sys_futex.c,v 1.20 2024/04/11 13:51:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.19 2023/02/24 11:02:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.20 2024/04/11 13:51:36 riastradh Exp $");
 
 /*
  * Futexes
@@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: sys_futex.c,
  *futex(FUTEX_WAIT, , v | 2, NULL, NULL, 0);
  *continue;
  *			}
- *		} while (atomic_cas_uint(, v, v & ~1) != v);
+ *		} while (atomic_cas_uint(, v, v | 1) != v);
  *		membar_acquire();
  *
  *		...



Re: CVS commit: src

2024-04-11 Thread Taylor R Campbell
> Date: Thu, 11 Apr 2024 11:19:38 +0700
> From: Robert Elz 
> 
> This is why I'd like to add a new keyword in the sets lists, like
> "obsolete" is - probably "optional" to mark files that aren't installed
> by the build, but might exist, and should simply be ignored if
> found - it isn't an error for them to exist, but nor is it an error
> for them to be absent.   Such files don't go in any of the constructed
> sets files (whether they happen to exist or not).

I agree, this is related to the subject of, and could probably use the
same mechanism as, PR 57581: set lists should have a way to obsolete
shlibs in DESTDIR but not in postinstall.

https://gnats.NetBSD.org/57581


CVS commit: src

2024-04-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 11 02:15:39 UTC 2024

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

Log Message:
Nix /var/run/named entry from set lists.

Normally we don't do this, but /var/run/named is

(a) used by running daemons, so postinstall should not delete it, and
(b) deleted at boot-time anyway by /etc/rc.d/mountcritlocal, so
there's no sense in having it checked by mtree.

However, this means that update builds need manual intervention to
delete $DESTDIR/var/run/named or else checkflist will fail, so add a
note to UPDATING about this.

Do the same with /var/run/lwresd just in case.

PR misc/57877


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 src/UPDATING
cvs rdiff -u -r1.1342 -r1.1343 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.



CVS commit: src

2024-04-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 11 02:15:39 UTC 2024

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

Log Message:
Nix /var/run/named entry from set lists.

Normally we don't do this, but /var/run/named is

(a) used by running daemons, so postinstall should not delete it, and
(b) deleted at boot-time anyway by /etc/rc.d/mountcritlocal, so
there's no sense in having it checked by mtree.

However, this means that update builds need manual intervention to
delete $DESTDIR/var/run/named or else checkflist will fail, so add a
note to UPDATING about this.

Do the same with /var/run/lwresd just in case.

PR misc/57877


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 src/UPDATING
cvs rdiff -u -r1.1342 -r1.1343 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/UPDATING
diff -u src/UPDATING:1.345 src/UPDATING:1.346
--- src/UPDATING:1.345	Fri Feb  9 22:08:30 2024
+++ src/UPDATING	Thu Apr 11 02:15:39 2024
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.345 2024/02/09 22:08:30 andvar Exp $
+$NetBSD: UPDATING,v 1.346 2024/04/11 02:15:39 riastradh Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,11 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20240410:
+	Update builds may require manually deleting
+	$DESTDIR/var/run/named (and, potentially,
+	$DESTDIR/var/run/lwresd) in order to avoid checkflist failure.
+
 20230828:
 	If:
 - you updated to current and ran postinstall between 20230826

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1342 src/distrib/sets/lists/base/mi:1.1343
--- src/distrib/sets/lists/base/mi:1.1342	Tue Apr  9 15:17:22 2024
+++ src/distrib/sets/lists/base/mi	Thu Apr 11 02:15:39 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1342 2024/04/09 15:17:22 nia Exp $
+# $NetBSD: mi,v 1.1343 2024/04/11 02:15:39 riastradh Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -6376,8 +6376,6 @@
 ./var/preserve	base-util-root
 ./var/quotas	base-util-root
 ./var/run	base-sys-root
-./var/run/lwresdbase-obsolete		obsolete
-./var/run/named	base-obsolete		obsolete
 ./var/rwho	base-netutil-root
 ./var/shm	base-sys-root
 ./var/spool	base-sys-root



CVS commit: src/doc

2024-04-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 11 02:08:17 UTC 2024

Modified Files:
src/doc: 3RDPARTY

Log Message:
doc/3RDPARTY: Tidy up am-utils entry.

Add vendor branch and release branch pattern.


To generate a diff of this commit:
cvs rdiff -u -r1.2002 -r1.2003 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.2002 src/doc/3RDPARTY:1.2003
--- src/doc/3RDPARTY:1.2002	Tue Apr  9 17:06:12 2024
+++ src/doc/3RDPARTY	Thu Apr 11 02:08:17 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.2002 2024/04/09 17:06:12 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.2003 2024/04/11 02:08:17 riastradh Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -56,16 +56,18 @@ You want the unix2 (dual-licensed) tar f
 Please read src/sys/dev/acpi/acpica/README before any modification.
 
 Package:	am-utils [amd]
-Version:	6.2
-Current Vers:	6.2
+Version:	6.2 (20140117)
+Current Vers:	6.2 (20140117)
 Maintainer:	Erez Zadok 
 Archive Site:	ftp://ftp.am-utils.org/pub/am-utils/
-Home Page:	http://www.am-utils.org/
+Home Page:	https://www.am-utils.org/
 Date:		2020-06-13
 Mailing List:	am-utils
 Responsible:	christos
 License:	BSD (4-clause)
 Location:	external/bsd/am-utils/dist
+Vendor tag:	ezk
+Release tag:	am-utils-x-y-MMDD
 Notes:
 Amd2netbsd script to convert to BSD make system and remove unneeded files.
 Fix symbolic links before import.



CVS commit: src/doc

2024-04-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 11 02:08:17 UTC 2024

Modified Files:
src/doc: 3RDPARTY

Log Message:
doc/3RDPARTY: Tidy up am-utils entry.

Add vendor branch and release branch pattern.


To generate a diff of this commit:
cvs rdiff -u -r1.2002 -r1.2003 src/doc/3RDPARTY

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

2024-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr  7 22:59:13 UTC 2024

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

Log Message:
riscv: Schedule next hardclock tick in the future, not the past.

If we have missed hardclock ticks, schedule up to one tick interval
in the future anyway; don't try to play hardclock catchup by
scheduling for when the next hardclock tick _should_ have been, in
the past, leading to ticking as fast as possible until we've caught
up.  as fast as possible until we've caught up.

Playing hardclock catchup triggers heartbeat panics when continuing
from ddb, if you've been in ddb for >15sec.  Other hardclock drivers
like x86 lapic don't play hardclock catchup either.

PR kern/57920


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/riscv/clock_machdep.c

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

Modified files:

Index: src/sys/arch/riscv/riscv/clock_machdep.c
diff -u src/sys/arch/riscv/riscv/clock_machdep.c:1.7 src/sys/arch/riscv/riscv/clock_machdep.c:1.8
--- src/sys/arch/riscv/riscv/clock_machdep.c:1.7	Thu Jan 18 07:41:50 2024
+++ src/sys/arch/riscv/riscv/clock_machdep.c	Sun Apr  7 22:59:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock_machdep.c,v 1.7 2024/01/18 07:41:50 skrll Exp $	*/
+/*	$NetBSD: clock_machdep.c,v 1.8 2024/04/07 22:59:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__RCSID("$NetBSD: clock_machdep.c,v 1.7 2024/01/18 07:41:50 skrll Exp $");
+__RCSID("$NetBSD: clock_machdep.c,v 1.8 2024/04/07 22:59:13 riastradh Exp $");
 
 #include 
 #include 
@@ -124,6 +124,10 @@ riscv_timer_intr(void *arg)
 	ci->ci_ev_timer.ev_count++;
 
 	ci->ci_lastintr_scheduled += timer_ticks_per_hz;
+	while (__predict_false(ci->ci_lastintr_scheduled < now)) {
+		ci->ci_lastintr_scheduled += timer_ticks_per_hz;
+		/* XXX count missed timer interrupts */
+	}
 	sbi_set_timer(ci->ci_lastintr_scheduled);
 
 	hardclock(cf);



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

2024-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr  7 22:59:13 UTC 2024

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

Log Message:
riscv: Schedule next hardclock tick in the future, not the past.

If we have missed hardclock ticks, schedule up to one tick interval
in the future anyway; don't try to play hardclock catchup by
scheduling for when the next hardclock tick _should_ have been, in
the past, leading to ticking as fast as possible until we've caught
up.  as fast as possible until we've caught up.

Playing hardclock catchup triggers heartbeat panics when continuing
from ddb, if you've been in ddb for >15sec.  Other hardclock drivers
like x86 lapic don't play hardclock catchup either.

PR kern/57920


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/riscv/clock_machdep.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

2024-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr  7 22:52:53 UTC 2024

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

Log Message:
riscv: Make sure cpu0->ci_cpu_freq is initialized by cpu_attach.

Otherwise this stays zero, which screws up cpu_ipi_wait.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/cpu.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/cpu.c
diff -u src/sys/arch/riscv/riscv/cpu.c:1.5 src/sys/arch/riscv/riscv/cpu.c:1.6
--- src/sys/arch/riscv/riscv/cpu.c:1.5	Sun Sep  3 08:48:20 2023
+++ src/sys/arch/riscv/riscv/cpu.c	Sun Apr  7 22:52:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.5 2023/09/03 08:48:20 skrll Exp $	*/
+/*	$NetBSD: cpu.c,v 1.6 2024/04/07 22:52:53 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.5 2023/09/03 08:48:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.6 2024/04/07 22:52:53 riastradh Exp $");
 
 #include 
 
@@ -184,6 +184,7 @@ cpu_attach(device_t dv, cpuid_t hartid)
 		ci = curcpu();
 		KASSERTMSG(ci == _info_store[0], "ci %p", ci);
 		ci->ci_cpuid = hartid;
+		ci->ci_cpu_freq = riscv_timer_frequency_get();
 	} else {
 #ifdef MULTIPROCESSOR
 		if ((boothowto & RB_MD1) != 0) {



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

2024-04-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr  7 22:52:53 UTC 2024

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

Log Message:
riscv: Make sure cpu0->ci_cpu_freq is initialized by cpu_attach.

Otherwise this stays zero, which screws up cpu_ipi_wait.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/cpu.c

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



CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 18:57:10 UTC 2024

Modified Files:
src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdi.c xhci.c
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
usb *hci: Always set ux_status before usbd_xfer_schedule_timeout.

Add an assert to usbd_xfer_schedule_timeout to enforce this.

Since access to ux_status is serialized by the bus lock, and nothing
releases the bus lock in the interim, this doesn't make a functional
change.  But it does reduce confusion by readers, who no longer have
to worry if some callers got the order wrong.  It could also now
potentially be factored out in a subsequent commit.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.317 -r1.318 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.252 -r1.253 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.180 -r1.181 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.80 -r1.81 src/sys/external/bsd/dwc2/dwc2.c

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



CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 18:57:10 UTC 2024

Modified Files:
src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdi.c xhci.c
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
usb *hci: Always set ux_status before usbd_xfer_schedule_timeout.

Add an assert to usbd_xfer_schedule_timeout to enforce this.

Since access to ux_status is serialized by the bus lock, and nothing
releases the bus lock in the interim, this doesn't make a functional
change.  But it does reduce confusion by readers, who no longer have
to worry if some callers got the order wrong.  It could also now
potentially be factored out in a subsequent commit.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.317 -r1.318 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.252 -r1.253 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.180 -r1.181 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.80 -r1.81 src/sys/external/bsd/dwc2/dwc2.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.324 src/sys/dev/usb/ehci.c:1.325
--- src/sys/dev/usb/ehci.c:1.324	Sat Feb 10 09:21:53 2024
+++ src/sys/dev/usb/ehci.c	Fri Apr  5 18:57:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.324 2024/02/10 09:21:53 andvar Exp $ */
+/*	$NetBSD: ehci.c,v 1.325 2024/04/05 18:57:10 riastradh Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.324 2024/02/10 09:21:53 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.325 2024/04/05 18:57:10 riastradh Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -3799,9 +3799,9 @@ ehci_device_ctrl_start(struct usbd_xfer 
 
 	/* Insert qTD in QH list - also does usb_syncmem(sqh) */
 	ehci_set_qh_qtd(sqh, setup);
-	usbd_xfer_schedule_timeout(xfer);
 	ehci_add_intr_list(sc, exfer);
 	xfer->ux_status = USBD_IN_PROGRESS;
+	usbd_xfer_schedule_timeout(xfer);
 
 #if 0
 #ifdef EHCI_DEBUG
@@ -3985,9 +3985,9 @@ ehci_device_bulk_start(struct usbd_xfer 
 
 	/* also does usb_syncmem(sqh) */
 	ehci_set_qh_qtd(sqh, exfer->ex_sqtdstart);
-	usbd_xfer_schedule_timeout(xfer);
 	ehci_add_intr_list(sc, exfer);
 	xfer->ux_status = USBD_IN_PROGRESS;
+	usbd_xfer_schedule_timeout(xfer);
 
 #if 0
 #ifdef EHCI_DEBUG
@@ -4184,9 +4184,9 @@ ehci_device_intr_start(struct usbd_xfer 
 
 	/* also does usb_syncmem(sqh) */
 	ehci_set_qh_qtd(sqh, exfer->ex_sqtdstart);
-	usbd_xfer_schedule_timeout(xfer);
 	ehci_add_intr_list(sc, exfer);
 	xfer->ux_status = USBD_IN_PROGRESS;
+	usbd_xfer_schedule_timeout(xfer);
 
 #if 0
 #ifdef EHCI_DEBUG

Index: src/sys/dev/usb/motg.c
diff -u src/sys/dev/usb/motg.c:1.42 src/sys/dev/usb/motg.c:1.43
--- src/sys/dev/usb/motg.c:1.42	Sun Feb  4 05:43:06 2024
+++ src/sys/dev/usb/motg.c	Fri Apr  5 18:57:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: motg.c,v 1.42 2024/02/04 05:43:06 mrg Exp $	*/
+/*	$NetBSD: motg.c,v 1.43 2024/04/05 18:57:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.42 2024/02/04 05:43:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.43 2024/04/05 18:57:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1321,8 +1321,8 @@ motg_device_ctrl_start1(struct motg_soft
 		goto end;
 	}
 	if (xfer->ux_status == USBD_NOT_STARTED) {
-		usbd_xfer_schedule_timeout(xfer);
 		xfer->ux_status = USBD_IN_PROGRESS;
+		usbd_xfer_schedule_timeout(xfer);
 	} else {
 		KASSERT(xfer->ux_status == USBD_IN_PROGRESS);
 	}
@@ -1764,8 +1764,8 @@ motg_device_data_start1(struct motg_soft
 		goto end;
 	}
 	if (xfer->ux_status == USBD_NOT_STARTED) {
-		usbd_xfer_schedule_timeout(xfer);
 		xfer->ux_status = USBD_IN_PROGRESS;
+		usbd_xfer_schedule_timeout(xfer);
 	} else {
 		KASSERT(xfer->ux_status == USBD_IN_PROGRESS);
 	}

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.325 src/sys/dev/usb/ohci.c:1.326
--- src/sys/dev/usb/ohci.c:1.325	Fri Feb  9 22:08:37 2024
+++ src/sys/dev/usb/ohci.c	Fri Apr  5 18:57:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.325 2024/02/09 22:08:37 andvar Exp $	*/
+/*	$NetBSD: ohci.c,v 1.326 2024/04/05 18:57:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.325 2024/02/09 22:08:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.326 2024/04/05 18:57:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2906,12 +2906,11 @@ ohci_device_ctrl_start(struct usbd_xfer 
 	sizeof(sed->ed.ed_tailp),
 	BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 	OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
+	

CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 13:05:41 UTC 2024

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/uvm: uvm_vnode.c

Log Message:
uvm: Expand v_size <= v_writesize assertions to help diagnostics.

PR kern/58117


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.120 -r1.121 src/sys/uvm/uvm_vnode.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/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.103 src/sys/miscfs/genfs/genfs_io.c:1.104
--- src/sys/miscfs/genfs/genfs_io.c:1.103	Sun Apr  9 12:26:36 2023
+++ src/sys/miscfs/genfs/genfs_io.c	Fri Apr  5 13:05:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.103 2023/04/09 12:26:36 riastradh Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.104 2024/04/05 13:05:40 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.103 2023/04/09 12:26:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.104 2024/04/05 13:05:40 riastradh Exp $");
 
 #include 
 #include 
@@ -1449,7 +1449,12 @@ genfs_do_io(struct vnode *vp, off_t off,
 	UVMHIST_LOG(ubchist, "vp %#jx kva %#jx len 0x%jx flags 0x%jx",
 	(uintptr_t)vp, (uintptr_t)kva, len, flags);
 
-	KASSERT(vp->v_size <= vp->v_writesize);
+	KASSERT(vp->v_size != VSIZENOTSET);
+	KASSERT(vp->v_writesize != VSIZENOTSET);
+	KASSERTMSG(vp->v_size <= vp->v_writesize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize);
 	GOP_SIZE(vp, vp->v_writesize, , 0);
 	if (vp->v_type != VBLK) {
 		fs_bshift = vp->v_mount->mnt_fs_bshift;

Index: src/sys/uvm/uvm_vnode.c
diff -u src/sys/uvm/uvm_vnode.c:1.120 src/sys/uvm/uvm_vnode.c:1.121
--- src/sys/uvm/uvm_vnode.c:1.120	Sun Apr  9 12:37:12 2023
+++ src/sys/uvm/uvm_vnode.c	Fri Apr  5 13:05:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_vnode.c,v 1.120 2023/04/09 12:37:12 riastradh Exp $	*/
+/*	$NetBSD: uvm_vnode.c,v 1.121 2024/04/05 13:05:41 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.120 2023/04/09 12:37:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.121 2024/04/05 13:05:41 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -451,9 +451,17 @@ uvm_vnp_setsize(struct vnode *vp, voff_t
 
 	KASSERT(newsize != VSIZENOTSET);
 	KASSERT(newsize >= 0);
-	KASSERT(vp->v_size <= vp->v_writesize);
-	KASSERT(vp->v_size == vp->v_writesize ||
-	newsize == vp->v_writesize || newsize <= vp->v_size);
+	KASSERTMSG(vp->v_size <= vp->v_writesize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize);
+	KASSERTMSG((vp->v_size == vp->v_writesize ||
+		newsize == vp->v_writesize || newsize <= vp->v_size),
+	"vp=%p v_size=0x%llx v_writesize=0x%llx newsize=0x%llx",
+	vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize,
+	(unsigned long long)newsize);
 
 	oldsize = vp->v_writesize;
 
@@ -481,8 +489,16 @@ uvm_vnp_setwritesize(struct vnode *vp, v
 	KASSERT(newsize >= 0);
 	KASSERT(vp->v_size != VSIZENOTSET);
 	KASSERT(vp->v_writesize != VSIZENOTSET);
-	KASSERT(vp->v_size <= vp->v_writesize);
-	KASSERT(vp->v_size <= newsize);
+	KASSERTMSG(vp->v_size <= vp->v_writesize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx newsize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize,
+	(unsigned long long)newsize);
+	KASSERTMSG(vp->v_size <= newsize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx newsize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize,
+	(unsigned long long)newsize);
 	mutex_enter(vp->v_interlock);
 	vp->v_writesize = newsize;
 	mutex_exit(vp->v_interlock);



CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 13:05:41 UTC 2024

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/uvm: uvm_vnode.c

Log Message:
uvm: Expand v_size <= v_writesize assertions to help diagnostics.

PR kern/58117


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.120 -r1.121 src/sys/uvm/uvm_vnode.c

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



CVS commit: src/usr.bin/config

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 00:43:42 UTC 2024

Modified Files:
src/usr.bin/config: defs.h files.c mkioconf.c mkmakefile.c pack.c

Log Message:
config(1): Make sort order deterministic.

Ensure we break ties in every case.  This way, even though we use the
unstable qsort(3) library routine, the output is reproducible, no
matter what algorithm is behind qsort(3).

It would be nice if we could just use a stable sort function here,
but mergesort(3) is nonstandard, so we'd have to add it to
tools/compat, which is a big pain.

Instead, put a tie-breaking rule in every comparison function we use
with qsort, and abort() in the event of ties -- that way, we noisily
refuse to rely on unstable sort order.

While here, dispense with any question of integer overflow, and
sprinkle comments.

PR bin/58115


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/config/defs.h
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/config/files.c
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/config/mkioconf.c
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/config/mkmakefile.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/config/pack.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.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.108 src/usr.bin/config/defs.h:1.109
--- src/usr.bin/config/defs.h:1.108	Thu Jan 18 05:41:38 2024
+++ src/usr.bin/config/defs.h	Fri Apr  5 00:43:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.108 2024/01/18 05:41:38 thorpej Exp $	*/
+/*	$NetBSD: defs.h,v 1.109 2024/04/05 00:43:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -207,6 +207,8 @@ struct attr {
 	/* "device class" */
 	const char *a_devclass;		/* device class described */
 	struct where a_where;
+
+	size_t	a_idx;			/* index to break sorting ties */
 };
 
 /*

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.37 src/usr.bin/config/files.c:1.38
--- src/usr.bin/config/files.c:1.37	Sat Mar  7 19:26:13 2020
+++ src/usr.bin/config/files.c	Fri Apr  5 00:43:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.37 2020/03/07 19:26:13 christos Exp $	*/
+/*	$NetBSD: files.c,v 1.38 2024/04/05 00:43:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: files.c,v 1.37 2020/03/07 19:26:13 christos Exp $");
+__RCSID("$NetBSD: files.c,v 1.38 2024/04/05 00:43:42 riastradh Exp $");
 
 #include 
 #include 
@@ -281,9 +281,9 @@ cmpfiles(const void *a, const void *b)
 	if (sa < sb)
 		return -1;
 	else if (sa > sb)
-		return 1;
+		return +1;
 	else
-		return 0;
+		abort();	/* no ties possible */
 }
 
 /*

Index: src/usr.bin/config/mkioconf.c
diff -u src/usr.bin/config/mkioconf.c:1.35 src/usr.bin/config/mkioconf.c:1.36
--- src/usr.bin/config/mkioconf.c:1.35	Sun Nov 19 01:46:29 2017
+++ src/usr.bin/config/mkioconf.c	Fri Apr  5 00:43:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkioconf.c,v 1.35 2017/11/19 01:46:29 christos Exp $	*/
+/*	$NetBSD: mkioconf.c,v 1.36 2024/04/05 00:43:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkioconf.c,v 1.35 2017/11/19 01:46:29 christos Exp $");
+__RCSID("$NetBSD: mkioconf.c,v 1.36 2024/04/05 00:43:42 riastradh Exp $");
 
 #include 
 #include 
@@ -136,7 +136,12 @@ cforder(const void *a, const void *b)
 
 	n1 = (*(const struct devi * const *)a)->i_cfindex;
 	n2 = (*(const struct devi * const *)b)->i_cfindex;
-	return (n1 - n2);
+	if (n1 < n2)
+		return -1;
+	else if (n1 > n2)
+		return +1;
+	else
+		abort();	/* no ties possible */
 }
 
 static void

Index: src/usr.bin/config/mkmakefile.c
diff -u src/usr.bin/config/mkmakefile.c:1.72 src/usr.bin/config/mkmakefile.c:1.73
--- src/usr.bin/config/mkmakefile.c:1.72	Thu Jan 18 04:41:37 2024
+++ src/usr.bin/config/mkmakefile.c	Fri Apr  5 00:43:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkmakefile.c,v 1.72 2024/01/18 04:41:37 thorpej Exp $	*/
+/*	$NetBSD: mkmakefile.c,v 1.73 2024/04/05 00:43:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkmakefile.c,v 1.72 2024/01/18 04:41:37 thorpej Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.73 2024/04/05 00:43:42 riastradh Exp $");
 
 #include 
 #include 
@@ -413,6 +413,7 @@ emitallkobjscb(const char *name, void *v
 		return 0;
 	if (TAILQ_EMPTY(>a_files))
 		return 0;
+	a->a_idx = attridx;
 	attrbuf[attridx++] = a;
 	/* XXX nattrs tracking is not exact yet */
 	if (attridx == nattrs) {
@@ -447,7 +448,21 @@ attrcmp(const void *l, const void *r)
 {
 	const struct attr * const *a = l, * const *b = r;
 	const int wa = (*a)->a_weight, wb = (*b)->a_weight;
-	return (wa > wb) ? -1 : (wa < wb) ? 1 : 0;
+
+	/*
+	 * Higher-weight first; then, among equal weights, earlier
+	 * index first.
+	 */
+	if (wa > wb)
+		return -1;
+	else if (wa < wb)
+		return +1;
+	else if ((*a)->a_idx < (*b)->a_idx)
+		return -1;
+	else if 

CVS commit: src/usr.bin/config

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 00:43:42 UTC 2024

Modified Files:
src/usr.bin/config: defs.h files.c mkioconf.c mkmakefile.c pack.c

Log Message:
config(1): Make sort order deterministic.

Ensure we break ties in every case.  This way, even though we use the
unstable qsort(3) library routine, the output is reproducible, no
matter what algorithm is behind qsort(3).

It would be nice if we could just use a stable sort function here,
but mergesort(3) is nonstandard, so we'd have to add it to
tools/compat, which is a big pain.

Instead, put a tie-breaking rule in every comparison function we use
with qsort, and abort() in the event of ties -- that way, we noisily
refuse to rely on unstable sort order.

While here, dispense with any question of integer overflow, and
sprinkle comments.

PR bin/58115


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/config/defs.h
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/config/files.c
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/config/mkioconf.c
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/config/mkmakefile.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/config/pack.c

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



CVS commit: src

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 21:19:25 UTC 2024

Modified Files:
src/lib/librumpuser: rumpuser_daemonize.c
src/tests/rump/rumpkern: t_sp.sh

Log Message:
Temporarily make PR t_sp:sigsafe noisier.

This is an attempt to diagnose why it's flaky in the releng testbeds
but not when I run it.  This change will be backed out once we get
new testbed output.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/librumpuser/rumpuser_daemonize.c
cvs rdiff -u -r1.18 -r1.19 src/tests/rump/rumpkern/t_sp.sh

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

Modified files:

Index: src/lib/librumpuser/rumpuser_daemonize.c
diff -u src/lib/librumpuser/rumpuser_daemonize.c:1.9 src/lib/librumpuser/rumpuser_daemonize.c:1.10
--- src/lib/librumpuser/rumpuser_daemonize.c:1.9	Thu Apr  4 17:27:23 2024
+++ src/lib/librumpuser/rumpuser_daemonize.c	Thu Apr  4 21:19:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_daemonize.c,v 1.9 2024/04/04 17:27:23 riastradh Exp $	*/
+/*	$NetBSD: rumpuser_daemonize.c,v 1.10 2024/04/04 21:19:25 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_daemonize.c,v 1.9 2024/04/04 17:27:23 riastradh Exp $");
+__RCSID("$NetBSD: rumpuser_daemonize.c,v 1.10 2024/04/04 21:19:25 riastradh Exp $");
 #endif /* !lint */
 
 #include 
@@ -161,6 +161,9 @@ rumpuser_daemonize_done(int error)
 			close(fd);
 	}
 
+	fflush(stdout);
+	fflush(stderr);
+
  out:
 	n = send(daemonpipe[1], , sizeof(error), MSG_NOSIGNAL);
 	if (n != sizeof(error)) {

Index: src/tests/rump/rumpkern/t_sp.sh
diff -u src/tests/rump/rumpkern/t_sp.sh:1.18 src/tests/rump/rumpkern/t_sp.sh:1.19
--- src/tests/rump/rumpkern/t_sp.sh:1.18	Thu Apr  4 17:27:32 2024
+++ src/tests/rump/rumpkern/t_sp.sh	Thu Apr  4 21:19:25 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: t_sp.sh,v 1.18 2024/04/04 17:27:32 riastradh Exp $
+#	$NetBSD: t_sp.sh,v 1.19 2024/04/04 21:19:25 riastradh Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -119,7 +119,9 @@ sigsafe()
 	export RUMP_SERVER=unix://commsock
 	export RUMP_STDOUT="$(pwd)/stdout"
 	export RUMP_STDERR="$(pwd)/stderr"
-	atf_check -s exit:0 rump_server ${RUMP_SERVER}
+	atf_check -s exit:0 rump_server -v ${RUMP_SERVER}
+	cat stdout
+	cat stderr >&2
 	atf_check -s exit:0 sh -c "$RUN_CLIENT" -- \
 	"$(atf_get_srcdir)"/h_client/h_sigcli
 }



CVS commit: src

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 21:19:25 UTC 2024

Modified Files:
src/lib/librumpuser: rumpuser_daemonize.c
src/tests/rump/rumpkern: t_sp.sh

Log Message:
Temporarily make PR t_sp:sigsafe noisier.

This is an attempt to diagnose why it's flaky in the releng testbeds
but not when I run it.  This change will be backed out once we get
new testbed output.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/librumpuser/rumpuser_daemonize.c
cvs rdiff -u -r1.18 -r1.19 src/tests/rump/rumpkern/t_sp.sh

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



CVS commit: src/external/bsd/am-utils/dist

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 20:33:59 UTC 2024

Removed Files:
src/external/bsd/am-utils/dist: amd2netbsd

Log Message:
external/bsd/am-utils: delete outdated amd2netbsd under dist

This was stored as a local change to dist, where it doesn't belong --
it belongs outside dist.  But we already have an amd2netbsd with the
correct path outside of dist.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/external/bsd/am-utils/dist/amd2netbsd

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



CVS commit: src/external/bsd/am-utils/dist

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 20:33:59 UTC 2024

Removed Files:
src/external/bsd/am-utils/dist: amd2netbsd

Log Message:
external/bsd/am-utils: delete outdated amd2netbsd under dist

This was stored as a local change to dist, where it doesn't belong --
it belongs outside dist.  But we already have an amd2netbsd with the
correct path outside of dist.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/external/bsd/am-utils/dist/amd2netbsd

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



CVS commit: src/tests/rump/rumpkern

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 17:27:32 UTC 2024

Modified Files:
src/tests/rump/rumpkern: t_sp.sh

Log Message:
rumpkern/t_sp: Save stdout and stderr to report on failure.

This is not very tidy at the moment, but it's an experiment using the
approach in PR bin/58112, to diagnose why t_sp:sigsafe keeps failing
intermittently.  If this works, perhaps can tidy it up and apply it
to all the other tests that run rump_servers.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/rump/rumpkern/t_sp.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/rump/rumpkern/t_sp.sh
diff -u src/tests/rump/rumpkern/t_sp.sh:1.17 src/tests/rump/rumpkern/t_sp.sh:1.18
--- src/tests/rump/rumpkern/t_sp.sh:1.17	Tue Sep  1 18:40:09 2020
+++ src/tests/rump/rumpkern/t_sp.sh	Thu Apr  4 17:27:32 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: t_sp.sh,v 1.17 2020/09/01 18:40:09 gson Exp $
+#	$NetBSD: t_sp.sh,v 1.18 2024/04/04 17:27:32 riastradh Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -66,6 +66,18 @@ test_case signal signal
 # test_case reconnect reconnect
 test_case_skip reconnect kern/55304 "leftover rump_server"
 
+RUN_CLIENT='
+	if "$@"; then
+		exit 0
+	else
+		status=$?
+	fi
+	RUMP_SERVER=unix://commsock rump.halt
+	cat stdout
+	cat stderr >&2
+	exit $status
+'
+
 basic()
 {
 	export RUMP_SERVER=unix://commsock
@@ -105,9 +117,11 @@ sigsafe()
 {
 
 	export RUMP_SERVER=unix://commsock
+	export RUMP_STDOUT="$(pwd)/stdout"
+	export RUMP_STDERR="$(pwd)/stderr"
 	atf_check -s exit:0 rump_server ${RUMP_SERVER}
-	atf_check -s exit:0 $(atf_get_srcdir)/h_client/h_sigcli
-
+	atf_check -s exit:0 sh -c "$RUN_CLIENT" -- \
+	"$(atf_get_srcdir)"/h_client/h_sigcli
 }
 
 signal()



CVS commit: src/tests/rump/rumpkern

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 17:27:32 UTC 2024

Modified Files:
src/tests/rump/rumpkern: t_sp.sh

Log Message:
rumpkern/t_sp: Save stdout and stderr to report on failure.

This is not very tidy at the moment, but it's an experiment using the
approach in PR bin/58112, to diagnose why t_sp:sigsafe keeps failing
intermittently.  If this works, perhaps can tidy it up and apply it
to all the other tests that run rump_servers.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/rump/rumpkern/t_sp.sh

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



CVS commit: src/lib/librumpuser

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 17:27:23 UTC 2024

Modified Files:
src/lib/librumpuser: rumpuser_daemonize.c

Log Message:
rumpuser(3): New RUMP_STDOUT, RUMP_STDERR environment variables.

If set, then when rump daemonizes, it opens the path in RUMP_STDOUT
and redirects fd 1 to that (which mostly gets the kernel console
output), and opens the path in RUMP_STDERR and redirects fd 2 to that
(no idea what this gets but it's probably good to record if it ever
gets anything).

This will allow tests that rely on rump_server daemons to stash the
output for diagnostics in case, e.g., the rump kernel crashes.

PR bin/58112


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/librumpuser/rumpuser_daemonize.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/librumpuser/rumpuser_daemonize.c
diff -u src/lib/librumpuser/rumpuser_daemonize.c:1.8 src/lib/librumpuser/rumpuser_daemonize.c:1.9
--- src/lib/librumpuser/rumpuser_daemonize.c:1.8	Thu Aug  3 20:45:49 2023
+++ src/lib/librumpuser/rumpuser_daemonize.c	Thu Apr  4 17:27:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_daemonize.c,v 1.8 2023/08/03 20:45:49 andvar Exp $	*/
+/*	$NetBSD: rumpuser_daemonize.c,v 1.9 2024/04/04 17:27:23 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_daemonize.c,v 1.8 2023/08/03 20:45:49 andvar Exp $");
+__RCSID("$NetBSD: rumpuser_daemonize.c,v 1.9 2024/04/04 17:27:23 riastradh Exp $");
 #endif /* !lint */
 
 #include 
@@ -53,6 +53,27 @@ static int daemonpipe[2];
 
 #include 
 
+static int
+openstdoutstderr(void)
+{
+	char path[PATH_MAX];
+	int fd;
+
+	if (getenv_r("RUMP_STDOUT", path, sizeof(path)) == 0) {
+		if ((fd = open(path, O_WRONLY|O_CREAT)) == -1)
+			return -1;
+		dup2(fd, STDOUT_FILENO);
+		(void)close(fd);
+	}
+	if (getenv_r("RUMP_STDERR", path, sizeof(path)) == 0) {
+		if ((fd = open(path, O_WRONLY|O_CREAT)) == -1)
+			return -1;
+		dup2(fd, STDERR_FILENO);
+		(void)close(fd);
+	}
+	return 0;
+}
+
 int
 rumpuser_daemonize_begin(void)
 {
@@ -82,6 +103,13 @@ rumpuser_daemonize_begin(void)
 		goto out;
 	}
 
+	if (openstdoutstderr() == -1) {
+		rv = errno;
+		(void)close(daemonpipe[0]);
+		(void)close(daemonpipe[1]);
+		goto out;
+	}
+
 	switch (fork()) {
 	case 0:
 		if (setsid() == -1) {
@@ -125,8 +153,10 @@ rumpuser_daemonize_done(int error)
 			goto out;
 		}
 		dup2(fd, STDIN_FILENO);
-		dup2(fd, STDOUT_FILENO);
-		dup2(fd, STDERR_FILENO);
+		if (getenv("RUMP_STDOUT") == NULL)
+			dup2(fd, STDOUT_FILENO);
+		if (getenv("RUMP_STDERR") == NULL)
+			dup2(fd, STDERR_FILENO);
 		if (fd > STDERR_FILENO)
 			close(fd);
 	}



CVS commit: src/lib/librumpuser

2024-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 17:27:23 UTC 2024

Modified Files:
src/lib/librumpuser: rumpuser_daemonize.c

Log Message:
rumpuser(3): New RUMP_STDOUT, RUMP_STDERR environment variables.

If set, then when rump daemonizes, it opens the path in RUMP_STDOUT
and redirects fd 1 to that (which mostly gets the kernel console
output), and opens the path in RUMP_STDERR and redirects fd 2 to that
(no idea what this gets but it's probably good to record if it ever
gets anything).

This will allow tests that rely on rump_server daemons to stash the
output for diagnostics in case, e.g., the rump kernel crashes.

PR bin/58112


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/librumpuser/rumpuser_daemonize.c

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



CVS commit: src

2024-04-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 00:46:42 UTC 2024

Modified Files:
src/lib/libc/arch/i386/gen: setjmp.S sigsetjmp.S
src/tests/lib/libc/setjmp: t_sigstack.c

Log Message:
i386 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
  => val==0 is unlikely in longjmp

PR lib/57946


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/arch/i386/gen/setjmp.S
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/arch/i386/gen/sigsetjmp.S
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/setjmp/t_sigstack.c

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



CVS commit: src

2024-04-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 00:46:42 UTC 2024

Modified Files:
src/lib/libc/arch/i386/gen: setjmp.S sigsetjmp.S
src/tests/lib/libc/setjmp: t_sigstack.c

Log Message:
i386 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
  => val==0 is unlikely in longjmp

PR lib/57946


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/arch/i386/gen/setjmp.S
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/arch/i386/gen/sigsetjmp.S
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/setjmp/t_sigstack.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/libc/arch/i386/gen/setjmp.S
diff -u src/lib/libc/arch/i386/gen/setjmp.S:1.17 src/lib/libc/arch/i386/gen/setjmp.S:1.18
--- src/lib/libc/arch/i386/gen/setjmp.S:1.17	Fri May 23 03:05:56 2014
+++ src/lib/libc/arch/i386/gen/setjmp.S	Thu Apr  4 00:46:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.S,v 1.17 2014/05/23 03:05:56 uebayasi Exp $	*/
+/*	$NetBSD: setjmp.S,v 1.18 2024/04/04 00:46:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS)
-	RCSID("$NetBSD: setjmp.S,v 1.17 2014/05/23 03:05:56 uebayasi Exp $")
+	RCSID("$NetBSD: setjmp.S,v 1.18 2024/04/04 00:46:41 riastradh Exp $")
 #endif
 
 /*
@@ -49,12 +49,24 @@
  * The previous signal state is restored.
  */
 
+/*
+ * setjmp(jmp_buf env@esp[4,8))
+ *
+ * ELF symbol: __setjmp14, because the size of jmp_buf changed on some
+ * platforms in 1.4.
+ */
 ENTRY(__setjmp14)
-	movl	4(%esp),%ecx
-	movl	0(%esp),%edx
-	movl	%edx, 0(%ecx)
-	movl	%ebx, 4(%ecx)
-	movl	%esp, 8(%ecx)
+	/*
+	 * Save the callee-saves registers: %ebp, %ebx, %edi, %esi,
+	 * plus %esp and the return address on the stack since it
+	 * will be overwritten if the caller makes any subroutine
+	 * calls before longjmp.
+	 */
+	movl	4(%esp),%ecx		/* ecx := env */
+	movl	0(%esp),%edx		/* edx := return address */
+	movl	%edx,0(%ecx)
+	movl	%ebx,4(%ecx)
+	movl	%esp,8(%ecx)
 	movl	%ebp,12(%ecx)
 	movl	%esi,16(%ecx)
 	movl	%edi,20(%ecx)
@@ -63,49 +75,65 @@ ENTRY(__setjmp14)
 	leal	24(%ecx),%edx
 
 	PIC_PROLOGUE
-	pushl	%edx
-	pushl	$0
-	pushl	$0
+	pushl	%edx			/* oset (signal mask saved to) */
+	pushl	$0			/* set := NULL */
+	pushl	$0			/* how := 0 (ignored) */
 #ifdef __PIC__
 	call	PIC_PLT(_C_LABEL(__sigprocmask14))
 #else
 	call	_C_LABEL(__sigprocmask14)
 #endif
-	addl	$12,%esp
+	addl	$12,%esp		/* pop sigprocmask args */
 	PIC_EPILOGUE
 
-	xorl	%eax,%eax
+	xorl	%eax,%eax		/* return 0 first time around */
 	ret
 END(__setjmp14)
 
+/*
+ * longjmp(jmp_buf env@esp[4,8), int val@[8,12))
+ *
+ * ELF symbol: __longjmp14, because the size of jmp_buf changed on some
+ * platforms in 1.4.
+ */
 ENTRY(__longjmp14)
+	/*
+	 * Restore the callee-saves registers: %ebp, %ebx, %edi, %esi,
+	 * plus %esp and the return address on the stack.
+	 */
+	movl	4(%esp),%edx		/* edx := env */
+	movl	8(%esp),%eax		/* eax := val */
+	movl	0(%edx),%ecx		/* ecx := return address */
+	movl	4(%edx),%ebx
+	movl	8(%edx),%esp
+	movl	12(%edx),%ebp
+	movl	16(%edx),%esi
+	movl	20(%edx),%edi
+	movl	%ecx,0(%esp)		/* restore return address */
+
 	/* Restore the signal mask. */
-	movl	4(%esp),%ecx
-	leal	24(%ecx),%edx
+	leal	24(%edx),%edx
+
+	pushl	%eax			/* save val@eax */
 
 	PIC_PROLOGUE
-	pushl	$0
-	pushl	%edx
-	pushl	$3			/* SIG_SETMASK */
+	pushl	$0			/* oset := NULL */
+	pushl	%edx			/* set (signal mask restored from) */
+	pushl	$3			/* how := SIG_SETMASK */
 #ifdef __PIC__
 	call	PIC_PLT(_C_LABEL(__sigprocmask14))
 #else
 	call	_C_LABEL(__sigprocmask14)
 #endif
-	addl	$12,%esp
+	addl	$12,%esp		/* pop sigprocmask args */
 	PIC_EPILOGUE
 
-	movl	4(%esp),%edx
-	movl	8(%esp),%eax
-	movl	0(%edx),%ecx
-	movl	4(%edx),%ebx
-	movl	8(%edx),%esp
-	movl	12(%edx),%ebp
-	movl	16(%edx),%esi
-	movl	20(%edx),%edi
-	testl	%eax,%eax
-	jnz	1f
-	incl	%eax
-1:	movl	%ecx,0(%esp)
-	ret
+	popl	%eax			/* restore val@eax */
+
+	testl	%eax,%eax		/* val == 0? */
+	jz	3f			/* jump if val == 0 */
+	ret/* return val@eax */
+
+3:	incl	%eax			/* val@eax := 1 */
+	ret/* return val@eax */
 END(__longjmp14)

Index: src/lib/libc/arch/i386/gen/sigsetjmp.S
diff -u src/lib/libc/arch/i386/gen/sigsetjmp.S:1.18 src/lib/libc/arch/i386/gen/sigsetjmp.S:1.19
--- src/lib/libc/arch/i386/gen/sigsetjmp.S:1.18	Fri May 23 02:34:19 2014
+++ src/lib/libc/arch/i386/gen/sigsetjmp.S	Thu Apr  4 00:46:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sigsetjmp.S,v 1.18 2014/05/23 02:34:19 uebayasi Exp $	*/
+/*	$NetBSD: sigsetjmp.S,v 1.19 2024/04/04 00:46:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,76 +36,104 @@
 
 

CVS commit: src

2024-04-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 00:46:30 UTC 2024

Modified Files:
src/lib/libc/arch/x86_64/gen: __setjmp14.S __sigsetjmp14.S
src/tests/lib/libc/setjmp: t_sigstack.c

Log Message:
amd64 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
  => Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
  => val==0 is unlikely in longjmp

PR lib/57946


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/gen/__setjmp14.S \
src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/setjmp/t_sigstack.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/libc/arch/x86_64/gen/__setjmp14.S
diff -u src/lib/libc/arch/x86_64/gen/__setjmp14.S:1.3 src/lib/libc/arch/x86_64/gen/__setjmp14.S:1.4
--- src/lib/libc/arch/x86_64/gen/__setjmp14.S:1.3	Thu May 22 15:01:56 2014
+++ src/lib/libc/arch/x86_64/gen/__setjmp14.S	Thu Apr  4 00:46:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: __setjmp14.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $	*/
+/*	$NetBSD: __setjmp14.S,v 1.4 2024/04/04 00:46:30 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #include 
 
 #if defined(LIBC_SCCS)
-	RCSID("$NetBSD: __setjmp14.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $")
+	RCSID("$NetBSD: __setjmp14.S,v 1.4 2024/04/04 00:46:30 riastradh Exp $")
 #endif
 
 /*
@@ -53,7 +53,19 @@
  * The previous signal state is restored.
  */
 
+/*
+ * setjmp(jmp_buf env@rdi)
+ *
+ * ELF symbol: __setjmp14, because the size of jmp_buf changed on some
+ * platforms in 1.4.
+ */
 ENTRY(__setjmp14)
+	/*
+	 * Save the callee-saves registers: %rbx, %rbp, %r12-r15,
+	 * plus %rsp and the return address on the stack since it
+	 * will be overwritten if the caller makes any subroutine
+	 * calls before longjmp.
+	 */
 	movq	(%rsp),%r11
 	movq	%rbx,(_JB_RBX * 8)(%rdi)
 	movq	%rbp,(_JB_RBP * 8)(%rdi)
@@ -64,47 +76,62 @@ ENTRY(__setjmp14)
 	movq	%rsp,(_JB_RSP * 8)(%rdi)
 	movq	%r11,(_JB_PC  * 8)(%rdi)
 
-	leaq	(_JB_SIGMASK * 8)(%rdi),%rdx
-	xorl	%edi,%edi
-	xorq	%rsi,%rsi
+	leaq	(_JB_SIGMASK * 8)(%rdi),%rdx	/* oset@rdx */
+	xorl	%edi,%edi		/* how@edi := 0 (ignored) */
+	xorl	%esi,%esi		/* set@rsi := NULL */
 
 #ifdef __PIC__
 	call	PIC_PLT(_C_LABEL(__sigprocmask14))
 #else
 	call	_C_LABEL(__sigprocmask14)
 #endif
-2:	xorl	%eax,%eax
+	xorl	%eax,%eax
 	ret
 END(__setjmp14)
 
+/*
+ * longjmp(jmp_buf env@rdi, int val@esi)
+ *
+ * ELF symbol: __longjmp14, because the size of jmp_buf changed on some
+ * platforms in 1.4
+ */
 ENTRY(__longjmp14)
-	movq	%rdi,%r12
-	movl	%esi,%r8d
-
-	leaq	(_JB_SIGMASK * 8)(%rdi),%rsi
-	movl	$3,%edi		/* SIG_SETMASK */
-	xorq	%rdx,%rdx
+	/*
+	 * Restore the callee-saves registers: %rbx, %rbp, %r12-r15,
+	 * plus %rsp and the return address on the stack.
+	 */
+	movq	(_JB_RBX * 8)(%rdi),%rbx
+	movq	(_JB_RBP * 8)(%rdi),%rbp
+	movq	(_JB_R12 * 8)(%rdi),%r12
+	movq	(_JB_R13 * 8)(%rdi),%r13
+	movq	(_JB_R14 * 8)(%rdi),%r14
+	movq	(_JB_R15 * 8)(%rdi),%r15
+	movq	(_JB_RSP * 8)(%rdi),%rsp
+	movq	(_JB_PC  * 8)(%rdi),%r11
+	movq	%r11,0(%rsp)
+
+	/*
+	 * Use  pushq %rsi  instead of  pushl %esi  in order to keep
+	 * 16-byte stack alignment, even though we only care about the
+	 * 32-bit int in esi.
+	 */
+	pushq	%rsi		/* save val@esi */
+
+	leaq	(_JB_SIGMASK * 8)(%rdi),%rsi	/* set@rsi */
+	movl	$3,%edi		/* how@edi := SIG_SETMASK */
+	xorl	%edx,%edx	/* oset@rdx := NULL */
 
-	pushq	%r8
 #ifdef __PIC__
 	call	PIC_PLT(_C_LABEL(__sigprocmask14))
 #else
 	call	_C_LABEL(__sigprocmask14)
 #endif
-	popq	%r8
-	movq	(_JB_RBX * 8)(%r12),%rbx
-	movq	(_JB_RBP * 8)(%r12),%rbp
-	movq	(_JB_R13 * 8)(%r12),%r13
-	movq	(_JB_R14 * 8)(%r12),%r14
-	movq	(_JB_R15 * 8)(%r12),%r15
-	movq	(_JB_RSP * 8)(%r12),%rsp
-	movq	(_JB_PC  * 8)(%r12),%r11
-	movq	(_JB_R12 * 8)(%r12),%r12
-
-	movl	%r8d,%eax
-	testl	%eax,%eax
-	jnz	1f
-	incl	%eax
-1:	movq	%r11,0(%rsp)
-	ret
+
+	popq	%rax		/* restore val@eax */
+
+	testl	%eax,%eax	/* val@eax == 0? */
+	jz	1f		/* jump if val@eax == 0 */
+	ret			/* return val@eax */
+1:	incl	%eax		/* val@eax := 1 */
+	ret			/* return val@eax */
 END(__longjmp14)
Index: src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S
diff -u src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S:1.3 src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S:1.4
--- src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S:1.3	Thu May 22 15:01:56 2014
+++ src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S	Thu Apr  4 00:46:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigsetjmp14.S,v 1.3 2014/05/22 15:01:56 uebayasi Exp $	*/
+/*	$NetBSD: __sigsetjmp14.S,v 1.4 2024/04/04 00:46:30 riastradh Exp $	*/
 
 /*
  * 

CVS commit: src

2024-04-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr  4 00:46:30 UTC 2024

Modified Files:
src/lib/libc/arch/x86_64/gen: __setjmp14.S __sigsetjmp14.S
src/tests/lib/libc/setjmp: t_sigstack.c

Log Message:
amd64 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
  => Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
  => val==0 is unlikely in longjmp

PR lib/57946


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/x86_64/gen/__setjmp14.S \
src/lib/libc/arch/x86_64/gen/__sigsetjmp14.S
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/setjmp/t_sigstack.c

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



CVS commit: src/share/mk

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:41:48 UTC 2024

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

Log Message:
bsd.own.mk: No need for MKSLJIT to be set differently from others.

- Use ?=, not =, so mk.conf setting wins.
- Write out per-architecture tabular settings, not a conditional.
- Add comments for the architectures that look like they should have
  sljit but don't.  (XXX Missing comments about powerpc and mips --
  not sure why, is this because modules don't yet work on those
  architectures, or what?)

Tidying for PR 58103: bpfjit.kmod is not built on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.1365 -r1.1366 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1365 src/share/mk/bsd.own.mk:1.1366
--- src/share/mk/bsd.own.mk:1.1365	Tue Apr  2 22:37:34 2024
+++ src/share/mk/bsd.own.mk	Tue Apr  2 22:41:48 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1365 2024/04/02 22:37:34 riastradh Exp $
+#	$NetBSD: bsd.own.mk,v 1.1366 2024/04/02 22:41:48 riastradh Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1336,6 +1336,21 @@ MKLLVMRT.i386=		yes
 MKLLVMRT.aarch64=	yes
 .endif
 
+# Just-in-time compiler for bpf, npf acceleration
+MKSLJIT.aarch64=	yes
+MKSLJIT.i386=		yes
+MKSLJIT.sparc=		yes
+#MKSLJIT.sparc64=	yes	# not suppored in sljit (yet?)
+MKSLJIT.x86_64=		yes
+#MKSLJIT.powerpc=	yes	# XXX
+#MKSLJIT.powerpc64=	yes	# XXX
+#MKSLJIT.mipsel=	yes	# XXX
+#MKSLJIT.mipseb=	yes	# XXX
+#MKSLJIT.mips64el=	yes	# XXX
+#MKSLJIT.mips64eb=	yes	# XXX
+#MKSLJIT.riscv32=	yes	# not until we update sljit
+#MKSLJIT.riscv64=	yes	# not until we update sljit
+
 # compat with old names
 MKDEBUGKERNEL?=${MKKDEBUG:Uno}
 MKDEBUGTOOLS?=${MKTOOLSDEBUG:Uno}
@@ -1391,13 +1406,6 @@ _MKVARS.no= \
 ${var}?=	${${var}.${MACHINE_ARCH}:U${${var}.${MACHINE}:Uno}}
 .endfor
 
-.if ${MACHINE_ARCH} == "aarch64" || \
-${MACHINE_ARCH} == "i386"|| \
-${MACHINE_ARCH} == "sparc"   || \
-${MACHINE_ARCH} == "x86_64"
-MKSLJIT=	yes
-.endif
-
 #
 # Which platforms build the xorg-server drivers (as opposed
 # to just Xnest and Xvfb.)



CVS commit: src/share/mk

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:41:48 UTC 2024

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

Log Message:
bsd.own.mk: No need for MKSLJIT to be set differently from others.

- Use ?=, not =, so mk.conf setting wins.
- Write out per-architecture tabular settings, not a conditional.
- Add comments for the architectures that look like they should have
  sljit but don't.  (XXX Missing comments about powerpc and mips --
  not sure why, is this because modules don't yet work on those
  architectures, or what?)

Tidying for PR 58103: bpfjit.kmod is not built on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.1365 -r1.1366 src/share/mk/bsd.own.mk

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



CVS commit: src

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:37:34 UTC 2024

Modified Files:
src/share/mk: bsd.own.mk
src/sys/arch/aarch64/include: sljit_machdep.h
src/sys/modules: Makefile

Log Message:
bsd.own.mk: Enable MKLSJIT on aarch64.

Make sure there's only one copy of the conditional, in bsd.own.mk;
just make sys/modules/Makefile conditional on MKSLJIT so we don't
have to keep these in sync.

As a workaround for PR 58106, tweak the conditional definition of
SLJIT_CACHE_FLUSH to use cpu_icache_sync_range only in _HARDKERNEL,
and use __builtin___clear_cache in userland and in rump kernels.

PR 58103: bpfjit.kmod is not built on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.1364 -r1.1365 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/sljit_machdep.h
cvs rdiff -u -r1.284 -r1.285 src/sys/modules/Makefile

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1364 src/share/mk/bsd.own.mk:1.1365
--- src/share/mk/bsd.own.mk:1.1364	Mon Apr  1 22:23:14 2024
+++ src/share/mk/bsd.own.mk	Tue Apr  2 22:37:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1364 2024/04/01 22:23:14 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1365 2024/04/02 22:37:34 riastradh Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1391,9 +1391,10 @@ _MKVARS.no= \
 ${var}?=	${${var}.${MACHINE_ARCH}:U${${var}.${MACHINE}:Uno}}
 .endfor
 
-.if ${MACHINE_ARCH} == "i386" || \
-${MACHINE_ARCH} == "x86_64" || \
-${MACHINE_ARCH} == "sparc"
+.if ${MACHINE_ARCH} == "aarch64" || \
+${MACHINE_ARCH} == "i386"|| \
+${MACHINE_ARCH} == "sparc"   || \
+${MACHINE_ARCH} == "x86_64"
 MKSLJIT=	yes
 .endif
 

Index: src/sys/arch/aarch64/include/sljit_machdep.h
diff -u src/sys/arch/aarch64/include/sljit_machdep.h:1.3 src/sys/arch/aarch64/include/sljit_machdep.h:1.4
--- src/sys/arch/aarch64/include/sljit_machdep.h:1.3	Fri Dec 11 18:03:33 2020
+++ src/sys/arch/aarch64/include/sljit_machdep.h	Tue Apr  2 22:37:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sljit_machdep.h,v 1.3 2020/12/11 18:03:33 skrll Exp $	*/
+/*	$NetBSD: sljit_machdep.h,v 1.4 2024/04/02 22:37:34 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 Alexander Nasonov.
@@ -43,7 +43,12 @@
 
 #define SLJIT_CONFIG_ARM_64 1
 
-#ifdef _KERNEL
+#ifdef _HARDKERNEL
+/*
+ * XXX Currently sys/rump/include/machine/cpu.h doesn't have
+ * ci_cpufuncs for cpu_icache_sync_range, so we do this only for
+ * non-rump kernels for now.
+ */
 #define SLJIT_CACHE_FLUSH(from, to) \
 	cpu_icache_sync_range((vaddr_t)(from), (vsize_t)((to) - (from)))
 #else

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.284 src/sys/modules/Makefile:1.285
--- src/sys/modules/Makefile:1.284	Thu Mar 21 02:36:02 2024
+++ src/sys/modules/Makefile	Tue Apr  2 22:37:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.284 2024/03/21 02:36:02 riastradh Exp $
+#	$NetBSD: Makefile,v 1.285 2024/04/02 22:37:34 riastradh Exp $
 
 .include 
 
@@ -261,15 +261,9 @@ SUBDIR+=	ubsec
 .endif
 
 .if ${MKSLJIT} != "no"
-# No modules for 32-bit arm, mips and powerpc yet.
-.if ${MACHINE_ARCH} == "aarch64" || \
-${MACHINE_ARCH} == "i386"|| \
-${MACHINE_ARCH} == "sparc"   || \
-${MACHINE_ARCH} == "x86_64"
 SUBDIR+=	bpfjit
 SUBDIR+=	sljit
 .endif
-.endif
 
 #
 # ACPI modules



CVS commit: src

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:37:34 UTC 2024

Modified Files:
src/share/mk: bsd.own.mk
src/sys/arch/aarch64/include: sljit_machdep.h
src/sys/modules: Makefile

Log Message:
bsd.own.mk: Enable MKLSJIT on aarch64.

Make sure there's only one copy of the conditional, in bsd.own.mk;
just make sys/modules/Makefile conditional on MKSLJIT so we don't
have to keep these in sync.

As a workaround for PR 58106, tweak the conditional definition of
SLJIT_CACHE_FLUSH to use cpu_icache_sync_range only in _HARDKERNEL,
and use __builtin___clear_cache in userland and in rump kernels.

PR 58103: bpfjit.kmod is not built on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.1364 -r1.1365 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/sljit_machdep.h
cvs rdiff -u -r1.284 -r1.285 src/sys/modules/Makefile

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



CVS commit: src/sys/external/bsd/sljit/dist/sljit_src

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:29:57 UTC 2024

Modified Files:
src/sys/external/bsd/sljit/dist/sljit_src: sljitNativeARM_64.c

Log Message:
sljit: Pacify -Wsign-compare.

If these sizes are negative, we're probably in trouble anyway, so
assert nonnegative here.

Needed to resolve PR 58103.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c

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



CVS commit: src/sys/external/bsd/sljit/dist/sljit_src

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:29:57 UTC 2024

Modified Files:
src/sys/external/bsd/sljit/dist/sljit_src: sljitNativeARM_64.c

Log Message:
sljit: Pacify -Wsign-compare.

If these sizes are negative, we're probably in trouble anyway, so
assert nonnegative here.

Needed to resolve PR 58103.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.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/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c
diff -u src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c:1.4 src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c:1.5
--- src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c:1.4	Sun Jan 20 23:14:16 2019
+++ src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c	Tue Apr  2 22:29:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sljitNativeARM_64.c,v 1.4 2019/01/20 23:14:16 alnsn Exp $	*/
+/*	$NetBSD: sljitNativeARM_64.c,v 1.5 2024/04/02 22:29:57 riastradh Exp $	*/
 
 /*
  *Stack-less Just-In-Time compiler
@@ -1079,7 +1079,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	local_size = (local_size + 15) & ~0xf;
 	compiler->local_size = local_size;
 
-	if (local_size <= (63 * sizeof(sljit_sw))) {
+	SLJIT_ASSERT(local_size >= 0);
+	if ((size_t)local_size <= (63 * sizeof(sljit_sw))) {
 		FAIL_IF(push_inst(compiler, STP_PRE | 29 | RT2(TMP_LR)
 			| RN(TMP_SP) | ((-(local_size >> 3) & 0x7f) << 15)));
 		FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RN(TMP_SP) | (0 << 10)));
@@ -1129,7 +1130,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 
 	SLJIT_ASSERT(prev == -1);
 
-	if (compiler->local_size > (63 * sizeof(sljit_sw))) {
+	SLJIT_ASSERT(compiler->local_size >= 0);
+	if ((size_t)compiler->local_size > (63 * sizeof(sljit_sw))) {
 		/* The local_size is already adjusted by the saved registers. */
 		if (local_size > 0xfff) {
 			FAIL_IF(push_inst(compiler, SUBI | RD(TMP_SP) | RN(TMP_SP) | ((local_size >> 12) << 10) | (1 << 22)));
@@ -1179,7 +1181,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	local_size = compiler->local_size;
 
 	saved_regs_size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 0);
-	if (local_size <= (63 * sizeof(sljit_sw)))
+	SLJIT_ASSERT(local_size >= 0);
+	if ((size_t)local_size <= (63 * sizeof(sljit_sw)))
 		offs = (local_size - saved_regs_size) << (15 - 3);
 	else {
 		FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
@@ -1232,7 +1235,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 
 	SLJIT_ASSERT(prev == -1);
 
-	if (compiler->local_size <= (63 * sizeof(sljit_sw))) {
+	SLJIT_ASSERT(compiler->local_size >= 0);
+	if ((size_t)compiler->local_size <= (63 * sizeof(sljit_sw))) {
 		FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
 			| RN(TMP_SP) | (((local_size >> 3) & 0x7f) << 15)));
 	} else if (saved_regs_size > 0) {



CVS commit: src/etc

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:29:35 UTC 2024

Modified Files:
src/etc/etc.aarch64: MAKEDEV.conf
src/etc/etc.amd64: MAKEDEV.conf
src/etc/etc.i386: MAKEDEV.conf

Log Message:
MAKEDEV: Tidy some entries on x86 and Arm.

While here, reduce some diffs arising from ordering and formatting
between these architectures.

Only difference between evbarm and aarch64 now is /dev/vchiq.  Not
sure offhand if it makes sense on aarch64 or only 32-bit Arm.

PR port-amd64/58093: /dev/efi missing on x86
PR port-arm/58100: /dev/ttyVI* missing on aarch64
PR port-arm/58101: /dev/nvme* missing on aarch64
PR port-arm/58102: /dev/raid* missing on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/etc/etc.aarch64/MAKEDEV.conf
cvs rdiff -u -r1.35 -r1.36 src/etc/etc.amd64/MAKEDEV.conf
cvs rdiff -u -r1.35 -r1.36 src/etc/etc.i386/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.aarch64/MAKEDEV.conf
diff -u src/etc/etc.aarch64/MAKEDEV.conf:1.9 src/etc/etc.aarch64/MAKEDEV.conf:1.10
--- src/etc/etc.aarch64/MAKEDEV.conf:1.9	Sat Jul 24 11:39:18 2021
+++ src/etc/etc.aarch64/MAKEDEV.conf	Tue Apr  2 22:29:35 2024
@@ -1,10 +1,16 @@
-# $NetBSD: MAKEDEV.conf,v 1.9 2021/07/24 11:39:18 jmcneill Exp $
+# $NetBSD: MAKEDEV.conf,v 1.10 2024/04/02 22:29:35 riastradh Exp $
 
 all_md)
 	makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3
+	makedev nvme0 nvme0ns1 nvme0ns2 nvme0ns3 nvme0ns4
+	makedev nvme1 nvme1ns1 nvme1ns2 nvme1ns3 nvme1ns4
+	makedev nvme2 nvme2ns1 nvme2ns2 nvme2ns3 nvme2ns4
+	makedev nvme3 nvme3ns1 nvme3ns2 nvme3ns3 nvme3ns4
+	makedev raid0 raid1 raid2 raid3
 	makedev ld0 ld1 ld2 ld3 ld4 ld5 ld6 ld7 dk0 dk1 dk2 dk3 dk4 dk5 dk6 dk7
 	makedev flash0 flash1 flash2 flash3 flash4 flash5 flash6 flash7
-	makedev tty0 tty1 plcom0 st0 st1 ch0 cd0 cd1
+	makedev tty0 tty1 tty2 tty3 plcom0
+	makedev st0 st1 ch0 cd0 cd1
 	makedev uk0 uk1 ss0
 	makedev lpa0 lpt0
 	makedev usbs
@@ -20,8 +26,8 @@ all_md)
 	makedev spiflash0
 	makedev bpf
 	makedev openfirm
-	makedev acpi
-	makedev smbios
+	makedev acpi smbios efi
+	makedev ttyVI
 	;;
 
 ramdisk|floppy)

Index: src/etc/etc.amd64/MAKEDEV.conf
diff -u src/etc/etc.amd64/MAKEDEV.conf:1.35 src/etc/etc.amd64/MAKEDEV.conf:1.36
--- src/etc/etc.amd64/MAKEDEV.conf:1.35	Sun Dec 11 17:35:56 2022
+++ src/etc/etc.amd64/MAKEDEV.conf	Tue Apr  2 22:29:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.35 2022/12/11 17:35:56 kre Exp $
+# $NetBSD: MAKEDEV.conf,v 1.36 2024/04/02 22:29:35 riastradh Exp $
 
 # As of 2003-04-17, the "init" case must not create more than 890 entries.
 all_md)
@@ -45,8 +45,7 @@ all_md)
 	makedev kttcp
 	makedev bio
 	makedev xmm0
-	makedev acpi
-	makedev smbios
+	makedev acpi smbios efi
 	makedev ttyVI
 	;;
 

Index: src/etc/etc.i386/MAKEDEV.conf
diff -u src/etc/etc.i386/MAKEDEV.conf:1.35 src/etc/etc.i386/MAKEDEV.conf:1.36
--- src/etc/etc.i386/MAKEDEV.conf:1.35	Fri Aug 12 11:15:41 2022
+++ src/etc/etc.i386/MAKEDEV.conf	Tue Apr  2 22:29:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.35 2022/08/12 11:15:41 riastradh Exp $
+# $NetBSD: MAKEDEV.conf,v 1.36 2024/04/02 22:29:35 riastradh Exp $
 
 # As of 2005-03-15, the "init" case must not create more than 1024 entries.
 all_md)
@@ -23,6 +23,7 @@ all_md)
 	makedev usbs
 	makedev ipty
 	makedev local
+	makedev cfs
 	makedev lpa0 lpa1 lpa2
 	makedev lpt0 lpt1 lpt2
 	makedev ss0 uk0 uk1
@@ -48,9 +49,7 @@ all_md)
 	makedev kttcp
 	makedev io
 	makedev bio
-	makedev cfs
-	makedev acpi
-	makedev smbios
+	makedev acpi smbios efi
 	makedev ttyVI
 	;;
 



CVS commit: src/etc

2024-04-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr  2 22:29:35 UTC 2024

Modified Files:
src/etc/etc.aarch64: MAKEDEV.conf
src/etc/etc.amd64: MAKEDEV.conf
src/etc/etc.i386: MAKEDEV.conf

Log Message:
MAKEDEV: Tidy some entries on x86 and Arm.

While here, reduce some diffs arising from ordering and formatting
between these architectures.

Only difference between evbarm and aarch64 now is /dev/vchiq.  Not
sure offhand if it makes sense on aarch64 or only 32-bit Arm.

PR port-amd64/58093: /dev/efi missing on x86
PR port-arm/58100: /dev/ttyVI* missing on aarch64
PR port-arm/58101: /dev/nvme* missing on aarch64
PR port-arm/58102: /dev/raid* missing on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/etc/etc.aarch64/MAKEDEV.conf
cvs rdiff -u -r1.35 -r1.36 src/etc/etc.amd64/MAKEDEV.conf
cvs rdiff -u -r1.35 -r1.36 src/etc/etc.i386/MAKEDEV.conf

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



CVS commit: src

2024-04-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr  1 18:33:24 UTC 2024

Modified Files:
src/external/bsd/elftoolchain/dist/libelf: _libelf_config.h libelf.h
src/external/bsd/elftoolchain/lib/libdwarf: Makefile
src/external/cddl/osnet/dist/lib/libdtrace/common: drti.c dt_module.c
src/external/cddl/osnet/sys: elf.h
src/external/cddl/osnet/sys/sys: elf.h
src/tests/lib/libc/sys: t_ptrace_wait.c
src/tools/ctfconvert: Makefile
src/tools/ctfmerge: Makefile
src/tools/elftoolchain/libdwarf: Makefile
src/tools/elftoolchain/libelf: Makefile
src/tools/libctf: Makefile
src/usr.bin/kdump: Makefile.ioctl-c
src/usr.sbin/tprof: ksyms.c

Log Message:
elftoolchain: Be consistent about which ELF header files we use.

1. For tools that use elftoolchain: always use elftoolchain's
   elfdefinitions.h.  Don't even think about looking at the host's
   sys/exec_elf.h, which makes no sense and should never happen.

   (ELF tools that don't use elftoolchain, like m68k-elf2coff,
   continue to use nbincludes/sys/exec_elf.h.  But no more nbincludes
   hacks in elftoolchain.)

2. For kernel components (solaris, zfs, dtrace): always use
   sys/exec_elf.h, even in Solaris components via sys/elf.h.
   elfdefinitions.h is not wired up in the kernel build at all.

3. For most userland components that involve libelf: use
   elfdefinitions.h via libelf header files (libelf.h, gelf.h).

   libdtrace in particular requires _all_ R_* reloc type definitions,
   but sys/exec_elf.h brings in only the _current machine's_ R_*
   reloc type definitions.  (While here: Use uintptr_t instead of
   Elf_Addr for pointer-to-integer cast, since Elf_Addr is MD and
   provided only by sys/exec_elf.h, not by elfdefinitions.h.)

   And most userland components using libelf don't rely on any
   properties of the current machine from sys/exec_elf.h, so they can
   use libelf's elfdefinition.h.

   Exceptions:

   - dtrace drti.c relies on link.h -> link_elf.h -> sys/exec_elf.h,
 but it also relies on sys/dtrace.h -> sys/elf.h ->
 elfdefinitions.h like other userland components using sys/elf.h.

   - kdump-ioctl.c uses sys/exec_elf.h directly and sys/dtrace.h ->
 sys/elf.h -> elfdefinitions like other userland components using
 sys/elf.h.

   - t_ptrace_wait.c (via t_ptrace_core_wait.h) uses libelf to parse
 core files, but relies on sys/exec_elf.h for struct
 netbsd_elfcore_procinfo.

   None of these exceptions needs all R_* reloc type definitions, so
   as a workaround, we can just suppress libelf's elfdefinitions.h by
   defining _SYS_ELFDEFINITIONS_H_ and use sys/exec_elf.h in these
   exceptions.

And undo the whole BUILTIN_ELF_HEADERS mistake.  This was:

- half bogus workarounds for missing build_install dependencies in
  tools/Makefile, which are no longer missing now, and
- half futile attempt to use src/sys/sys/exec_elf.h via nbincludes in
  tools involving libelf instead of libelf's elfdefinitions.h, which
  collides.

Longer-term, we may wish to unify sys/exec_elf.h and libelf's
elfdefinitions.h, so we don't have to play these games.

But at least now the games are limited to three .c files (one of
which is generated by Makefile.ioctl-c), rather than haphazardly
applied tree-wide by monstrous kludges in widely used .h files with
broken hackarounds to get the tools build lurching to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h \
src/external/bsd/elftoolchain/dist/libelf/libelf.h
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/elftoolchain/lib/libdwarf/Makefile
cvs rdiff -u -r1.8 -r1.9 \
src/external/cddl/osnet/dist/lib/libdtrace/common/drti.c
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/elf.h
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/sys/elf.h
cvs rdiff -u -r1.191 -r1.192 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.10 -r1.11 src/tools/ctfconvert/Makefile
cvs rdiff -u -r1.11 -r1.12 src/tools/ctfmerge/Makefile
cvs rdiff -u -r1.6 -r1.7 src/tools/elftoolchain/libdwarf/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tools/elftoolchain/libelf/Makefile
cvs rdiff -u -r1.9 -r1.10 src/tools/libctf/Makefile
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/kdump/Makefile.ioctl-c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/ksyms.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/elftoolchain/dist/libelf/_libelf_config.h
diff -u src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h:1.6 src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h:1.7
--- src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h:1.6	Sun Mar  3 17:37:33 2024
+++ src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h	Mon Apr  1 

CVS commit: src

2024-04-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr  1 18:33:24 UTC 2024

Modified Files:
src/external/bsd/elftoolchain/dist/libelf: _libelf_config.h libelf.h
src/external/bsd/elftoolchain/lib/libdwarf: Makefile
src/external/cddl/osnet/dist/lib/libdtrace/common: drti.c dt_module.c
src/external/cddl/osnet/sys: elf.h
src/external/cddl/osnet/sys/sys: elf.h
src/tests/lib/libc/sys: t_ptrace_wait.c
src/tools/ctfconvert: Makefile
src/tools/ctfmerge: Makefile
src/tools/elftoolchain/libdwarf: Makefile
src/tools/elftoolchain/libelf: Makefile
src/tools/libctf: Makefile
src/usr.bin/kdump: Makefile.ioctl-c
src/usr.sbin/tprof: ksyms.c

Log Message:
elftoolchain: Be consistent about which ELF header files we use.

1. For tools that use elftoolchain: always use elftoolchain's
   elfdefinitions.h.  Don't even think about looking at the host's
   sys/exec_elf.h, which makes no sense and should never happen.

   (ELF tools that don't use elftoolchain, like m68k-elf2coff,
   continue to use nbincludes/sys/exec_elf.h.  But no more nbincludes
   hacks in elftoolchain.)

2. For kernel components (solaris, zfs, dtrace): always use
   sys/exec_elf.h, even in Solaris components via sys/elf.h.
   elfdefinitions.h is not wired up in the kernel build at all.

3. For most userland components that involve libelf: use
   elfdefinitions.h via libelf header files (libelf.h, gelf.h).

   libdtrace in particular requires _all_ R_* reloc type definitions,
   but sys/exec_elf.h brings in only the _current machine's_ R_*
   reloc type definitions.  (While here: Use uintptr_t instead of
   Elf_Addr for pointer-to-integer cast, since Elf_Addr is MD and
   provided only by sys/exec_elf.h, not by elfdefinitions.h.)

   And most userland components using libelf don't rely on any
   properties of the current machine from sys/exec_elf.h, so they can
   use libelf's elfdefinition.h.

   Exceptions:

   - dtrace drti.c relies on link.h -> link_elf.h -> sys/exec_elf.h,
 but it also relies on sys/dtrace.h -> sys/elf.h ->
 elfdefinitions.h like other userland components using sys/elf.h.

   - kdump-ioctl.c uses sys/exec_elf.h directly and sys/dtrace.h ->
 sys/elf.h -> elfdefinitions like other userland components using
 sys/elf.h.

   - t_ptrace_wait.c (via t_ptrace_core_wait.h) uses libelf to parse
 core files, but relies on sys/exec_elf.h for struct
 netbsd_elfcore_procinfo.

   None of these exceptions needs all R_* reloc type definitions, so
   as a workaround, we can just suppress libelf's elfdefinitions.h by
   defining _SYS_ELFDEFINITIONS_H_ and use sys/exec_elf.h in these
   exceptions.

And undo the whole BUILTIN_ELF_HEADERS mistake.  This was:

- half bogus workarounds for missing build_install dependencies in
  tools/Makefile, which are no longer missing now, and
- half futile attempt to use src/sys/sys/exec_elf.h via nbincludes in
  tools involving libelf instead of libelf's elfdefinitions.h, which
  collides.

Longer-term, we may wish to unify sys/exec_elf.h and libelf's
elfdefinitions.h, so we don't have to play these games.

But at least now the games are limited to three .c files (one of
which is generated by Makefile.ioctl-c), rather than haphazardly
applied tree-wide by monstrous kludges in widely used .h files with
broken hackarounds to get the tools build lurching to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h \
src/external/bsd/elftoolchain/dist/libelf/libelf.h
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/elftoolchain/lib/libdwarf/Makefile
cvs rdiff -u -r1.8 -r1.9 \
src/external/cddl/osnet/dist/lib/libdtrace/common/drti.c
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/elf.h
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/sys/elf.h
cvs rdiff -u -r1.191 -r1.192 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.10 -r1.11 src/tools/ctfconvert/Makefile
cvs rdiff -u -r1.11 -r1.12 src/tools/ctfmerge/Makefile
cvs rdiff -u -r1.6 -r1.7 src/tools/elftoolchain/libdwarf/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tools/elftoolchain/libelf/Makefile
cvs rdiff -u -r1.9 -r1.10 src/tools/libctf/Makefile
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/kdump/Makefile.ioctl-c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/ksyms.c

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



CVS commit: src/doc

2024-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Mar 31 00:06:24 UTC 2024

Modified Files:
src/doc: 3RDPARTY

Log Message:
docs/3RDPARTY: Record vendor and release tags for elftoolchain.


To generate a diff of this commit:
cvs rdiff -u -r1.2000 -r1.2001 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.2000 src/doc/3RDPARTY:1.2001
--- src/doc/3RDPARTY:1.2000	Fri Mar 15 15:49:01 2024
+++ src/doc/3RDPARTY	Sun Mar 31 00:06:23 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.2000 2024/03/15 15:49:01 riastradh Exp $
+#	$NetBSD: 3RDPARTY,v 1.2001 2024/03/31 00:06:23 riastradh Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1648,6 +1648,8 @@ Mailing List:	none
 Responsible:	christos
 License:	BSD-like (2-clause)
 Location:	sys/external/bsd/elftoolchain/dist
+Vendor tag:	FreeBSD
+Release tag:	elftoolchain-rN
 Notes:
 		See README we use the svn id as the tag.
 



CVS commit: src/doc

2024-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Mar 31 00:06:24 UTC 2024

Modified Files:
src/doc: 3RDPARTY

Log Message:
docs/3RDPARTY: Record vendor and release tags for elftoolchain.


To generate a diff of this commit:
cvs rdiff -u -r1.2000 -r1.2001 src/doc/3RDPARTY

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



CVS commit: src/tools/elftoolchain/libdwarf

2024-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 30 22:39:53 UTC 2024

Modified Files:
src/tools/elftoolchain/libdwarf: Makefile

Log Message:
tools/elftoolchain: Build with BUILTIN_ELF_HEADERS again.

The header file dependency that motivated disabling this should be
resolved now.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tools/elftoolchain/libdwarf/Makefile

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

Modified files:

Index: src/tools/elftoolchain/libdwarf/Makefile
diff -u src/tools/elftoolchain/libdwarf/Makefile:1.5 src/tools/elftoolchain/libdwarf/Makefile:1.6
--- src/tools/elftoolchain/libdwarf/Makefile:1.5	Wed Mar 27 21:54:43 2024
+++ src/tools/elftoolchain/libdwarf/Makefile	Sat Mar 30 22:39:53 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2024/03/27 21:54:43 christos Exp $
+#	$NetBSD: Makefile,v 1.6 2024/03/30 22:39:53 riastradh Exp $
 
 HOSTLIB=dwarf
 
@@ -73,6 +73,7 @@ COMPATLIB_NO_LIB= yes # only the include
 
 LIBDWARF_OBJDIR!= cd ${.CURDIR} && ${PRINTOBJDIR}
 
+CPPFLAGS+=	-DBUILTIN_ELF_HEADERS
 CPPFLAGS+=	-I${.CURDIR}/../../compat
 CPPFLAGS+=	-I${.CURDIR}/../../common
 CPPFLAGS+=	-I${LIBDWARF_OBJDIR}/../common



CVS commit: src/tools/elftoolchain/libdwarf

2024-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 30 22:39:53 UTC 2024

Modified Files:
src/tools/elftoolchain/libdwarf: Makefile

Log Message:
tools/elftoolchain: Build with BUILTIN_ELF_HEADERS again.

The header file dependency that motivated disabling this should be
resolved now.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tools/elftoolchain/libdwarf/Makefile

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



CVS commit: src/tools

2024-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 30 22:38:03 UTC 2024

Modified Files:
src/tools: Makefile
Removed Files:
src/tools/elftoolchain: Makefile

Log Message:
tools/elftoolchain: Handle dependencies properly.

This should properly resolve the problem christos was trying to
address by a bogus make includes hack and #ifdefs in elftoolchain.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/tools/Makefile
cvs rdiff -u -r1.2 -r0 src/tools/elftoolchain/Makefile

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

Modified files:

Index: src/tools/Makefile
diff -u src/tools/Makefile:1.217 src/tools/Makefile:1.218
--- src/tools/Makefile:1.217	Wed Mar 27 05:43:38 2024
+++ src/tools/Makefile	Sat Mar 30 22:38:02 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.217 2024/03/27 05:43:38 rillig Exp $
+#	$NetBSD: Makefile,v 1.218 2024/03/30 22:38:02 riastradh Exp $
 
 .include 
 .include 
@@ -59,7 +59,9 @@ TOOLCHAIN_BITS+= dbsym mdsetimage
 
 DTRACE_BITS=
 .if ${MKDTRACE} != "no" || ${MKCTF} != "no"
-DTRACE_BITS+= .WAIT elftoolchain
+DTRACE_BITS+= .WAIT elftoolchain/common
+DTRACE_BITS+= .WAIT elftoolchain/libelf
+DTRACE_BITS+= .WAIT elftoolchain/libdwarf
 DTRACE_BITS+= .WAIT libctf
 .endif
 .if ${MKCTF} != "no"



CVS commit: src/tools

2024-03-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 30 22:38:03 UTC 2024

Modified Files:
src/tools: Makefile
Removed Files:
src/tools/elftoolchain: Makefile

Log Message:
tools/elftoolchain: Handle dependencies properly.

This should properly resolve the problem christos was trying to
address by a bogus make includes hack and #ifdefs in elftoolchain.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/tools/Makefile
cvs rdiff -u -r1.2 -r0 src/tools/elftoolchain/Makefile

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



CVS commit: src/usr.sbin/mountd

2024-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar 29 14:15:02 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5

Log Message:
exports(5): Tiny punctuation fix in man page.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/mountd/exports.5

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/mountd/exports.5
diff -u src/usr.sbin/mountd/exports.5:1.37 src/usr.sbin/mountd/exports.5:1.38
--- src/usr.sbin/mountd/exports.5:1.37	Fri Mar 29 00:23:05 2024
+++ src/usr.sbin/mountd/exports.5	Fri Mar 29 14:15:02 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: exports.5,v 1.37 2024/03/29 00:23:05 snj Exp $
+.\"	$NetBSD: exports.5,v 1.38 2024/03/29 14:15:02 riastradh Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -408,7 +408,7 @@ directory within
 .Pa /u2
 and mapping all uids to credentials for the principal
 that is authenticated by a Kerberos ticket.
-.Pq Sy Kerberos not implemented .
+.Pq Sy Kerberos not implemented.
 .It Pa /a
 is exported to the network
 .Ql 192.168.0.0 ,



CVS commit: src/usr.sbin/mountd

2024-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar 29 14:15:02 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5

Log Message:
exports(5): Tiny punctuation fix in man page.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/mountd/exports.5

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



CVS commit: src/sys/stand/efiboot

2024-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 28 18:24:57 UTC 2024

Modified Files:
src/sys/stand/efiboot: efiboot.c

Log Message:
efiboot: Duplicate efi_bootdp before we clobber it in efi_net_probe.

Patch from jakllsch@.  Makes Socionext Synquacer boot considerably
more reliably.

PR kern/58075


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/stand/efiboot/efiboot.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/stand/efiboot/efiboot.c
diff -u src/sys/stand/efiboot/efiboot.c:1.22 src/sys/stand/efiboot/efiboot.c:1.23
--- src/sys/stand/efiboot/efiboot.c:1.22	Wed Oct  6 10:13:19 2021
+++ src/sys/stand/efiboot/efiboot.c	Thu Mar 28 18:24:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.c,v 1.22 2021/10/06 10:13:19 jmcneill Exp $ */
+/* $NetBSD: efiboot.c,v 1.23 2024/03/28 18:24:57 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -86,6 +86,8 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS
 	status = uefi_call_wrapper(BS->HandleProtocol, 3, efi_li->DeviceHandle, , (void **)_bootdp);
 	if (EFI_ERROR(status))
 		efi_bootdp = NULL;
+	else
+		efi_bootdp = DuplicateDevicePath(efi_bootdp);
 
 #ifdef EFIBOOT_DEBUG
 	Print(L"Loaded image  : 0x%" PRIxEFIPTR "\n", efi_li);



CVS commit: src/sys/stand/efiboot

2024-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 28 18:24:57 UTC 2024

Modified Files:
src/sys/stand/efiboot: efiboot.c

Log Message:
efiboot: Duplicate efi_bootdp before we clobber it in efi_net_probe.

Patch from jakllsch@.  Makes Socionext Synquacer boot considerably
more reliably.

PR kern/58075


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/stand/efiboot/efiboot.c

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



CVS commit: src/sbin/fsirand

2024-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 28 15:39:42 UTC 2024

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

Log Message:
fsirand(8): Fix security claims.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/fsirand/fsirand.8

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



CVS commit: src/sbin/fsirand

2024-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 28 15:39:42 UTC 2024

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

Log Message:
fsirand(8): Fix security claims.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/fsirand/fsirand.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/fsirand/fsirand.8
diff -u src/sbin/fsirand/fsirand.8:1.10 src/sbin/fsirand/fsirand.8:1.11
--- src/sbin/fsirand/fsirand.8:1.10	Sun Sep 11 21:22:18 2016
+++ src/sbin/fsirand/fsirand.8	Thu Mar 28 15:39:42 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fsirand.8,v 1.10 2016/09/11 21:22:18 sevan Exp $
+.\"	$NetBSD: fsirand.8,v 1.11 2024/03/28 15:39:42 riastradh Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -43,8 +43,17 @@
 .Nm
 writes random inode generation numbers for all the inodes on device
 .Ar special .
-These random numbers make the NFS filehandles less predictable, increasing
-security of exported filesystems.
+These random numbers make the NFS filehandles less predictable, which
+was once thought to increase security of exported file systems.
+.Pp
+.Nm
+is no longer relevant because
+.Xr newfs 8
+has randomized inode generation numbers on all new file systems since
+.Nx 2.0 ,
+and in any case, exporting a file system to NFS clients allows them to
+traverse the entire file system, so making filehandles less predictable
+does not prevent clients from finding them anyway.
 .Pp
 .Nm
 should be run on a clean and unmounted filesystem.



CVS commit: src/sys/dev/acpi

2024-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 28 13:40:08 UTC 2024

Modified Files:
src/sys/dev/acpi: apei_einj.c

Log Message:
apei(4): Fix uninitialized stack access in error branch.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/apei_einj.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/acpi

2024-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar 28 13:40:08 UTC 2024

Modified Files:
src/sys/dev/acpi: apei_einj.c

Log Message:
apei(4): Fix uninitialized stack access in error branch.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/apei_einj.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/acpi/apei_einj.c
diff -u src/sys/dev/acpi/apei_einj.c:1.6 src/sys/dev/acpi/apei_einj.c:1.7
--- src/sys/dev/acpi/apei_einj.c:1.6	Tue Mar 26 22:01:03 2024
+++ src/sys/dev/acpi/apei_einj.c	Thu Mar 28 13:40:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: apei_einj.c,v 1.6 2024/03/26 22:01:03 rillig Exp $	*/
+/*	$NetBSD: apei_einj.c,v 1.7 2024/03/28 13:40:08 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apei_einj.c,v 1.6 2024/03/26 22:01:03 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apei_einj.c,v 1.7 2024/03/28 13:40:08 riastradh Exp $");
 
 #include 
 
@@ -516,6 +516,16 @@ apei_einj_trigger(struct apei_softc *sc,
 	uint32_t i, nentries;
 
 	/*
+	 * Initialize the machine to execute the TRIGGER_ERROR action's
+	 * instructions.  Do this early to keep the error branches
+	 * simpler.
+	 */
+	memset(M, 0, sizeof(*M));
+	M->sc = sc;
+	M->x = x;		/* input */
+	M->y = 0;		/* output */
+
+	/*
 	 * Get the TRIGGER_ERROR action table's physical address.
 	 */
 	teatab_pa = apei_einj_act(sc, ACPI_EINJ_GET_TRIGGER_TABLE, 0);
@@ -588,15 +598,6 @@ apei_einj_trigger(struct apei_softc *sc,
 	teatab = AcpiOsMapMemory(teatab_pa, mapsize);
 
 	/*
-	 * Initialize the machine to execute the TRIGGER_ERROR action's
-	 * instructions.
-	 */
-	memset(M, 0, sizeof(*M));
-	M->sc = sc;
-	M->x = x;		/* input */
-	M->y = 0;		/* output */
-
-	/*
 	 * Now iterate over the EINJ-type entries and execute the
 	 * trigger error action instructions -- but skip if they're not
 	 * for the TRIGGER_ERROR action, and stop if they're truncated.



CVS commit: src/usr.sbin/mountd

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 27 01:43:26 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5

Log Message:
exports(5): Substantially rewrite for clarity.

Hope this is an improvement over the turgid paragraphs all about
first/second/third cases of everything.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/mountd/exports.5

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/mountd/exports.5
diff -u src/usr.sbin/mountd/exports.5:1.34 src/usr.sbin/mountd/exports.5:1.35
--- src/usr.sbin/mountd/exports.5:1.34	Wed Mar 27 00:46:17 2024
+++ src/usr.sbin/mountd/exports.5	Wed Mar 27 01:43:26 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: exports.5,v 1.34 2024/03/27 00:46:17 riastradh Exp $
+.\"	$NetBSD: exports.5,v 1.35 2024/03/27 01:43:26 riastradh Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -39,116 +39,147 @@
 mount requests
 .Sh DESCRIPTION
 The
-.Nm exports
+.Nm
 file on an
 .Tn NFS
-server, used by
-.Xr mountd 8 ,
-lists filesystems to be exported to
+server lists filesystems to be exported to
 .Tn NFS
 clients.
+It is read and applied by
+.Xr mountd 8
+on start and on
+.Dv SIGHUP .
+.Pp
+Each entry in
+.Nm
+is a line with a list of directories followed by a list of hosts,
+netgroups, and options, separated by spaces or tabs:
+.Pp
+.Dl Pf / Va dir "..." Oo Va host | Va netgroup | Fl Va option Oc "..."
+.Pp
+All directories in a single line must live in the same filesystem,
+which is exported to the hosts and netgroups listed, according to the
+options specified.
+Exported directories must not have pathname components that are
+symbolic links,
+.Ql "." ,
+or
+.Ql ".." .
 .Pp
+.Bf -symbolic
+Warning:
 Exporting a directory exposes the
 .Em entire
 content of the filesystem that the directory lives in to
 .Tn NFS
-clients, even it it isn't the root directory of a filesystem on the
-server.
-The list of exports is only what the server advertises to clients in
-the mount protocol, not a restriction on what files or directories
-within exported filesystems clients have access to with
-.Tn NFS .
-.Pp
-Each line in the file
-(other than comment lines that begin with a
-.Sq # )
-specifies the mount point(s) and export flags within one local server
-filesystem for one or more hosts.
-A host may be specified only once for each local filesystem on the
-server and there may be only one default entry for each server
-filesystem that applies to all other hosts.
-The latter exports the filesystem to the
-.Dq world
-and should
-be used only when the filesystem contains public information.
+clients.
+.Ef
+This happens even if an exported directory is not the root directory of
+a filesystem on the server.
+.Tn NFS
+clients are only prevented from access to files and directories on
+filesystems that are
+.Em not
+exported at all.
 .Pp
-If you have modified the
-.Pa /etc/exports
-file, send the mountd a SIGHUP to make it re-read the
-.Pa /etc/exports
-file:
-.Dq kill -HUP `cat /var/run/mountd.pid` .
+.Bf -symbolic
+Warning:
+Access control is only by network address.
+.Ef
+.Tn NFS
+servers with any non-public data should be exposed only to restricted
+or firewalled networks with ingress filtering.
+There is no authentication or encryption to make it safe for
+restricting access on the open internet.
+.Pp
+Blank lines are ignored.
+Text beginning with
+.Ql #
+until the end of line is ignored as a comment.
+Each line ending with
+.Ql \e
+has the next line appended, without the
+.Ql \e ,
+as a continuation line.
+Characters can be escaped with
+.Ql \e .
+.Pp
+All directories, which begin with
+.Ql / ,
+must come before any hosts, netgroups, or options on a line.
+Options begin with
+.Ql - .
+All other items on an export line are interpreted either as netgroups
+(see
+.Xr netgroup 5 )
+or as hosts, which can be either names, as in example.com, or numbers,
+as in 192.0.2.123 or 2001:db8:1234:abcd::42.
+Sets of hosts in a contiguous network range can be specified with the
+.Fl network
+option.
 .Pp
-In a mount entry,
-the first field(s) specify the directory path(s) within a server filesystem
-that can be mounted on by the corresponding client(s).
-There are two forms of this specification.
-The first is to list all mount points as absolute
-directory paths separated by whitespace.
-The second is to specify the pathname of the root of the filesystem
-followed by the
-.Fl alldirs
-flag;
-this form allows the host(s) to mount at any point within the filesystem,
+The same filesystem may be exported on multiple lines with different
+options to different sets of hosts, as long as it is exported at most
+once to each host, netgroup, or network.
+.Pp
+Export lines with no hosts, netgroups, or
+.Fl network
+options are exported to
+.Em any
+hosts on the network, with no access control.

CVS commit: src/usr.sbin/mountd

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 27 01:43:26 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5

Log Message:
exports(5): Substantially rewrite for clarity.

Hope this is an improvement over the turgid paragraphs all about
first/second/third cases of everything.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/mountd/exports.5

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



CVS commit: src/usr.sbin/mountd

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 27 00:46:17 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5

Log Message:
exports(5): Revert warning about `-ro' on read/write file systems.

Looks like the nfs server does enforce that after all, in spite of
the rather oblique commentary in the BUGS section about export
options being tied to local mount point options with which they must
be noncontradictory.

And there's no reason in principle it shouldn't enforce this -- it
just need to block various file system _operations_, rather than the
subtree issue where the criteria for evaluating whether operations
are allowed on particular _file handles_ are too painful to
contemplate.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/mountd/exports.5

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/mountd/exports.5
diff -u src/usr.sbin/mountd/exports.5:1.33 src/usr.sbin/mountd/exports.5:1.34
--- src/usr.sbin/mountd/exports.5:1.33	Tue Mar 26 23:32:43 2024
+++ src/usr.sbin/mountd/exports.5	Wed Mar 27 00:46:17 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: exports.5,v 1.33 2024/03/26 23:32:43 riastradh Exp $
+.\"	$NetBSD: exports.5,v 1.34 2024/03/27 00:46:17 riastradh Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -174,33 +174,14 @@ This option is currently not implemented
 .Pp
 The
 .Fl ro
-option should be specified for filesystems that are read-only (default
-is to assume read/write).
+option specifies that the filesystem should be exported read-only
+(default read/write).
 The option
 .Fl o
 is a synonym for
 .Fl ro
 in an effort to be backward compatible with older export file formats.
 .Pp
-.Bf -symbolic
-Warning:
-Exporting a read/write filesystem with
-.Fl ro
-.Em does not
-prevent clients from writing to it.
-.Ef
-To prevent clients from writing to a filesystem, it must be mounted
-read-only
-.Em on the server
-in the first place.
-To export a read/write filesystem so clients can only read from it, not
-write to it, you can mount a read-only nullfs from the filesystem with
-.Xr mount_null 8
-using the
-.Fl o Cm ro
-option, and then export the read-only nullfs instead.
-See also caveats about nullfs namespace below.
-.Pp
 The
 .Fl noresvport
 option specifies that NFS RPC calls for the filesystem do not have to come
@@ -424,7 +405,7 @@ systems.
 .Pp
 .Pp
 Filesystems that provide a namespace for a subtree of another
-filesystem such as nullfs 
+filesystem such as nullfs
 .No ( Xr mount_null 8 )
 and umapfs
 .No ( Xr mount_umap 8 )



CVS commit: src/usr.sbin/mountd

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 27 00:46:17 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5

Log Message:
exports(5): Revert warning about `-ro' on read/write file systems.

Looks like the nfs server does enforce that after all, in spite of
the rather oblique commentary in the BUGS section about export
options being tied to local mount point options with which they must
be noncontradictory.

And there's no reason in principle it shouldn't enforce this -- it
just need to block various file system _operations_, rather than the
subtree issue where the criteria for evaluating whether operations
are allowed on particular _file handles_ are too painful to
contemplate.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/mountd/exports.5

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



CVS commit: src/usr.sbin/mountd

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 23:32:43 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5 mountd.8

Log Message:
exports(5), mountd(8): First pass at clarifying export semantics.

The exports(5) man page is full of walls of turgid prose that should
be itemized lists with syntax templates, and I'm itching to rewrite
it, but let's get the security-relevant warnings out of the way
first.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/mountd/exports.5
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/mountd/mountd.8

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/mountd/exports.5
diff -u src/usr.sbin/mountd/exports.5:1.32 src/usr.sbin/mountd/exports.5:1.33
--- src/usr.sbin/mountd/exports.5:1.32	Thu Mar 28 22:54:25 2013
+++ src/usr.sbin/mountd/exports.5	Tue Mar 26 23:32:43 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: exports.5,v 1.32 2013/03/28 22:54:25 njoly Exp $
+.\"	$NetBSD: exports.5,v 1.33 2024/03/26 23:32:43 riastradh Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -34,22 +34,30 @@
 .Os
 .Sh NAME
 .Nm exports
-.Nd define remote mount points for
+.Nd exported filesystem mount points for
 .Tn NFS
 mount requests
-.Sh SYNOPSIS
-.Nm exports
 .Sh DESCRIPTION
 The
 .Nm exports
-file specifies remote mount points for the
+file on an
 .Tn NFS
-mount protocol per the
+server, used by
+.Xr mountd 8 ,
+lists filesystems to be exported to
 .Tn NFS
-server specification; see
-.%T "Network File System Protocol Specification RFC 1094, Appendix A"
-and
-.%T "NFS: Network File System Version 3 Specification, Appendix I" .
+clients.
+.Pp
+Exporting a directory exposes the
+.Em entire
+content of the filesystem that the directory lives in to
+.Tn NFS
+clients, even it it isn't the root directory of a filesystem on the
+server.
+The list of exports is only what the server advertises to clients in
+the mount protocol, not a restriction on what files or directories
+within exported filesystems clients have access to with
+.Tn NFS .
 .Pp
 Each line in the file
 (other than comment lines that begin with a
@@ -166,14 +174,33 @@ This option is currently not implemented
 .Pp
 The
 .Fl ro
-option specifies that the filesystem should be exported read-only
-(default read/write).
+option should be specified for filesystems that are read-only (default
+is to assume read/write).
 The option
 .Fl o
 is a synonym for
 .Fl ro
 in an effort to be backward compatible with older export file formats.
 .Pp
+.Bf -symbolic
+Warning:
+Exporting a read/write filesystem with
+.Fl ro
+.Em does not
+prevent clients from writing to it.
+.Ef
+To prevent clients from writing to a filesystem, it must be mounted
+read-only
+.Em on the server
+in the first place.
+To export a read/write filesystem so clients can only read from it, not
+write to it, you can mount a read-only nullfs from the filesystem with
+.Xr mount_null 8
+using the
+.Fl o Cm ro
+option, and then export the read-only nullfs instead.
+See also caveats about nullfs namespace below.
+.Pp
 The
 .Fl noresvport
 option specifies that NFS RPC calls for the filesystem do not have to come
@@ -369,6 +396,23 @@ The default remote mount-point file.
 .Xr mountd 8 ,
 .Xr nfsd 8 ,
 .Xr showmount 8
+.Rs
+.%T NFS: Network File System Protocol Specification
+.%R RFC 1094
+.%I IETF Network Working Group
+.%O Appendix A
+.%U https://datatracker.ietf.org/doc/html/rfc1094#appendix-A.1
+.Re
+.Rs
+.%A B. Callaghan
+.%A B. Pawlowski
+.%A P. Staubach
+.%T NFS Version 3 Protocol Specification
+.%R RFC 1813
+.%I IETF Network Working Group
+.%O Appendix I
+.%U https://datatracker.ietf.org/doc/html/rfc1813#section-5.0
+.Re
 .Sh CAVEATS
 Don't re-export NFS-mounted filesystems unless you are sure of the
 implications.
@@ -377,6 +421,21 @@ systems being exported, e.g. when timest
 Re-exporting should work to some extent and can even be useful in
 some cases, but don't expect it works as well as with local file
 systems.
+.Pp
+.Pp
+Filesystems that provide a namespace for a subtree of another
+filesystem such as nullfs 
+.No ( Xr mount_null 8 )
+and umapfs
+.No ( Xr mount_umap 8 )
+.Em do not
+restrict
+.Tn NFS
+clients to that namespace, so they cannot be used to securely limit
+.Tn NFS
+clients to a subtree of a filesystem.
+If you want to export one subtree and prevent access to other subtrees,
+the exported subtree must be on its own filesystem on the server.
 .Sh BUGS
 The export options are tied to the local mount points in the kernel and
 must be non-contradictory for any exported subdirectory of the local

Index: src/usr.sbin/mountd/mountd.8
diff -u src/usr.sbin/mountd/mountd.8:1.42 src/usr.sbin/mountd/mountd.8:1.43
--- src/usr.sbin/mountd/mountd.8:1.42	Wed Mar 15 20:39:12 2023
+++ src/usr.sbin/mountd/mountd.8	Tue Mar 26 23:32:43 2024
@@ -1,4 +1,4 @@
-.\"	

CVS commit: src/usr.sbin/mountd

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 23:32:43 UTC 2024

Modified Files:
src/usr.sbin/mountd: exports.5 mountd.8

Log Message:
exports(5), mountd(8): First pass at clarifying export semantics.

The exports(5) man page is full of walls of turgid prose that should
be itemized lists with syntax templates, and I'm itching to rewrite
it, but let's get the security-relevant warnings out of the way
first.

PR misc/58063


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/mountd/exports.5
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/mountd/mountd.8

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



CVS commit: src/share/mk

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 18:38:52 UTC 2024

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

Log Message:
bsd.lib.mk: Avoid symbol check if we're not doing shared libraries.

Otherwise this fails on non-shlib builds like sun2.


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 src/share/mk/bsd.lib.mk

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

Modified files:

Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.396 src/share/mk/bsd.lib.mk:1.397
--- src/share/mk/bsd.lib.mk:1.396	Sat Mar 23 21:56:47 2024
+++ src/share/mk/bsd.lib.mk	Tue Mar 26 18:38:52 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.396 2024/03/23 21:56:47 riastradh Exp $
+#	$NetBSD: bsd.lib.mk,v 1.397 2024/03/26 18:38:52 riastradh Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include 
@@ -656,7 +656,7 @@ LIB_EXPSYM?=	${LIB}.${MACHINE_ARCH}.exps
 LIB_EXPSYM?=	${LIB}.expsym
 .endif
 
-.if !empty(LIB_EXPSYM)
+.if !empty(LIB_EXPSYM) && ${MKPIC} != "no"
 realall: ${_LIB.so.full}.diffsym
 ${_LIB.so.full}.diffsym: ${LIB_EXPSYM} ${_LIB.so.full}.actsym
 	${_MKTARGET_CREATE}



CVS commit: src/share/mk

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 18:38:52 UTC 2024

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

Log Message:
bsd.lib.mk: Avoid symbol check if we're not doing shared libraries.

Otherwise this fails on non-shlib builds like sun2.


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 src/share/mk/bsd.lib.mk

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



CVS commit: src/sys/conf

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 10:56:34 UTC 2024

Modified Files:
src/sys/conf: std

Log Message:
conf/std: Update comment over rnd(4) to reflect current reality.

PR kern/46728


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/conf/std

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

Modified files:

Index: src/sys/conf/std
diff -u src/sys/conf/std:1.23 src/sys/conf/std:1.24
--- src/sys/conf/std:1.23	Sun Jan 27 02:08:41 2019
+++ src/sys/conf/std	Tue Mar 26 10:56:34 2024
@@ -1,4 +1,4 @@
-# $NetBSD: std,v 1.23 2019/01/27 02:08:41 pgoyette Exp $
+# $NetBSD: std,v 1.24 2024/03/26 10:56:34 riastradh Exp $
 #
 # standard MI 'options'
 #
@@ -51,9 +51,13 @@ options	SCHED_4BSD
 pseudo-device	cpuctl
 
 #
-# Kernel entropy pool and random-number generator pseudodevice.
-# The pseudodevice might stop being "std" when the two are torn
-# apart some day but the entropy pool itself never will (they are
-# presently implemented in the same source file)
+# /dev/random and /dev/urandom interfaces.
+#
+# This could be taken out of conf/std now that the entropy pool and
+# kernel random number generation API is part of kern proper --
+# provided that some care is taken in ensuring that we copy & paste
+# this line in essentially every kernel config, because many
+# applications, even embedded ones, will likely rely in some way or
+# other on reading from /dev/urandom.
 #
 pseudo-device	rnd



CVS commit: src/sys/conf

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 10:56:34 UTC 2024

Modified Files:
src/sys/conf: std

Log Message:
conf/std: Update comment over rnd(4) to reflect current reality.

PR kern/46728


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/conf/std

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



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

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 10:51:16 UTC 2024

Modified Files:
src/sys/arch/mips/conf: files.octeon

Log Message:
mips/conf/files.octeon: octrnm does not depend on rnd

Whether or not we have /dev/random and /dev/urandom baked into the
kernel, configuring `octrnm* at ...' in the kernel config requires
octeon_rnm.c.

Related to PR kern/46728.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/conf/files.octeon

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



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

2024-03-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 26 10:51:16 UTC 2024

Modified Files:
src/sys/arch/mips/conf: files.octeon

Log Message:
mips/conf/files.octeon: octrnm does not depend on rnd

Whether or not we have /dev/random and /dev/urandom baked into the
kernel, configuring `octrnm* at ...' in the kernel config requires
octeon_rnm.c.

Related to PR kern/46728.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/conf/files.octeon

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/mips/conf/files.octeon
diff -u src/sys/arch/mips/conf/files.octeon:1.12 src/sys/arch/mips/conf/files.octeon:1.13
--- src/sys/arch/mips/conf/files.octeon:1.12	Thu Jul 16 21:34:52 2020
+++ src/sys/arch/mips/conf/files.octeon	Tue Mar 26 10:51:16 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.octeon,v 1.12 2020/07/16 21:34:52 jmcneill Exp $
+#	$NetBSD: files.octeon,v 1.13 2024/03/26 10:51:16 riastradh Exp $
 
 file	arch/mips/mips/locore_octeon.S
 file	arch/mips/mips/bus_dma.c
@@ -60,7 +60,7 @@ options 	COM_REGMAP
 
 device	octrnm
 attach	octrnm at iobus
-file	arch/mips/cavium/dev/octeon_rnm.c	octrnm & rnd
+file	arch/mips/cavium/dev/octeon_rnm.c	octrnm
 
 device	octtwsi: i2cbus
 attach	octtwsi at iobus



CVS commit: src/share/mk

2024-03-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 23 21:56:47 UTC 2024

Modified Files:
src/share/mk: bsd.README bsd.lib.mk

Log Message:
bsd.lib.mk: Tidy up expected symbols check a little.

Add some documentation in bsd.README.


To generate a diff of this commit:
cvs rdiff -u -r1.445 -r1.446 src/share/mk/bsd.README
cvs rdiff -u -r1.395 -r1.396 src/share/mk/bsd.lib.mk

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.445 src/share/mk/bsd.README:1.446
--- src/share/mk/bsd.README:1.445	Sat Jul 22 18:50:31 2023
+++ src/share/mk/bsd.README	Sat Mar 23 21:56:47 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.445 2023/07/22 18:50:31 lukem Exp $
+#	$NetBSD: bsd.README,v 1.446 2024/03/23 21:56:47 riastradh Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -993,6 +993,20 @@ PROGDPLIBS	A list of the tuples:
 		as well as in parent directories to cache common libraries
 		as a build-time optimization.
 
+LIB_EXPSYM	File listing all symbols expected to be defined by the
+		library.  Each line has a single symbol.  If the symbol
+		is versioned, it is followed by `@@', if it is the
+		default version, or `@', if not, and the symbol
+		version.  The lines must be sorted in LANG=C.
+
+		bsd.lib.mk checks to make sure exactly the set of
+		symbols in this file is defined when the library is
+		built; if not, the build will fail and print a diff
+		from the expected symbols to the actual symbols.
+		During development, you can update the expected symbols
+		from the actual ones with `make update-symbols'.
+
+
 The include file  includes the file named "../Makefile.inc"
 if it exists, as well as the include file .
 

Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.395 src/share/mk/bsd.lib.mk:1.396
--- src/share/mk/bsd.lib.mk:1.395	Wed Mar 20 13:50:37 2024
+++ src/share/mk/bsd.lib.mk	Sat Mar 23 21:56:47 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.395 2024/03/20 13:50:37 riastradh Exp $
+#	$NetBSD: bsd.lib.mk,v 1.396 2024/03/23 21:56:47 riastradh Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include 
@@ -672,7 +672,7 @@ ${_LIB.so.full}.diffsym: ${LIB_EXPSYM} $
 ${_LIB.so.full}.actsym: ${_LIB.so.full}
 	${_MKTARGET_CREATE}
 	${NM} --dynamic --extern-only --defined-only --with-symbol-versions \
-		${_LIB.so.full} \
+		${.ALLSRC} \
 	| cut -d' ' -f3 | LANG=C sort -u >${.TARGET}.tmp
 	${MV} ${.TARGET}.tmp ${.TARGET}
 CLEANFILES+=	${_LIB.so.full}.actsym
@@ -681,7 +681,7 @@ CLEANFILES+=	${_LIB.so.full}.diffsym
 CLEANFILES+=	${_LIB.so.full}.diffsym.tmp
 update-symbols: .PHONY
 update-symbols: ${_LIB.so.full}.actsym
-	cp ${_LIB.so.full}.actsym ${.CURDIR}/${LIB}.expsym
+	cp ${.ALLSRC} ${.CURDIR}/${LIB_EXPSYM}
 .endif
 
 .if !empty(LOBJS)			# {



CVS commit: src/share/mk

2024-03-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 23 21:56:47 UTC 2024

Modified Files:
src/share/mk: bsd.README bsd.lib.mk

Log Message:
bsd.lib.mk: Tidy up expected symbols check a little.

Add some documentation in bsd.README.


To generate a diff of this commit:
cvs rdiff -u -r1.445 -r1.446 src/share/mk/bsd.README
cvs rdiff -u -r1.395 -r1.396 src/share/mk/bsd.lib.mk

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



CVS commit: src/share/man/man4

2024-03-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 23 21:34:07 UTC 2024

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

Log Message:
wg(4): Fix IPv6 numbering in example diagram.

This way it matches the configuration suggested below (which avoids
host number zero on the subnet).

PR misc/58015


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/wg.4

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

Modified files:

Index: src/share/man/man4/wg.4
diff -u src/share/man/man4/wg.4:1.8 src/share/man/man4/wg.4:1.9
--- src/share/man/man4/wg.4:1.8	Tue Mar 12 02:28:03 2024
+++ src/share/man/man4/wg.4	Sat Mar 23 21:34:07 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wg.4,v 1.8 2024/03/12 02:28:03 riastradh Exp $
+.\"	$NetBSD: wg.4,v 1.9 2024/03/23 21:34:07 riastradh Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -83,7 +83,7 @@ Stationary server:  
 |[wm0]--internet---[bge0]|
 |[wg0] port 1234 - - - (tunnel) - - - - - - [wg0]|
 |   10.2.0.1  |   10.2.0.42  |
-|   fd00:2::0 |  fd00:2::42  |
+|   fd00:2::1 |  fd00:2::42  |
 | |   || |
 +--[wm1]--+  +-+   +-+
  | 10.1.0.1  | VPN 10.2.0.0/24 |



CVS commit: src/share/man/man4

2024-03-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 23 21:34:07 UTC 2024

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

Log Message:
wg(4): Fix IPv6 numbering in example diagram.

This way it matches the configuration suggested below (which avoids
host number zero on the subnet).

PR misc/58015


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/wg.4

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



CVS commit: src/sys/dev/acpi

2024-03-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 23 03:41:35 UTC 2024

Modified Files:
src/sys/dev/acpi: apei.c

Log Message:
apei(4): Make sure to initialize *fatalp in apei_gesb_report.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/apei.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/acpi/apei.c
diff -u src/sys/dev/acpi/apei.c:1.1 src/sys/dev/acpi/apei.c:1.2
--- src/sys/dev/acpi/apei.c:1.1	Wed Mar 20 17:11:43 2024
+++ src/sys/dev/acpi/apei.c	Sat Mar 23 03:41:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: apei.c,v 1.1 2024/03/20 17:11:43 riastradh Exp $	*/
+/*	$NetBSD: apei.c,v 1.2 2024/03/23 03:41:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apei.c,v 1.1 2024/03/20 17:11:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apei.c,v 1.2 2024/03/23 03:41:35 riastradh Exp $");
 
 #include 
 #include 
@@ -673,7 +673,8 @@ apei_gesb_report(struct apei_softc *sc, 
 	if (size < sizeof(*gesb)) {
 		device_printf(sc->sc_dev, "%s: truncated GESB, %zu < %zu\n",
 		ctx, size, sizeof(*gesb));
-		return 0;
+		status = 0;
+		goto out;
 	}
 	size -= sizeof(*gesb);
 



  1   2   3   4   5   6   7   8   9   10   >