Re: CVS commit: src/share/man/man7

2023-11-24 Thread Taylor R Campbell
> Date: Sat, 25 Nov 2023 02:05:25 +
> From: Taylor R Campbell 
> 
> > Date: Sat, 25 Nov 2023 00:23:33 - (UTC)
> > From: chris...@astron.com (Christos Zoulas)
> > 
> > Yes, this is indeed a lot better. I prefer though:
> > 
> > MAN+= \
> > bar.7 \
> > foo.7
> > 
> > It is faster to parse, involves less typing, whitespace is cleaner.
> 
> This one doesn't have the same pattern for every line, so it makes
> merging and sorting harder -- do M-x sort-lines on the content lines,
> and you'll come up with:
> 
> MAN+= \
> foo.7
> bar.7 \

err, obviously I meant this example the other way; if it had been
written as:

MAN+= \
foo.7 \
bar.7

as the natural order of metasyntactic variables (foo, bar), then doing
M-x sort-lines on the content lines would yield:

MAN+= \
bar.7
foo.7 \


Re: CVS commit: src/share/man/man7

2023-11-24 Thread Taylor R Campbell
> Date: Sat, 25 Nov 2023 00:23:33 - (UTC)
> From: chris...@astron.com (Christos Zoulas)
> 
> Yes, this is indeed a lot better. I prefer though:
> 
> MAN+= \
> bar.7 \
> foo.7
> 
> It is faster to parse, involves less typing, whitespace is cleaner.

This one doesn't have the same pattern for every line, so it makes
merging and sorting harder -- do M-x sort-lines on the content lines,
and you'll come up with:

MAN+= \
foo.7
bar.7 \

which does the wrong thing, and only if you're lucky will fail in an
obvious way rather than just silently omitting some entries.

In portable makefiles I usually write:

MAN= \
bar.7 \
foo.7 \
# end of MAN

so at least each line has the same pattern, making merging and sorting
easier.


Re: CVS commit: src/share/man/man7

2023-11-24 Thread Christos Zoulas
In article <20231123211614.011a1f...@cvs.netbsd.org>,
Taylor R Campbell  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  riastradh
>Date:  Thu Nov 23 21:16:13 UTC 2023
>
>Modified Files:
>   src/share/man/man7: Makefile
>
>Log Message:
>share/man/man7/Makefile: Split MAN on separate lines, and sort.
>
>Makes sorting and merging changes easier.
>
>No functional change intended.
>
>Preparing for a new stack(7) in the service of PR pkg/57708.

Yes, this is indeed a lot better. I prefer though:

MAN+= \
bar.7 \
foo.7

It is faster to parse, involves less typing, whitespace is cleaner.

christos



CVS commit: othersrc/libexec/tnftpd

2023-11-24 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sat Nov 25 01:22:53 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: ChangeLog NEWS

Log Message:
Add history of various security advisories to ChangeLog and NEWS.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 othersrc/libexec/tnftpd/ChangeLog
cvs rdiff -u -r1.18 -r1.19 othersrc/libexec/tnftpd/NEWS

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

Modified files:

Index: othersrc/libexec/tnftpd/ChangeLog
diff -u othersrc/libexec/tnftpd/ChangeLog:1.68 othersrc/libexec/tnftpd/ChangeLog:1.69
--- othersrc/libexec/tnftpd/ChangeLog:1.68	Sun Oct  1 06:15:30 2023
+++ othersrc/libexec/tnftpd/ChangeLog	Sat Nov 25 01:22:53 2023
@@ -1,10 +1,35 @@
-$NetBSD: ChangeLog,v 1.68 2023/10/01 06:15:30 lukem Exp $
+$NetBSD: ChangeLog,v 1.69 2023/11/25 01:22:53 lukem Exp $
 
 
+Sat Nov 25 01:21:53 UTC 2023	lu...@netbsd.org
+
+	* Add history of various security advisories to ChangeLog and NEWS.
+
 Sun Oct  1 05:57:14 UTC 2023	lu...@netbsd.org
 
 	* Release as "tnftpd 20231001".
 
+	* Security advisories:
+		* CVE-2020-7468: In FreeBSD 12.2-STABLE before r365772,
+		  11.4-STABLE before r365773, 12.1-RELEASE before p10,
+		  11.4-RELEASE before p4 and 11.3-RELEASE before p14 a ftpd(8)
+		  bug in the implementation of the file system sandbox, combined
+		  with capabilities available to an authenticated FTP user, can
+		  be used to escape the file system restriction configured in
+		  ftpchroot(5). Moreover, the bug allows a malicious client to
+		  gain root privileges.
+		* CVE-2023-40303: GNU inetutils through 2.4 may allow
+		  privilege escalation because of unchecked return values of
+		  set*id() family functions in ftpd, rcp, rlogin, rsh, rshd, and
+		  uucpd. This is, for example, relevant if the setuid system
+		  call fails when a process is trying to drop privileges before
+		  letting an ordinary user control the activities of the
+		  process.
+		* CVE-2023-45198: ftpd before "NetBSD-ftpd 20230930" can leak
+		  information about the host filesystem before authentication
+		  via an MLSD or MLST command.
+		* NetBSD-SA2023-007: multiple vulnerabilities in ftpd(8).
+
 	* Always use $YACC even without --enable-maintainer-mode.
 
 	* Update to NetBSD-ftpd 20230930:
@@ -28,7 +53,7 @@ Sat Sep 23 05:39:49 UTC 2023	lukem@NetBS
 		  fatal. Also treat failed set{e,}(u,g}id calls as fatal.
 		  Addresses CVE-2020-7468, via FreeBSD.
 		* Improve seteuid error handling, per suggestion by Simon
