CVS commit: src/usr.bin/systat

2023-03-29 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Mar 29 21:44:35 UTC 2023

Modified Files:
src/usr.bin/systat: systat.1

Log Message:
systat(1): try to give this page a quick facelift

... too bad what it really needs is reconstructive surgery.  I tried
to fix the most obvious problems (unsorted lists, obviously wrong
markup, pleonastic wording that drowns out useful information in
repetition and lifetime supply of quote marks).

This page really needs a native speaker to take some loving care of it.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/systat/systat.1

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



CVS commit: src/usr.bin/systat

2023-03-29 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Mar 29 21:44:35 UTC 2023

Modified Files:
src/usr.bin/systat: systat.1

Log Message:
systat(1): try to give this page a quick facelift

... too bad what it really needs is reconstructive surgery.  I tried
to fix the most obvious problems (unsorted lists, obviously wrong
markup, pleonastic wording that drowns out useful information in
repetition and lifetime supply of quote marks).

This page really needs a native speaker to take some loving care of it.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/systat/systat.1

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

Modified files:

Index: src/usr.bin/systat/systat.1
diff -u src/usr.bin/systat/systat.1:1.53 src/usr.bin/systat/systat.1:1.54
--- src/usr.bin/systat/systat.1:1.53	Wed Mar 29 19:40:18 2023
+++ src/usr.bin/systat/systat.1	Wed Mar 29 21:44:35 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: systat.1,v 1.53 2023/03/29 19:40:18 kre Exp $
+.\"	$NetBSD: systat.1,v 1.54 2023/03/29 21:44:35 uwe Exp $
 .\"
 .\" Copyright (c) 1985, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)systat.1	8.2 (Berkeley) 12/30/93
 .\"
-.Dd August 21, 2021
+.Dd March 29, 2023
 .Dt SYSTAT 1
 .Os
 .Sh NAME
@@ -43,17 +43,18 @@
 .Op Fl t Ar turns
 .Op Fl w Ar wait
 .Op Ar display
-.Op Ar refresh-interval
+.Op Ar wait
 .Sh DESCRIPTION
 .Nm
 displays various system statistics in a screen oriented fashion
-using the curses screen display library,
-.Xr curses 3 .
+using the
+.Xr curses 3
+screen display library.
 .Pp
 While
 .Nm
-is running the screen is usually divided into two windows (an exception
-is the vmstat display which uses the entire screen).
+is running the screen is usually divided into two windows
+.Pq an exception is the vmstat display which uses the entire screen .
 The upper window depicts the current system load average.
 The information displayed in the lower window may vary, depending on
 user commands.
@@ -65,27 +66,27 @@ displays the processes getting the large
 in the lower window.
 Other displays show more detailed process information,
 swap space usage,
-disk usage statistics (a la
-.Xr df 1 ) ,
-disk I/O statistics (a la
-.Xr iostat 8 ) ,
-virtual memory statistics (a la
-.Xr vmstat 1 ) ,
-network
-.Qq Ic mbufs
-utilization, network
-.Qq Ic ifstat 
-traffic, and network connections (a la
-.Xr netstat 1 ) .
+disk usage statistics
+.Pq a\~la Xr df 1 ,
+disk I/O statistics
+.Pq a\~la Xr iostat 8 ,
+virtual memory statistics
+.Pq a\~la Xr vmstat 1 ,
+network mbuf utilization,
+network interface traffic,
+and network connections
+.Pq a\~la Xr netstat 1 .
 .Pp
 Input is interpreted at two different levels.
-A ``global'' command interpreter processes all keyboard input.
+A global command interpreter processes all keyboard input.
 If this command interpreter fails to recognize a command, the
 input line is passed to a per-display command interpreter.
 This allows each display to have certain display-specific commands.
 .Pp
 Command line options:
-.Bl -tag -width "refresh_interval"
+.Bl -tag -width Fl
+.It Fl b
+Show the chosen display once and exit.
 .It Fl M Ar core
 Extract values associated with the name list from
 .Ar core
@@ -96,22 +97,26 @@ Extract the name list from
 .Ar system
 instead of the default
 .Pa /netbsd .
-.It Fl b
-Show the chosen display once and exit.
 .It Fl n
 Do not resolve IP addresses into string hostnames
