CVS commit: src/external/gpl3/gcc

2023-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Aug  5 23:52:43 UTC 2023

Modified Files:
src/external/gpl3/gcc: README.gcc12

Log Message:
note sparc & sparc64 seem to work fine except for sanitizers.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc/README.gcc12

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

Modified files:

Index: src/external/gpl3/gcc/README.gcc12
diff -u src/external/gpl3/gcc/README.gcc12:1.7 src/external/gpl3/gcc/README.gcc12:1.8
--- src/external/gpl3/gcc/README.gcc12:1.7	Fri Aug  4 14:54:40 2023
+++ src/external/gpl3/gcc/README.gcc12	Sat Aug  5 23:52:43 2023
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc12,v 1.7 2023/08/04 14:54:40 rin Exp $
+$NetBSD: README.gcc12,v 1.8 2023/08/05 23:52:43 mrg Exp $
 
 
 new stuff:
@@ -61,8 +61,8 @@ powerpc		y	?	y	y	?	n[4]		?	?	?
 powerpc64	y	?	?	y	?	?		?	?	?
 sh3eb		y	?	y	y	?	?		?	?	?
 sh3el		y	?	y	y	?	?		?	?	?
-sparc		y	y	y	y	b	y		y	?	?
-sparc64		y	b	y	y	b	y		?	?	?
+sparc		y	y	y	y	n[atf]	y		y	y	?
+sparc64		y	b	y	y	n[16]	y		y	?	?
 vax		y	?	y	y	?	n		?	?	?
 x86_64		y	y	y	y	y[13]	y		y	y	?
 riscv32		y	y	y	y	b	y		?	?	?
@@ -106,6 +106,13 @@ architecture	tools	kernels	libgcc	native
   ThreadSanitizer: nested bug in the same thread, aborting.
 [14]: "dd count=1" aborts. "COPTS.strsuftoll.c+=-fno-stack-protector" works around the problem.
 [15]: No regression observed for tests/lib/libc/{sys,gen}.
+[16]: sanitizers crash early:
+  Program received signal SIGSEGV, Segmentation fault.
+  (gdb) bt
+  #0  0x4064265c in __sanitizer::CheckASLR () at /usr/src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cpp:2181
+  #1  0xc704 in ?? ()
+  Backtrace stopped: previous frame identical to this frame (corrupt stack?)
+[atf]: new failures in ATF, probably crashes
 
 
 CPU vs platform test table (for CPUs with multiple ports).  this is "make release" or just kernels.



CVS commit: src/external/gpl3/gcc

2023-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Aug  5 23:52:43 UTC 2023

Modified Files:
src/external/gpl3/gcc: README.gcc12

Log Message:
note sparc & sparc64 seem to work fine except for sanitizers.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc/README.gcc12

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



CVS commit: src/sys/dev/pci

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 20:24:10 UTC 2023

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

Log Message:
regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1469 -r1.1470 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1468 -r1.1469 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1469 src/sys/dev/pci/pcidevs.h:1.1470
--- src/sys/dev/pci/pcidevs.h:1.1469	Sat Aug  5 20:09:13 2023
+++ src/sys/dev/pci/pcidevs.h	Sat Aug  5 20:24:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcidevs.h,v 1.1469 2023/08/05 20:09:13 andvar Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1470 2023/08/05 20:24:09 andvar Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -9875,7 +9875,7 @@
 #define	PCI_PRODUCT_VIATECH_VT3314_IG	0x3344		/* VT3314 CN900 UniChrome Integrated Graphics */
 #define	PCI_PRODUCT_VIATECH_VT8237R_SATA	0x3349		/* VT8237R Integrated SATA Controller */
 #define	PCI_PRODUCT_VIATECH_VT3351_HB_3351	0x3351		/* VT3351 Host Bridge */
-#define	PCI_PRODUCT_VIATECH_VX800_PPB	0x3353		/* VX800/VX820 PCI-PCI Bridge */
+#define	PCI_PRODUCT_VIATECH_VX800_PPB_2	0x3353		/* VX800/VX820 PCI-PCI Bridge */
 #define	PCI_PRODUCT_VIATECH_P4M900_3	0x3364		/* CN896/P4M900 Host Bridge */
 #define	PCI_PRODUCT_VIATECH_CHROME9_HC	0x3371		/* Chrome9 HC IGP */
 #define	PCI_PRODUCT_VIATECH_VT8237S_ISA	0x3372		/* VT8237S PCI-ISA Bridge */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1468 src/sys/dev/pci/pcidevs_data.h:1.1469