-		  Josefsson.
+		  Josefsson and CVE-2023-40303.
 		* Add missing check_login checks for MLST and MLSD.
 
 	* Sync libnetbsd replacements with NetBSD upstream:
@@ -117,6 +142,15 @@ Fri Mar 22 09:00:00 UTC 2013	lukem@NetBS
 
 	* Release as "tnftpd 20130322"
 
+	* Security advisories:
+		* CVE-2011-0418: The glob implementation in Pure-FTPd before
+		  1.0.32, and in libc in NetBSD 5.1, does not properly expand
+		  expressions containing curly brackets, which allows remote
+		  authenticated users to cause a denial of service (memory
+		  consumption) via a crafted FTP STAT command.
+		* NetBSD-SA2010-008: sftp(1)/ftp(1)/glob(3) related resource
+		  exhaustion.
+
 	* Update build framekwork to autoconf 2.69, automake 1.11.1,
 	  libtool 2.4.2.
 
@@ -153,6 +187,16 @@ Wed Dec 30 01:48:57 UTC 2009	lukem@NetBS
 
 	* Release as "tnftpd 20091122"
 
+	* Security advisories:
+		* CVE-2009-0537: Integer overflow in the fts_build function in
+		  fts.c in libc in (1) OpenBSD 4.4 and earlier and (2) Microsoft
+		  Interix 6.0 build 10.0.6030.0 allows context-dependent
+		  attackers to cause a denial of service (application crash) via
+		  a deep directory tree, related to the fts_level structure
+		  member, as demonstrated by (a) du, (b) rm, (c) chmod, and (d)
+		  chgrp on OpenBSD; and (e) SearchIndexer.exe on Vista
+		  Enterprise.
+
 Sat Nov  7 11:13:38 UTC 2009	lu...@netbsd.org
 
 	* Convert to automake & libtool.
@@ -180,7 +224,8 @@ Sun Mar  1 03:10:40 UTC 2009	lukem@NetBS
 		  fts_options.
 		- Avoid possible integer overflow and subsequent collateral
 		  damage.
-		   Received from OpenBSD via US-CERT as VU #590371.
+		  Received from OpenBSD via US-CERT as VU #590371 and
+		  as CVE-2009-0537.
 
 Tue Dec 30 22:36:05 UTC 2008	lu...@netbsd.org
 
@@ -229,6 +274,16 @@ Mon Sep 29 00:56:00 UTC 2008	lukem@NetBS
 
 	* Tagged as "tnftpd-20080929".
 
+	* Security advisories:
+		* CVE-2008-4247: ftpd in OpenBSD 4.3, FreeBSD 7.0, NetBSD 4.0,
+		  Solaris, and possibly other operating systems interprets long
+		  commands from an FTP client as multiple commands, which allows
+		  remote attackers to conduct cross-site request forgery (CSRF)
+		  attacks and execute arbitrary FTP commands via a long ftp://
+		  URI that leverages an existing session from the FTP client
+		  implementation in a web browser.
+		* NetBSD-SA2008-014: Cross-site request forgery in ftpd(8).
+
 	* Updated version to 

CVS commit: othersrc/libexec/tnftpd

2023-11-24 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sat Nov 25 01:22:53 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: ChangeLog NEWS

Log Message:
Add history of various security advisories to ChangeLog and NEWS.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 othersrc/libexec/tnftpd/ChangeLog
cvs rdiff -u -r1.18 -r1.19 othersrc/libexec/tnftpd/NEWS

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



CVS commit: src/share/misc

2023-11-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri Nov 24 21:17:49 UTC 2023

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add two BTB entries.


To generate a diff of this commit:
cvs rdiff -u -r1.380 -r1.381 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.380 src/share/misc/acronyms.comp:1.381
--- src/share/misc/acronyms.comp:1.380	Mon Nov 20 21:16:41 2023
+++ src/share/misc/acronyms.comp	Fri Nov 24 21:17:49 2023
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.380 2023/11/20 21:16:41 jschauma Exp $
+$NetBSD: acronyms.comp,v 1.381 2023/11/24 21:17:49 alnsn Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -197,6 +197,8 @@ BSSID	basic service set identifier
 BT	BitTorrent
 BT	Bluetooth
 BT	bit test
+BTB	branch target buffer
+BTB	board-to-board
 BTC	bit test [and] complement
 BTM	bus transport mechanism
 BTR	bit test [and] reset



CVS commit: src/share/misc

2023-11-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri Nov 24 21:17:49 UTC 2023

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add two BTB entries.


To generate a diff of this commit:
cvs rdiff -u -r1.380 -r1.381 src/share/misc/acronyms.comp

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



CVS commit: src/crypto/external/bsd/libsaslc/lib

2023-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 18:45:46 UTC 2023

Modified Files:
src/crypto/external/bsd/libsaslc/lib: Makefile

Log Message:
move line to avoid deprecated declaration errors outside of the kerberos block.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/crypto/external/bsd/libsaslc/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/crypto/external/bsd/libsaslc/lib/Makefile
diff -u src/crypto/external/bsd/libsaslc/lib/Makefile:1.10 src/crypto/external/bsd/libsaslc/lib/Makefile:1.11
--- src/crypto/external/bsd/libsaslc/lib/Makefile:1.10	Mon May  8 22:19:32 2023
+++ src/crypto/external/bsd/libsaslc/lib/Makefile	Fri Nov 24 13:45:46 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2023/05/09 02:19:32 christos Exp $
+# $NetBSD: Makefile,v 1.11 2023/11/24 18:45:46 christos Exp $
 
 .include 
 
