CVS commit: src/sys/fs/msdosfs

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 05:41:09 UTC 2023

Modified Files:
src/sys/fs/msdosfs: msdosfs_vnops.c

Log Message:
when calling a function that needs more bytes than we have, create a
stack variable long enough and use that instead.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/fs/msdosfs/msdosfs_vnops.c

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



CVS commit: src/sys/fs/msdosfs

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 05:41:09 UTC 2023

Modified Files:
src/sys/fs/msdosfs: msdosfs_vnops.c

Log Message:
when calling a function that needs more bytes than we have, create a
stack variable long enough and use that instead.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/fs/msdosfs/msdosfs_vnops.c

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

Modified files:

Index: src/sys/fs/msdosfs/msdosfs_vnops.c
diff -u src/sys/fs/msdosfs/msdosfs_vnops.c:1.110 src/sys/fs/msdosfs/msdosfs_vnops.c:1.111
--- src/sys/fs/msdosfs/msdosfs_vnops.c:1.110	Sat Oct 23 16:58:17 2021
+++ src/sys/fs/msdosfs/msdosfs_vnops.c	Mon Aug 14 05:41:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.110 2021/10/23 16:58:17 thorpej Exp $	*/
+/*	$NetBSD: msdosfs_vnops.c,v 1.111 2023/08/14 05:41:09 mrg Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.110 2021/10/23 16:58:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.111 2023/08/14 05:41:09 mrg Exp $");
 
 #include 
 #include 
@@ -1163,12 +1163,17 @@ msdosfs_readdir(void *v)
 offset / sizeof(struct direntry);
 dirbuf->d_type = DT_REG;
 			}
-			if (chksum != msdosfs_winChksum(dentp->deName))
+			if (chksum != msdosfs_winChksum(dentp->deName)) {
+char deName[11];
+
+memcpy(deName, dentp->deName,
+   sizeof dentp->deName);
+memset([8], 0, 3);
 dirbuf->d_namlen =
-msdosfs_dos2unixfn(dentp->deName,
-(u_char *)dirbuf->d_name,
-pmp->pm_flags & MSDOSFSMNT_SHORTNAME);
-			else
+msdosfs_dos2unixfn(deName,
+(u_char *)dirbuf->d_name,
+pmp->pm_flags & MSDOSFSMNT_SHORTNAME);
+			} else
 dirbuf->d_name[dirbuf->d_namlen] = 0;
 			namlen = dirbuf->d_namlen;
 			chksum = -1;



CVS commit: src/external/bsd/tre/lib

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 05:29:28 UTC 2023

Modified Files:
src/external/bsd/tre/lib: Makefile

Log Message:
apply -Wno-error for GCC 12.

this code seems broken.  hash_table_del() is called on a ptr that was
either just freed (realloc() case) or will be freed (xfree_impl() case),
but in both cases hash_table_del() will free() the same address.  for
the realloc() case, as it's after free(), it's UB.  for the xfree_impl()
case, it can be solved by not free()ing here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/tre/lib/Makefile

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



CVS commit: src/external/bsd/tre/lib

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 05:29:28 UTC 2023

Modified Files:
src/external/bsd/tre/lib: Makefile

Log Message:
apply -Wno-error for GCC 12.

this code seems broken.  hash_table_del() is called on a ptr that was
either just freed (realloc() case) or will be freed (xfree_impl() case),
but in both cases hash_table_del() will free() the same address.  for
the realloc() case, as it's after free(), it's UB.  for the xfree_impl()
case, it can be solved by not free()ing here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/tre/lib/Makefile

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

Modified files:

Index: src/external/bsd/tre/lib/Makefile
diff -u src/external/bsd/tre/lib/Makefile:1.5 src/external/bsd/tre/lib/Makefile:1.6
--- src/external/bsd/tre/lib/Makefile:1.5	Thu Aug  3 14:56:36 2023
+++ src/external/bsd/tre/lib/Makefile	Mon Aug 14 05:29:28 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2023/08/03 14:56:36 rin Exp $
+#	$NetBSD: Makefile,v 1.6 2023/08/14 05:29:28 mrg Exp $
 
 # for information:
 # the configure script is run as:
@@ -19,4 +19,8 @@ SRCS+=	tre-ast.c tre-compile.c tre-match
 SRCS+=	tre-match-backtrack.c tre-match-parallel.c tre-mem.c
 SRCS+=	tre-parse.c tre-stack.c xmalloc.c
 
+# XXXGCC12 this is very broken.  it double-free()'s as well as the UB
+# after realloc().
+COPTS.xmalloc.c+=	-Wno-error
+
 .include 



CVS commit: src/bin/sh

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 03:18:15 UTC 2023

Modified Files:
src/bin/sh: Makefile

Log Message:
use -O1 on sh3, GCC 12 and parser.c.

this triggers clobbered vs. longjmp/setjmp warnings with -Os that sh3 uses.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/bin/sh/Makefile

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



CVS commit: src/bin/sh

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 03:18:15 UTC 2023

Modified Files:
src/bin/sh: Makefile

Log Message:
use -O1 on sh3, GCC 12 and parser.c.

this triggers clobbered vs. longjmp/setjmp warnings with -Os that sh3 uses.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/bin/sh/Makefile

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

Modified files:

Index: src/bin/sh/Makefile
diff -u src/bin/sh/Makefile:1.120 src/bin/sh/Makefile:1.121
--- src/bin/sh/Makefile:1.120	Sun Oct 10 08:35:34 2021
+++ src/bin/sh/Makefile	Mon Aug 14 03:18:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.120 2021/10/10 08:35:34 rillig Exp $
+#	$NetBSD: Makefile,v 1.121 2023/08/14 03:18:14 mrg Exp $
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 
 .include 
@@ -93,5 +93,10 @@ COPTS.printf.c = -Wno-format-nonliteral
 COPTS.jobs.c = -Wno-format-nonliteral
 COPTS.var.c = -Wno-format-nonliteral
 
+# XXXGCC12 - only on some targets
+.if ${MACHINE_CPU} == "sh3"
+COPTS.parser.c+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -O1 :}
+.endif
+
 .include 
 .include 



CVS commit: src/sys/netinet

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 03:03:48 UTC 2023

Modified Files:
src/sys/netinet: dccp_tfrc.c

Log Message:
avoid uninitialised variable use.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/netinet/dccp_tfrc.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/netinet/dccp_tfrc.c
diff -u src/sys/netinet/dccp_tfrc.c:1.10 src/sys/netinet/dccp_tfrc.c:1.11
--- src/sys/netinet/dccp_tfrc.c:1.10	Mon Aug  7 23:28:58 2023
+++ src/sys/netinet/dccp_tfrc.c	Mon Aug 14 03:03:48 2023
@@ -1,5 +1,5 @@
 /*	$KAME: dccp_tfrc.c,v 1.16 2006/03/01 17:34:08 nishida Exp $	*/