-.Pq FQDNs
-on
-.Ic netstat .
+.Pf ( Tn FQDN Ns s ) .
 It has the same effect as
 .Ic numbers
 subcommand in
 .Ic netstat .
-.It Fl w Ar wait
-See
-.Ar refresh-interval .
 .It Fl t Ar turns
-How many refreshes to show each screen in 'all' display mode.
+How many refresh cycles to show each screen in
+.Sq all
+display mode.
+The default is 2.
+.It Fl w Ar wait
+Set the screen refresh interval to
+.Ar wait
+seconds.
+Floating point numbers are accepted.
+The default is 1\~second.
+.It Fl z
+Display 0 instead of space when there is no data.
 .It Ar display
 The
 .Ar display
@@ -136,30 +141,23 @@ or
 .Ic vmstat .
 These displays can also be requested interactively and are described in
 full detail below.
-.It Ar refresh-interval
-The
-.Ar refresh-interval
-specifies the screen refresh time interval in seconds.
-This is provided for backwards compatibility, and overrides the
-.Ar refresh-interval
-specified with the
-.Fl w
-flag.
-.It Fl z
-Display 0 instead of space when there is no data.
+.It Ar wait
+The same as
+.Fl w Ar wait .
+This form is provided for backwards compatibility.
 .El
 .Pp
 Certain characters cause immediate action by
 .Nm  .
 These are
-.Bl -tag -width Fl
+.Bl -tag -width Ic
 .It Ic \&^L
 Refresh the screen.
 .It Ic \&^G
-Print the name of the current ``display'' being shown in
+Print the name of the current display being shown in
 the lower window and the refresh interval.
 .It Ic \&^Z
-Stop
+Suspend
 .Nm  .
 .It 

CVS commit: src/usr.bin/systat

2023-03-29 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 29 19:40:18 UTC 2023

Modified Files:
src/usr.bin/systat: systat.1

Log Message:
PR misc/57305 from Nan Xiao

Be consistent with method (and style) when referring to the mbufs and
ifstat sub-commands when describing what is available (and correct
"mbuf" to be "mbufs" which is what the internal command really is).

That is don't just "double quote" one and 'single quote' the other.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/systat/systat.1

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



CVS commit: src/usr.bin/systat

2023-03-29 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Mar 29 19:40:18 UTC 2023

Modified Files:
src/usr.bin/systat: systat.1

Log Message:
PR misc/57305 from Nan Xiao

Be consistent with method (and style) when referring to the mbufs and
ifstat sub-commands when describing what is available (and correct
"mbuf" to be "mbufs" which is what the internal command really is).

That is don't just "double quote" one and 'single quote' the other.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/systat/systat.1

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

Modified files:

Index: src/usr.bin/systat/systat.1
diff -u src/usr.bin/systat/systat.1:1.52 src/usr.bin/systat/systat.1:1.53
--- src/usr.bin/systat/systat.1:1.52	Sat Aug 21 13:22:19 2021
+++ src/usr.bin/systat/systat.1	Wed Mar 29 19:40:18 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: systat.1,v 1.52 2021/08/21 13:22:19 christos Exp $
+.\"	$NetBSD: systat.1,v 1.53 2023/03/29 19:40:18 kre Exp $
 .\"
 .\" Copyright (c) 1985, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -71,7 +71,11 @@ disk I/O statistics (a la
 .Xr iostat 8 ) ,
 virtual memory statistics (a la
 .Xr vmstat 1 ) ,