@@ -59,7 +59,8 @@ LIBDPLIBS+= ssl ${NETBSDSRCDIR}/crypto/e
 .if (${MKKERBEROS} != "no")
 LIBDPLIBS+= gssapi ${NETBSDSRCDIR}/crypto/external/bsd/heimdal/lib/libgssapi
 
-COPTS.crypto.c+=-Wno-error=deprecated-declarations
 .endif
 
+COPTS.crypto.c+=-Wno-error=deprecated-declarations
+
 .include 



CVS commit: src/crypto/external/bsd/libsaslc/lib

2023-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 18:45:46 UTC 2023

Modified Files:
src/crypto/external/bsd/libsaslc/lib: Makefile

Log Message:
move line to avoid deprecated declaration errors outside of the kerberos block.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/crypto/external/bsd/libsaslc/lib/Makefile

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



CVS commit: src/tests/libexec/ld.elf_so

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 17:40:20 UTC 2023

Modified Files:
src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c

Log Message:
t_dlinfo, t_rtld_r_debug: Audit ATF_REQUIRE/CHECK, sprinkle messages.

Make sure to use ATF_REQUIRE when the subsequent code doesn't work if
the check fails.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/libexec/ld.elf_so/t_dlinfo.c
cvs rdiff -u -r1.4 -r1.5 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c

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



CVS commit: src/tests/libexec/ld.elf_so

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 17:40:20 UTC 2023

Modified Files:
src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c

Log Message:
t_dlinfo, t_rtld_r_debug: Audit ATF_REQUIRE/CHECK, sprinkle messages.