-/*	$NetBSD: dccp_tfrc.c,v 1.10 2023/08/07 23:28:58 mrg Exp $ */
+/*	$NetBSD: dccp_tfrc.c,v 1.11 2023/08/14 03:03:48 mrg Exp $ */
 
 /*
  * Copyright (c) 2003  Nils-Erik Mattsson
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dccp_tfrc.c,v 1.10 2023/08/07 23:28:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp_tfrc.c,v 1.11 2023/08/14 03:03:48 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dccp.h"
@@ -384,7 +384,7 @@ tfrc_time_no_feedback(void *ccb)
 		/* half send rate */
 		cb->x.denom *= 2;
 		v.num = cb->s;
-		v.denom *= TFRC_MAX_BACK_OFF_TIME;
+		v.denom = TFRC_MAX_BACK_OFF_TIME;
 		if (fixpoint_cmp(>x, ) < 0)
 			cb->x = v;
 
@@ -414,7 +414,7 @@ tfrc_time_no_feedback(void *ccb)
 
 		v.num = cb->s;
 		v.num *= 4;
-		v.denom *= cb->rtt;
+		v.denom = cb->rtt;
 		v.num *= 100;
 		normalize(, );
 		if (!cb->idle || fixpoint_cmp(>x_recv, ) >= 0) {



CVS commit: src/sys/netinet

2023-08-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug 14 03:03:48 UTC 2023

Modified Files:
src/sys/netinet: dccp_tfrc.c

Log Message:
avoid uninitialised variable use.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/netinet/dccp_tfrc.c

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



CVS commit: src/lib/libcrypt

2023-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 14 02:22:35 UTC 2023

Modified Files:
src/lib/libcrypt: crypt.c

Log Message:
libcrypt: trailing white space


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libcrypt/crypt.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/libcrypt/crypt.c
diff -u src/lib/libcrypt/crypt.c:1.39 src/lib/libcrypt/crypt.c:1.40
--- src/lib/libcrypt/crypt.c:1.39	Sat Jun 24 05:18:12 2023
+++ src/lib/libcrypt/crypt.c	Mon Aug 14 02:22:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypt.c,v 1.39 2023/06/24 05:18:12 msaitoh Exp $	*/
+/*	$NetBSD: crypt.c,v 1.40 2023/08/14 02:22:35 rin Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)crypt.c	8.1.1.1 (Berkeley) 8/18/93";
 #else
-__RCSID("$NetBSD: crypt.c,v 1.39 2023/06/24 05:18:12 msaitoh Exp $");
+__RCSID("$NetBSD: crypt.c,v 1.40 2023/08/14 02:22:35 rin Exp $");
 #endif
 #endif /* not lint */
 
@@ -503,7 +503,7 @@ ascii_is_unsafe(char ch)
  * full scheme name comparison
  * Updated to reflect alc suggestion(s) 
  *
- * returns boolean 0 on failure, 1 on success, 
+ * returns boolean 0 on failure, 1 on success,
  */
 static int 
 nondes_scheme_substr(const char * setting,char * scheme, unsigned int len)



CVS commit: src/lib/libcrypt

2023-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 14 02:22:35 UTC 2023

Modified Files:
src/lib/libcrypt: crypt.c

Log Message:
libcrypt: trailing white space


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libcrypt/crypt.c

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



CVS commit: src/external/gpl3/gcc/usr.bin/backend

2023-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 14 02:21:22 UTC 2023

Modified Files:
src/external/gpl3/gcc/usr.bin/backend: Makefile

Log Message:
gcc: Host tool gengtype requires version.h

Should fix random failure for parallel build.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/external/gpl3/gcc/usr.bin/backend/Makefile

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

Modified files:

Index: src/external/gpl3/gcc/usr.bin/backend/Makefile
diff -u src/external/gpl3/gcc/usr.bin/backend/Makefile:1.69 src/external/gpl3/gcc/usr.bin/backend/Makefile:1.70
--- src/external/gpl3/gcc/usr.bin/backend/Makefile:1.69	Tue Aug  1 05:57:54 2023
+++ src/external/gpl3/gcc/usr.bin/backend/Makefile	Mon Aug 14 02:21:22 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.69 2023/08/01 05:57:54 mrg Exp $
+#	$NetBSD: Makefile,v 1.70 2023/08/14 02:21:22 rin Exp $
 
 HOSTPROG_CXX=	1
 LIBISPRIVATE=	yes
@@ -119,7 +119,7 @@ gtype-desc.h: gengtype gtyp-input.list.t
 	# GCC 4.8 installs gtype-state and gengtype as a plugin
 
 # gengtype is the real need for options.h
-gengtype.lo gengtype-lex.lo gengtype-parse.lo gengtype-state.lo: ${HH} gtyp-gen.h config.h options.h
+gengtype.lo gengtype-lex.lo gengtype-parse.lo gengtype-state.lo: ${HH} gtyp-gen.h config.h options.h version.h
 gengtype: gengtype.lo gengtype-lex.lo gengtype-parse.lo gengtype-state.lo build-errors.lo
 	${_MKTARGET_LINK}
 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}



CVS commit: src/external/gpl3/gcc/usr.bin/backend

2023-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 14 02:21:22 UTC 2023

Modified Files:
src/external/gpl3/gcc/usr.bin/backend: Makefile

Log Message:
gcc: Host tool gengtype requires version.h

Should fix random failure for parallel build.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/external/gpl3/gcc/usr.bin/backend/Makefile

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



CVS commit: src/sys/uvm

2023-08-13 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug 13 23:06:07 UTC 2023

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
uvm: prevent TLB invalidation races during COW resolution

When a thread takes a page fault which results in COW resolution,
other threads in the same process can be concurrently accessing that
same mapping on other CPUs.  When the faulting thread updates the pmap
entry at the end of COW processing, the resulting TLB invalidations to
other CPUs are not done atomically, so another thread can write to the
new writable page and then a third thread might still read from the
old read-only page, resulting in inconsistent views of the page by the
latter two threads.  Fix this by removing the pmap entry entirely for
the original page before we install the new pmap entry for the new
page, so that the new page can only be modified after the old page is
no longer accessible.

This fixes PR 56535 as well as the netbsd versions of problems
described in various bug trackers:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225584
https://reviews.freebsd.org/D14347
https://github.com/golang/go/issues/34988


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/uvm/uvm_fault.c

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



CVS commit: src/sys/uvm

2023-08-13 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug 13 23:06:07 UTC 2023

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
uvm: prevent TLB invalidation races during COW resolution

