CVS commit: src/sys/arch/alpha/alpha

2021-04-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Apr 20 01:29:40 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: interrupt.c

Log Message:
Don't use atomics to manipulate cpu_info::ci_intrdepth: it's modified
only in the interrupt service path by the owning CPU, at entry and exit.
Even if the r/m/w cycle of incrementing the value were interrupted, the
result would still be the same because the interrupting frame will have
completed its own symmetrical increment/decrement cycle upon return.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/alpha/alpha/interrupt.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/alpha/alpha/interrupt.c
diff -u src/sys/arch/alpha/alpha/interrupt.c:1.94 src/sys/arch/alpha/alpha/interrupt.c:1.95
--- src/sys/arch/alpha/alpha/interrupt.c:1.94	Tue Apr 20 00:09:45 2021
+++ src/sys/arch/alpha/alpha/interrupt.c	Tue Apr 20 01:29:40 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $");
 
 #include 
 #include 
@@ -193,7 +193,7 @@ interrupt(unsigned long a0, unsigned lon
 	switch (a0) {
 	case ALPHA_INTR_XPROC:	/* interprocessor interrupt */
 #if defined(MULTIPROCESSOR)
-		atomic_inc_ulong(&ci->ci_intrdepth);
+		ci->ci_intrdepth++;
 
 		alpha_ipi_process(ci, framep);
 
@@ -205,7 +205,7 @@ interrupt(unsigned long a0, unsigned lon
 		hwrpb->rpb_txrdy != 0)
 			cpu_iccb_receive();
 
-		atomic_dec_ulong(&ci->ci_intrdepth);
+		ci->ci_intrdepth--;
 #else
 		printf("WARNING: received interprocessor interrupt!\n");
 #endif /* MULTIPROCESSOR */
@@ -226,7 +226,7 @@ interrupt(unsigned long a0, unsigned lon
 		 * "was processing interrupts when the clock interrupt
 		 * happened".
 		 */
-		atomic_add_long(&ci->ci_intrdepth, 0x10);
+		ci->ci_intrdepth += 0x10;
 		sc->sc_evcnt_clock.ev_count++;
 		ci->ci_data.cpu_nintr++;
 		if (platform.clockintr) {
@@ -251,18 +251,18 @@ interrupt(unsigned long a0, unsigned lon
 			schedhz != 0)
 schedclock(ci->ci_curlwp);
 		}
-		atomic_add_long(&ci->ci_intrdepth, -0x10);
+		ci->ci_intrdepth -= 0x10;
 		break;
 
 	case ALPHA_INTR_ERROR:	/* Machine Check or Correctable Error */
-		atomic_inc_ulong(&ci->ci_intrdepth);
+		ci->ci_intrdepth++;
 		a0 = alpha_pal_rdmces();
 		if (platform.mcheck_handler != NULL &&
 		(void *)framep->tf_regs[FRAME_PC] != XentArith)
 			(*platform.mcheck_handler)(a0, framep, a1, a2);
 		else
 			machine_check(a0, framep, a1, a2);
-		atomic_dec_ulong(&ci->ci_intrdepth);
+		ci->ci_intrdepth--;
 		break;
 
 	case ALPHA_INTR_DEVICE:	/* I/O device interrupt */
@@ -272,14 +272,14 @@ interrupt(unsigned long a0, unsigned lon
 		KDASSERT(a1 >= SCB_IOVECBASE && a1 < SCB_SIZE);
 
 		atomic_inc_ulong(&sc->sc_evcnt_device.ev_count);
-		atomic_inc_ulong(&ci->ci_intrdepth);
+		ci->ci_intrdepth++;
 
 		ci->ci_data.cpu_nintr++;
 
 		struct scbvec * const scb = &scb_iovectab[idx];
 		(*scb->scb_func)(scb->scb_arg, a1);
 
-		atomic_dec_ulong(&ci->ci_intrdepth);
+		ci->ci_intrdepth--;
 		break;
 	}
 



CVS commit: src/sys/arch/alpha

2021-04-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Apr 20 00:09:45 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: interrupt.c
src/sys/arch/alpha/include: cpu.h

Log Message:
Slight tweak to previous changes:

Rather than simply increment the interrupt depth for the clock interrupt,
we add 0x10.  Why?  Because while we only use a single Alpha IPL (4) for
IPL_{BIO,NET,TTY,VM}, technically the architecture specification suports
two in the OSF/1 PALcode (3 [low-pri] and 4 [high-pri]), meaning we could
conceiveably have intrdepth > 1 just for device interrupts.

Adding 0x10 here means that cpu_intr_p() can check for "intrdepth != 0" for
"in interrupt context" and CLKF_INTR() can check "(intrdepth & 0xf) != 0" for
"was processing interrupts when the clock interrupt happened".


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/alpha/alpha/interrupt.c
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/alpha/include/cpu.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/alpha/alpha/interrupt.c
diff -u src/sys/arch/alpha/alpha/interrupt.c:1.93 src/sys/arch/alpha/alpha/interrupt.c:1.94
--- src/sys/arch/alpha/alpha/interrupt.c:1.93	Thu Apr 15 00:19:52 2021
+++ src/sys/arch/alpha/alpha/interrupt.c	Tue Apr 20 00:09:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.93 2021/04/15 00:19:52 rin Exp $ */
+/* $NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.93 2021/04/15 00:19:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $");
 
 #include 
 #include 
@@ -212,7 +212,21 @@ interrupt(unsigned long a0, unsigned lon
 		break;
 		
 	case ALPHA_INTR_CLOCK:	/* clock interrupt */
-		atomic_inc_ulong(&ci->ci_intrdepth);
+		/*
+		 * Rather than simply increment the interrupt depth
+		 * for the clock interrupt, we add 0x10.  Why?  Because
+		 * while we only call out a single device interrupt
+		 * level, technically the architecture specification
+		 * suports two, meaning we could have intrdepth > 1
+		 * just for device interrupts.
+		 *
+		 * Adding 0x10 here means that cpu_intr_p() can check
+		 * for "intrdepth != 0" for "in interrupt context" and
+		 * CLKF_INTR() can check "(intrdepth & 0xf) != 0" for
+		 * "was processing interrupts when the clock interrupt
+		 * happened".
+		 */
+		atomic_add_long(&ci->ci_intrdepth, 0x10);
 		sc->sc_evcnt_clock.ev_count++;
 		ci->ci_data.cpu_nintr++;
 		if (platform.clockintr) {
@@ -237,7 +251,7 @@ interrupt(unsigned long a0, unsigned lon
 			schedhz != 0)
 schedclock(ci->ci_curlwp);
 		}
-		atomic_dec_ulong(&ci->ci_intrdepth);
+		atomic_add_long(&ci->ci_intrdepth, -0x10);
 		break;
 
 	case ALPHA_INTR_ERROR:	/* Machine Check or Correctable Error */

Index: src/sys/arch/alpha/include/cpu.h
diff -u src/sys/arch/alpha/include/cpu.h:1.100 src/sys/arch/alpha/include/cpu.h:1.101
--- src/sys/arch/alpha/include/cpu.h:1.100	Thu Apr 15 08:23:24 2021
+++ src/sys/arch/alpha/include/cpu.h	Tue Apr 20 00:09:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.100 2021/04/15 08:23:24 rin Exp $ */
+/* $NetBSD: cpu.h,v 1.101 2021/04/20 00:09:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -206,7 +206,7 @@ struct clockframe {
  * like this stastic has to be extremely accurate.
  */
 #define	CLKF_INTR(framep)		\
-	(curcpu()->ci_intrdepth > 1)	/* one for clock interrupt itself */
+	((curcpu()->ci_intrdepth & 0xf) != 0)	/* see interrupt() */
 
 /*
  * This is used during profiling to integrate system time.  It can safely



CVS commit: src/usr.bin/make

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 23:51:42 UTC 2021

Modified Files:
src/usr.bin/make: cond.c
src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk

Log Message:
make: do not complain when skipping the condition 'no >= 10'

Seen in external/bsd/tmux when building with Clang.  See
varmod-ifelse.mk for the detailed story.


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/usr.bin/make/cond.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-ifelse.mk

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/make/cond.c
diff -u src/usr.bin/make/cond.c:1.261 src/usr.bin/make/cond.c:1.262
--- src/usr.bin/make/cond.c:1.261	Sun Apr  4 11:56:43 2021
+++ src/usr.bin/make/cond.c	Mon Apr 19 23:51:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.261 2021/04/04 11:56:43 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.262 2021/04/19 23:51:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.261 2021/04/04 11:56:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.262 2021/04/19 23:51:42 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -854,7 +854,7 @@ CondParser_LeafToken(CondParser *par, bo
 	arglen = ParseFuncArg(par, &cp, doEval, NULL, &arg);
 	cp1 = cp;
 	cpp_skip_whitespace(&cp1);
-	if (*cp1 == '=' || *cp1 == '!')
+	if (*cp1 == '=' || *cp1 == '!' || *cp1 == '<' || *cp1 == '>')
 		return CondParser_Comparison(par, doEval);
 	par->p = cp;
 

Index: src/usr.bin/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.9 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.10
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.9	Mon Apr 19 23:43:14 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Mon Apr 19 23:51:42 2021
@@ -15,8 +15,8 @@ CondParser_Eval: ${ ${:U\$}{VAR} == valu
 CondParser_Eval: ${VAR} == value 
 lhs = "value", rhs = "value", op = ==
 lhs = "ok", rhs = "ok", op = !=
-make: Bad conditional expression 'string == "literal" && no >= 10' in 'string == "literal" && no >= 10?yes:no'
-make: "varmod-ifelse.mk" line 153: .
+make: "varmod-ifelse.mk" line 153: no.
+make: "varmod-ifelse.mk" line 154: String comparison operator must be either == or !=
 make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no'
 make: "varmod-ifelse.mk" line 154: .
 make: Bad conditional expression 'string == "literal" &&  >= 10' in 'string == "literal" &&  >= 10?yes:no'

Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.15 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.16
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.15	Mon Apr 19 23:43:14 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Mon Apr 19 23:51:42 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.15 2021/04/19 23:43:14 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.16 2021/04/19 23:51:42 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
@@ -140,14 +140,14 @@ VAR=	value
 # therefore parsing stopped at the '>', producing the 'Bad conditional
 # expression'.
 #
-# TODO: make should at least describe the part of the condition that is
-#  wrong. In this case it is probably the "no >= 10".  Ideally that should
-#  not matter though since the left-hand side of the '&&' evaluates to false,
-#  thus the right-hand side only needs to be parsed, not evaluated.  Since
-#  this is the modifier ':?', which expands subexpressions before parsing
-#  the condition, the "no >= 10" is probably a parse error since it "can be
-#  seen at compile-time" that the operand types of '>=' don't match.  Only
-#  that the concept of "compile-time" does not really apply here.
+# Ideally, the conditional expression would not be expanded before parsing
+# it.  This would allow to write the conditions exactly as seen below.  That
+# change has a high chance of breaking _some_ existing code and would need
+# to be thoroughly tested.
+#
+# Since cond.c 1.262 from 2021-04-20, make reports a more specific error
+# message in situations like these, pointing directly to the specific problem
+# instead of just saying that the whole condition is bad.
 STRING=		string
 NUMBER=		no		# not really a number
 .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.



CVS commit: src/usr.bin/make/unit-tests

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 23:43:15 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk

Log Message:
tests/make: add another example for parsing of the modifier ':?'


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-ifelse.mk

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/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.8 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.9
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.8	Mon Apr 19 23:27:17 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Mon Apr 19 23:43:14 2021
@@ -19,6 +19,10 @@ make: Bad conditional expression 'string
 make: "varmod-ifelse.mk" line 153: .
 make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no'
 make: "varmod-ifelse.mk" line 154: .
+make: Bad conditional expression 'string == "literal" &&  >= 10' in 'string == "literal" &&  >= 10?yes:no'
+make: "varmod-ifelse.mk" line 159: .
+make: Bad conditional expression 'string == "literal" ||  >= 10' in 'string == "literal" ||  >= 10?yes:no'
+make: "varmod-ifelse.mk" line 160: .
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.14 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.15
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.14	Mon Apr 19 23:27:17 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Mon Apr 19 23:43:14 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.14 2021/04/19 23:27:17 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.15 2021/04/19 23:43:14 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
@@ -152,3 +152,9 @@ STRING=		string
 NUMBER=		no		# not really a number
 .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
 .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.
+
+# The following situation occasionally occurs with MKINET6 or similar
+# variables.
+NUMBER=		# empty, not really a number either
+.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
+.info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.



CVS commit: src/usr.bin/make/unit-tests

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 23:27:17 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk

Log Message:
tests/make: add detailed explanation for error message in conditional


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmod-ifelse.mk

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/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.7 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.8
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.7	Mon Apr 19 22:22:27 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Mon Apr 19 23:27:17 2021
@@ -16,7 +16,9 @@ CondParser_Eval: ${VAR} == value 
 lhs = "value", rhs = "value", op = ==
 lhs = "ok", rhs = "ok", op = !=
 make: Bad conditional expression 'string == "literal" && no >= 10' in 'string == "literal" && no >= 10?yes:no'
-make: "varmod-ifelse.mk" line 127: .
+make: "varmod-ifelse.mk" line 153: .
+make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no'
+make: "varmod-ifelse.mk" line 154: .
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.13 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.14
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.13	Mon Apr 19 22:22:27 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Mon Apr 19 23:27:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.13 2021/04/19 22:22:27 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.14 2021/04/19 23:27:17 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
@@ -111,8 +111,34 @@ VAR=	value
 .endif
 .MAKEFLAGS: -d0
 
-# Seen on 2021-04-19 when building external/bsd/tmux with HAVE_LLVM=yes
-# and HAVE_GCC=no.
+# On 2021-04-19, when building external/bsd/tmux with HAVE_LLVM=yes and
+# HAVE_GCC=no, the following conditional generated this error message:
+#
+#	make: Bad conditional expression 'string == "literal" && no >= 10'
+#	in 'string == "literal" && no >= 10?yes:no'
+#
+# Despite the error message (which was not clearly marked with "error:"),
+# the build continued, for historical reasons, see main_Exit.
+#
+# The tricky detail here is that the condition that looks so obvious in the
+# form written in the makefile becomes tricky when it is actually evaluated.
+# This is because the condition is written in the place of the variable name
+# of the expression, and in an expression, the variable name is always
+# expanded first, before even looking at the modifiers.  This happens for the
+# modifier ':?' as well, so when CondEvalExpression gets to see the
+# expression, it already looks like this:
+#
+#	string == "literal" && no >= 10
+#
+# When parsing such an expression, the parser used to be strict.  It first
+# evaluated the left-hand side of the operator '&&' and then started parsing
+# the right-hand side 'no >= 10'.  The word 'no' is obviously a string
+# literal, not enclosed in quotes, which is ok, even on the left-hand side of
+# the comparison operator, but only because this is a condition in the
+# modifier ':?'.  In an ordinary directive '.if', this would be a parse error.
+# For strings, only the comparison operators '==' and '!=' are defined,
+# therefore parsing stopped at the '>', producing the 'Bad conditional
+# expression'.
 #
 # TODO: make should at least describe the part of the condition that is
 #  wrong. In this case it is probably the "no >= 10".  Ideally that should
@@ -123,5 +149,6 @@ VAR=	value
 #  seen at compile-time" that the operand types of '>=' don't match.  Only
 #  that the concept of "compile-time" does not really apply here.
 STRING=		string
-NUMBER=		no
+NUMBER=		no		# not really a number
 .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
+.info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.



CVS commit: src/usr.bin/make

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 22:22:27 UTC 2021

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: cond-late.exp cond1.exp varmod-ifelse.exp
varmod-ifelse.mk

Log Message:
make: use straight quotes for error 'Bad conditional expression'

This diagnostic was supposed to be an error, see ApplyModifier_IfElse.

When such an error occurs while the makefiles are read, make stops with
an error, as can be expected.  But when such an error occurs later,
after all makefiles have been read, the message is printed but make does
not stop.

In lint mode (-dL), make stops in such a case.  I didn't dare to make
this the default behavior, out of fear of breaking existing build
infrastructure, not only in NetBSD or pkgsrc, but also FreeBSD and other
operating systems that use the bmake distribution, generated from the
same source code.


To generate a diff of this commit:
cvs rdiff -u -r1.929 -r1.930 src/usr.bin/make/var.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-late.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond1.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-ifelse.mk

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/make/var.c
diff -u src/usr.bin/make/var.c:1.929 src/usr.bin/make/var.c:1.930
--- src/usr.bin/make/var.c:1.929	Wed Apr 14 16:59:34 2021
+++ src/usr.bin/make/var.c	Mon Apr 19 22:22:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.929 2021/04/14 16:59:34 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.930 2021/04/19 22:22:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.929 2021/04/14 16:59:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.930 2021/04/19 22:22:27 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3384,7 +3384,7 @@ ApplyModifier_IfElse(const char **pp, Mo
 	(*pp)--;		/* Go back to the ch->endc. */
 
 	if (cond_rc == COND_INVALID) {
-		Error("Bad conditional expression `%s' in %s?%s:%s",
+		Error("Bad conditional expression '%s' in '%s?%s:%s'",
 		expr->name, expr->name, then_expr.str, else_expr.str);
 		return AMR_CLEANUP;
 	}

Index: src/usr.bin/make/unit-tests/cond-late.exp
diff -u src/usr.bin/make/unit-tests/cond-late.exp:1.3 src/usr.bin/make/unit-tests/cond-late.exp:1.4
--- src/usr.bin/make/unit-tests/cond-late.exp:1.3	Sat Jul 25 20:37:46 2020
+++ src/usr.bin/make/unit-tests/cond-late.exp	Mon Apr 19 22:22:27 2021
@@ -1,4 +1,4 @@
-make: Bad conditional expression ` != "no"' in  != "no"?:
+make: Bad conditional expression ' != "no"' in ' != "no"?:'
 yes
 no
 exit status 0

Index: src/usr.bin/make/unit-tests/cond1.exp
diff -u src/usr.bin/make/unit-tests/cond1.exp:1.4 src/usr.bin/make/unit-tests/cond1.exp:1.5
--- src/usr.bin/make/unit-tests/cond1.exp:1.4	Thu Jan 21 23:32:28 2021
+++ src/usr.bin/make/unit-tests/cond1.exp	Mon Apr 19 22:22:27 2021
@@ -17,7 +17,7 @@ Passed:
 5 is  prime
 
 make: String comparison operator must be either == or !=
-make: Bad conditional expression `"0" > 0' in "0" > 0?OK:No
+make: Bad conditional expression '"0" > 0' in '"0" > 0?OK:No'
 
 OK
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.6 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.7
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.6	Mon Apr 19 22:05:29 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Mon Apr 19 22:22:27 2021
@@ -1,21 +1,21 @@
-make: Bad conditional expression `variable expression == "literal"' in variable expression == "literal"?bad:bad
+make: Bad conditional expression 'variable expression == "literal"' in 'variable expression == "literal"?bad:bad'
 make: "varmod-ifelse.mk" line 27: Malformed conditional (${${:Uvariable expression} == "literal":?bad:bad})
-make: Bad conditional expression ` == ""' in  == ""?bad-assign:bad-assign
-make: Bad conditional expression ` == ""' in  == ""?bad-cond:bad-cond
+make: Bad conditional expression ' == ""' in ' == ""?bad-assign:bad-assign'
+make: Bad conditional expression ' == ""' in ' == ""?bad-cond:bad-cond'
 make: "varmod-ifelse.mk" line 44: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
-make: Bad conditional expression `1 == == 2' in 1 == == 2?yes:no
+make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
 make: "varmod-ifelse.mk" line 66: Malformed conditional (${1 == == 2:?yes:no} != "")
 CondParser_Eval: "${1 == == 2:?yes:no}" != ""
 CondParser_Eval: 1 == == 2
 lhs = 1.00, rhs = 0.00, op = ==
-make: Bad conditional expression `1 == == 2' in 1 == == 2?yes:no
+make: Bad conditional expression '1 == == 2' in '1 == == 2?yes:no'
 lhs = "", rhs = "", op = !=
 m

CVS commit: src/usr.bin/make/unit-tests

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 22:05:29 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk

Log Message:
tests/make: demonstrate unexpected behavior of the modifier ':?'


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmod-ifelse.mk

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/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.5 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.6
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.5	Thu Dec 10 16:36:47 2020
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Mon Apr 19 22:05:29 2021
@@ -15,6 +15,8 @@ CondParser_Eval: ${ ${:U\$}{VAR} == valu
 CondParser_Eval: ${VAR} == value 
 lhs = "value", rhs = "value", op = ==
 lhs = "ok", rhs = "ok", op = !=
+make: Bad conditional expression `string == "literal" && no >= 10' in string == "literal" && no >= 10?yes:no
+make: "varmod-ifelse.mk" line 127: .
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.11 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.12
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.11	Sun Apr 11 13:35:56 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Mon Apr 19 22:05:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.11 2021/04/11 13:35:56 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.12 2021/04/19 22:05:29 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
@@ -111,5 +111,18 @@ VAR=	value
 .endif
 .MAKEFLAGS: -d0
 
-all:
-	@:;
+# Seen on 2021-04-19 when building external/bsd/tmux with HAVE_LLVM=yes
+# and HAVE_GCC=no.
+#
+# TODO: make should at least describe the part of the condition that is
+#  wrong. In this case it is probably the "no >= 10".  Ideally that should
+#  not matter though since the left-hand side of the '&&' evaluates to false,
+#  thus the right-hand side only needs to be parsed, not evaluated.  Since
+#  this is the modifier ':?', which expands subexpressions before parsing
+#  the condition, the "no >= 10" is probably a parse error since it "can be
+#  seen at compile-time" that the operand types of '>=' don't match.  Only
+#  that the concept of "compile-time" does not really apply here.
+STRING=		string
+NUMBER=		no
+.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
+# XXX: In the diagnostic, the second placeholder is missing the quotes.



CVS commit: src/external/bsd/tmux/dist

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 21:52:17 UTC 2021

Modified Files:
src/external/bsd/tmux/dist: control.c status.c

Log Message:
tmux: fix -Wformat-nonliteral for Clang

dist/control.c:394:17: error: format string is not a string literal
[-Werror,-Wformat-nonliteral]
xvasprintf(&s, fmt, ap);
   ^~~

dist/status.c:436:33: error: format string is not a string literal
[-Werror,-Wformat-nonliteral]
xvasprintf(&c->message_string, fmt, ap);
   ^~~


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/tmux/dist/control.c
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/tmux/dist/status.c

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

Modified files:

Index: src/external/bsd/tmux/dist/control.c
diff -u src/external/bsd/tmux/dist/control.c:1.2 src/external/bsd/tmux/dist/control.c:1.3
--- src/external/bsd/tmux/dist/control.c:1.2	Sat Apr 17 20:42:09 2021
+++ src/external/bsd/tmux/dist/control.c	Mon Apr 19 21:52:17 2021
@@ -385,7 +385,7 @@ control_pause_pane(struct client *c, str
 }
 
 /* Write a line. */
-static void
+static void __printflike(2, 0)
 control_vwrite(struct client *c, const char *fmt, va_list ap)
 {
 	struct control_state	*cs = c->control_state;

Index: src/external/bsd/tmux/dist/status.c
diff -u src/external/bsd/tmux/dist/status.c:1.11 src/external/bsd/tmux/dist/status.c:1.12
--- src/external/bsd/tmux/dist/status.c:1.11	Sat Apr 17 20:42:09 2021
+++ src/external/bsd/tmux/dist/status.c	Mon Apr 19 21:52:17 2021
@@ -422,7 +422,7 @@ status_redraw(struct client *c)
 }
 
 /* Set a status line message. */
-void
+void __printflike(5, 0)
 status_message_set(struct client *c, int delay, int ignore_styles,
 int ignore_keys, const char *fmt, ...)
 {



CVS commit: src/usr.bin/mail

2021-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 19 17:49:28 UTC 2021

Modified Files:
src/usr.bin/mail: format.c

Log Message:
Fix weekday parsing; only reset the string when parsing fail and only set
the weekday when parsing succeeds (Steffen Nurpmeso)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/format.c

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

Modified files:

Index: src/usr.bin/mail/format.c
diff -u src/usr.bin/mail/format.c:1.15 src/usr.bin/mail/format.c:1.16
--- src/usr.bin/mail/format.c:1.15	Sat Apr 11 10:22:32 2009
+++ src/usr.bin/mail/format.c	Mon Apr 19 13:49:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: format.c,v 1.15 2009/04/11 14:22:32 christos Exp $	*/
+/*	$NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef __lint__
-__RCSID("$NetBSD: format.c,v 1.15 2009/04/11 14:22:32 christos Exp $");
+__RCSID("$NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $");
 #endif /* not __lint__ */
 
 #include 
@@ -579,10 +579,10 @@ date_to_tm(char *date, struct tm *tm)
 	 */
 
 	/* Check for an optional 'day-of-week' */
-	if ((tail = strptime(date, " %a,", &tmp_tm)) == NULL) {
+	if ((tail = strptime(date, " %a,", &tmp_tm)) == NULL)
 		tail = date;
+	else
 		tm->tm_wday = tmp_tm.tm_wday;
-	}
 
 	/* Get the required 'day' and 'month' */
 	if ((tail = strptime(tail, " %d %b", &tmp_tm)) == NULL)



CVS commit: src/usr.bin/make

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 16:35:11 UTC 2021

Modified Files:
src/usr.bin/make: main.c

Log Message:
make: avoid double slash in name of temporary directory

If the environment variable TMPDIR is not set, make uses a default path
that includes a trailing '/'.

For extra correctness it always appended an extra '/', leading to paths
of the form '/tmp//makeXX'.  This looked suspicious, as if there had
been a forgotten empty part between the two '/'.  Avoid this ambiguity
by replacing '//' with '/'.


To generate a diff of this commit:
cvs rdiff -u -r1.538 -r1.539 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.538 src/usr.bin/make/main.c:1.539
--- src/usr.bin/make/main.c:1.538	Wed Apr 14 17:24:48 2021
+++ src/usr.bin/make/main.c	Mon Apr 19 16:35:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.538 2021/04/14 17:24:48 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.539 2021/04/19 16:35:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.538 2021/04/14 17:24:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.539 2021/04/19 16:35:11 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -2198,7 +2198,7 @@ getTmpdir(void)
 		return tmpdir;
 
 	/* Honor $TMPDIR but only if it is valid. Ensure it ends with '/'. */
-	(void)Var_Subst("${TMPDIR:tA:U" _PATH_TMP "}/",
+	(void)Var_Subst("${TMPDIR:tA:U" _PATH_TMP ":S,/$,,W}/",
 	SCOPE_GLOBAL, VARE_WANTRES, &tmpdir);
 	/* TODO: handle errors */
 



CVS commit: src/doc

2021-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 19 14:42:18 UTC 2021

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new OpenSSH


To generate a diff of this commit:
cvs rdiff -u -r1.1798 -r1.1799 src/doc/3RDPARTY
cvs rdiff -u -r1.2797 -r1.2798 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1798 src/doc/3RDPARTY:1.1799
--- src/doc/3RDPARTY:1.1798	Mon Apr 19 02:29:13 2021
+++ src/doc/3RDPARTY	Mon Apr 19 10:42:18 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1798 2021/04/19 06:29:13 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1799 2021/04/19 14:42:18 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1070,7 +1070,7 @@ Notes:
 Patch applied after OpenSSH import.
 
 Package:	OpenSSH
-Version:	8.5
+Version:	8.6
 Current Vers:	8.6 / portable 8.6p1
 Maintainer:	OpenSSH
 Archive Site:	http://www.openssh.com/ftp.html

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2797 src/doc/CHANGES:1.2798
--- src/doc/CHANGES:1.2797	Sat Apr 17 16:42:57 2021
+++ src/doc/CHANGES	Mon Apr 19 10:42:18 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2797 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2798 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -361,3 +361,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	sparc64: Switch to GCC 10.  [mrg 20200416]
 	vax: Switch to GCC 10.  [mrg 20200416]
 	tmux(1): Imported 3.2. [christos 20210417]
+	OpenSSH: Import 8.6. [christos 20210419]



CVS commit: src/distrib/sets/lists

2021-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 19 14:41:18 UTC 2021

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi

Log Message:
bump libssh


To generate a diff of this commit:
cvs rdiff -u -r1.917 -r1.918 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.274 -r1.275 src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.917 src/distrib/sets/lists/base/shl.mi:1.918
--- src/distrib/sets/lists/base/shl.mi:1.917	Sun Apr 11 22:08:59 2021
+++ src/distrib/sets/lists/base/shl.mi	Mon Apr 19 10:41:18 2021
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.917 2021/04/12 02:08:59 mrg Exp $
+# $NetBSD: shl.mi,v 1.918 2021/04/19 14:41:18 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -876,8 +876,8 @@
 ./usr/lib/libsqlite3.so.1.4			base-sys-shlib		compatfile
 ./usr/lib/libss.sobase-obsolete		obsolete
 ./usr/lib/libssh.sobase-secsh-shlib	compatfile
-./usr/lib/libssh.so.39base-secsh-shlib	compatfile
-./usr/lib/libssh.so.39.0			base-secsh-shlib	compatfile
+./usr/lib/libssh.so.40base-secsh-shlib	compatfile
+./usr/lib/libssh.so.40.0			base-secsh-shlib	compatfile
 ./usr/lib/libssl.sobase-crypto-shlib	compatfile
 ./usr/lib/libssl.so.12base-crypto-shlib	compatfile,openssl=10
 ./usr/lib/libssl.so.12.0			base-crypto-shlib	compatfile,openssl=10

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.274 src/distrib/sets/lists/debug/shl.mi:1.275
--- src/distrib/sets/lists/debug/shl.mi:1.274	Sun Apr 11 22:09:00 2021
+++ src/distrib/sets/lists/debug/shl.mi	Mon Apr 19 10:41:18 2021
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.274 2021/04/12 02:09:00 mrg Exp $
+# $NetBSD: shl.mi,v 1.275 2021/04/19 14:41:18 christos Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
@@ -305,7 +305,7 @@
 ./usr/libdata/debug/usr/lib/libskey.so.2.0.debug		comp-sys-debug	debug,compatfile,skey
 ./usr/libdata/debug/usr/lib/libsl.so.6.0.debug			comp-krb5-debug	debug,compatfile,kerberos
 ./usr/libdata/debug/usr/lib/libsqlite3.so.1.4.debug		comp-sys-debug	debug,compatfile
-./usr/libdata/debug/usr/lib/libssh.so.39.0.debug		comp-secsh-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libssh.so.40.0.debug		comp-secsh-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libssl.so.12.0.debug		comp-crypto-debug	debug,compatfile,openssl=10
 ./usr/libdata/debug/usr/lib/libssl.so.14.0.debug		comp-crypto-debug	debug,compatfile,openssl=11
 ./usr/libdata/debug/usr/lib/libstdc++.so.9.0.debug		comp-sys-debug	debug,compatfile,gcc=9,cxx,libstdcxx



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

2021-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 19 14:40:16 UTC 2021

Modified Files:
src/crypto/external/bsd/openssh/dist: addrmatch.c auth-krb5.c
auth-options.c auth.c auth2-pubkey.c auth2.c chacha.h channels.c
channels.h cipher.c clientloop.c dh.c dh.h hostfile.c kex.c
kexgen.c log.c log.h misc.c misc.h monitor.c monitor_wrap.c
monitor_wrap.h mux.c packet.c readconf.c scp.c servconf.c
servconf.h serverloop.c session.c sftp-client.c sftp-client.h
sftp-server.c sftp.c srclimit.c ssh-add.c ssh-agent.c ssh-keygen.c
ssh-sk-client.c ssh.c ssh_api.c ssh_config.5 sshconnect.c
sshconnect2.c sshd.8 sshd.c sshd_config.5 sshkey-xmss.c
sshkey-xmss.h sshkey.c umac.c utf8.h version.h xmalloc.h
src/crypto/external/bsd/openssh/dist/moduli-gen: moduli.2048
moduli.3072 moduli.4096 moduli.6144 moduli.7680 moduli.8192
src/crypto/external/bsd/openssh/lib: shlib_version

Log Message:
Merge local changes between 8.5 and 8.6


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/crypto/external/bsd/openssh/dist/addrmatch.c
cvs rdiff -u -r1.15 -r1.16 src/crypto/external/bsd/openssh/dist/auth-krb5.c
cvs rdiff -u -r1.25 -r1.26 \
src/crypto/external/bsd/openssh/dist/auth-options.c \
src/crypto/external/bsd/openssh/dist/misc.c \
src/crypto/external/bsd/openssh/dist/sshkey.c
cvs rdiff -u -r1.29 -r1.30 src/crypto/external/bsd/openssh/dist/auth.c \
src/crypto/external/bsd/openssh/dist/channels.c \
src/crypto/external/bsd/openssh/dist/kex.c \
src/crypto/external/bsd/openssh/dist/monitor_wrap.c \
src/crypto/external/bsd/openssh/dist/serverloop.c \
src/crypto/external/bsd/openssh/dist/ssh_config.5 \
src/crypto/external/bsd/openssh/dist/sshconnect.c
cvs rdiff -u -r1.27 -r1.28 \
src/crypto/external/bsd/openssh/dist/auth2-pubkey.c
cvs rdiff -u -r1.23 -r1.24 src/crypto/external/bsd/openssh/dist/auth2.c \
src/crypto/external/bsd/openssh/dist/sftp-server.c \
src/crypto/external/bsd/openssh/dist/sshd.8
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/openssh/dist/chacha.h \
src/crypto/external/bsd/openssh/dist/srclimit.c
cvs rdiff -u -r1.18 -r1.19 src/crypto/external/bsd/openssh/dist/channels.h
cvs rdiff -u -r1.19 -r1.20 src/crypto/external/bsd/openssh/dist/cipher.c \
src/crypto/external/bsd/openssh/dist/dh.c \
src/crypto/external/bsd/openssh/dist/hostfile.c \
src/crypto/external/bsd/openssh/dist/umac.c
cvs rdiff -u -r1.31 -r1.32 src/crypto/external/bsd/openssh/dist/clientloop.c \
src/crypto/external/bsd/openssh/dist/sftp.c \
src/crypto/external/bsd/openssh/dist/ssh-agent.c
cvs rdiff -u -r1.12 -r1.13 src/crypto/external/bsd/openssh/dist/dh.h \
src/crypto/external/bsd/openssh/dist/sftp-client.h \
src/crypto/external/bsd/openssh/dist/ssh_api.c
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/openssh/dist/kexgen.c
cvs rdiff -u -r1.22 -r1.23 src/crypto/external/bsd/openssh/dist/log.c
cvs rdiff -u -r1.16 -r1.17 src/crypto/external/bsd/openssh/dist/log.h
cvs rdiff -u -r1.20 -r1.21 src/crypto/external/bsd/openssh/dist/misc.h
cvs rdiff -u -r1.36 -r1.37 src/crypto/external/bsd/openssh/dist/monitor.c
cvs rdiff -u -r1.21 -r1.22 \
src/crypto/external/bsd/openssh/dist/monitor_wrap.h
cvs rdiff -u -r1.28 -r1.29 src/crypto/external/bsd/openssh/dist/mux.c
cvs rdiff -u -r1.43 -r1.44 src/crypto/external/bsd/openssh/dist/packet.c
cvs rdiff -u -r1.33 -r1.34 src/crypto/external/bsd/openssh/dist/readconf.c \
src/crypto/external/bsd/openssh/dist/session.c \
src/crypto/external/bsd/openssh/dist/sshd_config.5
cvs rdiff -u -r1.30 -r1.31 src/crypto/external/bsd/openssh/dist/scp.c
cvs rdiff -u -r1.35 -r1.36 src/crypto/external/bsd/openssh/dist/servconf.c \
src/crypto/external/bsd/openssh/dist/ssh.c \
src/crypto/external/bsd/openssh/dist/version.h
cvs rdiff -u -r1.24 -r1.25 src/crypto/external/bsd/openssh/dist/servconf.h \
src/crypto/external/bsd/openssh/dist/ssh-add.c
cvs rdiff -u -r1.26 -r1.27 src/crypto/external/bsd/openssh/dist/sftp-client.c
cvs rdiff -u -r1.38 -r1.39 src/crypto/external/bsd/openssh/dist/ssh-keygen.c
cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/openssh/dist/ssh-sk-client.c \
src/crypto/external/bsd/openssh/dist/utf8.h
cvs rdiff -u -r1.39 -r1.40 src/crypto/external/bsd/openssh/dist/sshconnect2.c
cvs rdiff -u -r1.41 -r1.42 src/crypto/external/bsd/openssh/dist/sshd.c
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/openssh/dist/sshkey-xmss.c
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/openssh/dist/sshkey-xmss.h
cvs rdiff -u -r1.13 -r1.14 src/crypto/external/bsd/openssh/dist/xmalloc.h
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/external/bsd/openssh/dist/moduli-gen/moduli.2048
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssh/dist/moduli-gen/moduli.3072 \
src/crypto/external/bsd/openssh/dist/moduli-gen/moduli.4096 \
src/crypto/external/bsd/openssh/

CVS import: src/crypto/external/bsd/openssh/dist

2021-04-19 Thread Christos Zoulas
he same file as used for GNOME2. Use the GNOME3
   gdk_seat_grab() to manage keyboard/mouse/server grabs for better
   compatibility with Wayland.

 * Fix portability build errors bz3293 bz3292 bz3291 bz3278

 * sshd(8): soft-disallow the fstatat64 syscall in the Linux
   seccomp-bpf sandbox. bz3276

 * unit tests: enable autoopt and misc unit tests that were
   previously skipped

Status:

Vendor Tag: OPENSSH
Release Tags:   v86-20210419

U src/crypto/external/bsd/openssh/dist/LICENCE
U src/crypto/external/bsd/openssh/dist/OVERVIEW
U src/crypto/external/bsd/openssh/dist/PROTOCOL
U src/crypto/external/bsd/openssh/dist/PROTOCOL.agent
U src/crypto/external/bsd/openssh/dist/PROTOCOL.certkeys
U src/crypto/external/bsd/openssh/dist/PROTOCOL.chacha20poly1305
U src/crypto/external/bsd/openssh/dist/PROTOCOL.key
U src/crypto/external/bsd/openssh/dist/PROTOCOL.krl
U src/crypto/external/bsd/openssh/dist/PROTOCOL.mux
U src/crypto/external/bsd/openssh/dist/PROTOCOL.sshsig
U src/crypto/external/bsd/openssh/dist/PROTOCOL.u2f
U src/crypto/external/bsd/openssh/dist/README
U src/crypto/external/bsd/openssh/dist/addr.c
U src/crypto/external/bsd/openssh/dist/addr.h
C src/crypto/external/bsd/openssh/dist/addrmatch.c
U src/crypto/external/bsd/openssh/dist/atomicio.c
U src/crypto/external/bsd/openssh/dist/atomicio.h
U src/crypto/external/bsd/openssh/dist/auth-bsdauth.c
C src/crypto/external/bsd/openssh/dist/auth-krb5.c
C src/crypto/external/bsd/openssh/dist/auth-options.c
U src/crypto/external/bsd/openssh/dist/auth-options.h
U src/crypto/external/bsd/openssh/dist/auth-passwd.c
U src/crypto/external/bsd/openssh/dist/auth-rhosts.c
C src/crypto/external/bsd/openssh/dist/auth.c
U src/crypto/external/bsd/openssh/dist/auth.h
U src/crypto/external/bsd/openssh/dist/auth2-chall.c
U src/crypto/external/bsd/openssh/dist/auth2-gss.c
U src/crypto/external/bsd/openssh/dist/auth2-hostbased.c
U src/crypto/external/bsd/openssh/dist/auth2-kbdint.c
U src/crypto/external/bsd/openssh/dist/auth2-none.c
U src/crypto/external/bsd/openssh/dist/auth2-passwd.c
C src/crypto/external/bsd/openssh/dist/auth2-pubkey.c
C src/crypto/external/bsd/openssh/dist/auth2.c
U src/crypto/external/bsd/openssh/dist/authfd.c
U src/crypto/external/bsd/openssh/dist/authfd.h
U src/crypto/external/bsd/openssh/dist/authfile.c
U src/crypto/external/bsd/openssh/dist/authfile.h
U src/crypto/external/bsd/openssh/dist/bitmap.c
U src/crypto/external/bsd/openssh/dist/bitmap.h
U src/crypto/external/bsd/openssh/dist/canohost.c
U src/crypto/external/bsd/openssh/dist/canohost.h
U src/crypto/external/bsd/openssh/dist/chacha.c
C src/crypto/external/bsd/openssh/dist/chacha.h
C src/crypto/external/bsd/openssh/dist/channels.c
C src/crypto/external/bsd/openssh/dist/channels.h
U src/crypto/external/bsd/openssh/dist/cipher-aesctr.c
U src/crypto/external/bsd/openssh/dist/cipher-aesctr.h
U src/crypto/external/bsd/openssh/dist/cipher-chachapoly-libcrypto.c
U src/crypto/external/bsd/openssh/dist/cipher-chachapoly.c
U src/crypto/external/bsd/openssh/dist/cipher-chachapoly.h
C src/crypto/external/bsd/openssh/dist/cipher.c
U src/crypto/external/bsd/openssh/dist/cipher.h
U src/crypto/external/bsd/openssh/dist/cleanup.c
C src/crypto/external/bsd/openssh/dist/clientloop.c
U src/crypto/external/bsd/openssh/dist/clientloop.h
U src/crypto/external/bsd/openssh/dist/compat.c
U src/crypto/external/bsd/openssh/dist/compat.h
U src/crypto/external/bsd/openssh/dist/crypto_api.h
C src/crypto/external/bsd/openssh/dist/dh.c
C src/crypto/external/bsd/openssh/dist/dh.h
U src/crypto/external/bsd/openssh/dist/digest-libc.c
U src/crypto/external/bsd/openssh/dist/digest-openssl.c
U src/crypto/external/bsd/openssh/dist/digest.h
U src/crypto/external/bsd/openssh/dist/dispatch.c
U src/crypto/external/bsd/openssh/dist/dispatch.h
U src/crypto/external/bsd/openssh/dist/dns.c
U src/crypto/external/bsd/openssh/dist/dns.h
U src/crypto/external/bsd/openssh/dist/ed25519.c
U src/crypto/external/bsd/openssh/dist/fatal.c
U src/crypto/external/bsd/openssh/dist/fe25519.c
U src/crypto/external/bsd/openssh/dist/fe25519.h
U src/crypto/external/bsd/openssh/dist/ge25519.c
U src/crypto/external/bsd/openssh/dist/ge25519.h
U src/crypto/external/bsd/openssh/dist/ge25519_base.data
U src/crypto/external/bsd/openssh/dist/groupaccess.c
U src/crypto/external/bsd/openssh/dist/groupaccess.h
U src/crypto/external/bsd/openssh/dist/gss-genr.c
U src/crypto/external/bsd/openssh/dist/gss-serv-krb5.c
U src/crypto/external/bsd/openssh/dist/gss-serv.c
U src/crypto/external/bsd/openssh/dist/hash.c
U src/crypto/external/bsd/openssh/dist/hmac.c
U src/crypto/external/bsd/openssh/dist/hmac.h
C src/crypto/external/bsd/openssh/dist/hostfile.c
U src/crypto/external/bsd/openssh/dist/hostfile.h
C src/crypto/external/bsd/openssh/dist/kex.c
U src/crypto/external/bsd/openssh/dist/kex.h
U src/crypto/external/bsd/openssh/dist/kexc25519.c
U src/crypto/external/bsd/openssh/dist/kexdh.c
U src/crypto/external/bsd/openssh/dist/kexecdh.c
C src/crypto/external/bsd/

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

2021-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 19 14:07:36 UTC 2021

Modified Files:
src/crypto/external/bsd/openssh: openssh2netbsd

Log Message:
Force user to specify source dir. Too dangerous to run in random places.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/openssh/openssh2netbsd

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/openssh/openssh2netbsd
diff -u src/crypto/external/bsd/openssh/openssh2netbsd:1.3 src/crypto/external/bsd/openssh/openssh2netbsd:1.4
--- src/crypto/external/bsd/openssh/openssh2netbsd:1.3	Fri Dec  4 13:42:49 2020
+++ src/crypto/external/bsd/openssh/openssh2netbsd	Mon Apr 19 10:07:36 2021
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: openssh2netbsd,v 1.3 2020/12/04 18:42:49 christos Exp $
+#	$NetBSD: openssh2netbsd,v 1.4 2021/04/19 14:07:36 christos Exp $
 #
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,6 +28,14 @@
 #
 # openssh2netbsd:  convert a openssh source tree into netbsd openssh tree
 
+if [ -z "$1" ]; then
+	echo "Usage: $0 " 1>&2
+	exit 1
+fi
+
+set -e
+cd "$1"
+
 ### Remove CVS
 find . -name CVS -print | xargs rm -r
 



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

2021-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr 19 13:18:43 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: func.c

Log Message:
lint: add debug logging for reachability


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/usr.bin/xlint/lint1/func.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.105 src/usr.bin/xlint/lint1/func.c:1.106
--- src/usr.bin/xlint/lint1/func.c:1.105	Sun Apr 18 17:36:18 2021
+++ src/usr.bin/xlint/lint1/func.c	Mon Apr 19 13:18:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.105 2021/04/18 17:36:18 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.106 2021/04/19 13:18:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.105 2021/04/18 17:36:18 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.106 2021/04/19 13:18:43 rillig Exp $");
 #endif
 
 #include 
@@ -190,6 +190,11 @@ end_control_statement(control_statement_
 static void
 set_reached(bool new_reached)
 {
+#ifdef DEBUG
+	printf("%s:%d: %s -> %s\n", curr_pos.p_file, curr_pos.p_line,
+	reached ? "reachable" : "unreachable",
+	new_reached ? "reachable" : "unreachable");
+#endif
 	reached = new_reached;
 	warn_about_unreachable = true;
 }



CVS commit: src/external/gpl3/gcc

2021-04-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 19 08:40:15 UTC 2021

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

Log Message:
hppa switched.  sh3el seems ready.  m68k atf wasn't fail..


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc/README.gcc10

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

Modified files:

Index: src/external/gpl3/gcc/README.gcc10
diff -u src/external/gpl3/gcc/README.gcc10:1.13 src/external/gpl3/gcc/README.gcc10:1.14
--- src/external/gpl3/gcc/README.gcc10:1.13	Sat Apr 17 22:03:57 2021
+++ src/external/gpl3/gcc/README.gcc10	Mon Apr 19 08:40:15 2021
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc10,v 1.13 2021/04/17 22:03:57 mrg Exp $
+$NetBSD: README.gcc10,v 1.14 2021/04/19 08:40:15 mrg Exp $
 
 
 new stuff:
@@ -49,11 +49,11 @@ earmv7		y	b	y	y		y		?	?	?
 earmv7eb	y	b	y	y		y		?	?	?
 earmv7hf	y	y	y	y		y		y	y	n
 earmv7hfeb	y	b	y	y		y		?	?	?
-hppa		y	y	y	y		y		y	?	?
+hppa		y	y	y	y		y		y	y	y
 i386		y	y	y	y		y		y	n[8]	?
 ia64		y	y	y	y		y		?	N/A	y
 m68000		y	b	y	y		n[1]		?	?	?
-m68k		y	y	y	y		y[9]		y	n	n
+m68k		y	y	y	y		y[9]		y	?	n
 mipseb		y	y	y	y		y		y	?	?
 mipsel		y	y	y	y		y		y	?	?
 mips64eb	y	y	y	y		y		y	?	?
@@ -61,7 +61,7 @@ mips64el	y	b	y	y		y		y	?	?
 powerpc		y	b	y	y		y		y	?	n
 powerpc64	y	b	y	y		y		N/A	N/A	n
 sh3eb		y	b	y	y		y		?	?	?
-sh3el		y	y	y	y		y		y	y[7]	?
+sh3el		y	y	y	y		y		y	y[7]	n
 sparc		y	y	y	y		y		y	y	y
 sparc64		y	y	y	y		y		y	y	y
 vax		y	y	y	y		y		y	n[6]	y



CVS commit: src/sys/arch/riscv

2021-04-19 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Apr 19 07:55:59 UTC 2021

Modified Files:
src/sys/arch/riscv/include: insn.h
src/sys/arch/riscv/riscv: db_disasm.c

Log Message:
Make the riscv disassembler work, as best as I can test from amd64 userspace.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/include/insn.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/riscv/db_disasm.c

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

Modified files:

Index: src/sys/arch/riscv/include/insn.h
diff -u src/sys/arch/riscv/include/insn.h:1.3 src/sys/arch/riscv/include/insn.h:1.4
--- src/sys/arch/riscv/include/insn.h:1.3	Wed Apr 14 06:32:20 2021
+++ src/sys/arch/riscv/include/insn.h	Mon Apr 19 07:55:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: insn.h,v 1.3 2021/04/14 06:32:20 dholland Exp $ */
+/* $NetBSD: insn.h,v 1.4 2021/04/19 07:55:59 dholland Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -241,16 +241,16 @@ union riscv_insn {
  * Quadrant 1 goes FUNCT3 -> FUNCT2a -> FUNCT3b,
  * Quadrant 2 goes FUNCT3 -> FUNCT1b.
  */
-#define INSN16_FUNCT3(insn)	(((insn) && 0xe000) >> 13)
-#define INSN16_FUNCT2a(insn)	(((insn) && 0x0c00) >> 10)
-#define INSN16_FUNCT1b(insn)	(((insn) && 0x1000) >> 12)
-#define INSN16_FUNCT2b(insn)	(((insn) && 0x0060) >> 5)
+#define INSN16_FUNCT3(insn)	(((insn) & 0xe000) >> 13)
+#define INSN16_FUNCT2a(insn)	(((insn) & 0x0c00) >> 10)
+#define INSN16_FUNCT1b(insn)	(((insn) & 0x1000) >> 12)
+#define INSN16_FUNCT2b(insn)	(((insn) & 0x0060) >> 5)
 #define INSN16_FUNCT3c(insn)	\
 	((INSN16_FUNCT1b(insn) << 2) | INSN16_FUNCT2b(insn))
 
 /* full-size register fields */
 #define INSN16_RS1(insn)	(((insn) & 0x0f80) >> 7)  /* bits 7-11 */
-#define INSN16_RS2(insn)	(((insn) & 0x007c) >> 7)  /* bits 2-6 */
+#define INSN16_RS2(insn)	(((insn) & 0x007c) >> 2)  /* bits 2-6 */
 
 /* small register fields, for registers 8-15 */
 #define INSN16_RS1x(insn)	insn) & 0x0380) >> 7) + 8)	/* bits 7-9 */
@@ -422,6 +422,12 @@ union riscv_insn {
 #define OPFP_D			0b01
 #define OPFP_Q			0b11
 
+// in some instructions they're an integer operand size instead
+#define OPFP_W			0b00
+#define OPFP_WU			0b01
+#define OPFP_L			0b10
+#define OPFP_LU			0b11
+
 // primary is AMO (0b01011, 11), top 5 bits
 // (bottom two bits are ACQUIRE and RELEASE flags respectively)
 // funct3 gives the operand size
@@ -644,7 +650,7 @@ union riscv_insn {
 
 #define OPCODE16_Q0	0b00	/* quadrant 0 */
 #define OPCODE16_Q1	0b01	/* quadrant 1 */
-#define OPCODE16_Q2	0b11	/* quadrant 2 */
+#define OPCODE16_Q2	0b10	/* quadrant 2 */
 
 /* quadrant 0 */
 #define Q0_ADDI4SPN	0b000

Index: src/sys/arch/riscv/riscv/db_disasm.c
diff -u src/sys/arch/riscv/riscv/db_disasm.c:1.3 src/sys/arch/riscv/riscv/db_disasm.c:1.4
--- src/sys/arch/riscv/riscv/db_disasm.c:1.3	Wed Apr 14 06:32:20 2021
+++ src/sys/arch/riscv/riscv/db_disasm.c	Mon Apr 19 07:55:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.3 2021/04/14 06:32:20 dholland Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.4 2021/04/19 07:55:59 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__RCSID("$NetBSD: db_disasm.c,v 1.3 2021/04/14 06:32:20 dholland Exp $");
+__RCSID("$NetBSD: db_disasm.c,v 1.4 2021/04/19 07:55:59 dholland Exp $");
 
 #include 
 #include 
@@ -65,6 +65,11 @@ db_print_addr(db_addr_t loc)
 	db_sym_t sym;
 	const char *symname;
 
+/* hack for testing since the test program is ASLR'd */
+#ifndef _KERNEL
+	loc &= 0xfff;
+#endif
+
 	diff = INT_MAX;
 	symname = NULL;
 	sym = db_search_symbol(loc, DB_STGY_ANY, &diff);
@@ -101,6 +106,30 @@ db_print_addr(db_addr_t loc)
 #define IN_Q1(op) COMBINE(op, OPCODE16_Q1)
 #define IN_Q2(op) COMBINE(op, OPCODE16_Q2)
 
+/*
+ * All the 16-bit immediate bit-wrangling is done in uint32_t, which
+ * is sufficient, but on RV64 the resulting values should be printed
+ * as 64-bit. Continuing the assumption that we're disassembling for
+ * the size we're built on, do nothing for RV32 and sign-extend from
+ * 32 to 64 for RV64. (And bail on RV128 since it's not clear what
+ * the C type sizes are going to be there anyway...)
+ */
+static
+unsigned long
+maybe_signext64(uint32_t x)
+{
+#if __riscv_xlen == 32
+	return x;
+#elif __riscv_xlen == 64
+	uint64_t xx;
+
+	xx = ((x & 0x8000) ? 0x : 0) | x;
+	return xx;
+#else
+#error Oops.
+#endif
+}
+
 static
 int
 db_disasm_16(db_addr_t loc, uint32_t insn, bool altfmt)
@@ -110,10 +139,15 @@ db_disasm_16(db_addr_t loc, uint32_t ins
 	uint32_t imm;
 	unsigned rd, rs1, rs2;
 
+	//warnx("toot 0x%x", insn);
 	switch (COMBINE(INSN16_FUNCT3(insn), INSN16_QUADRANT(insn))) {
 	case IN_Q0(Q0_ADDI4SPN):
 		rd = INSN16_RS2x(insn);
 		imm = INSN16_IMM_CIW(insn);
+		if (imm == 0) {
+			/* reserved (all bits 0 -> invalid) */
+			return EINVAL;
+		}
 		db_printf("c.addi4spn %s, 0x%x\n", riscv_registers[rd], imm);
 		break;
 	c