--- src/sys/dev/pci/pcidevs_data.h:1.1468	Sat Aug  5 20:09:13 2023
+++ src/sys/dev/pci/pcidevs_data.h	Sat Aug  5 20:24:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1468 2023/08/05 20:09:13 andvar Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1469 2023/08/05 20:24:09 andvar Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -17857,7 +17857,7 @@ static const uint32_t pci_products[] = {
 	42195, 692, 8696, 6413, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT3351_HB_3351, 
 	41564, 6911, 6521, 0,
-	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX800_PPB, 
+	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX800_PPB_2, 
 	41571, 8725, 6521, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_3, 
 	41583, 6911, 6521, 0,



CVS commit: src/sys/dev/pci

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 20:24:10 UTC 2023

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

Log Message:
regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1469 -r1.1470 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1468 -r1.1469 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 20:23:41 UTC 2023

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

Log Message:
fix duplicate definition.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1488 src/sys/dev/pci/pcidevs:1.1489
--- src/sys/dev/pci/pcidevs:1.1488	Sat Aug  5 20:08:03 2023
+++ src/sys/dev/pci/pcidevs	Sat Aug  5 20:23:40 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1488 2023/08/05 20:08:03 andvar Exp $
+$NetBSD: pcidevs,v 1.1489 2023/08/05 20:23:40 andvar Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -9868,7 +9868,7 @@ product	VIATECH	VT8237A_ISA	0x3337	VT823
 product	VIATECH VT3314_IG	0x3344	VT3314 CN900 UniChrome Integrated Graphics
 product VIATECH VT8237R_SATA	0x3349	VT8237R Integrated SATA Controller
 product VIATECH VT3351_HB_3351	0x3351	VT3351 Host Bridge
-product VIATECH VX800_PPB	0x3353	VX800/VX820 PCI-PCI Bridge
+product VIATECH VX800_PPB_2	0x3353	VX800/VX820 PCI-PCI Bridge
 product VIATECH P4M900_3	0x3364	CN896/P4M900 Host Bridge
 product VIATECH CHROME9_HC	0x3371	Chrome9 HC IGP
 product VIATECH VT8237S_ISA	0x3372	VT8237S PCI-ISA Bridge



CVS commit: src/sys/dev/pci

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 20:23:41 UTC 2023

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

Log Message:
fix duplicate definition.


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

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



CVS commit: src/sys/dev/pci

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 20:09:14 UTC 2023

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

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1468 -r1.1469 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1467 -r1.1468 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 20:09:14 UTC 2023

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

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1468 -r1.1469 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1467 -r1.1468 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1468 src/sys/dev/pci/pcidevs.h:1.1469
--- src/sys/dev/pci/pcidevs.h:1.1468	Fri Aug  4 19:17:27 2023
+++ src/sys/dev/pci/pcidevs.h	Sat Aug  5 20:09:13 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1468 2023/08/04 19:17:27 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1469 2023/08/05 20:09:13 andvar Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1487 2023/08/04 19:17:00 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1488 2023/08/05 20:08:03 andvar Exp
  */
 
 /*
@@ -9263,6 +9263,7 @@
 #define	PCI_PRODUCT_S3_SAVAGE_IX_MV	0x8c12		/* Savage/IX+MV */
 #define	PCI_PRODUCT_S3_SAVAGE_IX	0x8c13		/* Savage/IX */
 #define	PCI_PRODUCT_S3_SAVAGE_IXC	0x8c2e		/* Savage/IXC */
+#define	PCI_PRODUCT_S3_CHROME_500	0x9060		/* Chrome 530 GT/540 GTX/5400E */
 #define	PCI_PRODUCT_S3_SAVAGE2000	0x9102		/* Savage2000 */
 #define	PCI_PRODUCT_S3_SONICVIBES	0xca00		/* SonicVibes */
 
@@ -9798,6 +9799,7 @@
 #define	PCI_PRODUCT_VIATECH_K8HTB_0	0x0282		/* K8HTB Host */
 #define	PCI_PRODUCT_VIATECH_VT8363_HB	0x0305		/* VT8363 (Apollo KT133) Host Bridge */
 #define	PCI_PRODUCT_VIATECH_VT3351_HB_0351	0x0351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VX800_HC	0x0353		/* VX800/VX820 Host Controller */
 #define	PCI_PRODUCT_VIATECH_P4M900	0x0364		/* CN896/P4M900 Host Bridge */
 #define	PCI_PRODUCT_VIATECH_VT8371_HB	0x0391		/* VT8371 (Apollo KX133) Host Bridge */
 #define	PCI_PRODUCT_VIATECH_VX900_HB	0x0410		/* VX900 Host Bridge */
@@ -9821,8 +9823,10 @@
 #define	PCI_PRODUCT_VIATECH_VT86C926	0x0926		/* VT86C926 Amazon PCI-Ethernet Controller */
 #define	PCI_PRODUCT_VIATECH_VT82C570M	0x1000		/* VT82C570M (Apollo) Host-PCI Bridge */
 #define	PCI_PRODUCT_VIATECH_VT82C570MV	0x1006		/* VT82C570M (Apollo) PCI-ISA Bridge */
+#define	PCI_PRODUCT_VIATECH_CHROME9HC3	0x1122		/* VX800/VX820 Chrome 9 HC3 Integrated Graphics */
 #define	PCI_PRODUCT_VIATECH_KT880_1	0x1269		/* KT880 CPU to PCI Bridge */
 #define	PCI_PRODUCT_VIATECH_VT3351_HB_1351	0x1351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VX800_ERR	0x1353		/* VX800/VX820 Error Reporting */
 #define	PCI_PRODUCT_VIATECH_P4M900_1	0x1364		/* CN896/P4M900 Host Bridge */
 #define	PCI_PRODUCT_VIATECH_VX900_ERR	0x1410		/* VX900 Error Reporting */
 #define	PCI_PRODUCT_VIATECH_VT82C586_IDE	0x1571		/* VT82C586 IDE Controller */
@@ -9830,6 +9834,7 @@
 #define	PCI_PRODUCT_VIATECH_VT6105M_BOM	0x2006		/* VT6105M_BOM (Rhine III) 10/100 Ethernet */
 #define	PCI_PRODUCT_VIATECH_KT880_2	0x2269		/* KT880 CPU to PCI Bridge */
 #define	PCI_PRODUCT_VIATECH_VT3351_HB_2351	0x2351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VX800_HBC	0x2353		/* VX800/VX820 Host Bus Control */
 #define	PCI_PRODUCT_VIATECH_P4M900_2	0x2364		/* CN896/P4M900 Host Bridge */
 #define	PCI_PRODUCT_VIATECH_VX900_0	0x2410		/* VX900 CPU Bus Controller */
 #define	PCI_PRODUCT_VIATECH_VT8251_PPB_287A	0x287a		/* VT8251 PCI-PCI Bridge */
@@ -9870,6 +9875,7 @@
 #define	PCI_PRODUCT_VIATECH_VT3314_IG	0x3344		/* VT3314 CN900 UniChrome Integrated Graphics */
 #define	PCI_PRODUCT_VIATECH_VT8237R_SATA	0x3349		/* VT8237R Integrated SATA Controller */
 #define	PCI_PRODUCT_VIATECH_VT3351_HB_3351	0x3351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VX800_PPB	0x3353		/* VX800/VX820 PCI-PCI Bridge */
 #define	PCI_PRODUCT_VIATECH_P4M900_3	0x3364		/* CN896/P4M900 Host Bridge */
 #define	PCI_PRODUCT_VIATECH_CHROME9_HC	0x3371		/* Chrome9 HC IGP */
 #define	PCI_PRODUCT_VIATECH_VT8237S_ISA	0x3372		/* VT8237S PCI-ISA Bridge */
@@ -9880,22 +9886,26 @@
 #define	PCI_PRODUCT_VIATECH_VL805_XHCI	0x3483		/* VL805 xHCI */
 #define	PCI_PRODUCT_VIATECH_KT880_4	0x4269		/* KT880 CPU to PCI Bridge */
 #define	PCI_PRODUCT_VIATECH_VT3351_HB_4351	0x4351		/* VT3351 Host Bridge */
+#define	PCI_PRODUCT_VIATECH_VX800_PMC	0x4353		/* VX800/VX820 Power Management Control */
 #define	PCI_PRODUCT_VIATECH_P4M900_4	0x4364		/* CN896/P4M900 Host Bridge */
 #define	PCI_PRODUCT_VIATECH_VX900_1	0x4410		/* VX900 Power Management Controller */
 #define	PCI_PRODUCT_VIATECH_CX700M2_IDE	0x5324		/* CX700M2/VX700 IDE Controller */
 #define	PCI_PRODUCT_VIATECH_VT8237A_SATA_2	0x5337		/* VT8237A Integrated SATA Controller */
 #define	PCI_PRODUCT_VIATECH_VT3351_IOAPIC	0x5351		/* VT3351 I/O APIC Interrupt Controller */
+#define	PCI_PRODUCT_VIATECH_VX800_APIC	0x5353		/* VX800/VX820 APIC and Central Traffic Control */
 #define	PCI_PRODUCT_VIATECH_P4M900_IOAPIC	0x5364		/* CN896/P4M900 IOAPIC */
 

CVS commit: src/sys/dev/pci

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 20:08:04 UTC 2023

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

Log Message:
Add device ids of the VX800 chipset and s3 chrome 500 series GPU.
Descriptions mainly aligned with VX800/820 Series System Programming Manual.


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

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



CVS commit: src/sys/arch

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 14:38:43 UTC 2023

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0 XEN3_DOMU
src/sys/arch/i386/conf: XEN3PAE_DOM0 XEN3PAE_DOMU

Log Message:
xen/x86: Enable heartbeat checks.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/conf/XEN3PAE_DOMU

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/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.198 src/sys/arch/amd64/conf/XEN3_DOM0:1.199
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.198	Thu Feb  9 14:09:48 2023
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat Aug  5 14:38:43 2023
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.198 2023/02/09 14:09:48 abs Exp $
+# $NetBSD: XEN3_DOM0,v 1.199 2023/08/05 14:38:43 riastradh Exp $
 
 # XEN3_DOM0 machine description file
 #
@@ -14,7 +14,7 @@ include 	"arch/amd64/conf/std.xen"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"XEN3_DOM0-$Revision: 1.198 $"
+#ident		"XEN3_DOM0-$Revision: 1.199 $"
 
 maxusers	32		# estimated number of users
 
@@ -166,6 +166,10 @@ options 	KDTRACE_HOOKS	# kernel DTrace h
 # Fault Injection Driver.
 #options 	FAULT
 
+# Heartbeat checks
+options 	HEARTBEAT
+options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
 # Compatibility options
 # x86_64 never shipped with a.out binaries; the two options below are
 # only relevant to 32-bit i386 binaries

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.102 src/sys/arch/amd64/conf/XEN3_DOMU:1.103
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.102	Sat Jul 22 15:18:48 2023
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Sat Aug  5 14:38:43 2023
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.102 2023/07/22 15:18:48 riastradh Exp $
+# $NetBSD: XEN3_DOMU,v 1.103 2023/08/05 14:38:43 riastradh Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -11,7 +11,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOMU-$Revision: 1.102 $"
+#ident		"XEN3_DOMU-$Revision: 1.103 $"
 
 maxusers	32		# estimated number of users
 
@@ -56,6 +56,10 @@ makeoptions	COPTS="-O2 -fno-omit-frame-p
 options DDB_COMMANDONENTER="trace;show registers"
 options 	KDTRACE_HOOKS	# kernel DTrace hooks
 
+# Heartbeat checks
+options 	HEARTBEAT
+options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
 # Compatibility options
 include 	"conf/compat_netbsd15.config"
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID

Index: src/sys/arch/i386/conf/XEN3PAE_DOM0
diff -u src/sys/arch/i386/conf/XEN3PAE_DOM0:1.39 src/sys/arch/i386/conf/XEN3PAE_DOM0:1.40
--- src/sys/arch/i386/conf/XEN3PAE_DOM0:1.39	Sat Jul 22 15:19:03 2023
+++ src/sys/arch/i386/conf/XEN3PAE_DOM0	Sat Aug  5 14:38:43 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3PAE_DOM0,v 1.39 2023/07/22 15:19:03 riastradh Exp $
+#	$NetBSD: XEN3PAE_DOM0,v 1.40 2023/08/05 14:38:43 riastradh Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -78,6 +78,10 @@ makeoptions	DEBUG="-g"	# compile full sy
 options DDB_COMMANDONENTER="show registers"
 options 	KDTRACE_HOOKS	# kernel DTrace hooks
 
+# Heartbeat checks
+options 	HEARTBEAT
+options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI

Index: src/sys/arch/i386/conf/XEN3PAE_DOMU
diff -u src/sys/arch/i386/conf/XEN3PAE_DOMU:1.21 src/sys/arch/i386/conf/XEN3PAE_DOMU:1.22
--- src/sys/arch/i386/conf/XEN3PAE_DOMU:1.21	Sat Jul 22 15:19:17 2023
+++ src/sys/arch/i386/conf/XEN3PAE_DOMU	Sat Aug  5 14:38:43 2023
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3PAE_DOMU,v 1.21 2023/07/22 15:19:17 riastradh Exp $
+# $NetBSD: XEN3PAE_DOMU,v 1.22 2023/08/05 14:38:43 riastradh Exp $
 
 include 	"arch/i386/conf/std.xen"
 
@@ -62,6 +62,10 @@ makeoptions	DEBUG="-g"	# compile full sy
 options DDB_COMMANDONENTER="trace;show registers"
 options 	KDTRACE_HOOKS	# kernel DTrace hooks
 
+# Heartbeat checks
+options 	HEARTBEAT
+options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI



CVS commit: src/sys/arch

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 14:38:43 UTC 2023

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0 XEN3_DOMU
src/sys/arch/i386/conf: XEN3PAE_DOM0 XEN3PAE_DOMU

Log Message:
xen/x86: Enable heartbeat checks.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/conf/XEN3PAE_DOMU

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



CVS commit: src/tests/crypto/opencrypto

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:29:57 UTC 2023

Modified Files:
src/tests/crypto/opencrypto: h_ioctl.c

Log Message:
tests/crypto/opencrypto: test_asymfeat requires privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/crypto/opencrypto/h_ioctl.c

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



CVS commit: src/tests/crypto/opencrypto

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:29:57 UTC 2023

Modified Files:
src/tests/crypto/opencrypto: h_ioctl.c

Log Message:
tests/crypto/opencrypto: test_asymfeat requires privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/crypto/opencrypto/h_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/tests/crypto/opencrypto/h_ioctl.c
diff -u src/tests/crypto/opencrypto/h_ioctl.c:1.5 src/tests/crypto/opencrypto/h_ioctl.c:1.6
--- src/tests/crypto/opencrypto/h_ioctl.c:1.5	Sat May 21 20:38:34 2022
+++ src/tests/crypto/opencrypto/h_ioctl.c	Sat Aug  5 13:29:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_ioctl.c,v 1.5 2022/05/21 20:38:34 riastradh Exp $	*/
+/*	$NetBSD: h_ioctl.c,v 1.6 2023/08/05 13:29:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -450,9 +451,11 @@ main(void)
 	if (ret < 0)
 		err(1, "test_ncryptret");
 
-	ret = test_asymfeat(fd);
-	if (ret < 0)
-		err(1, "test_asymfeat");
+	if (getuid() == 0) {
+		ret = test_asymfeat(fd);
+		if (ret < 0)
+			err(1, "test_asymfeat");
+	}
 
 	return 0;
 }



CVS commit: src/tests/net/inpcb

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:25:26 UTC 2023

Modified Files:
src/tests/net/inpcb: t_inpcb_bind.sh

Log Message:
tests/net/inpcb: Tests require root.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/t_inpcb_bind.sh

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

Modified files:

Index: src/tests/net/inpcb/t_inpcb_bind.sh
diff -u src/tests/net/inpcb/t_inpcb_bind.sh:1.1 src/tests/net/inpcb/t_inpcb_bind.sh:1.2
--- src/tests/net/inpcb/t_inpcb_bind.sh:1.1	Thu Nov 17 08:40:23 2022
+++ src/tests/net/inpcb/t_inpcb_bind.sh	Sat Aug  5 13:25:26 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: t_inpcb_bind.sh,v 1.1 2022/11/17 08:40:23 ozaki-r Exp $
+#	$NetBSD: t_inpcb_bind.sh,v 1.2 2023/08/05 13:25:26 riastradh Exp $
 #
 # Copyright (c) 2022 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -70,6 +70,7 @@ add_test()
 	eval "${name}_head() {
 			atf_set descr \"${desc}\"
 			atf_set require.progs rump_server
+			atf_set require.user root
 		}
 	${name}_body() {
 			test_${name}



CVS commit: src/tests/net/inpcb

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:25:26 UTC 2023

Modified Files:
src/tests/net/inpcb: t_inpcb_bind.sh

Log Message:
tests/net/inpcb: Tests require root.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/t_inpcb_bind.sh

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



CVS commit: src/tests/net/net

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:22:49 UTC 2023

Modified Files:
src/tests/net/net: t_bind.c

Log Message:
tests/net/net/t_bind: IP_BINDANY and IPV6_BINDANY require root.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_bind.c

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



CVS commit: src/tests/net/net

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:22:49 UTC 2023

Modified Files:
src/tests/net/net: t_bind.c

Log Message:
tests/net/net/t_bind: IP_BINDANY and IPV6_BINDANY require root.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_bind.c

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

Modified files:

Index: src/tests/net/net/t_bind.c
diff -u src/tests/net/net/t_bind.c:1.1 src/tests/net/net/t_bind.c:1.2
--- src/tests/net/net/t_bind.c:1.1	Tue Sep  8 14:13:50 2020
+++ src/tests/net/net/t_bind.c	Sat Aug  5 13:22:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_bind.c,v 1.1 2020/09/08 14:13:50 christos Exp $	*/
+/*	$NetBSD: t_bind.c,v 1.2 2023/08/05 13:22:49 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_bind.c,v 1.1 2020/09/08 14:13:50 christos Exp $");
+__RCSID("$Id: t_bind.c,v 1.2 2023/08/05 13:22:49 riastradh Exp $");
 #endif
 
 #include 
@@ -144,6 +144,7 @@ ATF_TC_HEAD(bindany_4, tc)
 {
 
 	atf_tc_set_md_var(tc, "descr", "Check AF_INET bindany");
+	atf_tc_set_md_var(tc, "require.user", "root");
 }
 
 ATF_TC_BODY(bindany_4, tc)
@@ -156,6 +157,7 @@ ATF_TC_HEAD(bindany_6, tc)
 {
 
 	atf_tc_set_md_var(tc, "descr", "Check AF_INET6 bindany");
+	atf_tc_set_md_var(tc, "require.user", "root");
 }
 
 ATF_TC_BODY(bindany_6, tc)



CVS commit: src/tests/lib/librumphijack

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:13:37 UTC 2023

Modified Files:
src/tests/lib/librumphijack: t_tcpip.sh

Log Message:
tests/lib/librumphijack: Avoid trying to run rpcbind as non-root.

Can probably make this work through rumphijack, but there's no sense
in even trying the test if we can't, so let's reduce the unprivileged
false alarms.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/lib/librumphijack/t_tcpip.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/lib/librumphijack/t_tcpip.sh
diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.22 src/tests/lib/librumphijack/t_tcpip.sh:1.23
--- src/tests/lib/librumphijack/t_tcpip.sh:1.22	Sun May 28 08:17:00 2023
+++ src/tests/lib/librumphijack/t_tcpip.sh	Sat Aug  5 13:13:37 2023
@@ -1,4 +1,4 @@
-#   $NetBSD: t_tcpip.sh,v 1.22 2023/05/28 08:17:00 hannken Exp $
+#   $NetBSD: t_tcpip.sh,v 1.23 2023/08/05 13:13:37 riastradh Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -229,6 +229,11 @@ atf_test_case nfs cleanup
 nfs_head()
 {
 atf_set "descr" "Test hijacked nfsd and mount_nfs"
+
+	# XXX Can probably make this work as nonroot, but need to
+	# convince rpcbind running in the rump kernel server that it
+	# has uid 0.
+	atf_set "require.user" "root"
 }
 
 nfs_body()
@@ -250,6 +255,11 @@ atf_test_case nfs_autoload cleanup
 nfs_autoload_head()
 {
 atf_set "descr" "Test hijacked nfsd with autoload from /stand"
+
+	# XXX Can probably make this work as nonroot, but need to
+	# convince rpcbind running in the rump kernel server that it
+	# has uid 0.
+	atf_set "require.user" "root"
 }
 
 nfs_autoload_body()



CVS commit: src/tests/lib/librumphijack

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:13:37 UTC 2023

Modified Files:
src/tests/lib/librumphijack: t_tcpip.sh

Log Message:
tests/lib/librumphijack: Avoid trying to run rpcbind as non-root.

Can probably make this work through rumphijack, but there's no sense
in even trying the test if we can't, so let's reduce the unprivileged
false alarms.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/lib/librumphijack/t_tcpip.sh

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



CVS commit: src/tests/lib/libnvmm

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:05:14 UTC 2023

Modified Files:
src/tests/lib/libnvmm: t_io_assist.sh t_mem_assist.sh

Log Message:
tests/lib/libnvmm: Tests require privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libnvmm/t_io_assist.sh \
src/tests/lib/libnvmm/t_mem_assist.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/lib/libnvmm/t_io_assist.sh
diff -u src/tests/lib/libnvmm/t_io_assist.sh:1.2 src/tests/lib/libnvmm/t_io_assist.sh:1.3
--- src/tests/lib/libnvmm/t_io_assist.sh:1.2	Sat Sep  5 07:22:26 2020
+++ src/tests/lib/libnvmm/t_io_assist.sh	Sat Aug  5 13:05:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: t_io_assist.sh,v 1.2 2020/09/05 07:22:26 maxv Exp $
+#	$NetBSD: t_io_assist.sh,v 1.3 2023/08/05 13:05:14 riastradh Exp $
 #
 # Copyright (c) 2019-2020 Maxime Villard, m00nbsd.net
 # All rights reserved.
@@ -31,6 +31,7 @@ atf_test_case io_assist
 io_assist_head()
 {
 	atf_set "descr" "Check the I/O Assist provided in libnvmm"
+	atf_set "require.user" "root"
 }
 
 io_assist_body()
Index: src/tests/lib/libnvmm/t_mem_assist.sh
diff -u src/tests/lib/libnvmm/t_mem_assist.sh:1.2 src/tests/lib/libnvmm/t_mem_assist.sh:1.3
--- src/tests/lib/libnvmm/t_mem_assist.sh:1.2	Sat Sep  5 07:22:26 2020
+++ src/tests/lib/libnvmm/t_mem_assist.sh	Sat Aug  5 13:05:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: t_mem_assist.sh,v 1.2 2020/09/05 07:22:26 maxv Exp $
+#	$NetBSD: t_mem_assist.sh,v 1.3 2023/08/05 13:05:14 riastradh Exp $
 #
 # Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
 # All rights reserved.
@@ -31,6 +31,7 @@ atf_test_case mem_assist
 mem_assist_head()
 {
 	atf_set "descr" "Check the Mem Assist provided in libnvmm"
+	atf_set "require.user" "root"
 }
 
 mem_assist_body()



CVS commit: src/tests/lib/libnvmm

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:05:14 UTC 2023

Modified Files:
src/tests/lib/libnvmm: t_io_assist.sh t_mem_assist.sh

Log Message:
tests/lib/libnvmm: Tests require privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libnvmm/t_io_assist.sh \
src/tests/lib/libnvmm/t_mem_assist.sh

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



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:01:06 UTC 2023

Modified Files:
src/tests/lib/libc/kevent_nullmnt: t_nullmnt.sh

Log Message:
t_nullmnt: Need privileges for mount.

(unless vfs.generic.usermount=1 but let's keep it simple)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh

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



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:01:06 UTC 2023

Modified Files:
src/tests/lib/libc/kevent_nullmnt: t_nullmnt.sh

Log Message:
t_nullmnt: Need privileges for mount.

(unless vfs.generic.usermount=1 but let's keep it simple)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.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/lib/libc/kevent_nullmnt/t_nullmnt.sh
diff -u src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh:1.6 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh:1.7
--- src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh:1.6	Mon Jul 18 04:30:30 2022
+++ src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh	Sat Aug  5 13:01:06 2023
@@ -30,6 +30,7 @@ atf_test_case nullmnt_upper_lower cleanu
 nullmnt_upper_lower_head()
 {
 	atf_set "descr" "ensure upper fs events seen on lower fs"
+	atf_set "require.user" "root"
 }
 nullmnt_upper_lower_body()
 {
@@ -44,6 +45,7 @@ atf_test_case nullmnt_upper_upper cleanu
 nullmnt_upper_upper_head()
 {
 	atf_set "descr" "ensure upper fs events seen on upper fs"
+	atf_set "require.user" "root"
 }
 nullmnt_upper_upper_body()
 {
@@ -57,6 +59,7 @@ atf_test_case nullmnt_lower_upper cleanu
 nullmnt_lower_upper_head()
 {
 	atf_set "descr" "ensure lower fs events seen on upper fs"
+	atf_set "require.user" "root"
 }
 nullmnt_lower_upper_body()
 {
@@ -71,6 +74,7 @@ atf_test_case nullmnt_lower_lower cleanu
 nullmnt_lower_lower_head()
 {
 	atf_set "descr" "ensure lower fs events seen on lower fs"
+	atf_set "require.user" "root"
 }
 nullmnt_lower_lower_body()
 {



CVS commit: src/tests/include

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 12:11:05 UTC 2023

Modified Files:
src/tests/include: t_paths.c

Log Message:
tests/include/t_paths: Test all paths, nonfatally.

This way a single failure doesn't suppress failure reports for all
the other paths to test.

Omit some needless blank lines while here.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/include/t_paths.c

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

Modified files:

Index: src/tests/include/t_paths.c
diff -u src/tests/include/t_paths.c:1.18 src/tests/include/t_paths.c:1.19
--- src/tests/include/t_paths.c:1.18	Sat Aug  5 11:59:09 2023
+++ src/tests/include/t_paths.c	Sat Aug  5 12:11:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_paths.c,v 1.18 2023/08/05 11:59:09 riastradh Exp $ */
+/*	$NetBSD: t_paths.c,v 1.19 2023/08/05 12:11:05 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_paths.c,v 1.18 2023/08/05 11:59:09 riastradh Exp $");
+__RCSID("$NetBSD: t_paths.c,v 1.19 2023/08/05 12:11:05 riastradh Exp $");
 
 #include 
 #include 
@@ -135,39 +135,34 @@ ATF_TC_BODY(paths, tc)
 	uid = getuid();
 
 	for (i = 0; i < __arraycount(paths); i++) {
-
 		(void)fprintf(stderr, "testing '%s'\n", paths[i].path);
 
 		errno = 0;
 		fd = open(paths[i].path, O_RDONLY);
-
 		if (fd < 0) {
-
 			switch (errno) {
-
 			case ENODEV:
 if ((paths[i].flags & PATH_OPT) == 0) {
-
-	atf_tc_fail("Required path %s does "
-	"not exist", paths[i].path);
+	atf_tc_fail_nonfatal("Required path %s"
+	" does not exist", paths[i].path);
+	continue;
 }
 break;
-
 			case EPERM:	/* FALLTHROUGH */
 			case EACCES:	/* FALLTHROUGH */
-
 if ((paths[i].flags & PATH_ROOT) == 0) {
-
-	atf_tc_fail("UID %u failed to open %s, "
-	"error %d", (uint32_t)uid,
-	 paths[i].path, errno);
+	atf_tc_fail_nonfatal("UID %u"
+	" failed to open %s,"
+	" error %d (%s)",
+	(uint32_t)uid,
+	paths[i].path,
+	errno, strerror(errno));
+	continue;
 }
-
 /* FALLTHROUGH */
 			case EBUSY:	/* FALLTHROUGH */
 			case ENXIO:	/* FALLTHROUGH */
 			case ENOENT:	/* FALLTHROUGH */
-
 			default:
 continue;
 			}