When a thread takes a page fault which results in COW resolution,
other threads in the same process can be concurrently accessing that
same mapping on other CPUs.  When the faulting thread updates the pmap
entry at the end of COW processing, the resulting TLB invalidations to
other CPUs are not done atomically, so another thread can write to the
new writable page and then a third thread might still read from the
old read-only page, resulting in inconsistent views of the page by the
latter two threads.  Fix this by removing the pmap entry entirely for
the original page before we install the new pmap entry for the new
page, so that the new page can only be modified after the old page is
no longer accessible.

This fixes PR 56535 as well as the netbsd versions of problems
described in various bug trackers:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225584
https://reviews.freebsd.org/D14347
https://github.com/golang/go/issues/34988


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.233 src/sys/uvm/uvm_fault.c:1.234
--- src/sys/uvm/uvm_fault.c:1.233	Mon Jul 17 12:55:37 2023
+++ src/sys/uvm/uvm_fault.c	Sun Aug 13 23:06:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.233 2023/07/17 12:55:37 riastradh Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.234 2023/08/13 23:06:07 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.233 2023/07/17 12:55:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.234 2023/08/13 23:06:07 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -634,8 +634,17 @@ uvmfault_promote(struct uvm_faultinfo *u
 		goto done;
 	}
 
-	/* copy page [pg now dirty] */
+	/*
+	 * copy the page [pg now dirty]
+	 *
+	 * Remove the pmap entry now for the old page at this address
+	 * so that no thread can modify the new page while any thread
+	 * might still see the old page.
+	 */
 	if (opg) {
+		pmap_remove(vm_map_pmap(ufi->orig_map), ufi->orig_rvaddr,
+			 ufi->orig_rvaddr + PAGE_SIZE);
+		pmap_update(vm_map_pmap(ufi->orig_map));
 		uvm_pagecopy(opg, pg);
 	}
 	KASSERT(uvm_pagegetdirty(pg) == UVM_PAGE_STATUS_DIRTY);



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

2023-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug 13 22:06:44 UTC 2023

Modified Files:
src/sys/arch/arm/marvell: armadaxpreg.h

Log Message:
fix typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/marvell/armadaxpreg.h

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

Modified files:

Index: src/sys/arch/arm/marvell/armadaxpreg.h
diff -u src/sys/arch/arm/marvell/armadaxpreg.h:1.9 src/sys/arch/arm/marvell/armadaxpreg.h:1.10
--- src/sys/arch/arm/marvell/armadaxpreg.h:1.9	Mon Apr  4 19:33:45 2022
+++ src/sys/arch/arm/marvell/armadaxpreg.h	Sun Aug 13 22:06:44 2023
@@ -280,7 +280,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define ARMADAXP_GPIO2_BASE	(MVSOC_DEVBUS_BASE + 0x8140)
 
 /*
- * Miscellanseous Register
+ * Miscellaneous Register
  */
 #define	ARMADAXP_MISC_BASE	(MVSOC_DEVBUS_BASE + 0x8200)
 
@@ -293,7 +293,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define	ARMADAXP_MISC_SSRR_GLOBALSOFTRST	(1 << 0)
 
 /*
- * Thermal Sensor and Thermal Managemer
+ * Thermal Sensor and Thermal Management
  */
 #define ARMADAXP_TS_BASE	(MVSOC_DEVBUS_BASE + 0x82b0)
 #define ARMADAXP_TM_BASE	(MVSOC_DEVBUS_BASE + 0x84c0)



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

2023-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug 13 22:06:44 UTC 2023

Modified Files:
src/sys/arch/arm/marvell: armadaxpreg.h

Log Message:
fix typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/marvell/armadaxpreg.h

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



CVS commit: src/share/mk

2023-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 13 21:52:33 UTC 2023

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

Log Message:
fix typo in previous


To generate a diff of this commit:
cvs rdiff -u -r1.1355 -r1.1356 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.1355 src/share/mk/bsd.own.mk:1.1356
--- src/share/mk/bsd.own.mk:1.1355	Sun Aug 13 21:17:05 2023
+++ src/share/mk/bsd.own.mk	Sun Aug 13 21:52:32 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1355 2023/08/13 21:17:05 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1356 2023/08/13 21:52:32 wiz Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -81,7 +81,7 @@ HAVE_GCC?=	10
 # Platforms that can't run a modern GCC natively
 .if ${MACHINE_ARCH} == "m68000"
 MKGCCCMDS?=	no
-MGGDB?=		no
+MKGDB?=		no
 .endif
 
 #



CVS commit: src/share/mk

2023-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 13 21:52:33 UTC 2023

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

Log Message:
fix typo in previous


To generate a diff of this commit:
cvs rdiff -u -r1.1355 -r1.1356 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/external/gpl3/gdb/lib

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:29:16 UTC 2023

Modified Files:
src/external/gpl3/gdb/lib/libgdb/arch/x86_64: defs.mk
src/external/gpl3/gdb/lib/libreadline/arch/x86_64: defs.mk

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/gdb/lib/libreadline/arch/x86_64/defs.mk

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/gdb/lib/libgdb/arch/x86_64/defs.mk
diff -u src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk:1.22 src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk:1.23
--- src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk:1.22	Mon Aug  7 12:51:40 2023
+++ src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk	Sun Aug 13 17:29:15 2023
@@ -2,6 +2,6 @@
 # Generated from: NetBSD: mknative-gdb,v 1.16 2023/07/31 17:09:59 christos Exp 
 # Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp 
 #
-G_INTERNAL_CFLAGS=  -I. -I${GNUHOSTDIST}/gdb -I${GNUHOSTDIST}/gdb/config -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I${GNUHOSTDIST}/gdb/../include/opcode -I../bfd -I${GNUHOSTDIST}/gdb/../bfd -I${GNUHOSTDIST}/gdb/../include -I${GNUHOSTDIST}/gdb/../readline/readline/.. -I${GNUHOSTDIST}/gdb/../zlib  -I../libdecnumber -I${GNUHOSTDIST}/gdb/../libdecnumber -I./../intl -I${GNUHOSTDIST}/gdb/../gnulib/import -I../gnulib/import -I${GNUHOSTDIST}/gdb/.. -I.. -I${GNUHOSTDIST}/gdb/../libbacktrace/ -I../libbacktrace/  -DTUI=1 -I/usr/obj/amd64-x86_64/tools/include   -I${GNUHOSTDIST}/gdb/.. -pthread  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing
 -declarations -Wstrict-null-sentinel -Wformat -Wformat-nonliteral 