-network ``mbuf'' utilization, network 'ifstat' traffic, and network connections (a la
+network
+.Qq Ic mbufs
+utilization, network
+.Qq Ic ifstat 
+traffic, and network connections (a la
 .Xr netstat 1 ) .
 .Pp
 Input is interpreted at two different levels.



CVS commit: src/include/ssp

2023-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 29 13:37:10 UTC 2023

Modified Files:
src/include/ssp: ssp.h

Log Message:
PR/57288: Mingye Wang: : Use __builtin_dynamic_object_size
for LLVM > 9 and GCC > 12, introducing _SSP_FORTIFY_LEVEL == 3


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/include/ssp/ssp.h

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

Modified files:

Index: src/include/ssp/ssp.h
diff -u src/include/ssp/ssp.h:1.13 src/include/ssp/ssp.h:1.14
--- src/include/ssp/ssp.h:1.13	Thu Sep  3 16:43:47 2015
+++ src/include/ssp/ssp.h	Wed Mar 29 09:37:10 2023
@@ -1,7 +1,7 @@
-/*	$NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $	*/
+/*	$NetBSD: ssp.h,v 1.14 2023/03/29 13:37:10 christos Exp $	*/
 
 /*-
- * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2011, 2023 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -36,7 +36,9 @@
 #if !defined(__cplusplus)
 # if _FORTIFY_SOURCE > 0 && !defined(__lint__) && \
  (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1)
-#  if _FORTIFY_SOURCE > 1
+#  if _FORTIFY_SOURCE > 2 && __has_builtin(__builtin_dynamic_object_size)
+#   define __SSP_FORTIFY_LEVEL 3
+#  elif _FORTIFY_SOURCE > 1
 #   define __SSP_FORTIFY_LEVEL 2
 #  else
 #   define __SSP_FORTIFY_LEVEL 1
@@ -58,8 +60,13 @@
 
 #define __ssp_inline static __inline __attribute__((__always_inline__))
 
-#define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1)
-#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0)
+#if __SSP_FORTIFY_LEVEL > 2
+# define __ssp_bos(ptr) __builtin_dynamic_object_size(ptr, 1)
+# define __ssp_bos0(ptr) __builtin_dynamic_object_size(ptr, 0)
+#else
+# define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1)
+# define __ssp_bos0(ptr) __builtin_object_size(ptr, 0)
+#endif
 
 #define __ssp_check(buf, len, bos) \
 	if (bos(buf) != (size_t)-1 && len > bos(buf)) \



CVS commit: src/include/ssp

2023-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 29 13:37:10 UTC 2023

Modified Files:
src/include/ssp: ssp.h

Log Message:
PR/57288: Mingye Wang: : Use __builtin_dynamic_object_size
for LLVM > 9 and GCC > 12, introducing _SSP_FORTIFY_LEVEL == 3


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/include/ssp/ssp.h

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/openssl/dist/crypto/bn/asm

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 13:07:46 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bn/asm: x86_64-gcc.c

Log Message:
openssl: Remove local micro-optimization on AMD (but not Intel).

Upstream OpenSSL changed

loop 1b

to

dec %rcx
jnz 1b

which has mostly the same semantics, in this change:

https://github.com/openssl/openssl/pull/4743

For some reason, in one of the OpenSSL updates, we ended up with a
local change to revert this.

The Intel and AMD optimization guides are silent on the LOOP
instruction, but Agner Fog's tables shows that while LOOP is one
cycle shorter than DEC;JNZ on AMD Zen microarchitectures, it is a
good half dozen cycles longer than DEC;JNZ on recent Intel
microarchitectures.

The history of the OpenSSL change suggests it was intended, and I
can't find any indication other than `merge conflicts' that we
intended to keep the LOOP version.  So let's reduce the local diff by
nixing it.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-gcc.c

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/openssl/dist/crypto/bn/asm

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 13:07:46 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bn/asm: x86_64-gcc.c

Log Message:
openssl: Remove local micro-optimization on AMD (but not Intel).

Upstream OpenSSL changed

loop 1b

to

dec %rcx
jnz 1b

which has mostly the same semantics, in this change:

https://github.com/openssl/openssl/pull/4743

For some reason, in one of the OpenSSL updates, we ended up with a
local change to revert this.

The Intel and AMD optimization guides are silent on the LOOP
instruction, but Agner Fog's tables shows that while LOOP is one
cycle shorter than DEC;JNZ on AMD Zen microarchitectures, it is a
good half dozen cycles longer than DEC;JNZ on recent Intel
microarchitectures.

The history of the OpenSSL change suggests it was intended, and I
can't find any indication other than `merge conflicts' that we
intended to keep the LOOP version.  So let's reduce the local diff by
nixing it.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-gcc.c

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/openssl/dist/crypto/bn/asm/x86_64-gcc.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-gcc.c:1.11 src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-gcc.c:1.12
--- src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-gcc.c:1.11	Sun Mar 22 00:53:03 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-gcc.c	Wed Mar 29 13:07:46 2023
@@ -219,9 +219,10 @@ BN_ULONG bn_add_words(BN_ULONG *rp, cons
   "   adcq(%5,%2,8),%0\n"
   "   movq%0,(%3,%2,8)\n"
   "   lea 1(%2),%2\n"
-  "   loop1b  \n"
-  "   sbbq%0,%0   \n":"=" (ret), "+c"(n),
-  "+r"(i)
+  "   dec %1  \n"
+  "   jnz 1b  \n"
+  "   sbbq%0,%0   \n"
+  :"=" (ret), "+c"(n), "+r"(i)
   :"r"(rp), "r"(ap), "r"(bp)
   :"cc", "memory");
 
@@ -245,9 +246,10 @@ BN_ULONG bn_sub_words(BN_ULONG *rp, cons
   "   sbbq(%5,%2,8),%0\n"
   "   movq%0,(%3,%2,8)\n"
   "   lea 1(%2),%2\n"
-  "   loop1b  \n"
-  "   sbbq%0,%0   \n":"=" (ret), "+c"(n),
-  "+r"(i)
+  "   dec %1  \n"
+  "   jnz 1b  \n"
+  "   sbbq%0,%0   \n"
+  :"=" (ret), "+c"(n), "+r"(i)
   :"r"(rp), "r"(ap), "r"(bp)
   :"cc", "memory");
 



CVS commit: src/sys/netinet6

2023-03-29 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Wed Mar 29 13:01:44 UTC 2023

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

Log Message:
use carp mac address when replying to neighbor solicitations referring
to carp interface addresses.
unconfuses commercial routers


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/netinet6/nd6_nbr.c

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

Modified files:

Index: src/sys/netinet6/nd6_nbr.c
diff -u src/sys/netinet6/nd6_nbr.c:1.182 src/sys/netinet6/nd6_nbr.c:1.183
--- src/sys/netinet6/nd6_nbr.c:1.182	Mon Aug  2 12:56:25 2021
+++ src/sys/netinet6/nd6_nbr.c	Wed Mar 29 13:01:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_nbr.c,v 1.182 2021/08/02 12:56:25 andvar Exp $	*/
+/*	$NetBSD: nd6_nbr.c,v 1.183 2023/03/29 13:01:44 kardel Exp $	*/
 /*	$KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.182 2021/08/02 12:56:25 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.183 2023/03/29 13:01:44 kardel Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -100,7 +100,7 @@ static int dad_maxtry = 15;	/* max # of 
 void
 nd6_ns_input(struct mbuf *m, int off, int icmp6len)
 {
-	struct ifnet *ifp;
+	struct ifnet *ifp, *ifpc;
 	struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
 	struct nd_neighbor_solicit *nd_ns;
 	struct in6_addr saddr6 = ip6->ip6_src;
@@ -116,10 +116,11 @@ nd6_ns_input(struct mbuf *m, int off, in
 	union nd_opts ndopts;
 	const struct sockaddr_dl *proxydl = NULL;
 	struct psref psref;
+	struct psref psref_c;
 	struct psref psref_ia;
 	char ip6buf[INET6_ADDRSTRLEN], ip6buf2[INET6_ADDRSTRLEN];
 
-	ifp = m_get_rcvif_psref(m, );
+	ifp = ifpc = m_get_rcvif_psref(m, );
 	if (ifp == NULL)
 		goto freeit;
 
@@ -224,8 +225,15 @@ nd6_ns_input(struct mbuf *m, int off, in
 	if (ifp->if_carp && ifp->if_type != IFT_CARP) {
 		int s = pserialize_read_enter();
 		ifa = carp_iamatch6(ifp->if_carp, );
-		if (ifa != NULL)
+		if (ifa != NULL) {
 			ifa_acquire(ifa, _ia);
+			if (ifa->ifa_ifp && ifa->ifa_ifp != ifp) {
+ifpc = ifa->ifa_ifp;
+if_acquire(ifpc, _c);
+			}
+		}
+		
+		
 		pserialize_read_exit(s);
 	} else
 		ifa = NULL;
@@ -350,14 +358,14 @@ nd6_ns_input(struct mbuf *m, int off, in
 		in6_all = in6addr_linklocal_allnodes;
 		if (in6_setscope(_all, ifp, NULL) != 0)
 			goto bad;
-		nd6_na_output(ifp, _all, ,
+		nd6_na_output(ifpc, _all, ,
 		((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) |
 		(ip6_forwarding ? ND_NA_FLAG_ROUTER : 0),
 		tlladdr, (const struct sockaddr *)proxydl);
 		goto freeit;
 	}
 
-	nd6_cache_lladdr(ifp, , lladdr, lladdrlen, ND_NEIGHBOR_SOLICIT, 0);
+	nd6_cache_lladdr(ifpc, , lladdr, lladdrlen, ND_NEIGHBOR_SOLICIT, 0);
 
 	nd6_na_output(ifp, , ,
 	((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) |
@@ -366,6 +374,9 @@ nd6_ns_input(struct mbuf *m, int off, in
  freeit:
 	ifa_release(ifa, _ia);
 	m_put_rcvif_psref(ifp, );
+	if (ifp != ifpc)
+		if_put(ifpc, _c);
+
 	m_freem(m);
 	return;
 



CVS commit: src/sys/netinet6

2023-03-29 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Wed Mar 29 13:01:44 UTC 2023

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

Log Message:
use carp mac address when replying to neighbor solicitations referring
to carp interface addresses.
unconfuses commercial routers


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/netinet6/nd6_nbr.c

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/openssl

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:29:10 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bn/asm: mips.pl
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: mips.S

Log Message:
openssl: Omit local indentation diff in mips bignum assembly.

Cute as it is to write the an instruction in a delay slot with an
extra space, it's not really useful to keep this around as a local
change since the substantive change was applied upstream years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssl/dist/crypto/bn/asm/mips.pl
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S

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/openssl/dist/crypto/bn/asm/mips.pl
diff -u src/crypto/external/bsd/openssl/dist/crypto/bn/asm/mips.pl:1.9 src/crypto/external/bsd/openssl/dist/crypto/bn/asm/mips.pl:1.10
--- src/crypto/external/bsd/openssl/dist/crypto/bn/asm/mips.pl:1.9	Fri Jan  7 15:50:10 2022
+++ src/crypto/external/bsd/openssl/dist/crypto/bn/asm/mips.pl	Wed Mar 29 10:29:09 2023
@@ -817,7 +817,7 @@ bn_div_3_words:
 	$LD	$a0,($a3)
 	move	$ta2,$a1
 	bne	$a0,$a2,bn_div_3_words_internal
-	 $LD	$a1,-$BNSZ($a3)
+	$LD	$a1,-$BNSZ($a3)
 	li	$v0,-1
 	jr	$ra
 	move	$a0,$v0

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S:1.4 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S:1.5
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S:1.4	Sun Jun 21 22:16:16 2020
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S	Wed Mar 29 10:29:10 2023
@@ -589,7 +589,7 @@ bn_div_3_words:
 	lw	$4,($7)
 	move	$10,$5
 	bne	$4,$6,bn_div_3_words_internal
-	 lw	$5,-4($7)
+	lw	$5,-4($7)
 	li	$2,-1
 	jr	$31
 	move	$4,$2



CVS commit: src/crypto/external/bsd/openssl

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:29:10 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bn/asm: mips.pl
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: mips.S

Log Message:
openssl: Omit local indentation diff in mips bignum assembly.

Cute as it is to write the an instruction in a delay slot with an
extra space, it's not really useful to keep this around as a local
change since the substantive change was applied upstream years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssl/dist/crypto/bn/asm/mips.pl
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S

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/openssl/dist/crypto/bio

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:25:11 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bio: bss_log.c

Log Message:
openssl: Omit needless sprintf->snprintf under OPENSSL_SYS_WIN32.

Much as I'm happy to eliminate sprintf, there's very little value to
maintaining a local change under an #ifdef that will never, ever be
taken on NetBSD.

Verified libcrypto.so does not sprout any references to sprintf as a
result.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c

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/openssl/dist/crypto/bio

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:25:11 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/bio: bss_log.c

Log Message:
openssl: Omit needless sprintf->snprintf under OPENSSL_SYS_WIN32.

Much as I'm happy to eliminate sprintf, there's very little value to
maintaining a local change under an #ifdef that will never, ever be
taken on NetBSD.

Verified libcrypto.so does not sprout any references to sprintf as a
result.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c

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/openssl/dist/crypto/bio/bss_log.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c:1.12 src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c:1.13
--- src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c:1.12	Sun Mar 22 20:07:05 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/bio/bss_log.c	Wed Mar 29 10:25:11 2023
@@ -280,7 +280,7 @@ static void xsyslog(BIO *bp, int priorit
 break;
 }
 
-snprintf(pidbuf, sizeof(pidbuf), "[%u] ", GetCurrentProcessId());
+sprintf(pidbuf, "[%u] ", GetCurrentProcessId());
 lpszStrings[0] = pidbuf;
 lpszStrings[1] = string;
 



CVS commit: src/crypto/external/bsd/openssl/dist/crypto

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:21:27 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: threads_pthread.c

Log Message:
openssl: Omit needless #ifdef notyet around __atomic_is_lock_free.

At the time this was done, our gcc version did not have it, but now
it does, so let's reduce the local diff.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/dist/crypto/threads_pthread.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/threads_pthread.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/threads_pthread.c:1.4 src/crypto/external/bsd/openssl/dist/crypto/threads_pthread.c:1.5
--- src/crypto/external/bsd/openssl/dist/crypto/threads_pthread.c:1.4	Thu Jan 23 02:54:53 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/threads_pthread.c	Wed Mar 29 10:21:27 2023
@@ -162,15 +162,12 @@ int CRYPTO_THREAD_compare_id(CRYPTO_THRE
 
 int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
 {
-#ifdef notyet
-// We don't provide yet __atomic_is_lock_free
 # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL)
 if (__atomic_is_lock_free(sizeof(*val), val)) {
 *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL);
 return 1;
 }
 # endif
-#endif
 if (!CRYPTO_THREAD_write_lock(lock))
 return 0;
 



CVS commit: src/crypto/external/bsd/openssl/dist/crypto

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:21:27 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: threads_pthread.c

Log Message:
openssl: Omit needless #ifdef notyet around __atomic_is_lock_free.

At the time this was done, our gcc version did not have it, but now
it does, so let's reduce the local diff.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/dist/crypto/threads_pthread.c

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/openssl/dist/crypto

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:19:39 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: mem_clr.c

Log Message:
openssl: Omit needless #include  in mem_clr.c.

This was needed back when the file was patched locally to cast a
pointer to intptr_t rather than to int, but that code is now gone and
the include is no longer necessary.  So let's reduce the local diff
by omitting this unnecessary change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/crypto/external/bsd/openssl/dist/crypto/mem_clr.c

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/openssl/dist/crypto/mem_clr.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/mem_clr.c:1.7 src/crypto/external/bsd/openssl/dist/crypto/mem_clr.c:1.8
--- src/crypto/external/bsd/openssl/dist/crypto/mem_clr.c:1.7	Thu Feb  8 21:51:24 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/mem_clr.c	Wed Mar 29 10:19:39 2023
@@ -9,7 +9,6 @@
 
 #include 
 #include 
-#include 
 
 /*
  * Pointer to memset is volatile so that compiler must de-reference



CVS commit: src/crypto/external/bsd/openssl/dist/crypto

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:19:39 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: mem_clr.c

Log Message:
openssl: Omit needless #include  in mem_clr.c.

This was needed back when the file was patched locally to cast a
pointer to intptr_t rather than to int, but that code is now gone and
the include is no longer necessary.  So let's reduce the local diff
by omitting this unnecessary change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/crypto/external/bsd/openssl/dist/crypto/mem_clr.c

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/openssl/dist/apps

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:18:50 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/apps: s_client.c s_server.c

Log Message:
openssl: Revert local patch around fileno(stdin/stdout).

According to the commit history, this was introduced when gcc4.5
complained about using the return value of fileno without checking it
against -1.  gcc 10.4 no longer appears to object, so let's just nix
the local patch.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
src/crypto/external/bsd/openssl/dist/apps/s_client.c \
src/crypto/external/bsd/openssl/dist/apps/s_server.c

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/openssl/dist/apps/s_client.c
diff -u src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.25 src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.26
--- src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.25	Tue Mar 15 20:51:12 2022
+++ src/crypto/external/bsd/openssl/dist/apps/s_client.c	Wed Mar 29 10:18:50 2023
@@ -2770,16 +2770,6 @@ int s_client_main(int argc, char **argv)
 for (;;) {
 FD_ZERO();
 FD_ZERO();
-int fdin = fileno_stdin();
-if (fdin < 0) {
-BIO_printf(bio_err,"bad fileno for stdin\n");
-goto shut;
-}
-int fdout = fileno_stdout();
-if (fdout < 0) {
-BIO_printf(bio_err,"bad fileno for stdout\n");
-goto shut;
-}
 
 if (SSL_is_dtls(con) && DTLSv1_get_timeout(con, ))
 timeoutp = 
@@ -2834,10 +2824,10 @@ int s_client_main(int argc, char **argv)
  * set the flag so we exit.
  */
 if (read_tty && !at_eof)
-openssl_fdset(fdin, );
+openssl_fdset(fileno_stdin(), );
 #if !defined(OPENSSL_SYS_VMS)
 if (write_tty)
-openssl_fdset(fdout, );
+openssl_fdset(fileno_stdout(), );
 #endif
 }
 if (read_ssl)