@@ -175,35 +170,34 @@ ATF_TC_BODY(paths, tc)
 
 		(void)memset(, 0, sizeof(struct stat));
 
-		ATF_REQUIRE(fstat(fd, ) == 0);
+		if (fstat(fd, ) == -1) {
+			atf_tc_fail_nonfatal("fstat %s failed, error %d (%s)",
+			paths[i].path, errno, strerror(errno));
+			ATF_CHECK(close(fd) == 0);
+			continue;
+		}
 
 		m = st.st_mode;
 
 		if ((paths[i].flags & PATH_DEV) != 0) {
-
 			ATF_CHECK(S_ISBLK(m) != 0 || S_ISCHR(m) != 0);
-
 			ATF_CHECK((paths[i].flags & PATH_DIR) == 0);
 			ATF_CHECK((paths[i].flags & PATH_FILE) == 0);
 		}
 
 		if ((paths[i].flags & PATH_DIR) != 0) {
-
 			ATF_CHECK(S_ISDIR(m) != 0);
-
 			ATF_CHECK((paths[i].flags & PATH_DEV) == 0);
 			ATF_CHECK((paths[i].flags & PATH_FILE) == 0);
 		}
 
 		if ((paths[i].flags & PATH_FILE) != 0) {
-
 			ATF_CHECK(S_ISREG(m) != 0);
-
 			ATF_CHECK((paths[i].flags & PATH_DEV) == 0);
 			ATF_CHECK((paths[i].flags & PATH_DIR) == 0);
 		}
 