-G_LIBGDB_OBS=ada-exp.o ada-lang.o ada-tasks.o ada-typeprint.o ada-valprint.o ada-varobj.o addrmap.o agent.o alloc.o amd64-bsd-nat.o amd64-nat.o amd64-netbsd-nat.o amd64-netbsd-tdep.o amd64-ravenscar-thread.o amd64-tdep.o annotate.o arch-utils.o amd64.o i386.o async-event.o auto-load.o auxv.o ax-gdb.o ax-general.o bcache.o bfd-target.o block.o blockframe.o break-catch-exec.o break-catch-fork.o break-catch-load.o break-catch-sig.o break-catch-syscall.o break-catch-throw.o breakpoint.o bt-utils.o btrace.o build-id.o buildsym-legacy.o buildsym.o c-exp.o c-lang.o c-typeprint.o c-valprint.o c-varobj.o charset.o cli-out.o cli-cmds.o cli-decode.o cli-dump.o cli-interp.o cli-logging.o cli-option.o cli-script.o cli-setshow.o cli-style.o cli-utils.o coff-pe-read.o coffread.o compile-c-support.o compile-c-symbols.o compile-c-types.o compile-cplus-symbols.o compile-cplus-types.o compile-loc2c.o compile-object-load.o compile-object-run.o compile.o complaints.o completer.o copying.o corefile.o cor
 elow.o cp-abi.o cp-name-parser.o cp-namespace.o cp-support.o cp-valprint.o ctfread.o d-exp.o d-lang.o d-namespace.o d-valprint.o dbxread.o dcache.o debug.o debuginfod-support.o dictionary.o disasm.o displaced-stepping.o dtrace-probe.o dummy-frame.o abbrev-cache.o abbrev.o attribute.o comp-unit-head.o cooked-index.o cu.o dwz.o expr.o frame-tailcall.o frame.o index-cache.o index-common.o index-write.o leb.o line-header.o loc.o macro.o read.o section.o stringify.o elf-none-tdep.o elfread.o eval.o event-top.o exceptions.o exec.o expprint.o extension.o f-exp.o f-lang.o f-typeprint.o f-valprint.o filename-seen-cache.o filesystem.o findcmd.o findvar.o fork-child.o frame-base.o frame-info.o frame-unwind.o frame.o gcore-elf.o gcore.o gdb-demangle.o gdb_bfd.o gdbtypes.o gmp-utils.o gnu-v2-abi.o gnu-v3-abi.o go-exp.o go-lang.o go-typeprint.o go-valprint.o guile.o i386-bsd-tdep.o i386-netbsd-tdep.o i386-tdep.o i387-tdep.o inf-child.o inf-loop.o inf-ptrace.o infcall.o infcmd.o inferior.o inflow.
 o infrun.o inline-frame.o interps.o jit.o language.o linespec.o location.o m2-exp.o m2-lang.o m2-typeprint.o m2-valprint.o macrocmd.o macroexp.o macroscope.o macrotab.o main.o maint-test-options.o maint-test-settings.o maint.o mdebugread.o mem-break.o memattr.o memory-map.o memrange.o memtag.o mi-cmd-break.o mi-cmd-catch.o mi-cmd-disas.o mi-cmd-env.o mi-cmd-file.o mi-cmd-info.o mi-cmd-stack.o mi-cmd-target.o mi-cmd-var.o mi-cmds.o mi-common.o mi-console.o mi-getopt.o mi-interp.o mi-main.o mi-out.o mi-parse.o mi-symbol-cmds.o minidebug.o minsyms.o mipsread.o namespace.o fork-inferior.o netbsd-nat.o x86-dregs.o netbsd-nat.o netbsd-tdep.o objc-lang.o objfiles.o observable.o opencl-lang.o osabi.o osdata.o p-exp.o p-lang.o p-typeprint.o p-valprint.o parse.o posix-hdep.o printcmd.o probe.o 

CVS commit: src/external/gpl3/gdb/lib

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:29:16 UTC 2023

Modified Files:
src/external/gpl3/gdb/lib/libgdb/arch/x86_64: defs.mk
src/external/gpl3/gdb/lib/libreadline/arch/x86_64: defs.mk

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/gdb/lib/libreadline/arch/x86_64/defs.mk

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



CVS commit: src/external/gpl3/gdb/dist/gdb

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:28:22 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb: amd64-netbsd-nat.c

Log Message:
put back the kvm code that was lost between 11.0 and 13.2


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gdb/dist/gdb/amd64-netbsd-nat.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/gpl3/gdb/dist/gdb/amd64-netbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/amd64-netbsd-nat.c:1.1.1.1 src/external/gpl3/gdb/dist/gdb/amd64-netbsd-nat.c:1.2
--- src/external/gpl3/gdb/dist/gdb/amd64-netbsd-nat.c:1.1.1.1	Sun Jul 30 18:44:45 2023
+++ src/external/gpl3/gdb/dist/gdb/amd64-netbsd-nat.c	Sun Aug 13 17:28:22 2023
@@ -24,6 +24,13 @@
 #include "amd64-tdep.h"
 #include "amd64-bsd-nat.h"
 #include "amd64-nat.h"
+#include "regcache.h"
+#include "gdbcore.h"
+#include "bsd-kvm.h"
+
+#include 
+#include 
+#include 
 
 /* Mapping between the general-purpose registers in NetBSD/amd64
`struct reg' format and GDB's register cache layout for
@@ -54,6 +61,55 @@ static int amd64nbsd32_r_reg_offset[] =
   15 * 8			/* %gs */
 };
 
+static int
+amd64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+  struct switchframe sf;
+
+  /* The following is true for NetBSD/amd64:
+
+ The pcb contains the stack pointer at the point of the context
+ switch in cpu_switchto().  At that point we have a stack frame as
+ described by `struct switchframe', which for NetBSD/amd64 has the
+ following layout:
+
+ interrupt level
+ %r15
+ %r14
+ %r13
+ %r12
+ %rbx
+ return address
+
+ Together with %rsp in the pcb, this accounts for all callee-saved
+ registers specified by the psABI.  From this information we
+ reconstruct the register state as it would look when we just
+ returned from cpu_switchto().
+
+ For kernel core dumps, dumpsys() builds a fake switchframe for us. */
+
+  /* The stack pointer shouldn't be zero.  */
+  if (pcb->pcb_rsp == 0)
+return 0;
+
+  /* Read the stack frame, and check its validity.  */
+  read_memory (pcb->pcb_rsp, (gdb_byte *) , sizeof sf);
+  pcb->pcb_rsp += sizeof (struct switchframe);
+  regcache->raw_supply (12, _r12);
+  regcache->raw_supply (13, _r13);
+  regcache->raw_supply (14, _r14);
+  regcache->raw_supply (15, _r15);
+  regcache->raw_supply (AMD64_RBX_REGNUM, _rbx);
+  regcache->raw_supply (AMD64_RIP_REGNUM, _rip);
+
+  regcache->raw_supply (AMD64_RSP_REGNUM, >pcb_rsp);
+  regcache->raw_supply (AMD64_RBP_REGNUM, >pcb_rbp);
+  regcache->raw_supply (AMD64_FS_REGNUM, >pcb_fs);
+  regcache->raw_supply (AMD64_GS_REGNUM, >pcb_gs);
+
+  return 1;
+}
+
 static amd64_bsd_nat_target the_amd64_nbsd_nat_target;
 
 void _initialize_amd64nbsd_nat ();