Make sure to use ATF_REQUIRE when the subsequent code doesn't work if
the check fails.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/libexec/ld.elf_so/t_dlinfo.c
cvs rdiff -u -r1.4 -r1.5 src/tests/libexec/ld.elf_so/t_rtld_r_debug.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/libexec/ld.elf_so/t_dlinfo.c
diff -u src/tests/libexec/ld.elf_so/t_dlinfo.c:1.7 src/tests/libexec/ld.elf_so/t_dlinfo.c:1.8
--- src/tests/libexec/ld.elf_so/t_dlinfo.c:1.7	Fri Nov 24 17:40:09 2023
+++ src/tests/libexec/ld.elf_so/t_dlinfo.c	Fri Nov 24 17:40:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_dlinfo.c,v 1.7 2023/11/24 17:40:09 riastradh Exp $	*/
+/*	$NetBSD: t_dlinfo.c,v 1.8 2023/11/24 17:40:20 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_self, tc
 	int rv;
 
 	rv = dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, );
-	ATF_CHECK_EQ(rv, 0);
+	ATF_REQUIRE_EQ_MSG(rv, 0, "dlinfo: %s", dlerror());
 	ATF_CHECK((strstr(map->l_name, "t_dlinfo") != NULL));
 }
 
@@ -61,7 +61,7 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_inval, t
 	int rv;
 
 	rv = dlinfo(NULL, RTLD_DI_LINKMAP, );
-	ATF_CHECK_EQ(rv, -1);
+	ATF_CHECK_EQ_MSG(rv, -1, "rv=%d", rv);
 }
 
 ATF_TC(rtld_dlinfo_linkmap_dlopen);
@@ -76,12 +76,12 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen, 
 	int rv;
 
 	handle = dlopen("libutil.so", RTLD_LAZY);
-	ATF_CHECK(handle);
+	ATF_REQUIRE_MSG(handle, "dlopen: %s", dlerror());
 
 	rv = dlinfo(handle, RTLD_DI_LINKMAP, );
-	ATF_CHECK_EQ(rv, 0);
+	ATF_REQUIRE_EQ_MSG(rv, 0, "dlinfo: %s", dlerror());
 	ATF_CHECK((strstr(map->l_name, "libutil.so") != NULL));
-	dlclose(handle);
+	ATF_CHECK_EQ_MSG(dlclose(handle), 0, "dlclose: %s", dlerror());
 }
 
 ATF_TC(rtld_dlinfo_linkmap_dlopen_iter);
@@ -95,7 +95,7 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_i
 	void *handle;
 
 	handle = dlopen("libutil.so", RTLD_LAZY);
-	ATF_CHECK(handle);
+	ATF_REQUIRE_MSG(handle, "dlopen: %s", dlerror());
 
 	ATF_REQUIRE_EQ_MSG(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, ), 0,
 	"dlinfo: %s", dlerror());
@@ -105,10 +105,10 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_i
 	for (; map; map = map->l_prev)
 		if (strstr(map->l_name, "libutil.so") != NULL)
 			break;
-	
+
 	ATF_REQUIRE_MSG(map, "dlopen()d object not found from linkmap");
 	ATF_REQUIRE_MSG(dlopen(map->l_name, RTLD_LAZY) != NULL,
-	"could not dlopen() name in linkmap");
+	"could not dlopen() name in linkmap: %s", dlerror());
 }
 
 ATF_TP_ADD_TCS(tp)

Index: src/tests/libexec/ld.elf_so/t_rtld_r_debug.c
diff -u src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.4 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.5
--- src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.4	Fri Nov 24 17:40:09 2023
+++ src/tests/libexec/ld.elf_so/t_rtld_r_debug.c	Fri Nov 24 17:40:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rtld_r_debug.c,v 1.4 2023/11/24 17:40:09 riastradh Exp $	*/
+/*	$NetBSD: t_rtld_r_debug.c,v 1.5 2023/11/24 17:40:20 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -104,7 +104,9 @@ check_r_debug_return_link_map(const char
 	loader = NULL;
 	debug = get_rtld_r_debug();
 	ATF_CHECK(debug != NULL);
-	ATF_CHECK(debug->r_version == R_DEBUG_VERSION);
+	ATF_CHECK_EQ_MSG(debug->r_version, R_DEBUG_VERSION,
+	"debug->r_version=%d R_DEBUG_VERSION=%d",
+	debug->r_version, R_DEBUG_VERSION);
 	map = debug->r_map;
 	ATF_CHECK(map != NULL);
 
@@ -120,8 +122,12 @@ check_r_debug_return_link_map(const char
 	ATF_CHECK(found);
 	ATF_CHECK(loader != NULL);
 	ATF_CHECK(debug->r_brk != NULL);
-	ATF_CHECK(debug->r_state == RT_CONSISTENT);
-	ATF_CHECK(debug->r_ldbase == loader);
+	ATF_CHECK_EQ_MSG(debug->r_state, RT_CONSISTENT,
+	"debug->r_state=%d RT_CONSISTENT=%d",
+	debug->r_state, RT_CONSISTENT);
+	ATF_CHECK_EQ_MSG(debug->r_ldbase, loader,
+	"debug->r_ldbase=%p loader=%p",
+	debug->r_ldbase, loader);
 }
 
 ATF_TC(self);
@@ -146,15 +152,15 @@ ATF_TC_BODY(dlopen, tc)
 	struct link_map *map, *r_map;
 
 	handle = dlopen("libutil.so", RTLD_LAZY);
-	ATF_CHECK(handle);
+	ATF_REQUIRE_MSG(handle, "dlopen: %s", dlerror());
 
 	check_r_debug_return_link_map("libutil.so", _map);
 
 	ATF_REQUIRE_EQ_MSG(dlinfo(handle, RTLD_DI_LINKMAP, ), 0,
 	"dlinfo: %s", dlerror());
 
-	ATF_CHECK(map == r_map);
-	dlclose(handle);
+	ATF_CHECK_EQ_MSG(map, r_map, "map=%p r_map=%p", map, r_map);
+	ATF_CHECK_EQ_MSG(dlclose(handle), 0, "dlclose: %s", dlerror());
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/tests/libexec/ld.elf_so

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 17:40:09 UTC 2023

Modified Files:
src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c

Log Message:
rtld tests: Don't use RZ for dlinfo.

Use

ATF_REQUIRE_EQ_MSG(dlinfo(...), 0, "dlinfo: %s", dlerror())

instead, in order to accurately report the error on failure.  RZ is
only for functions like pthread_create(3) that return zero on success
and errno(3) code on failure, but dlinfo returns -1 on failure and
sets dlerror() to report the nature of the error.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/libexec/ld.elf_so/t_dlinfo.c
cvs rdiff -u -r1.3 -r1.4 src/tests/libexec/ld.elf_so/t_rtld_r_debug.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/libexec/ld.elf_so/t_dlinfo.c
diff -u src/tests/libexec/ld.elf_so/t_dlinfo.c:1.6 src/tests/libexec/ld.elf_so/t_dlinfo.c:1.7
--- src/tests/libexec/ld.elf_so/t_dlinfo.c:1.6	Tue Jul  9 16:24:01 2019
+++ src/tests/libexec/ld.elf_so/t_dlinfo.c	Fri Nov 24 17:40:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_dlinfo.c,v 1.6 2019/07/09 16:24:01 maya Exp $	*/
+/*	$NetBSD: t_dlinfo.c,v 1.7 2023/11/24 17:40:09 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,8 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_i
 	handle = dlopen("libutil.so", RTLD_LAZY);
 	ATF_CHECK(handle);
 
-	RZ(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, ));
+	ATF_REQUIRE_EQ_MSG(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, ), 0,
+	"dlinfo: %s", dlerror());
 
 	for (; map->l_next; map = map->l_next)
 		continue;

Index: src/tests/libexec/ld.elf_so/t_rtld_r_debug.c
diff -u src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.3 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.4
--- src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.3	Tue Sep 29 16:35:42 2020
+++ src/tests/libexec/ld.elf_so/t_rtld_r_debug.c	Fri Nov 24 17:40:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rtld_r_debug.c,v 1.3 2020/09/29 16:35:42 roy Exp $	*/
+/*	$NetBSD: t_rtld_r_debug.c,v 1.4 2023/11/24 17:40:09 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -150,7 +150,8 @@ ATF_TC_BODY(dlopen, tc)
 
 	check_r_debug_return_link_map("libutil.so", _map);
 
-	RZ(dlinfo(handle, RTLD_DI_LINKMAP, ));
+	ATF_REQUIRE_EQ_MSG(dlinfo(handle, RTLD_DI_LINKMAP, ), 0,
+	"dlinfo: %s", dlerror());
 
 	ATF_CHECK(map == r_map);
 	dlclose(handle);



CVS commit: src/tests/libexec/ld.elf_so

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 17:40:09 UTC 2023

Modified Files:
src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c

Log Message:
rtld tests: Don't use RZ for dlinfo.

Use

ATF_REQUIRE_EQ_MSG(dlinfo(...), 0, "dlinfo: %s", dlerror())

instead, in order to accurately report the error on failure.  RZ is
only for functions like pthread_create(3) that return zero on success
and errno(3) code on failure, but dlinfo returns -1 on failure and
sets dlerror() to report the nature of the error.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/libexec/ld.elf_so/t_dlinfo.c
cvs rdiff -u -r1.3 -r1.4 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c

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



CVS commit: src/tests

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 17:31:03 UTC 2023

Modified Files:
src/tests/fs/hfs: t_pathconvert.c
src/tests/kernel: t_memfd_create.c
src/tests/lib/librefuse: t_refuse_opt.c
src/tests/lib/librumpclient: t_fd.c

Log Message:
tests: Audit RZ abuse.

RZ succeeds if x is zero, and fails if x is nonzero, treating a
nonzero value as a error number as in errno(3) to print the message.

The following library routines instead return -1 on failure and set
errno to the error code:

fuse_opt_add_arg
fuse_opt_add_opt
fuse_opt_add_opt_escaped
fuse_opt_insert_arg
lseek
system

So use RL instead for those -- succeeds if x is zero, and fails if x
is -1.

This shouldn't make any tests newly fail or newly succeed -- the
functions in question only ever return 0 or -1 -- but if the tests
were already failing anywhere, they will now fail with meaningful
messages.

TBD: dlinfo, which isn't fit for RL or RZ since it reports errors via
dlerror() rather than errno.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/hfs/t_pathconvert.c
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/t_memfd_create.c
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/librefuse/t_refuse_opt.c
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/librumpclient/t_fd.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/fs/hfs/t_pathconvert.c
diff -u src/tests/fs/hfs/t_pathconvert.c:1.7 src/tests/fs/hfs/t_pathconvert.c:1.8
--- src/tests/fs/hfs/t_pathconvert.c:1.7	Tue Jul  9 16:24:01 2019
+++ src/tests/fs/hfs/t_pathconvert.c	Fri Nov 24 17:31:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pathconvert.c,v 1.7 2019/07/09 16:24:01 maya Exp $	*/
+/*	$NetBSD: t_pathconvert.c,v 1.8 2023/11/24 17:31:03 riastradh Exp $	*/
 
 #include 
 #include 