-		ATF_REQUIRE(close(fd) == 0);
+		ATF_CHECK(close(fd) == 0);
 	}
 }
 



CVS commit: src/tests/include

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 12:11:05 UTC 2023

Modified Files:
src/tests/include: t_paths.c

Log Message:
tests/include/t_paths: Test all paths, nonfatally.

This way a single failure doesn't suppress failure reports for all
the other paths to test.

Omit some needless blank lines while here.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/include/t_paths.c

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



CVS commit: src/tests/include

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:59:09 UTC 2023

Modified Files:
src/tests/include: t_paths.c

Log Message:
tests/include/t_paths: /dev/ksyms requires root.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/include/t_paths.c

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

Modified files:

Index: src/tests/include/t_paths.c
diff -u src/tests/include/t_paths.c:1.17 src/tests/include/t_paths.c:1.18
--- src/tests/include/t_paths.c:1.17	Sun Feb  3 03:19:28 2019
+++ src/tests/include/t_paths.c	Sat Aug  5 11:59:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_paths.c,v 1.17 2019/02/03 03:19:28 mrg Exp $ */
+/*	$NetBSD: t_paths.c,v 1.18 2023/08/05 11:59:09 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_paths.c,v 1.17 2019/02/03 03:19:28 mrg Exp $");
+__RCSID("$NetBSD: t_paths.c,v 1.18 2023/08/05 11:59:09 riastradh Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ static const struct {
 	{ _PATH_I18NMODULE,	PATH_DIR		},
 	{ _PATH_ICONV,		PATH_DIR		},
 	{ _PATH_KMEM,		PATH_DEV | PATH_ROOT	},
-	{ _PATH_KSYMS,		PATH_DEV		},
+	{ _PATH_KSYMS,		PATH_DEV | PATH_ROOT	},
 	{ _PATH_KVMDB,		PATH_FILE		},
 	{ _PATH_LOCALE,		PATH_DIR		},
 	{ _PATH_MAILDIR,	PATH_DIR		},



CVS commit: src/tests/include

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:59:09 UTC 2023

Modified Files:
src/tests/include: t_paths.c

Log Message:
tests/include/t_paths: /dev/ksyms requires root.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/include/t_paths.c

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



CVS commit: src/sys/rump/librump/rumpkern

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:51:48 UTC 2023

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

Log Message:
Revert "rump: Set mp_online = true and start threads _after_ cold = 0."

This breaks some tests, e.g. dev/scsipi/t_cd:noisyeject, which relies
on config_finalize to wait for driver threads.  Trouble is, the
actual setting of cold=0 happens near the call to config_finalize in
RUMP__FACTION_DEV.  Need to think harder about this.


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.356 src/sys/rump/librump/rumpkern/rump.c:1.357
--- src/sys/rump/librump/rumpkern/rump.c:1.356	Sat Aug  5 08:05:57 2023
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Aug  5 11:51:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $	*/
+/*	$NetBSD: rump.c,v 1.357 2023/08/05 11:51:47 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.357 2023/08/05 11:51:47 riastradh Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -391,9 +391,14 @@ rump_init_callback(void (*cpuinit_callba
 	cprng_init();
 	cprng_fast_init();
 
+	mp_online = true;
+
 	if (cpuinit_callback)
 		(*cpuinit_callback)();
 
+	/* CPUs are up.  allow kernel threads to run */
+	rump_thread_allow(NULL);
+
 	rnd_init_softint();
 
 	kqueue_init();