@@ -65,4 +121,6 @@ _initialize_amd64nbsd_nat ()
   amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
 
   add_inf_child_target (_amd64_nbsd_nat_target);
+
+  bsd_kvm_add_target (amd64nbsd_supply_pcb);
 }



CVS commit: src/external/gpl3/gdb/dist/gdb

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:28:22 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb: amd64-netbsd-nat.c

Log Message:
put back the kvm code that was lost between 11.0 and 13.2


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gdb/dist/gdb/amd64-netbsd-nat.c

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



CVS commit: src/external/gpl3/gdb/dist/gdb

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:28:04 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb: configure.nat

Log Message:
centralize handling of kvm on NetBSD


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/configure.nat

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



CVS commit: src/external/gpl3/gdb/dist/gdb

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:28:04 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb: configure.nat

Log Message:
centralize handling of kvm on NetBSD


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/configure.nat

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/gdb/dist/gdb/configure.nat
diff -u src/external/gpl3/gdb/dist/gdb/configure.nat:1.7 src/external/gpl3/gdb/dist/gdb/configure.nat:1.8
--- src/external/gpl3/gdb/dist/gdb/configure.nat:1.7	Sun Aug  6 16:25:30 2023
+++ src/external/gpl3/gdb/dist/gdb/configure.nat	Sun Aug 13 17:28:04 2023
@@ -68,7 +68,9 @@ case ${gdb_host} in
 	LOADLIBES='-lkvm'
 	;;
 nbsd*)
-	NATDEPFILES='fork-child.o nat/fork-inferior.o nat/netbsd-nat.o inf-ptrace.o'
+	NATDEPFILES='fork-child.o nat/fork-inferior.o inf-ptrace.o \
+	nat/netbsd-nat.o bsd-kvm.o'
+	LOADLIBES='-lkvm'
 	HAVE_NATIVE_GCORE_HOST=1
 	;;
 obsd*)
@@ -345,8 +347,6 @@ case ${gdb_host} in
 	esac
 	;;
 nbsd)
-	NATDEPFILES="${NATDEPFILES} bsd-kvm.o"
-	LOADLIBES='-lkvm'
 	case ${gdb_host_cpu} in
 	aarch64)
 		# Host: NetBSD/aarch64
@@ -366,8 +366,7 @@ case ${gdb_host} in
 		;;
 	powerpc)
 		# Host: NetBSD/powerpc
-		NATDEPFILES="${NATDEPFILES} ppc-netbsd-nat.o bsd-kvm.o"
-		LOADLIBES='-lkvm'
+		NATDEPFILES="${NATDEPFILES} ppc-netbsd-nat.o"
 		;;
 	sh)
 		# Host: NetBSD/sh
@@ -377,21 +376,16 @@ case ${gdb_host} in
 	esac
 	;;
 nbsd64)
-	NATDEPFILES="${NATDEPFILES} bsd-kvm.o"
-	LOADLIBES='-lkvm'
 	case ${gdb_host_cpu} in
 	i386)
 		# Host: NetBSD/amd64
 		NATDEPFILES="${NATDEPFILES} netbsd-nat.o amd64-nat.o x86-nat.o \
 		nat/x86-dregs.o x86-bsd-nat.o amd64-bsd-nat.o \
-		amd64-netbsd-nat.o bsd-kvm.o"
-		LOADLIBES='-lkvm'
+		amd64-netbsd-nat.o"
 		;;
 	sparc)
 		# Host: NetBSD/sparc64
-		NATDEPFILES="${NATDEPFILES} sparc64-netbsd-nat.o sparc-nat.o \
-		bsd-kvm.o"
-		LOADLIBES='-lkvm'
+		NATDEPFILES="${NATDEPFILES} sparc64-netbsd-nat.o sparc-nat.o"
 		;;
 
 	esac
@@ -408,8 +402,7 @@ case ${gdb_host} in
 		# Host: NetBSD/i386 ELF
 		NATDEPFILES="${NATDEPFILES} netbsd-nat.o x86-nat.o \
 		nat/x86-dregs.o \
-		x86-bsd-nat.o i386-bsd-nat.o i386-netbsd-nat.o bsd-kvm.o"
-		LOADLIBES='-lkvm'
+		x86-bsd-nat.o i386-bsd-nat.o i386-netbsd-nat.o"
 		;;
 	m68k)
 		# Host: NetBSD/m68k ELF
@@ -417,9 +410,7 @@ case ${gdb_host} in
 		;;
 	sparc)
 		# Host: NetBSD/sparc ELF
-		NATDEPFILES="${NATDEPFILES} sparc-nat.o sparc-netbsd-nat.o \
-		bsd-kvm.o"
-		LOADLIBES='-lkvm'
+		NATDEPFILES="${NATDEPFILES} sparc-nat.o sparc-netbsd-nat.o"
 		;;
 	vax)
 		# Host: NetBSD/vax ELF



CVS commit: src/external/gpl3/gdb/dist/gdb/doc

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 21:25:56 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb/doc: GDBvn.texi

Log Message:
gdb/doc/GDBvn.texi: Omit spurious trailing blank line.