@@ -42,10 +42,10 @@ ATF_TC_BODY(colonslash, tc)
 
 	snprintf(thecmd, sizeof(thecmd), "uudecode %s/colon.hfs.bz2.uue",
 	atf_tc_get_config_var(tc, "srcdir"));
-	RZ(system(thecmd));
+	RL(system(thecmd));
 
 	snprintf(thecmd, sizeof(thecmd), "bunzip2 " IMGNAME ".bz2");
-	RZ(system(thecmd));
+	RL(system(thecmd));
 
 	memset(, 0, sizeof args);
 	args.fspec = __UNCONST(FAKEBLK);

Index: src/tests/kernel/t_memfd_create.c
diff -u src/tests/kernel/t_memfd_create.c:1.2 src/tests/kernel/t_memfd_create.c:1.3
--- src/tests/kernel/t_memfd_create.c:1.2	Sat Jul 29 16:24:35 2023
+++ src/tests/kernel/t_memfd_create.c	Fri Nov 24 17:31:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_memfd_create.c,v 1.2 2023/07/29 16:24:35 rin Exp $	*/
+/*	$NetBSD: t_memfd_create.c,v 1.3 2023/11/24 17:31:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_memfd_create.c,v 1.2 2023/07/29 16:24:35 rin Exp $");
+__RCSID("$NetBSD: t_memfd_create.c,v 1.3 2023/11/24 17:31:03 riastradh Exp $");
 
 #include 
 #include 
@@ -109,7 +109,7 @@ ATF_TC_BODY(read_write, tc)
 	"File offset not set after write (%jd != %zu)", (intmax_t)offset,
 	sizeof(write_buf));
 
-	RZ(lseek(fd, 0, SEEK_SET));
+	RL(lseek(fd, 0, SEEK_SET));
 
 	RL(read(fd, read_buf, sizeof(read_buf)));
 	offset = lseek(fd, 0, SEEK_CUR);
@@ -158,7 +158,7 @@ ATF_TC_BODY(truncate, tc)
 	"Truncate did not grow size to %zu (is %jd)", sizeof(read_buf),
 	(intmax_t)st.st_size);
 
-	RZ(lseek(fd, 0, SEEK_SET));
+	RL(lseek(fd, 0, SEEK_SET));
 	RL(read(fd, read_buf, sizeof(read_buf)));
 
 	for (size_t i = 0; i < sizeof(read_buf)/2; i++)
@@ -255,7 +255,7 @@ test_all_seals_except(int fd, int except
 	}
 
 	if (except & ~(F_SEAL_WRITE|F_SEAL_FUTURE_WRITE)) {
-		RZ(lseek(fd, 0, SEEK_SET));
+		RL(lseek(fd, 0, SEEK_SET));
 		rv = write(fd, write_buf, sizeof(write_buf));
 		if (rv == -1) {
 			ATF_REQUIRE_MSG(errno != EPERM,

Index: src/tests/lib/librefuse/t_refuse_opt.c
diff -u src/tests/lib/librefuse/t_refuse_opt.c:1.9 src/tests/lib/librefuse/t_refuse_opt.c:1.10
--- src/tests/lib/librefuse/t_refuse_opt.c:1.9	Sat Dec  4 06:42:39 2021
+++ src/tests/lib/librefuse/t_refuse_opt.c	Fri Nov 24 17:31:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_refuse_opt.c,v 1.9 2021/12/04 06:42:39 pho Exp $ */
+/*	$NetBSD: t_refuse_opt.c,v 1.10 2023/11/24 17:31:03 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_refuse_opt.c,v 1.9 2021/12/04 06:42:39 pho Exp $");
+__RCSID("$NetBSD: t_refuse_opt.c,v 1.10 2023/11/24 17:31:03 riastradh Exp $");
 
 #include 
 
@@ -47,8 +47,8 @@ ATF_TC_BODY(t_fuse_opt_add_arg, tc)
 {
 	struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
 
-	RZ(fuse_opt_add_arg(, "foo"));
-	RZ(fuse_opt_add_arg(, "bar"));
+	RL(fuse_opt_add_arg(, "foo"));
+	RL(fuse_opt_add_arg(, "bar"));
 
 	ATF_REQUIRE_EQ(args.argc, 2);
 	ATF_CHECK_STREQ(args.argv[0], "foo");
@@ -66,8 +66,8 @@ ATF_TC_BODY(t_fuse_opt_insert_arg, tc)
 {
 	struct fuse_args args = 

CVS commit: src/tests

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 17:31:03 UTC 2023

Modified Files:
src/tests/fs/hfs: t_pathconvert.c
src/tests/kernel: t_memfd_create.c
src/tests/lib/librefuse: t_refuse_opt.c
src/tests/lib/librumpclient: t_fd.c

Log Message:
tests: Audit RZ abuse.

RZ succeeds if x is zero, and fails if x is nonzero, treating a
nonzero value as a error number as in errno(3) to print the message.

The following library routines instead return -1 on failure and set
errno to the error code:

fuse_opt_add_arg
fuse_opt_add_opt
fuse_opt_add_opt_escaped
fuse_opt_insert_arg
lseek
system

So use RL instead for those -- succeeds if x is zero, and fails if x
is -1.

This shouldn't make any tests newly fail or newly succeed -- the
functions in question only ever return 0 or -1 -- but if the tests
were already failing anywhere, they will now fail with meaningful
messages.

TBD: dlinfo, which isn't fit for RL or RZ since it reports errors via
dlerror() rather than errno.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/hfs/t_pathconvert.c
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/t_memfd_create.c
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/librefuse/t_refuse_opt.c
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/librumpclient/t_fd.c

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



CVS commit: src/sys/arch/prep/prep

2023-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 16:49:59 UTC 2023

Modified Files:
src/sys/arch/prep/prep: residual.c

Log Message:
Make this compile again with options RESIDUAL_DATA_DUMP (Andrius V)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/prep/prep/residual.c

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

Modified files:

Index: src/sys/arch/prep/prep/residual.c
diff -u src/sys/arch/prep/prep/residual.c:1.18 src/sys/arch/prep/prep/residual.c:1.19
--- src/sys/arch/prep/prep/residual.c:1.18	Thu Mar 27 14:22:56 2014
+++ src/sys/arch/prep/prep/residual.c	Fri Nov 24 11:49:59 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: residual.c,v 1.18 2014/03/27 18:22:56 christos Exp $ */
+/*  $NetBSD: residual.c,v 1.19 2023/11/24 16:49:59 christos Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: residual.c,v 1.18 2014/03/27 18:22:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: residual.c,v 1.19 2023/11/24 16:49:59 christos Exp $");
 
 #include 
 #include 
@@ -935,6 +935,7 @@ large_vendor_pcibridge_subr(struct _L4_P
 	printf("PCI Bridge Slot Data\n");
 	for (i = 0; i < numslots; i++) {
 		int j, first, l;
+		char *t;
 
 		if (pi->map[i].slotnum)
 			printf("  PCI Slot %d", pi->map[i].slotnum);



CVS commit: src/sys/arch/prep/prep

2023-11-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 24 16:49:59 UTC 2023

Modified Files:
src/sys/arch/prep/prep: residual.c

Log Message:
Make this compile again with options RESIDUAL_DATA_DUMP (Andrius V)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/prep/prep/residual.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-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 16:36:23 UTC 2023

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

Log Message:
t_rnd: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/kernel/t_rnd.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-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 16:36:23 UTC 2023

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

Log Message:
t_rnd: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/kernel/t_rnd.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_rnd.c
diff -u src/tests/kernel/t_rnd.c:1.12 src/tests/kernel/t_rnd.c:1.13
--- src/tests/kernel/t_rnd.c:1.12	Fri Nov 24 16:35:51 2023
+++ src/tests/kernel/t_rnd.c	Fri Nov 24 16:36:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rnd.c,v 1.12 2023/11/24 16:35:51 riastradh Exp $	*/
+/*	$NetBSD: t_rnd.c,v 1.13 2023/11/24 16:36:23 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_rnd.c,v 1.12 2023/11/24 16:35:51 riastradh Exp $");
+__RCSID("$NetBSD: t_rnd.c,v 1.13 2023/11/24 16:36:23 riastradh Exp $");
 
 #include 
 #include 
@@ -81,7 +81,7 @@ ATF_TC_BODY(RNDADDDATA2, tc)
 	fd = rump_sys_open("/dev/random", O_RDWR, 0);
 	if (fd == -1)
 		atf_tc_fail_errno("cannot open /dev/random");
-		
+
 	rd.entropy = 1;
 	rd.len = -1;
 	ATF_REQUIRE_ERRNO(EINVAL, rump_sys_ioctl(fd, RNDADDDATA, ) == -1);



CVS commit: src/tests/kernel

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 16:35:51 UTC 2023

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

Log Message:
t_rnd: Fix misuse of RZ.

Not likely to matter, but in the unlikely event that rump_sys_close
fails, it will return -1 and set errno as RL expects, not return the
error code as RZ expects.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/kernel/t_rnd.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_rnd.c
diff -u src/tests/kernel/t_rnd.c:1.11 src/tests/kernel/t_rnd.c:1.12
--- src/tests/kernel/t_rnd.c:1.11	Sun Apr 16 18:24:23 2017
+++ src/tests/kernel/t_rnd.c	Fri Nov 24 16:35:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rnd.c,v 1.11 2017/04/16 18:24:23 riastradh Exp $	*/
+/*	$NetBSD: t_rnd.c,v 1.12 2023/11/24 16:35:51 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_rnd.c,v 1.11 2017/04/16 18:24:23 riastradh Exp $");
+__RCSID("$NetBSD: t_rnd.c,v 1.12 2023/11/24 16:35:51 riastradh Exp $");
 
 #include 
 #include 
@@ -106,7 +106,7 @@ ATF_TC_BODY(read_random, tc)
 		alarm(2);
 		RL(fd = rump_sys_open("/dev/random", RUMP_O_RDONLY));
 		RL(rump_sys_read(fd, buf, sizeof(buf)));
-		RZ(rump_sys_close(fd));
+		RL(rump_sys_close(fd));
 	}
 }
 



CVS commit: src/tests/kernel

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 16:35:51 UTC 2023

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

Log Message:
t_rnd: Fix misuse of RZ.

Not likely to matter, but in the unlikely event that rump_sys_close
fails, it will return -1 and set errno as RL expects, not return the
error code as RZ expects.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/kernel/t_rnd.c

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



CVS commit: src

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 16:21:17 UTC 2023

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/lib/libpthread: Makefile
Added Files:
src/tests/lib/libpthread: t_stack.c

Log Message:
pthread: Add tests for pthread user stack allocation.

PR lib/57721

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


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1296 -r1.1297 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libpthread/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libpthread/t_stack.c

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.423 src/distrib/sets/lists/debug/mi:1.424
--- src/distrib/sets/lists/debug/mi:1.423	Fri Nov 10 23:04:50 2023
+++ src/distrib/sets/lists/debug/mi	Fri Nov 24 16:21:17 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.423 2023/11/10 23:04:50 christos Exp $
+# $NetBSD: mi,v 1.424 2023/11/24 16:21:17 riastradh Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2365,6 +2365,7 @@
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_sigmask.debug		tests-lib-tests		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_sigsuspend.debug		tests-lib-tests		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_sleep.debug		tests-lib-tests		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libpthread/t_stack.debug		tests-lib-tests		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_status.debug		tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_swapcontext.debug	tests-lib-tests		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_thrd.debug		tests-lib-tests		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1296 src/distrib/sets/lists/tests/mi:1.1297
--- src/distrib/sets/lists/tests/mi:1.1296	Fri Nov 10 23:04:50 2023
+++ src/distrib/sets/lists/tests/mi	Fri Nov 24 16:21:17 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1296 2023/11/10 23:04:50 christos Exp $
+# $NetBSD: mi,v 1.1297 2023/11/24 16:21:17 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4032,6 +4032,7 @@
 ./usr/tests/lib/libpthread/t_sigmask			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libpthread/t_sigsuspend			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libpthread/t_sleep			tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libpthread/t_stack			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libpthread/t_status			tests-obsolete		obsolete
 ./usr/tests/lib/libpthread/t_swapcontext		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libpthread/t_thrd			tests-lib-tests		compattestfile,atf

Index: src/tests/lib/libpthread/Makefile
diff -u src/tests/lib/libpthread/Makefile:1.15 src/tests/lib/libpthread/Makefile:1.16
--- src/tests/lib/libpthread/Makefile:1.15	Sun Jun 21 07:06:05 2020
+++ src/tests/lib/libpthread/Makefile	Fri Nov 24 16:21:17 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2020/06/21 07:06:05 lukem Exp $
+# $NetBSD: Makefile,v 1.16 2023/11/24 16:21:17 riastradh Exp $
 
 NOMAN=		# defined
 
@@ -37,6 +37,7 @@ TESTS_C+=	t_sigmask
 TESTS_C+=	t_sigsuspend
 TESTS_C+=	t_siglongjmp
 TESTS_C+=	t_sleep
+TESTS_C+=	t_stack
 TESTS_C+=	t_swapcontext
 TESTS_SH+=	t_thread_local_dtor
 TESTS_C+=	t_timedmutex

Added files:

Index: src/tests/lib/libpthread/t_stack.c
diff -u /dev/null src/tests/lib/libpthread/t_stack.c:1.1
--- /dev/null	Fri Nov 24 16:21:17 2023
+++ src/tests/lib/libpthread/t_stack.c	Fri Nov 24 16:21:17 2023
@@ -0,0 +1,418 @@
+/*	$NetBSD: t_stack.c,v 1.1 2023/11/24 16:21:17 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2023 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * 

CVS commit: src

2023-11-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Nov 24 16:21:17 UTC 2023

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/lib/libpthread: Makefile
Added Files:
src/tests/lib/libpthread: t_stack.c

Log Message:
pthread: Add tests for pthread user stack allocation.

PR lib/57721

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


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1296 -r1.1297 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libpthread/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libpthread/t_stack.c

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



CVS commit: src

2023-11-24 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Nov 24 15:13:36 UTC 2023

Modified Files:
src/share/man/man4: gpiosim.4
src/sys/dev/gpio: gpiosim.c

Log Message:
Style changes.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/gpiosim.4
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/gpio/gpiosim.c

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

Modified files:

Index: src/share/man/man4/gpiosim.4
diff -u src/share/man/man4/gpiosim.4:1.7 src/share/man/man4/gpiosim.4:1.8
--- src/share/man/man4/gpiosim.4:1.7	Wed Nov  8 23:46:54 2023
+++ src/share/man/man4/gpiosim.4	Fri Nov 24 15:13:35 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpiosim.4,v 1.7 2023/11/08 23:46:54 brad Exp $
+.\" $NetBSD: gpiosim.4,v 1.8 2023/11/24 15:13:35 brad Exp $
 .\"
 .\" Copyright (c) 2009, 2013 Marc Balmer 
 .\" All rights reserved.
@@ -38,7 +38,8 @@ variable, where "" denotes the number
 .Nm
 instance.
 .Pp
-Both edge and level interrupts are simulated.  The "hw.gpiosim.ms"
+Both edge and level interrupts are simulated.
+The "hw.gpiosim.ms"
 .Xr sysctl 8
 variable will change the amount of time between
 .Xr callout 9

Index: src/sys/dev/gpio/gpiosim.c
diff -u src/sys/dev/gpio/gpiosim.c:1.25 src/sys/dev/gpio/gpiosim.c:1.26
--- src/sys/dev/gpio/gpiosim.c:1.25	Wed Nov  8 23:46:54 2023
+++ src/sys/dev/gpio/gpiosim.c	Fri Nov 24 15:13:35 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiosim.c,v 1.25 2023/11/08 23:46:54 brad Exp $ */
+/* $NetBSD: gpiosim.c,v 1.26 2023/11/24 15:13:35 brad Exp $ */
 /*  $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $	*/
 
 /*
@@ -76,7 +76,7 @@ static void *   gpiosim_intr_establish(v
 static void gpiosim_intr_disestablish(void *, void *);
 static bool gpiosim_gpio_intrstr(void *, int, int, char *, size_t);
 
-voidgpiosim_wq(struct work *,void *);
+voidgpiosim_wq(struct work *, void *);
 voidgpiosim_co(void *);
 
 CFATTACH_DECL_NEW(gpiosim, sizeof(struct gpiosim_softc), gpiosim_match,
@@ -149,7 +149,8 @@ gpiosim_attach(device_t parent, device_t
 		sc->sc_gpio_irqs[i].sc_gpio_irqtriggered = false;
 
 		/* read initial state */