@@ -447,11 +452,6 @@ rump_init_callback(void (*cpuinit_callba
 
 	cold = 0;
 
-	mp_online = true;
-
-	/* CPUs are up.  allow kernel threads to run */
-	rump_thread_allow(NULL);
-
 	sysctl_finalize();
 
 	module_init_class(MODULE_CLASS_ANY);



CVS commit: src/sys/rump/librump/rumpkern

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:51:48 UTC 2023

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

Log Message:
Revert "rump: Set mp_online = true and start threads _after_ cold = 0."

This breaks some tests, e.g. dev/scsipi/t_cd:noisyeject, which relies
on config_finalize to wait for driver threads.  Trouble is, the
actual setting of cold=0 happens near the call to config_finalize in
RUMP__FACTION_DEV.  Need to think harder about this.


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 src/sys/rump/librump/rumpkern/rump.c

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



CVS commit: src/sys/crypto/cprng_fast

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:39:18 UTC 2023

Modified Files:
src/sys/crypto/cprng_fast: cprng_fast.c

Log Message:
cprng_fast(9): Drop and retake percpu reference across cprng_strong.

cprng_strong may sleep on an adaptive lock (via entropy_extract),
which invalidates percpu(9) references.

Discovered by stumbling upon this panic in a test run:

panic: kernel diagnostic assertion "(cprng == percpu_getref(cprng_fast_percpu)) 
&& (percpu_putref(cprng_fast_percpu), true)" failed: file 
"/home/riastradh/netbsd/current/src/sys/rump/librump/rumpkern/../../../crypto/cprng_fast/cprng_fast.c",
 line 117

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/crypto/cprng_fast/cprng_fast.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/crypto/cprng_fast/cprng_fast.c
diff -u src/sys/crypto/cprng_fast/cprng_fast.c:1.18 src/sys/crypto/cprng_fast/cprng_fast.c:1.19
--- src/sys/crypto/cprng_fast/cprng_fast.c:1.18	Thu Sep  1 18:32:25 2022
+++ src/sys/crypto/cprng_fast/cprng_fast.c	Sat Aug  5 11:39:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cprng_fast.c,v 1.18 2022/09/01 18:32:25 riastradh Exp $	*/
+/*	$NetBSD: cprng_fast.c,v 1.19 2023/08/05 11:39:18 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.18 2022/09/01 18:32:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.19 2023/08/05 11:39:18 riastradh Exp $");
 
 #include 
 #include 
@@ -58,7 +58,7 @@ struct cprng_fast {
 };
 
 static void	cprng_fast_init_cpu(void *, void *, struct cpu_info *);
-static void	cprng_fast_reseed(struct cprng_fast *);
+static void	cprng_fast_reseed(struct cprng_fast **, unsigned);
 
 static void	cprng_fast_seed(struct cprng_fast *, const void *);
 static void	cprng_fast_buf(struct cprng_fast *, void *, unsigned);
@@ -93,6 +93,7 @@ static int
 cprng_fast_get(struct cprng_fast **cprngp)
 {
 	struct cprng_fast *cprng;
+	unsigned epoch;
 	int s;
 
 	KASSERT(!cpu_intr_p());
@@ -101,9 +102,10 @@ cprng_fast_get(struct cprng_fast **cprng
 	*cprngp = cprng = percpu_getref(cprng_fast_percpu);
 	s = splsoftserial();
 
-	if (__predict_false(cprng->epoch != entropy_epoch())) {
+	epoch = entropy_epoch();
+	if (__predict_false(cprng->epoch != epoch)) {
 		splx(s);
-		cprng_fast_reseed(cprng);
+		cprng_fast_reseed(cprngp, epoch);
 		s = splsoftserial();
 	}
 
@@ -121,13 +123,25 @@ cprng_fast_put(struct cprng_fast *cprng,
 }
 
 static void
-cprng_fast_reseed(struct cprng_fast *cprng)
+cprng_fast_reseed(struct cprng_fast **cprngp, unsigned epoch)
 {
-	unsigned epoch = entropy_epoch();
+	struct cprng_fast *cprng;
 	uint8_t seed[CPRNG_FAST_SEED_BYTES];
 	int s;
 
+	/*
+	 * Drop the percpu(9) reference to extract a fresh seed from
+	 * the entropy pool.  cprng_strong may sleep on an adaptive
+	 * lock, which invalidates our percpu(9) reference.
+	 *
+	 * This may race with reseeding in another thread, which is no
+	 * big deal -- worst case, we rewind the entropy epoch here and
+	 * cause the next caller to reseed again, and in the end we
+	 * just reseed a couple more times than necessary.
+	 */
+	percpu_putref(cprng_fast_percpu);
 	cprng_strong(kern_cprng, seed, sizeof(seed), 0);
+	*cprngp = cprng = percpu_getref(cprng_fast_percpu);
 
 	s = splsoftserial();
 	cprng_fast_seed(cprng, seed);



CVS commit: src/sys/crypto/cprng_fast

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:39:18 UTC 2023

Modified Files:
src/sys/crypto/cprng_fast: cprng_fast.c

Log Message:
cprng_fast(9): Drop and retake percpu reference across cprng_strong.

cprng_strong may sleep on an adaptive lock (via entropy_extract),
which invalidates percpu(9) references.

Discovered by stumbling upon this panic in a test run:

panic: kernel diagnostic assertion "(cprng == percpu_getref(cprng_fast_percpu)) 
&& (percpu_putref(cprng_fast_percpu), true)" failed: file 
"/home/riastradh/netbsd/current/src/sys/rump/librump/rumpkern/../../../crypto/cprng_fast/cprng_fast.c",
 line 117

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/crypto/cprng_fast/cprng_fast.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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:21:24 UTC 2023

Modified Files:
src/sys/kern: kern_entropy.c subr_cprng.c

Log Message:
cprng(9): Drop and retake percpu reference across entropy_extract.

entropy_extract may sleep on an adaptive lock, which invalidates
percpu(9) references.

Add a note in the comment over entropy_extract about this.

Discovered by stumbling upon this panic during a test run:

[   1.0200050] panic: kernel diagnostic assertion "(cprng == 
percpu_getref(cprng_fast_percpu)) && (percpu_putref(cprng_fast_percpu), true)" 
failed: file 
"/home/riastradh/netbsd/current/src/sys/rump/librump/rumpkern/../../../crypto/cprng_fast/cprng_fast.c",
 line 117

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/kern_entropy.c
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/subr_cprng.c

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

Modified files:

Index: src/sys/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.64 src/sys/kern/kern_entropy.c:1.65
--- src/sys/kern/kern_entropy.c:1.64	Fri Aug  4 16:02:01 2023
+++ src/sys/kern/kern_entropy.c	Sat Aug  5 11:21:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.64 2023/08/04 16:02:01 riastradh Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.65 2023/08/05 11:21:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.64 2023/08/04 16:02:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.65 2023/08/05 11:21:24 riastradh Exp $");
 
 #include 
 #include 
@@ -1468,8 +1468,9 @@ sysctl_entropy_gather(SYSCTLFN_ARGS)
  *		EINTR/ERESTART	No entropy, ENTROPY_SIG set, and interrupted.
  *
  *	If ENTROPY_WAIT is set, allowed only in thread context.  If
- *	ENTROPY_WAIT is not set, allowed also in softint context.
- *	Forbidden in hard interrupt context.
+ *	ENTROPY_WAIT is not set, allowed also in softint context -- may
+ *	sleep on an adaptive lock up to IPL_SOFTSERIAL.  Forbidden in
+ *	hard interrupt context.
  */
 int
 entropy_extract(void *buf, size_t len, int flags)

Index: src/sys/kern/subr_cprng.c
diff -u src/sys/kern/subr_cprng.c:1.43 src/sys/kern/subr_cprng.c:1.44
--- src/sys/kern/subr_cprng.c:1.43	Fri May 13 09:40:25 2022
+++ src/sys/kern/subr_cprng.c	Sat Aug  5 11:21:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cprng.c,v 1.43 2022/05/13 09:40:25 riastradh Exp $	*/
+/*	$NetBSD: subr_cprng.c,v 1.44 2023/08/05 11:21:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.43 2022/05/13 09:40:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.44 2023/08/05 11:21:24 riastradh Exp $");
 
 #include 
 #include 
@@ -265,10 +265,39 @@ cprng_fini_cpu(void *ptr, void *cookie, 
 	kmem_free(cc->cc_drbg, sizeof(*cc->cc_drbg));
 }
 
+static void
+cprng_strong_reseed(struct cprng_strong *cprng, unsigned epoch,
+struct cprng_cpu **ccp, int *sp)
+{
+	uint8_t seed[NIST_HASH_DRBG_SEEDLEN_BYTES];
+
+	/*
+	 * Drop everything to extract a fresh seed from the entropy
+	 * pool.  entropy_extract may sleep on an adaptive lock, which
+	 * invalidates our percpu(9) reference.
+	 *
+	 * This may race with reseeding in another thread, which is no
+	 * big deal -- worst case, we rewind the entropy epoch here and
+	 * cause the next caller to reseed again, and in the end we
+	 * just reseed a couple more times than necessary.
+	 */
+	splx(*sp);
+	percpu_putref(cprng->cs_percpu);
+	entropy_extract(seed, sizeof seed, 0);
+	*ccp = percpu_getref(cprng->cs_percpu);
+	*sp = splraiseipl(cprng->cs_iplcookie);
+
+	(*ccp)->cc_evcnt->reseed.ev_count++;
+	if (__predict_false(nist_hash_drbg_reseed((*ccp)->cc_drbg,
+		seed, sizeof seed, NULL, 0)))
+		panic("nist_hash_drbg_reseed");
+	explicit_memset(seed, 0, sizeof seed);
+	(*ccp)->cc_epoch = epoch;
+}
+
 size_t
 cprng_strong(struct cprng_strong *cprng, void *buf, size_t len, int flags)
 {
-	uint8_t seed[NIST_HASH_DRBG_SEEDLEN_BYTES];
 	struct cprng_cpu *cc;
 	unsigned epoch;
 	int s;
@@ -293,25 +322,13 @@ cprng_strong(struct cprng_strong *cprng,
 
 	/* If the entropy epoch has changed, (re)seed.  */
 	epoch = entropy_epoch();
-	if (__predict_false(epoch != cc->cc_epoch)) {
-		entropy_extract(seed, sizeof seed, 0);
-		cc->cc_evcnt->reseed.ev_count++;
-		if (__predict_false(nist_hash_drbg_reseed(cc->cc_drbg,
-			seed, sizeof seed, NULL, 0)))
-			panic("nist_hash_drbg_reseed");
-		explicit_memset(seed, 0, sizeof seed);
-		cc->cc_epoch = epoch;
-	}
+	if (__predict_false(epoch != cc->cc_epoch))
+		cprng_strong_reseed(cprng, epoch, , );
 
 	/* Generate data.  Failure here means it's time to reseed.  */
 	if (__predict_false(nist_hash_drbg_generate(cc->cc_drbg, buf, len,
 		NULL, 0))) {
-		entropy_extract(seed, sizeof seed, 0);
-		

CVS commit: src/sys/kern

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:21:24 UTC 2023

Modified Files:
src/sys/kern: kern_entropy.c subr_cprng.c

Log Message:
cprng(9): Drop and retake percpu reference across entropy_extract.

entropy_extract may sleep on an adaptive lock, which invalidates
percpu(9) references.

Add a note in the comment over entropy_extract about this.

Discovered by stumbling upon this panic during a test run:

[   1.0200050] panic: kernel diagnostic assertion "(cprng == 
percpu_getref(cprng_fast_percpu)) && (percpu_putref(cprng_fast_percpu), true)" 
failed: file 
"/home/riastradh/netbsd/current/src/sys/rump/librump/rumpkern/../../../crypto/cprng_fast/cprng_fast.c",
 line 117

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/kern_entropy.c
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/subr_cprng.c

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



CVS commit: src

2023-08-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug  5 10:13:39 UTC 2023

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

Log Message:
lint: implement __builtin_offsetof for the simplest cases

Cases not covered:
1. C99 allows designators in the offsetof macro.
2. For packed types, the offset is likely to be incorrect.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/expr_sizeof.c
cvs rdiff -u -r1.575 -r1.576 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/expr_sizeof.c
diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.13 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.14
--- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.13	Sun Jul  9 11:18:55 2023
+++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c	Sat Aug  5 10:13:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr_sizeof.c,v 1.13 2023/07/09 11:18:55 rillig Exp $	*/
+/*	$NetBSD: expr_sizeof.c,v 1.14 2023/08/05 10:13:39 rillig Exp $	*/
 # 3 "expr_sizeof.c"
 
 /*
@@ -132,8 +132,7 @@ bit_fields(void)
 	} mixed;
 	/* expect+1: error: negative array dimension (-8) [20] */
 	typedef int sizeof_mixed[-(int)sizeof(mixed)];
-	/* FIXME: Implement build_offsetof correctly. */
-	/* expect+3: error: negative array dimension (-8) [20] */
+	/* expect+3: error: negative array dimension (-1) [20] */
 	typedef int offsetof_mixed_ch[
 	-(int)__builtin_offsetof(struct mixed, ch)
 	];

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.575 src/usr.bin/xlint/lint1/tree.c:1.576
--- src/usr.bin/xlint/lint1/tree.c:1.575	Wed Aug  2 18:57:54 2023
+++ src/usr.bin/xlint/lint1/tree.c	Sat Aug  5 10:13:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.575 2023/08/02 18:57:54 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.576 2023/08/05 10:13:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.575 2023/08/02 18:57:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.576 2023/08/05 10:13:39 rillig Exp $");
 #endif
 
 #include 
@@ -3960,17 +3960,26 @@ build_sizeof(const type_t *tp)
 /*
  * Create a constant node for offsetof.
  */
-/* ARGSUSED */ /* FIXME: See implementation comments. */
 tnode_t *
 build_offsetof(const type_t *tp, const sym_t *sym)
 {
+	unsigned int offset_in_bits = 0;
 
-	if (!is_struct_or_union(tp->t_tspec))
+	if (!is_struct_or_union(tp->t_tspec)) {
 		/* unacceptable operand of '%s' */
 		error(111, "offsetof");
+		goto proceed;
+	}
+	sym_t *mem = find_member(tp->t_sou, sym->s_name);
+	if (mem == NULL) {
+		/* type '%s' does not have member '%s' */
+		error(101, sym->s_name, type_name(tp));
+		goto proceed;
+	}
+	offset_in_bits = mem->u.s_member.sm_offset_in_bits;
 
-	/* FIXME: Don't wrongly use the size of the whole type, use sym. */
-	unsigned int offset_in_bytes = type_size_in_bits(tp) / CHAR_SIZE;
+proceed:;
+	unsigned int offset_in_bytes = offset_in_bits / CHAR_SIZE;
 	tnode_t *tn = build_integer_constant(SIZEOF_TSPEC, offset_in_bytes);
 	tn->tn_system_dependent = true;
 	return tn;



CVS commit: src

2023-08-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug  5 10:13:39 UTC 2023

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

Log Message:
lint: implement __builtin_offsetof for the simplest cases

Cases not covered:
1. C99 allows designators in the offsetof macro.
2. For packed types, the offset is likely to be incorrect.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/expr_sizeof.c
cvs rdiff -u -r1.575 -r1.576 src/usr.bin/xlint/lint1/tree.c

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



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

2023-08-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug  5 10:00:59 UTC 2023

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

Log Message:
tests/lint: fix test for packed structs on 32-bit platforms


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/d_packed_structs.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_packed_structs.c
diff -u src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.5 src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.6
--- src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.5	Tue Aug  1 19:52:15 2023
+++ src/tests/usr.bin/xlint/lint1/d_packed_structs.c	Sat Aug  5 10:00:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_packed_structs.c,v 1.5 2023/08/01 19:52:15 rillig Exp $	*/
+/*	$NetBSD: d_packed_structs.c,v 1.6 2023/08/05 10:00:59 rillig Exp $	*/
 # 3 "d_packed_structs.c"
 
 /* packed tests */
@@ -30,12 +30,12 @@ typedef struct __packed {
 
 struct x {
 	char c;
-	long l;
+	long long l;
 } __packed;
 
 struct y {
 	char c;
-	long l;
+	long long l;
 };
 
 int a[sizeof(struct y) - sizeof(struct x) - 1];



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

2023-08-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug  5 10:00:59 UTC 2023

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

Log Message:
tests/lint: fix test for packed structs on 32-bit platforms


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/d_packed_structs.c

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



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

2023-08-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug  5 09:44:18 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint2: msg_013.exp msg_013.ln

Log Message:
tests/lint: test C99 printf conversion specifiers in lint2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint2/msg_013.exp \
src/tests/usr.bin/xlint/lint2/msg_013.ln

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



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

2023-08-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug  5 09:44:18 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint2: msg_013.exp msg_013.ln

Log Message:
tests/lint: test C99 printf conversion specifiers in lint2


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint2/msg_013.exp \
src/tests/usr.bin/xlint/lint2/msg_013.ln

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

Modified files:

Index: src/tests/usr.bin/xlint/lint2/msg_013.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_013.exp:1.1 src/tests/usr.bin/xlint/lint2/msg_013.exp:1.2
--- src/tests/usr.bin/xlint/lint2/msg_013.exp:1.1	Thu Aug  5 22:36:08 2021
+++ src/tests/usr.bin/xlint/lint2/msg_013.exp	Sat Aug  5 09:44:18 2023
@@ -0,0 +1,3 @@
+my_printf: malformed format string  	local.c(12)
+my_printf: malformed format string  	local.c(13)
+my_printf, arg 2 inconsistent with format  	local.c(13)
Index: src/tests/usr.bin/xlint/lint2/msg_013.ln
diff -u src/tests/usr.bin/xlint/lint2/msg_013.ln:1.1 src/tests/usr.bin/xlint/lint2/msg_013.ln:1.2
--- src/tests/usr.bin/xlint/lint2/msg_013.ln:1.1	Thu Aug  5 22:36:08 2021
+++ src/tests/usr.bin/xlint/lint2/msg_013.ln	Sat Aug  5 09:44:18 2023
@@ -1,6 +1,18 @@
-# $NetBSD: msg_013.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_013.ln,v 1.2 2023/08/05 09:44:18 rillig Exp $
 #
 # Test data for message 13 of lint2:
 #	%s: malformed format string  	%s
 #
-# TODO: add actual test data
+
+0 s local.c
+S local.c
+
+# void my_printf(const char *fmt) {}
+4 d 0.4 v 1P 1d 9my_printf F1 PcC V
+
+# my_printf("%f", 0.0);
+11 c 0.11 s1"%f" i 9my_printf f2 PC D V
+# my_printf("%a", 0.0);
+12 c 0.12 s1"%a" i 9my_printf f2 PC D V
+# my_printf("%lf", 0.0L);
+13 c 0.13 s1"%lf" i 9my_printf f2 PC lD V



CVS commit: src/sys/kern

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 09:25:39 UTC 2023

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

Log Message:
s/acccept/accept/ in comment.


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

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

Modified files:

Index: src/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.302 src/sys/kern/uipc_socket.c:1.303
--- src/sys/kern/uipc_socket.c:1.302	Sat Apr  9 23:52:22 2022
+++ src/sys/kern/uipc_socket.c	Sat Aug  5 09:25:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.302 2022/04/09 23:52:22 riastradh Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.303 2023/08/05 09:25:39 andvar Exp $	*/
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.302 2022/04/09 23:52:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.303 2023/08/05 09:25:39 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -702,7 +702,7 @@ sofree(struct socket *so)
 	KASSERT(!cv_has_waiters(>so_snd.sb_cv));
 	sorflush(so);
 	refs = so->so_aborting;	/* XXX */
-	/* Remove acccept filter if one is present. */
+	/* Remove accept filter if one is present. */
 	if (so->so_accf != NULL)
 		(void)accept_filt_clear(so);
 	sounlock(so);



CVS commit: src/sys/kern

2023-08-05 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug  5 09:25:39 UTC 2023

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

Log Message:
s/acccept/accept/ in comment.


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

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



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:55:48 UTC 2023

Modified Files:
src/distrib/sets/lists/base: md.amd64 md.sparc64

Log Message:
base/md.amd64, base/md.sparc64: Mark openssl compat directories.

Should fix MKCOMPAT=no build.

PR port-amd64/57567


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.261 -r1.262 src/distrib/sets/lists/base/md.sparc64

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

Modified files:

Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.294 src/distrib/sets/lists/base/md.amd64:1.295
--- src/distrib/sets/lists/base/md.amd64:1.294	Fri Aug  4 08:54:00 2023
+++ src/distrib/sets/lists/base/md.amd64	Sat Aug  5 08:55:48 2023
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.294 2023/08/04 08:54:00 mrg Exp $
+# $NetBSD: md.amd64,v 1.295 2023/08/05 08:55:48 riastradh Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
@@ -11,14 +11,14 @@
 ./usr/lib/i386/libproc.so.1.0			base-compat-shlib	compat,pic,dtrace
 ./usr/lib/i386/librtld_db.so.0			base-compat-shlib	compat,pic,dtrace
 ./usr/lib/i386/librtld_db.so.0.0		base-compat-shlib	compat,pic,dtrace
-./usr/lib/i386/opensslbase-crypto-usr
-./usr/lib/i386/openssl/engines			base-crypto-usr
+./usr/lib/i386/opensslbase-crypto-usr		compat
+./usr/lib/i386/openssl/engines			base-crypto-usr		compat
 ./usr/lib/i386/openssl/engines/dasync.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/i386/openssl/engines/devcrypto.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/i386/openssl/engines/loader_attic.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/i386/openssl/engines/ossltest.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/i386/openssl/engines/padlock.so	base-crypto-usr		compat,pic,openssl=30
-./usr/lib/i386/openssl/modules			base-crypto-usr
+./usr/lib/i386/openssl/modules			base-crypto-usr		compat
 ./usr/lib/i386/openssl/modules/legacy.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/libtsan.sobase-sys-shlib		cxx,gcc
 ./usr/lib/libtsan.so.1base-sys-shlib		cxx,gcc=10

Index: src/distrib/sets/lists/base/md.sparc64
diff -u src/distrib/sets/lists/base/md.sparc64:1.261 src/distrib/sets/lists/base/md.sparc64:1.262
--- src/distrib/sets/lists/base/md.sparc64:1.261	Sat May 27 10:12:11 2023
+++ src/distrib/sets/lists/base/md.sparc64	Sat Aug  5 08:55:48 2023
@@ -1,15 +1,15 @@
-# $NetBSD: md.sparc64,v 1.261 2023/05/27 10:12:11 riastradh Exp $
+# $NetBSD: md.sparc64,v 1.262 2023/08/05 08:55:48 riastradh Exp $
 ./libexec/ld.elf_so-sparc			base-sysutil-bin	compat,pic
 ./sbin/edlabel	base-obsolete	obsolete
 ./usr/bin/fdformatbase-util-bin
 ./usr/libexec/ld.elf_so-sparc			base-sysutil-bin	compat,pic
-./usr/lib/sparc/opensslbase-crypto-usr
-./usr/lib/sparc/openssl/engines			base-crypto-usr
+./usr/lib/sparc/opensslbase-crypto-usr		compat
+./usr/lib/sparc/openssl/engines			base-crypto-usr		compat
 ./usr/lib/sparc/openssl/engines/dasync.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/sparc/openssl/engines/devcrypto.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/sparc/openssl/engines/loader_attic.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lib/sparc/openssl/engines/ossltest.so	base-crypto-usr		compat,pic,openssl=30
-./usr/lib/sparc/openssl/modules			base-crypto-usr
+./usr/lib/sparc/openssl/modules			base-crypto-usr		compat
 ./usr/lib/sparc/openssl/modules/legacy.so	base-crypto-usr		compat,pic,openssl=30
 ./usr/lkm/compat_netbsd32.o			base-obsolete		obsolete
 ./usr/lkm/compat_sunos32.o			base-obsolete		obsolete



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:55:48 UTC 2023

Modified Files:
src/distrib/sets/lists/base: md.amd64 md.sparc64

Log Message:
base/md.amd64, base/md.sparc64: Mark openssl compat directories.

Should fix MKCOMPAT=no build.

PR port-amd64/57567


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.261 -r1.262 src/distrib/sets/lists/base/md.sparc64

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



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:15:41 UTC 2023

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

Log Message:
comp/mi: /usr/include/g++/bit is gcc-only, not for clang (or pcc)


To generate a diff of this commit:
cvs rdiff -u -r1.2444 -r1.2445 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2444 src/distrib/sets/lists/comp/mi:1.2445
--- src/distrib/sets/lists/comp/mi:1.2444	Fri Aug  4 08:54:00 2023
+++ src/distrib/sets/lists/comp/mi	Sat Aug  5 08:15:40 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2444 2023/08/04 08:54:00 mrg Exp $
+#	$NetBSD: mi,v 1.2445 2023/08/05 08:15:40 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -1084,7 +1084,7 @@
 ./usr/include/g++/backward/tree.h		comp-obsolete		obsolete
 ./usr/include/g++/backward/vector.h		comp-obsolete		obsolete
 ./usr/include/g++/barrier			comp-cxx-include	gcc,cxx,libstdcxx,gcc=12
-./usr/include/g++/bitcomp-cxx-include	cxx,libstdcxx
+./usr/include/g++/bitcomp-cxx-include	gcc,cxx,libstdcxx
 ./usr/include/g++/bitdo1.h			comp-obsolete		obsolete
 ./usr/include/g++/bitdo2.h			comp-obsolete		obsolete
 ./usr/include/g++/bitprims.h			comp-obsolete		obsolete



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:15:41 UTC 2023

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

Log Message:
comp/mi: /usr/include/g++/bit is gcc-only, not for clang (or pcc)


To generate a diff of this commit:
cvs rdiff -u -r1.2444 -r1.2445 src/distrib/sets/lists/comp/mi

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



CVS commit: src/sys/rump/librump/rumpkern

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:05:58 UTC 2023

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

Log Message:
rump: Set mp_online = true and start threads _after_ cold = 0.

Otherwise we may have threads running while cold, which is a
contradiction in terms.

Deferring mp_online = true is necessary because things like xcall(9)
use rely on it to decide whether to wait for threads on other CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.355 -r1.356 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.355 src/sys/rump/librump/rumpkern/rump.c:1.356
--- src/sys/rump/librump/rumpkern/rump.c:1.355	Mon Mar 28 20:49:32 2022
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Aug  5 08:05:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.355 2022/03/28 20:49:32 christos Exp $	*/
+/*	$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.355 2022/03/28 20:49:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -391,14 +391,9 @@ rump_init_callback(void (*cpuinit_callba
 	cprng_init();
 	cprng_fast_init();
 
-	mp_online = true;
-
 	if (cpuinit_callback)
 		(*cpuinit_callback)();
 
-	/* CPUs are up.  allow kernel threads to run */
-	rump_thread_allow(NULL);
-
 	rnd_init_softint();
 
 	kqueue_init();
@@ -452,6 +447,11 @@ rump_init_callback(void (*cpuinit_callba
 
 	cold = 0;
 
+	mp_online = true;
+
+	/* CPUs are up.  allow kernel threads to run */
+	rump_thread_allow(NULL);
+
 	sysctl_finalize();
 
 	module_init_class(MODULE_CLASS_ANY);



CVS commit: src/sys/rump/librump/rumpkern

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:05:58 UTC 2023

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

Log Message:
rump: Set mp_online = true and start threads _after_ cold = 0.

Otherwise we may have threads running while cold, which is a
contradiction in terms.

Deferring mp_online = true is necessary because things like xcall(9)
use rely on it to decide whether to wait for threads on other CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.355 -r1.356 src/sys/rump/librump/rumpkern/rump.c

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



CVS commit: src/tests/kernel

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:05:16 UTC 2023

Modified Files:
src/tests/kernel: t_fcntl.c

Log Message:
memfd(2): Run all tests; don't stop after the first failure.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/t_fcntl.c

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

Modified files:

Index: src/tests/kernel/t_fcntl.c
diff -u src/tests/kernel/t_fcntl.c:1.3 src/tests/kernel/t_fcntl.c:1.4
--- src/tests/kernel/t_fcntl.c:1.3	Sat Jul 29 12:16:34 2023
+++ src/tests/kernel/t_fcntl.c	Sat Aug  5 08:05:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fcntl.c,v 1.3 2023/07/29 12:16:34 christos Exp $	*/
+/*	$NetBSD: t_fcntl.c,v 1.4 2023/08/05 08:05:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -108,14 +108,18 @@ ATF_TC_BODY(getpath_memfd, tc)
 
 	for (size_t i = 0; i < __arraycount(memfd_names); i++) {
 		fd = memfd_create(memfd_names[i].bare, 0);
-		ATF_REQUIRE_MSG(fd != -1, "Failed to create memfd (%s)",
+		ATF_CHECK_MSG(fd != -1, "Failed to create memfd (%s)",
 		strerror(errno));
+		if (fd == -1)
+			continue;
 		rv = fcntl(fd, F_GETPATH, path);
-		ATF_REQUIRE_MSG(rv != -1, "Can't get path `%s' (%s)",
+		ATF_CHECK_MSG(rv != -1, "Can't get path `%s' (%s)",
 		memfd_names[i].bare, strerror(errno));
-		ATF_REQUIRE_MSG(strcmp(memfd_names[i].prefixed, path) == 0,
+		if (rv == -1)
+			goto next;
+		ATF_CHECK_MSG(strcmp(memfd_names[i].prefixed, path) == 0,
 		"Bad name `%s' != `%s'", path, memfd_names[i].prefixed);
-		close(fd);
+next:		close(fd);
 	}
 }
 



CVS commit: src/tests/kernel

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:05:16 UTC 2023

Modified Files:
src/tests/kernel: t_fcntl.c

Log Message:
memfd(2): Run all tests; don't stop after the first failure.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/t_fcntl.c

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