@@ -2965,7 +2955,7 @@ int s_client_main(int argc, char **argv)
 /* Assume Windows/DOS/BeOS can always write */
 else if (!ssl_pending && write_tty)
 #else
-else if (!ssl_pending && FD_ISSET(fdout, ))
+else if (!ssl_pending && FD_ISSET(fileno_stdout(), ))
 #endif
 {
 #ifdef CHARSET_EBCDIC
@@ -3052,7 +3042,7 @@ int s_client_main(int argc, char **argv)
 #if defined(OPENSSL_SYS_MSDOS)
 else if (has_stdin_waiting())
 #else
-else if (FD_ISSET(fdin, ))
+else if (FD_ISSET(fileno_stdin(), ))
 #endif
 {
 if (crlf) {
Index: src/crypto/external/bsd/openssl/dist/apps/s_server.c
diff -u src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.25 src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.26
--- src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.25	Tue Feb  7 22:25:29 2023
+++ src/crypto/external/bsd/openssl/dist/apps/s_server.c	Wed Mar 29 10:18:50 2023
@@ -2265,7 +2265,7 @@ static int sv_body(int s, int stype, int
 char *buf = NULL;
 fd_set readfds;
 int ret = 1, width;
-int k, i, fdin;
+int k, i;
 unsigned long l;
 SSL *con = NULL;
 BIO *sbio;
@@ -2449,14 +2449,9 @@ static int sv_body(int s, int stype, int
|| (async && SSL_waiting_for_async(con));
 
 if (!read_from_sslcon) {
-fdin = fileno_stdin();
-if (fdin < 0) {
-BIO_printf(bio_err,"Bad fileno for stdin\n");
-goto err;
-}
 FD_ZERO();
 #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
-openssl_fdset(fdin, );
+openssl_fdset(fileno_stdin(), );
 #endif
 openssl_fdset(s, );
 /*
@@ -2493,7 +2488,7 @@ static int sv_body(int s, int stype, int
 
 if (i <= 0)
 continue;
-if (FD_ISSET(fdin, ))
+if (FD_ISSET(fileno_stdin(), ))
 read_from_terminal = 1;
 #endif
 if (FD_ISSET(s, ))



CVS commit: src/crypto/external/bsd/openssl/dist/apps

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 10:18:50 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/dist/apps: s_client.c s_server.c

Log Message:
openssl: Revert local patch around fileno(stdin/stdout).

According to the commit history, this was introduced when gcc4.5
complained about using the return value of fileno without checking it
against -1.  gcc 10.4 no longer appears to object, so let's just nix
the local patch.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
src/crypto/external/bsd/openssl/dist/apps/s_client.c \
src/crypto/external/bsd/openssl/dist/apps/s_server.c

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



CVS commit: src/sys/dev/pci

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 09:45:05 UTC 2023

Modified Files:
src/sys/dev/pci: virtioreg.h

Log Message:
virtio(4): Use flexible array members, not zero-length arrays.

This enables the compiler to detect sizeof mistakes like
PR kern/57304.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/virtioreg.h

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

Modified files:

Index: src/sys/dev/pci/virtioreg.h
diff -u src/sys/dev/pci/virtioreg.h:1.11 src/sys/dev/pci/virtioreg.h:1.12
--- src/sys/dev/pci/virtioreg.h:1.11	Sat Oct 15 20:00:35 2022
+++ src/sys/dev/pci/virtioreg.h	Wed Mar 29 09:45:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtioreg.h,v 1.11 2022/10/15 20:00:35 riastradh Exp $	*/
+/*	$NetBSD: virtioreg.h,v 1.12 2023/03/29 09:45:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -153,7 +153,7 @@ struct vring_desc {
 struct vring_avail {
 uint16_t flags;
 uint16_t idx;
-uint16_t ring[0];
+uint16_t ring[];
 	/* trailed by uint16_t used_event when VIRTIO_F_RING_EVENT_IDX */
 } __packed;
 
@@ -168,7 +168,7 @@ struct vring_used_elem {
 struct vring_used {
 uint16_t flags;
 uint16_t idx;
-struct vring_used_elem ring[0];
+struct vring_used_elem ring[];
 	/* trailed by uint16_t avail_event when VIRTIO_F_RING_EVENT_IDX */
 } __packed;
 



CVS commit: src/sys/dev/pci

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 09:45:05 UTC 2023

Modified Files:
src/sys/dev/pci: virtioreg.h

Log Message:
virtio(4): Use flexible array members, not zero-length arrays.

This enables the compiler to detect sizeof mistakes like
PR kern/57304.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/virtioreg.h

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



CVS commit: src/sys/dev/pci

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 09:44:26 UTC 2023

Modified Files:
src/sys/dev/pci: virtio.c

Log Message:
virtio(4): Fix sizing of virtqueue allocation.

vq->vq_avail[0].ring is a zero-length array, and thus sizeof is zero;
likewise vq->vq_used[0].ring.

Use vq->vq_avail[0].ring[0] and vq->vq_used[0].ring[0] to fix this
and restore the previous allocation sizing logic.

XXX We shouldn't use zero-length arrays here -- they are asking for
trouble like this, and C99 has a standard way to express what we're
actually trying to get at it, flexible array members.

PR kern/57304

Reported-by: syzbot+7fb1047f5dfa33b26...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/virtio.c

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

Modified files:

Index: src/sys/dev/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.71 src/sys/dev/pci/virtio.c:1.72
--- src/sys/dev/pci/virtio.c:1.71	Mon Mar 27 14:56:40 2023
+++ src/sys/dev/pci/virtio.c	Wed Mar 29 09:44:25 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.71 2023/03/27 14:56:40 nakayama Exp $	*/
+/*	$NetBSD: virtio.c,v 1.72 2023/03/29 09:44:25 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.71 2023/03/27 14:56:40 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.72 2023/03/29 09:44:25 riastradh Exp $");
 
 #include 
 #include 
@@ -784,9 +784,9 @@ virtio_alloc_vq(struct virtio_softc *sc,
 
 	size_desc = sizeof(vq->vq_desc[0]) * vq_num;
 	size_avail = sizeof(uint16_t) * hdrlen
-	+ sizeof(vq->vq_avail[0].ring) * vq_num;
+	+ sizeof(vq->vq_avail[0].ring[0]) * vq_num;
 	size_used = sizeof(uint16_t) *hdrlen
-	+ sizeof(vq->vq_used[0].ring) * vq_num;
+	+ sizeof(vq->vq_used[0].ring[0]) * vq_num;
 	size_indirect = (sc->sc_indirect && maxnsegs >= MINSEG_INDIRECT) ?
 	sizeof(struct vring_desc) * maxnsegs * vq_num : 0;
 



CVS commit: src/sys/dev/pci

2023-03-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar 29 09:44:26 UTC 2023

Modified Files:
src/sys/dev/pci: virtio.c

Log Message:
virtio(4): Fix sizing of virtqueue allocation.

vq->vq_avail[0].ring is a zero-length array, and thus sizeof is zero;
likewise vq->vq_used[0].ring.

Use vq->vq_avail[0].ring[0] and vq->vq_used[0].ring[0] to fix this
and restore the previous allocation sizing logic.

XXX We shouldn't use zero-length arrays here -- they are asking for
trouble like this, and C99 has a standard way to express what we're
actually trying to get at it, flexible array members.

PR kern/57304

Reported-by: syzbot+7fb1047f5dfa33b26...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/virtio.c

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