-		sc->sc_gpio_pins[i].pin_flags = GPIO_PIN_INPUT;}
+		sc->sc_gpio_pins[i].pin_flags = GPIO_PIN_INPUT;
+	}
 
 	sc->sc_state = 0;
 	sc->sc_ms = GPIOSIM_MS;
@@ -200,14 +201,20 @@ gpiosim_attach(device_t parent, device_t
 gpiosim_ms_sysctl, 0, >sc_ms, 0,
 	CTL_CREATE, CTL_EOL);
 
-	error = workqueue_create(>sc_wq,"gsimwq",gpiosim_wq,sc,PRI_NONE,IPL_VM,WQ_MPSAFE);
+	error = workqueue_create(>sc_wq,
+	"gsimwq",
+	gpiosim_wq,
+	sc,
+	PRI_NONE,
+	IPL_VM,
+	WQ_MPSAFE);
 	if (error != 0) {
 		aprint_error(": can't create workqueue for interrupts\n");
 return;
 	}
 
-	callout_init(>sc_co,CALLOUT_MPSAFE);
-	callout_setfunc(>sc_co,gpiosim_co, sc);
+	callout_init(>sc_co, CALLOUT_MPSAFE);
+	callout_setfunc(>sc_co, gpiosim_co, sc);
 	sc->sc_co_running = false;
 	sc->sc_co_init = true;
 