Reduces diff from upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi

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/gdb/dist/gdb/doc/GDBvn.texi
diff -u src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi:1.3 src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi:1.4
--- src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi:1.3	Sun Aug 13 12:17:17 2023
+++ src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi	Sun Aug 13 21:25:55 2023
@@ -1,4 +1,3 @@
 @set GDBVN 13.2
 @set VERSION_PACKAGE (GDB) 
 @set BUGURL @uref{https://www.gnu.org/software/gdb/bugs/}
-



CVS commit: src/external/gpl3/gdb/dist/gdb/doc

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 21:25:56 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb/doc: GDBvn.texi

Log Message:
gdb/doc/GDBvn.texi: Omit spurious trailing blank line.

Reduces diff from upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi

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



CVS commit: src/share/mk

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:17:05 UTC 2023

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

Log Message:
sun2 can't make gdb anymore. there is no gmp because no gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.1354 -r1.1355 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.1354 src/share/mk/bsd.own.mk:1.1355
--- src/share/mk/bsd.own.mk:1.1354	Fri Aug 11 16:29:17 2023
+++ src/share/mk/bsd.own.mk	Sun Aug 13 17:17:05 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1354 2023/08/11 20:29:17 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1355 2023/08/13 21:17:05 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -81,6 +81,7 @@ HAVE_GCC?=	10
 # Platforms that can't run a modern GCC natively
 .if ${MACHINE_ARCH} == "m68000"
 MKGCCCMDS?=	no
+MGGDB?=		no
 .endif
 
 #



CVS commit: src/share/mk

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 21:17:05 UTC 2023

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

Log Message:
sun2 can't make gdb anymore. there is no gmp because no gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.1354 -r1.1355 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/external/apache2/mDNSResponder

2023-08-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Aug 13 18:57:07 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSCore: DNSCommon.c
src/external/apache2/mDNSResponder/dist/mDNSPosix: mDNSPosix.c
src/external/apache2/mDNSResponder/usr.sbin/mdnsd: Makefile

Log Message:
mdnsd(8): switch to use arc4random(3) for randomness


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile

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



CVS commit: src/external/apache2/mDNSResponder

2023-08-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Aug 13 18:57:07 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSCore: DNSCommon.c
src/external/apache2/mDNSResponder/dist/mDNSPosix: mDNSPosix.c
src/external/apache2/mDNSResponder/usr.sbin/mdnsd: Makefile

Log Message:
mdnsd(8): switch to use arc4random(3) for randomness


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
cvs rdiff -u -r1.17 -r1.18 \
src/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile

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

Modified files:



Index: src/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile
diff -u src/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile:1.17 src/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile:1.18
--- src/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile:1.17	Sat Jun  3 21:26:27 2023
+++ src/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile	Sun Aug 13 18:57:07 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2023/06/03 21:26:27 lukem Exp $
+#	$NetBSD: Makefile,v 1.18 2023/08/13 18:57:07 gutteridge Exp $
 
 PROG=	mdnsd
 
@@ -7,7 +7,7 @@ PROG=	mdnsd
 .PATH:	${DIST}/mDNSPosix ${DIST}/mDNSCore ${DIST}/mDNSShared
 
 CPPFLAGS+=-I${DIST}/mDNSCore -I${DIST}/mDNSShared \
-	-DPROGRAM_NAME=\"mdnsd\" -DHAVE_SIGINFO
+	-DPROGRAM_NAME=\"mdnsd\" -DHAVE_SIGINFO -D_PLATFORM_HAS_STRONG_PRNG_
 #CPPFLAGS+=-DMDNS_DEBUGMSGS=99
 SRCS=	PosixDaemon.c mDNSPosix.c mDNSBSD.c mDNS.c DNSDigest.c uDNS.c \
 	DNSCommon.c uds_daemon.c mDNSDebug.c dnssd_ipc.c GenLinkedList.c \



Re: CVS commit: src

2023-08-13 Thread Taylor R Campbell
> Date: Thu, 10 Aug 2023 07:42:53 +1000
> from: matthew green 
> 
> > Log Message:
> > viadrmums(4): build legacy VIA DRM UMS driver module for amd64.
> >
> > This driver is not built-in by default, thus loadable module can help 
> > (un)lucky
> 
> if it works, why isn't it in GENERIC as well as a module?

Couple reasons:

1. I never adequately tested it.  I started X a few years ago (and a
   couple drm updates ago) but that's it.  (Also only on 32-bit VIA.)
   Maybe andvar can test it more extensively now, though -- glxgears,
   x11perf, firefox, 

   Even better if we can get a sampling of code coverage, e.g. maybe
   with dtrace to count function calls at least, to confirm it's
   actually getting exercised.

2. It's a legacy UMS driver, which is inherently sketchy (display
   configuration requires granting userland direct access to pci and
   device registers) and increasingly unmaintained even upstream.

   So I put in some infrastructure to allow UMS drivers to be loaded
   dynamically, so it wouldn't be necessary to have sketchy business
   like that in the kernel by default.

   I kind of intended to give the same treatment to the other legacy
   UMS drivers like mga (matrox), r128, sis, tdfx, , but it's been
   a very low priority so I haven't gotten a round tuit (and I only
   have hardware for mga and that's in a build server I don't like to
   mess with).


Re: CVS commit: src

2023-08-13 Thread David Brownlee
On Sat, 12 Aug 2023 at 16:16, Andrius V  wrote:
>
> Hi,
>
> Sorry, didn't notice the email until today. To answer your question
> why it is not enabled in GENERIC by default, I am not sure
> (Taylor(?)), it was commented since the day one both on i386 and
> amd64.
>
> However, I have some doubts if it is very relevant driver to enable
> it. From the context perspective, viadrmums is also a legacy driver,
> Linux have already removed it in the latest kernel source code, and
> new https://cgit.freedesktop.org/openchrome/drm-openchrome/ was
> developed, but haven't made it to official kernel yet (and hard to
> tell when and if it will happen at all)). VIA integrated graphics
> drivers development was a always a bit of a sad story: lack of
> interest, manpower/skills, lack of VIA participation, the hardware is
> pretty obscure and under-performing, and likely more suitable for non
> graphics related tasks. Myself I used it mainly for NAS and testing
> platform, thus I need only basic graphics support. Nevertheless, if it
> doesn't affect the development much and it does seem to be work in the
> machines I own, I can enable it.

Some of us are all about the legacy hardware :)

Seriously, one of the areas in which NetBSD's reputation is relatively
better is in older x86 hardware, so if enabling it is likely to give a
better experience for some set of hardware while being very unlikely
to make things worse, I'd support enabling it

David


CVS commit: src/lib/libc/gen

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 15:20:37 UTC 2023

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
vis(3): Per KNF, sys/param.h comes before sys/types.h.

Which is nice because that's also lexicographic.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/lib/libc/gen/vis.c

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



CVS commit: src/lib/libc/gen

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 15:20:37 UTC 2023

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
vis(3): Per KNF, sys/param.h comes before sys/types.h.