@@ -242,7 +249,7 @@ gpiosim_detach(device_t self, int flags)
 
 	/* Destroy any callouts */
 	if (sc->sc_co_init) {
-		callout_halt(>sc_co,NULL);
+		callout_halt(>sc_co, NULL);
 		callout_destroy(>sc_co);
 	}
 	return 0;
@@ -308,7 +315,7 @@ gpiosim_sysctl(SYSCTLFN_ARGS)
 	mutex_exit(>sc_intr_mutex);
 
 	if (t > 0) {
-		workqueue_enqueue(sc->sc_wq,(struct work *)_work,NULL);
+		workqueue_enqueue(sc->sc_wq, (struct work *)_work, NULL);
 	}
 
 	return 0;
@@ -327,6 +334,7 @@ gpiosim_ms_sysctl(SYSCTLFN_ARGS)
 	if (error || newp == NULL)
 		return (error);
 
+	/* Make sure that this can not be zero */
 	if (t < 1)
 		return (EINVAL);
 
@@ -389,7 +397,7 @@ gpiosim_intr_establish(void *vsc, int pi
 	if (((irqmode & GPIO_INTR_HIGH_LEVEL) ||
 	(irqmode & GPIO_INTR_LOW_LEVEL)) &&
 	(sc->sc_co_running == false)) {
-		callout_schedule(>sc_co,mstohz(sc->sc_ms));
+		callout_schedule(>sc_co, mstohz(sc->sc_ms));
 		sc->sc_co_running = true;
 	}
 
@@ -488,7 +496,7 @@ gpiosim_co(void *arg)
 	mutex_exit(>sc_intr_mutex);
 
 	if (sc->sc_co_running == true) {
-		callout_schedule(>sc_co,mstohz(sc->sc_ms));
+		callout_schedule(>sc_co, mstohz(sc->sc_ms));
 	}
 }
 
@@ -497,7 +505,7 @@ MODULE(MODULE_CLASS_DRIVER, gpiosim, "gp
 
 #ifdef _MODULE
 static const struct cfiattrdata gpiobus_iattrdata = {
-	"gpiobus", 0, { { NULL, NULL, 0 },}
+	"gpiobus", 0, { { NULL, NULL, 0 }, }
 };
 static const struct cfiattrdata *const gpiosim_attrs[] = {
 	_iattrdata, NULL



CVS commit: src

2023-11-24 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Nov 24 15:13:36 UTC 2023

Modified Files:
src/share/man/man4: gpiosim.4
src/sys/dev/gpio: gpiosim.c

Log Message:
Style changes.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/gpiosim.4
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/gpio/gpiosim.c

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