Which is nice because that's also lexicographic.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/lib/libc/gen/vis.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/gen/vis.c
diff -u src/lib/libc/gen/vis.c:1.85 src/lib/libc/gen/vis.c:1.86
--- src/lib/libc/gen/vis.c:1.85	Sun Aug 13 15:19:24 2023
+++ src/lib/libc/gen/vis.c	Sun Aug 13 15:20:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $	*/
+/*	$NetBSD: vis.c,v 1.86 2023/08/13 15:20:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $");
+__RCSID("$NetBSD: vis.c,v 1.86 2023/08/13 15:20:37 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID("$FreeBSD$");
@@ -66,8 +66,8 @@ __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
 
-#include 
 #include 
+#include 
 
 #include 
 #include 



CVS commit: src/lib/libc/gen

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 15:19:24 UTC 2023

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
vis(3): Need  for SIZE_MAX, per C standard.

>From Kyle Evans .

Followup to PR lib/57573.

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


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/lib/libc/gen/vis.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/gen/vis.c
diff -u src/lib/libc/gen/vis.c:1.84 src/lib/libc/gen/vis.c:1.85
--- src/lib/libc/gen/vis.c:1.84	Sun Aug 13 15:19:13 2023
+++ src/lib/libc/gen/vis.c	Sun Aug 13 15:19:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $	*/
+/*	$NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $");
+__RCSID("$NetBSD: vis.c,v 1.85 2023/08/13 15:19:24 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID("$FreeBSD$");
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/lib/libc/gen

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 15:19:24 UTC 2023

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
vis(3): Need  for SIZE_MAX, per C standard.

>From Kyle Evans .

Followup to PR lib/57573.

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


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/lib/libc/gen/vis.c

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



CVS commit: src/lib/libc/gen

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 15:19:13 UTC 2023

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
vis(3): Sort includes.  No functional change intended.

Prompted by PR lib/57573.

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


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/lib/libc/gen/vis.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/gen/vis.c
diff -u src/lib/libc/gen/vis.c:1.83 src/lib/libc/gen/vis.c:1.84
--- src/lib/libc/gen/vis.c:1.83	Sat Aug 12 12:48:52 2023
+++ src/lib/libc/gen/vis.c	Sun Aug 13 15:19:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vis.c,v 1.83 2023/08/12 12:48:52 riastradh Exp $	*/
+/*	$NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.83 2023/08/12 12:48:52 riastradh Exp $");
+__RCSID("$NetBSD: vis.c,v 1.84 2023/08/13 15:19:13 riastradh Exp $");
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID("$FreeBSD$");
@@ -65,13 +65,14 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #include "namespace.h"
+
 #include 
 #include 
 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 



CVS commit: src/lib/libc/gen

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 15:19:13 UTC 2023

Modified Files:
src/lib/libc/gen: vis.c

Log Message:
vis(3): Sort includes.  No functional change intended.

Prompted by PR lib/57573.

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


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/lib/libc/gen/vis.c

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



CVS commit: src/external/gpl3/gdb/dist/gdb/doc

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 12:17:17 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb/doc: GDBvn.texi

Log Message:
restore original contents that got overwriten by the build.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi

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/gdb/dist/gdb/doc/GDBvn.texi
diff -u src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi:1.2 src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi:1.3
--- src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi:1.2	Mon Jul 31 13:00:50 2023
+++ src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi	Sun Aug 13 08:17:17 2023
@@ -1 +1,4 @@
 @set GDBVN 13.2
+@set VERSION_PACKAGE (GDB) 
+@set BUGURL @uref{https://www.gnu.org/software/gdb/bugs/}
+



CVS commit: src/external/gpl3/gdb/dist/gdb/doc

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 12:17:17 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb/doc: GDBvn.texi

Log Message:
restore original contents that got overwriten by the build.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/doc/GDBvn.texi

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



CVS commit: src/external/gpl3/gdb/bin/gdb

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 12:16:15 UTC 2023

Modified Files:
src/external/gpl3/gdb/bin/gdb: Makefile

Log Message:
remove building GDBvn.text, it comes with gdb-13.2


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/external/gpl3/gdb/bin/gdb/Makefile

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

Modified files:

Index: src/external/gpl3/gdb/bin/gdb/Makefile
diff -u src/external/gpl3/gdb/bin/gdb/Makefile:1.25 src/external/gpl3/gdb/bin/gdb/Makefile:1.26
--- src/external/gpl3/gdb/bin/gdb/Makefile:1.25	Fri Aug 11 13:46:00 2023
+++ src/external/gpl3/gdb/bin/gdb/Makefile	Sun Aug 13 08:16:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.25 2023/08/11 17:46:00 christos Exp $
+#	$NetBSD: Makefile,v 1.26 2023/08/13 12:16:14 christos Exp $
 
 NOCTF=
 .include 
@@ -35,13 +35,10 @@ TEXINFO=	gdb.texinfo stabs.texinfo
 INFOFLAGS=	-I${DIST}/gdb/doc -I${DIST}/gdb/mi \
 		-I${DIST}/readline/readline/doc -I${.CURDIR}/.. -DGDBN=${GDBN}
 
-GDBvn.texi: ${DIST}/gdb/version.in
-	echo "@set GDBVN $$(${TOOL_CAT} ${.ALLSRC})" > ${.TARGET}
-
 gdb-cfg.texi: ${DIST}/gdb/doc/all-cfg.texi
 	${TOOL_CAT} ${.ALLSRC} > ${.TARGET}
 
-CLEANFILES+= GDBvn.texi gdb-cfg.texi
+CLEANFILES+= gdb-cfg.texi
 stabs.info gdb.info: gdb-cfg.texi GDBvn.texi
 
 FILES=		netbsd.xml
@@ -54,8 +51,6 @@ PROGDPLIBS+= gdb ${GDBLIBDIR}/libgdb
 # XXX: modula2 won't load otherwise, since nothing brings the m2-objs in.
 LIBGDBDIR!=	cd ${GDBLIBDIR}/libgdb && ${PRINTOBJDIR}
 LDADD+=		${LIBGDBDIR}/m2-lang.o
-#LDADD+= -L${LIBGDBDIR} -Wl,--whole-archive -lgdb -Wl,-no-whole-archive
-#DPADD+= ${LIBGDBDIR}/libgdb.a
 
 # Simulator support
 .if ${GDB_MACHINE_ARCH} == powerpc || ${GDB_MACHINE_ARCH} == powerpcle || \



CVS commit: src/external/gpl3/gdb/bin/gdb

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 12:16:15 UTC 2023

Modified Files:
src/external/gpl3/gdb/bin/gdb: Makefile

Log Message:
remove building GDBvn.text, it comes with gdb-13.2


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/external/gpl3/gdb/bin/gdb/Makefile

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



CVS commit: src/external/gpl3/gdb/lib

2023-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 12:04:12 UTC 2023

Modified Files:
src/external/gpl3/gdb/lib/libbfd/arch/mipsel: bfd-in3.h bfd.h bfdver.h
config.h defs.mk targmatch.h
src/external/gpl3/gdb/lib/libctf/arch/mipsel: defs.mk
src/external/gpl3/gdb/lib/libdecnumber/arch/mipsel: gstdint.h
src/external/gpl3/gdb/lib/libgdb/arch/mipsel: config.h defs.mk init.c
jit-reader.h version.c xml-builtin.c
src/external/gpl3/gdb/lib/libgdbsupport/arch/mipsel: defs.mk
src/external/gpl3/gdb/lib/libgdbsupport/arch/mipsel/gdbsupport:
config.h
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel: defs.mk
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib: config.h
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import: alloca.h
ctype.h dirent.h fcntl.h fnmatch.h glob.h inttypes.h limits.h
locale.h math.h signal.h stdint.h stdio.h stdlib.h string.h time.h
unistd.h wchar.h wctype.h
src/external/gpl3/gdb/lib/libiberty/arch/mipsel: defs.mk
src/external/gpl3/gdb/lib/libopcodes/arch/mipsel: config.h
src/external/gpl3/gdb/lib/libreadline/arch/mipsel: defs.mk
Added Files:
src/external/gpl3/gdb/lib/libbacktrace/arch/mipsel:
backtrace-supported.h config.h defs.mk
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import:
glob-libc.gl.h
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/malloc:
scratch_buffer.gl.h
src/external/gpl3/gdb/lib/libsframe/arch/mipsel: defs.mk

Log Message:
add mipsel


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libbacktrace/arch/mipsel/backtrace-supported.h \
src/external/gpl3/gdb/lib/libbacktrace/arch/mipsel/config.h \
src/external/gpl3/gdb/lib/libbacktrace/arch/mipsel/defs.mk
cvs rdiff -u -r1.9 -r1.10 \
src/external/gpl3/gdb/lib/libbfd/arch/mipsel/bfd-in3.h \
src/external/gpl3/gdb/lib/libbfd/arch/mipsel/bfd.h \
src/external/gpl3/gdb/lib/libbfd/arch/mipsel/bfdver.h
cvs rdiff -u -r1.10 -r1.11 \
src/external/gpl3/gdb/lib/libbfd/arch/mipsel/config.h \
src/external/gpl3/gdb/lib/libbfd/arch/mipsel/defs.mk
cvs rdiff -u -r1.14 -r1.15 \
src/external/gpl3/gdb/lib/libbfd/arch/mipsel/targmatch.h
cvs rdiff -u -r1.1 -r1.2 src/external/gpl3/gdb/lib/libctf/arch/mipsel/defs.mk
cvs rdiff -u -r1.11 -r1.12 \
src/external/gpl3/gdb/lib/libdecnumber/arch/mipsel/gstdint.h
cvs rdiff -u -r1.17 -r1.18 \
src/external/gpl3/gdb/lib/libgdb/arch/mipsel/config.h \
src/external/gpl3/gdb/lib/libgdb/arch/mipsel/defs.mk
cvs rdiff -u -r1.14 -r1.15 \
src/external/gpl3/gdb/lib/libgdb/arch/mipsel/init.c
cvs rdiff -u -r1.7 -r1.8 \
src/external/gpl3/gdb/lib/libgdb/arch/mipsel/jit-reader.h
cvs rdiff -u -r1.9 -r1.10 \
src/external/gpl3/gdb/lib/libgdb/arch/mipsel/version.c \
src/external/gpl3/gdb/lib/libgdb/arch/mipsel/xml-builtin.c
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gdb/lib/libgdbsupport/arch/mipsel/defs.mk
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gdb/lib/libgdbsupport/arch/mipsel/gdbsupport/config.h
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/defs.mk
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/config.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/alloca.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/ctype.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/dirent.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/fcntl.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/fnmatch.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/glob.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/inttypes.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/limits.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/locale.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/math.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/signal.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/stdint.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/stdio.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/stdlib.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/string.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/time.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/wchar.h \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/wctype.h
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libgnulib/arch/mipsel/gnulib/import/glob-libc.gl.h
cvs rdiff -u -r1.2 -r1.3 \

CVS commit: src/lib/libc/string

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 11:27:22 UTC 2023

Modified Files:
src/lib/libc/string: strncpy.3

Log Message:
strncpy(3): More on how strlcpy is not a safe strncpy replacement.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/string/strncpy.3

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/string/strncpy.3
diff -u src/lib/libc/string/strncpy.3:1.15 src/lib/libc/string/strncpy.3:1.16
--- src/lib/libc/string/strncpy.3:1.15	Fri Aug 11 21:32:26 2023
+++ src/lib/libc/string/strncpy.3	Sun Aug 13 11:27:22 2023
@@ -31,7 +31,7 @@
 .\"
 .\" from: @(#)strcpy.3	8.1 (Berkeley) 6/4/93
 .\" from: NetBSD: strcpy.3,v 1.23 2015/04/01 20:18:17 riastradh Exp
-.\"	$NetBSD: strncpy.3,v 1.15 2023/08/11 21:32:26 riastradh Exp $
+.\"	$NetBSD: strncpy.3,v 1.16 2023/08/13 11:27:22 riastradh Exp $
 .\"
 .Dd August 11, 2023
 .Dt STRNCPY 3
@@ -212,6 +212,10 @@ buf[sizeof(buf) - 1] = '\e0';
 .Ed
 .Pp
 If
+.Va input
+is guaranteed to be
+.Tn NUL Ns -terminated ,
+and if
 .Va buf
 need only be
 .Tn NUL Ns -terminated ,
@@ -225,6 +229,16 @@ as follows:
 strlcpy(buf, input, sizeof(buf));
 .Ed
 .Pp
+It is not enough for
+.Va input
+to have
+.Li sizeof(buf)
+bytes allocated; it MUST be
+.Tn NUL Ns -terminated
+for
+.Xr strlcpy 3
+to be used.
+.Pp
 Note that because
 .Xr strlcpy 3
 is not defined in any standards, it should
@@ -235,18 +249,26 @@ Because
 .Xr strlcpy 3
 does not fully initialize
 .Fa dst ,
-it is
+but does read all the way to a
+.Tn NUL
+terminator in
+.Fa src
+even past
+.Fa len
+bytes,
+.Xr strlcpy 3
+is
 .Em not
 a safe
 .Tn NUL Ns -terminating
 replacement for
-.Fn strncpy
-if the buffer is not separately zero-initialized.
+.Fn strncpy .
 Naively replacing
 .Fn strncpy
 by
 .Xr strlcpy 3
-can lead to disclosure of secrets from uninitialized memory.
+can lead to crashes, undefined behaviour, and disclosure of secrets
+from uninitialized memory.
 .Sh SEE ALSO
 .Xr bcopy 3 ,
 .Xr memccpy 3 ,



CVS commit: src/lib/libc/string

2023-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 13 11:27:22 UTC 2023

Modified Files:
src/lib/libc/string: strncpy.3

Log Message:
strncpy(3): More on how strlcpy is not a safe strncpy replacement.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/string/strncpy.3

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