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

2019-02-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 15 05:06:38 UTC 2019

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Add new ATF tests traceme_signal{ignored,masked}_crash* in t_ptrace_wait*

New tests verify that crashes (from trap signals) are delivered to tracer
regardless of the signal masking or signal ignoring option enabled in the
traced child.

All tests pass.

In close future these tests will obtain additional asserts.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.87 src/tests/lib/libc/sys/t_ptrace_wait.c:1.88
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.87	Fri Feb 15 04:11:39 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Fri Feb 15 05:06:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.87 2019/02/15 04:11:39 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.88 2019/02/15 05:06:38 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.87 2019/02/15 04:11:39 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.88 2019/02/15 05:06:38 kamil Exp $");
 
 #include 
 #include 
@@ -511,6 +511,252 @@ TRACEME_CRASH(traceme_crash_bus, SIGBUS)
 /// 
 
 static void
+traceme_signalmasked_crash(int sig)
+{
+	pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+	struct ptrace_siginfo info;
+	sigset_t intmask;
+
+#ifndef PTRACE_ILLEGAL_ASM
+	if (sig == SIGILL)
+		atf_tc_skip("PTRACE_ILLEGAL_ASM not defined");
+#endif
+
+	memset(, 0, sizeof(info));
+
+	DPRINTF("Before forking process PID=%d\n", getpid());
+	SYSCALL_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		sigemptyset();
+		sigaddset(, sig);
+		sigprocmask(SIG_BLOCK, , NULL);
+
+		DPRINTF("Before executing a trap\n");
+		switch (sig) {
+		case SIGTRAP:
+			trigger_trap();
+			break;
+		case SIGSEGV:
+			trigger_segv();
+			break;
+		case SIGILL:
+			trigger_ill();
+			break;
+		case SIGFPE:
+			trigger_fpe();
+			break;
+		case SIGBUS:
+			trigger_bus();
+			break;
+		default:
+			/* NOTREACHED */
+			FORKEE_ASSERTX(0 && "This shall not be reached");
+		}
+
+		/* NOTREACHED */
+		FORKEE_ASSERTX(0 && "This shall not be reached");
+	}
+	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sig);
+
+	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child");
+	SYSCALL_REQUIRE(
+	ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
+
+	DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sig);
+	switch (sig) {
+	case SIGTRAP:
+		ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_BRKPT);
+		break;
+	case SIGSEGV:
+		ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SEGV_MAPERR);
+		break;
+	case SIGILL:
+		ATF_REQUIRE_EQ(info.psi_siginfo.si_code, ILL_PRVOPC);
+		break;
+	case SIGFPE:
+		ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_INTDIV);
+		break;
+	case SIGBUS:
+		ATF_REQUIRE_EQ(info.psi_siginfo.si_code, BUS_ADRERR);
+		break;
+	}
+
+
+
+	SYSCALL_REQUIRE(ptrace(PT_KILL, child, NULL, 0) != -1);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_signaled(status, SIGKILL, 0);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
+}
+
+#define TRACEME_SIGNALMASKED_CRASH(test, sig)\
+ATF_TC(test);\
+ATF_TC_HEAD(test, tc)			\
+{	\
+	atf_tc_set_md_var(tc, "descr",	\
+	"Verify masked crash signal " #sig " in a child after "	\
+	"PT_TRACE_ME is delivered to its tracer");			\
+}	\
+	\
+ATF_TC_BODY(test, tc)			\
+{	\
+	\
+	traceme_signalmasked_crash(sig);\
+}
+
+TRACEME_SIGNALMASKED_CRASH(traceme_signalmasked_crash_trap, SIGTRAP)
+TRACEME_SIGNALMASKED_CRASH(traceme_signalmasked_crash_segv, SIGSEGV)
+TRACEME_SIGNALMASKED_CRASH(traceme_signalmasked_crash_ill, SIGILL)
+TRACEME_SIGNALMASKED_CRASH(traceme_signalmasked_crash_fpe, SIGFPE)
+TRACEME_SIGNALMASKED_CRASH(traceme_signalmasked_crash_bus, SIGBUS)
+
+/// 

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

2019-02-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 15 04:11:39 UTC 2019

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Add new ATF tests traceme_raisesignal_ignored in t_ptrace_wait*

Verify that ignoring (with SIG_IGN) in tracee
does not stop tracer from catching this raised signal.

Cover crash signals and already covered ones in other tests.

All tests pass.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.86 src/tests/lib/libc/sys/t_ptrace_wait.c:1.87
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.86	Thu Feb 14 06:47:32 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Fri Feb 15 04:11:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.86 2019/02/14 06:47:32 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.87 2019/02/15 04:11:39 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.86 2019/02/14 06:47:32 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.87 2019/02/15 04:11:39 kamil Exp $");
 
 #include 
 #include 
@@ -188,6 +188,121 @@ TRACEME_RAISE(traceme_raise10, SIGSEGV) 
 /// 
 
 static void
+traceme_raisesignal_ignored(int sigignored)
+{
+	const int exitval = 5;
+	const int sigval = SIGSTOP;
+	pid_t child, wpid;
+	struct sigaction sa;
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+	struct ptrace_siginfo info;
+
+	memset(, 0, sizeof(info));
+
+	DPRINTF("Before forking process PID=%d\n", getpid());
+	SYSCALL_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		memset(, 0, sizeof(sa));
+		sa.sa_handler = SIG_IGN;
+		sigemptyset(_mask);
+		FORKEE_ASSERT(sigaction(sigignored, , NULL) != -1);
+
+		DPRINTF("Before raising %s from child\n", strsignal(sigval));
+		FORKEE_ASSERT(raise(sigval) == 0);
+
+		DPRINTF("Before raising %s from child\n",
+		strsignal(sigignored));
+		FORKEE_ASSERT(raise(sigignored) == 0);
+
+		DPRINTF("Before exiting of the child process\n");
+		_exit(exitval);
+	}
+	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigval);
+
+	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+	SYSCALL_REQUIRE(
+	ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
+
+	DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
+
+	DPRINTF("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigignored);
+
+	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+	SYSCALL_REQUIRE(
+	ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
+
+	DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigignored);
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
+
+	DPRINTF("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_exited(status, exitval);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
+}
+
+#define TRACEME_RAISESIGNAL_IGNORED(test, sig)\
+ATF_TC(test);\
+ATF_TC_HEAD(test, tc)			\
+{	\
+	atf_tc_set_md_var(tc, "descr",	\
+	"Verify that ignoring (with SIG_IGN) " #sig " in tracee "	\
+	"does not stop tracer from catching this raised signal");	\
+}	\
+	\
+ATF_TC_BODY(test, tc)			\
+{	\
+	\
+	traceme_raisesignal_ignored(sig);\
+}
+
+// A signal handler for SIGKILL 

CVS commit: src/sys/arch/evbarm

2019-02-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 14 21:47:52 UTC 2019

Added Files:
src/sys/arch/evbarm/conf: IYONIX files.iyonix std.iyonix
src/sys/arch/evbarm/iyonix: autoconf.c com_obio.c i80321_mainbus.c
iyonix_machdep.c iyonix_pci.c iyonixreg.h iyonixvar.h obio.c
obio_space.c obiovar.h

Log Message:
move arch/iyonix into evbarm - it's got less machine specific code than most
evbarm/*...
does not quite work yet, but I don't want it to accumulate more differences
to what's in arch/iyonix


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/IYONIX \
src/sys/arch/evbarm/conf/files.iyonix src/sys/arch/evbarm/conf/std.iyonix
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/iyonix/autoconf.c \
src/sys/arch/evbarm/iyonix/com_obio.c \
src/sys/arch/evbarm/iyonix/i80321_mainbus.c \
src/sys/arch/evbarm/iyonix/iyonix_machdep.c \
src/sys/arch/evbarm/iyonix/iyonix_pci.c \
src/sys/arch/evbarm/iyonix/iyonixreg.h \
src/sys/arch/evbarm/iyonix/iyonixvar.h src/sys/arch/evbarm/iyonix/obio.c \
src/sys/arch/evbarm/iyonix/obio_space.c \
src/sys/arch/evbarm/iyonix/obiovar.h

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

Added files:

Index: src/sys/arch/evbarm/conf/IYONIX
diff -u /dev/null src/sys/arch/evbarm/conf/IYONIX:1.1
--- /dev/null	Thu Feb 14 21:47:52 2019
+++ src/sys/arch/evbarm/conf/IYONIX	Thu Feb 14 21:47:52 2019
@@ -0,0 +1,423 @@
+#	$NetBSD: IYONIX,v 1.1 2019/02/14 21:47:52 macallan Exp $
+#
+# GENERIC machine description file
+#
+# This machine description file is used to generate the default NetBSD
+# kernel.  The generic kernel does not include all options, subsystems
+# and device drivers, but should be useful for most applications.
+#
+# The machine description file can be customised for your specific
+# machine to reduce the kernel size and improve its performance.
+#
+# For further information on compiling NetBSD kernels, see the config(8)
+# man page.
+#
+# For further information on hardware support for this architecture, see
+# the intro(4) man page.  For further information about kernel options
+# for this architecture, see the options(4) man page.  For an explanation
+# of each device driver in this file see the section 4 man page for the
+# device.
+
+include	"arch/evbarm/conf/std.iyonix"
+
+options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+#ident 		"GENERIC-$Revision: 1.1 $"
+
+maxusers	32		# estimated number of users
+
+options 	MSGBUFSIZE=65536
+
+# CPU options
+
+# For XScale systems
+options 	CPU_XSCALE_80321	# Support the XScale core
+makeoptions	CPUFLAGS="-mcpu=xscale"
+
+# Architecture options
+options 	XSCALE_CACHE_READ_WRITE_ALLOCATE
+#options 	HZ=512
+makeoptions	CPUFLAGS="-mcpu=xscale"
+
+# Standard system options
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+#options 	NTP		# NTP phase/frequency locked loop
+
+#options 	KTRACE		# system call tracing via ktrace(1)
+
+
+#options 	SYSVMSG		# System V-like message queues
+#options 	SYSVSEM		# System V-like semaphores
+#options 	SYSVSHM		# System V-like memory sharing
+
+# Device options
+
+# Console options.  The default console is speed is 115200 baud.
+#options 	CONSPEED=9600		# Console speed
+
+# Miscellaneous kernel options
+options 	KTRACE		# system call tracing, a la ktrace(1)
+options 	IRQSTATS	# manage IRQ statistics
+#options 	SCSIVERBOSE	# Verbose SCSI errors
+options 	PCIVERBOSE	# Verbose PCI descriptions
+options 	MIIVERBOSE	# Verbose MII autoconfuration messages
+#options 	PCI_CONFIG_DUMP	# verbosely dump PCI config space
+
+options 	USERCONF	# userconf(4) support
+#options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
+#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+# Development and Debugging options
+
+# Alternate buffer queue strategies for better responsiveness under high
+# disk I/O load.
+#options 	BUFQ_READPRIO
+#options 	BUFQ_PRIOCSCAN
+
+# Diagnostic/debugging support options
+#options 	DIAGNOSTIC	# expensive kernel consistency checks
+#options 	DEBUG		# expensive debugging checks/support
+options 	DDB		# in-kernel debugger
+#options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
+#options 	DDB_KEYCODE=0x40
+#options 	KGDB		# remote debugger
+#options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
+#makeoptions	DEBUG="-g"	# compile full symbol table
+makeoptions	COPY_SYMTAB=1
+#options 	PMAP_DEBUG	# Enable pmap_debug_level code
+#options 	VERBOSE_INIT_ARM # verbose bootstraping messages
+
+#options 	PMAP_INCLUDE_PTE_SYNC
+#options 	LOCKDEBUG
+
+
+# Compatibility options
+
+include 	"conf/compat_netbsd70.config"
+options 	COMPAT_NETBSD32	# allow running arm (e.g. non-earm) binaries
+
+# File systems
+file-system 	FFS		# UFS
+#file-system 	EXT2FS		# second extended file system (linux)

CVS commit: src/distrib/sets/lists

2019-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 14 20:42:41 UTC 2019

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: ad.arm md.amd64 md.sparc64 shl.mi
src/distrib/sets/lists/debug: shl.mi

Log Message:
get rid of binutils=227-specific files.


To generate a diff of this commit:
cvs rdiff -u -r1.855 -r1.856 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.95 -r1.96 src/distrib/sets/lists/comp/ad.arm
cvs rdiff -u -r1.268 -r1.269 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.206 -r1.207 src/distrib/sets/lists/comp/md.sparc64
cvs rdiff -u -r1.323 -r1.324 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.215 -r1.216 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.855 src/distrib/sets/lists/base/shl.mi:1.856
--- src/distrib/sets/lists/base/shl.mi:1.855	Sat Feb  2 17:39:32 2019
+++ src/distrib/sets/lists/base/shl.mi	Thu Feb 14 15:42:40 2019
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.855 2019/02/02 22:39:32 mrg Exp $
+# $NetBSD: shl.mi,v 1.856 2019/02/14 20:42:40 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -199,8 +199,6 @@
 ./usr/lib/libavl.sobase-zfs-shlib		compatfile,zfs
 ./usr/lib/libavl.so.0base-zfs-shlib		compatfile,zfs
 ./usr/lib/libavl.so.0.0  		base-zfs-shlib		compatfile,zfs
-./usr/lib/libbfd.so.15base-sys-shlib		compatfile,binutils=227
-./usr/lib/libbfd.so.15.0			base-sys-shlib		compatfile,binutils=227
 ./usr/lib/libbfd.so.16base-sys-shlib		compatfile,binutils=231
 ./usr/lib/libbfd.so.16.0			base-sys-shlib		compatfile,binutils=231
 ./usr/lib/libbind9.sobase-bind-shlib		compatfile

Index: src/distrib/sets/lists/comp/ad.arm
diff -u src/distrib/sets/lists/comp/ad.arm:1.95 src/distrib/sets/lists/comp/ad.arm:1.96
--- src/distrib/sets/lists/comp/ad.arm:1.95	Thu Feb  7 05:45:48 2019
+++ src/distrib/sets/lists/comp/ad.arm	Thu Feb 14 15:42:40 2019
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.95 2019/02/07 10:45:48 mrg Exp $
+# $NetBSD: ad.arm,v 1.96 2019/02/14 20:42:40 christos Exp $
 ./usr/bin/elf2aoutcomp-sysutil-bin
 ./usr/include/acorn26comp-obsolete		obsolete
 ./usr/include/acorn26/ansi.h			comp-obsolete		obsolete
@@ -784,11 +784,11 @@
 ./usr/libdata/ldscripts/armelfb_nbsd_eabihf.xsw	-unknown-		binutils,eabi
 ./usr/libdata/ldscripts/armelfb_nbsd_eabihf.xu	-unknown-		binutils,eabi
 ./usr/libdata/ldscripts/armelfb_nbsd_eabihf.xw	-unknown-		binutils,eabi
-./usr/libdata/ldscripts/armnbsd.x		-unknown-		binutils=227
-./usr/libdata/ldscripts/armnbsd.xbn		-unknown-		binutils=227
-./usr/libdata/ldscripts/armnbsd.xn		-unknown-		binutils=227
-./usr/libdata/ldscripts/armnbsd.xr		-unknown-		binutils=227
-./usr/libdata/ldscripts/armnbsd.xu		-unknown-		binutils=227
+./usr/libdata/ldscripts/armnbsd.x		comp-obsolete		obsolete
+./usr/libdata/ldscripts/armnbsd.xbn		comp-obsolete		obsolete
+./usr/libdata/ldscripts/armnbsd.xn		comp-obsolete		obsolete
+./usr/libdata/ldscripts/armnbsd.xr		comp-obsolete		obsolete
+./usr/libdata/ldscripts/armnbsd.xu		comp-obsolete		obsolete
 ./usr/libdata/lint/llib-larm.ln			comp-c-lintlib		lint
 ./usr/libdata/lint/llib-larm32.ln		comp-obsolete		obsolete
 ./usr/libdata/lint/llib-lpmc.ln			comp-obsolete		obsolete

Index: src/distrib/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.268 src/distrib/sets/lists/comp/md.amd64:1.269
--- src/distrib/sets/lists/comp/md.amd64:1.268	Thu Feb 14 07:49:28 2019
+++ src/distrib/sets/lists/comp/md.amd64	Thu Feb 14 15:42:40 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.268 2019/02/14 12:49:28 wiz Exp $
+# $NetBSD: md.amd64,v 1.269 2019/02/14 20:42:40 christos Exp $
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
 ./usr/include/amd64/aout_machdep.h		comp-c-include
@@ -917,16 +917,11 @@
 ./usr/libdata/ldscripts/elf_x86_64.xsw		comp-util-bin		binutils
 ./usr/libdata/ldscripts/elf_x86_64.xu		comp-util-bin		binutils
 ./usr/libdata/ldscripts/elf_x86_64.xw		comp-util-bin		binutils
-./usr/libdata/ldscripts/i386nbsd.x		comp-obsolete		binutils=231
-./usr/libdata/ldscripts/i386nbsd.x		comp-util-bin		binutils=227
-./usr/libdata/ldscripts/i386nbsd.xbn		comp-obsolete		binutils=231
-./usr/libdata/ldscripts/i386nbsd.xbn		comp-util-bin		binutils=227
-./usr/libdata/ldscripts/i386nbsd.xn		comp-obsolete		binutils=231
-./usr/libdata/ldscripts/i386nbsd.xn		comp-util-bin		binutils=227
-./usr/libdata/ldscripts/i386nbsd.xr		comp-obsolete		binutils=231
-./usr/libdata/ldscripts/i386nbsd.xr		comp-util-bin		binutils=227
-./usr/libdata/ldscripts/i386nbsd.xu		comp-obsolete		binutils=231
-./usr/libdata/ldscripts/i386nbsd.xu		comp-util-bin		binutils=227
+./usr/libdata/ldscripts/i386nbsd.x		comp-obsolete		obsolete

CVS commit: src/usr.sbin/sup/source

2019-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 14 20:19:51 UTC 2019

Modified Files:
src/usr.sbin/sup/source: supcmeat.c

Log Message:
add breaks for done() since it might not be __dead.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sup/source/supcmeat.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.sbin/sup/source/supcmeat.c
diff -u src/usr.sbin/sup/source/supcmeat.c:1.42 src/usr.sbin/sup/source/supcmeat.c:1.43
--- src/usr.sbin/sup/source/supcmeat.c:1.42	Tue Apr  9 12:39:20 2013
+++ src/usr.sbin/sup/source/supcmeat.c	Thu Feb 14 15:19:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: supcmeat.c,v 1.42 2013/04/09 16:39:20 christos Exp $	*/
+/*	$NetBSD: supcmeat.c,v 1.43 2019/02/14 20:19:51 christos Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -371,17 +371,21 @@ setup(TREE * t)
 	case FSETUPSAME:
 		notify(1, "Attempt to upgrade from same host to same directory");
 		done(FDONESRVERROR, "Overwrite error");
+		break;
 	case FSETUPHOST:
 		notify(1, "This host has no permission to access %s",
 		collname);
 		done(FDONESRVERROR, "Permission denied");
+		break;
 	case FSETUPOLD:
 		notify(1, "This version of SUP is too old for the fileserver");
 		done(FDONESRVERROR, "Obsolete client");
+		break;
 	case FSETUPRELEASE:
 		notify(1, "Invalid release %s for collection %s",
 		release == NULL ? DEFRELEASE : release, collname);
 		done(FDONESRVERROR, "Invalid release");
+		break;
 	case FSETUPBUSY:
 		vnotify(0, "Fileserver is currently busy");
 		t->Tmode = SCMOK;



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-14 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Feb 14 20:09:40 UTC 2019

Modified Files:
src/sys/arch/sparc64/sparc64: trap.c

Log Message:
sun4v: add debug printout for ALIGN trap


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/arch/sparc64/sparc64/trap.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/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.189 src/sys/arch/sparc64/sparc64/trap.c:1.190
--- src/sys/arch/sparc64/sparc64/trap.c:1.189	Wed Dec 19 13:57:50 2018
+++ src/sys/arch/sparc64/sparc64/trap.c	Thu Feb 14 20:09:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.189 2018/12/19 13:57:50 maxv Exp $ */
+/*	$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.189 2018/12/19 13:57:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -717,6 +717,10 @@ dopanic:
 #ifdef DEBUG
 		if (!CPU_ISSUN4V) {
 			isfsr = ldxa(SFSR, ASI_IMMU);
+		} else {
+		  paddr_t mmu_fsa_ifa = cpus->ci_mmufsa
+		+ offsetof(struct mmufsa, ifa);
+			isfsr = ldxa(mmu_fsa_ifa, ASI_PHYS_CACHED);
 		}
 #endif
 		/* 
@@ -731,10 +735,34 @@ dopanic:
 		
 #ifdef DEBUG
 #define fmt64(x)	(u_int)((x)>>32), (u_int)((x))
-		printf("Alignment error: pid=%d.%d comm=%s dsfsr=%08x:%08x "
-		   "dsfar=%x:%x isfsr=%08x:%08x pc=%lx\n",
-		   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, fmt64(dsfsr), fmt64(dsfar),
-		   fmt64(isfsr), pc);
+		if (!CPU_ISSUN4V) {
+			printf("Alignment error: pid=%d.%d comm=%s dsfsr=%08x:%08x "
+			   "dsfar=%x:%x isfsr=%08x:%08x pc=%lx\n",
+			   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, fmt64(dsfsr), fmt64(dsfar),
+			   fmt64(isfsr), pc);
+		} else {
+		  
+			printf("Alignment error: pid=%d.%d comm=%s pc=%lx\n",
+			   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, pc);
+			paddr_t mmufsa_ift_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ift);
+			paddr_t mmufsa_ifa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifa);
+			paddr_t mmufsa_ifc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifc);
+			paddr_t mmufsa_dft_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dft);
+			paddr_t mmufsa_dfa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfa);
+			paddr_t mmufsa_dfc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfc);
+			int64_t ift = ldxa(mmufsa_ift_addr, ASI_PHYS_CACHED);
+			printf("ift = %016lx\n", ift);
+			int64_t ifa = ldxa(mmufsa_ifa_addr, ASI_PHYS_CACHED);
+			printf("ifa = %016lx\n", ifa);
+			int64_t ifc = ldxa(mmufsa_ifc_addr, ASI_PHYS_CACHED);
+			printf("ifc = %016lx\n", ifc);
+			int64_t dft = ldxa(mmufsa_dft_addr, ASI_PHYS_CACHED);
+			printf("dft = %016lx\n", dft);
+			int64_t dfa = ldxa(mmufsa_dfa_addr, ASI_PHYS_CACHED);
+			printf("dfa = %016lx\n", dfa);
+			int64_t dfc = ldxa(mmufsa_dfc_addr, ASI_PHYS_CACHED);
+			printf("dfc = %016lx\n", dfc);
+		}
 #endif
 		
 #if defined(DDB) && defined(DEBUG)



CVS commit: src/lib/libedit

2019-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 14 20:09:12 UTC 2019

Modified Files:
src/lib/libedit: readline.c

Log Message:
PR/53981: Jonathan Perkins: history_list should null-terminate


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/lib/libedit/readline.c

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

Modified files:

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.149 src/lib/libedit/readline.c:1.150
--- src/lib/libedit/readline.c:1.149	Thu Jan 10 13:41:56 2019
+++ src/lib/libedit/readline.c	Thu Feb 14 15:09:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.149 2019/01/10 18:41:56 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.150 2019/02/14 20:09:12 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.149 2019/01/10 18:41:56 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.150 2019/02/14 20:09:12 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -1590,7 +1590,7 @@ history_list(void)
 		return NULL;
 
 	if ((nlp = el_realloc(_history_listp,
-	(size_t)history_length * sizeof(*nlp))) == NULL)
+	((size_t)history_length + 1) * sizeof(*nlp))) == NULL)
 		return NULL;
 	_history_listp = nlp;
 
@@ -1607,6 +1607,7 @@ history_list(void)
 		if (i++ == history_length)
 			abort();
 	} while (history(h, , H_PREV) == 0);
+	_history_listp[i] = NULL;
 	return _history_listp;
 }
 



CVS commit: src/usr.sbin/sup/source

2019-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 14 17:08:54 UTC 2019

Modified Files:
src/usr.sbin/sup/source: supextern.h

Log Message:
done is not always done (it returns, it is not dead)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/sup/source/supextern.h

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

Modified files:

Index: src/usr.sbin/sup/source/supextern.h
diff -u src/usr.sbin/sup/source/supextern.h:1.27 src/usr.sbin/sup/source/supextern.h:1.28
--- src/usr.sbin/sup/source/supextern.h:1.27	Wed Feb  6 12:21:51 2019
+++ src/usr.sbin/sup/source/supextern.h	Thu Feb 14 12:08:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: supextern.h,v 1.27 2019/02/06 17:21:51 christos Exp $	*/
+/*	$NetBSD: supextern.h,v 1.28 2019/02/14 17:08:54 christos Exp $	*/
 
 struct stat;
 
@@ -133,7 +133,7 @@ int recvreg(TREE *, int, struct stat *);
 int copyfile(char *, char *);
 void finishup(int);
 void done(int, const char *, ...)
-	__attribute__((__format__(__printf__, 2, 3))) __dead;
+	__attribute__((__format__(__printf__, 2, 3)));
 void goaway(const char *, ...)
 	__attribute__((__format__(__printf__, 1, 2)));
 



CVS commit: src/external/bsd/nsd

2019-02-14 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Thu Feb 14 14:40:08 UTC 2019

Modified Files:
src/external/bsd/nsd: Makefile.inc

Log Message:
libpthread isn't used


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

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/nsd/Makefile.inc
diff -u src/external/bsd/nsd/Makefile.inc:1.5 src/external/bsd/nsd/Makefile.inc:1.6
--- src/external/bsd/nsd/Makefile.inc:1.5	Fri Oct 12 09:43:59 2018
+++ src/external/bsd/nsd/Makefile.inc	Thu Feb 14 14:40:07 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.5 2018/10/12 09:43:59 hannken Exp $
+# $NetBSD: Makefile.inc,v 1.6 2019/02/14 14:40:07 prlw1 Exp $
 
 .include 
 
@@ -23,7 +23,6 @@ DPLIBS+= ssl ${NETBSDSRCDIR}/crypto/exte
 DPLIBS+= crypto ${NETBSDSRCDIR}/crypto/external/bsd/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto
 DPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt
 DPLIBS+= util ${NETBSDSRCDIR}/lib/libutil
-DPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread
 
 __subst: .USE
 	${TOOL_SED} \



CVS commit: src

2019-02-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Feb 14 14:30:20 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c
src/sys/dev/nvmm/x86: nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c

Log Message:
Harmonize the handling of the CPL between AMD and Intel.

AMD has a separate guest CPL field, because on AMD, the SYSCALL/SYSRET
instructions do not force SS.DPL to predefined values. On Intel they do,
so the CPL on Intel is just the guest's SS.DPL value.

Even though technically possible on AMD, there is no sane reason for a
guest kernel to set a non-three SS.DPL, doing that would mess up several
common segmentation practices and wouldn't be compatible with Intel.

So, force the Intel behavior on AMD, by always setting SS.DPL<=>CPL.
Remove the now unused CPL field from nvmm_x64_state::misc[]. This actually
increases performance on AMD: to detect interrupt windows the virtualizer
has to modify some fields of misc[], and because CPL was there, we had to
flush the SEG set of the VMCB cache. Now there is no flush necessary.

While here remove the CPL check for XSETBV on Intel, contrary to AMD
Intel checks the CPL before the intercept, so if we receive an XSETBV
VMEXIT, we are certain that it was executed at CPL=0 in the guest. By the
way my check was wrong in the first place, it was reading SS.RPL instead
of SS.DPL.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libnvmm/libnvmm_x86.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/nvmm/x86/nvmm_x86.h
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c

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

Modified files:

Index: src/lib/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.21 src/lib/libnvmm/libnvmm_x86.c:1.22
--- src/lib/libnvmm/libnvmm_x86.c:1.21	Tue Feb 12 14:50:21 2019
+++ src/lib/libnvmm/libnvmm_x86.c	Thu Feb 14 14:30:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.21 2019/02/12 14:50:21 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.22 2019/02/14 14:30:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -92,7 +92,6 @@ nvmm_vcpu_dump(struct nvmm_machine *mach
 	printf("| -> CR3=%p\n", (void *)state.crs[NVMM_X64_CR_CR3]);
 	printf("| -> CR4=%p\n", (void *)state.crs[NVMM_X64_CR_CR4]);
 	printf("| -> CR8=%p\n", (void *)state.crs[NVMM_X64_CR_CR8]);
-	printf("| -> CPL=%p\n", (void *)state.misc[NVMM_X64_MISC_CPL]);
 
 	return 0;
 }

Index: src/sys/dev/nvmm/x86/nvmm_x86.h
diff -u src/sys/dev/nvmm/x86/nvmm_x86.h:1.4 src/sys/dev/nvmm/x86/nvmm_x86.h:1.5
--- src/sys/dev/nvmm/x86/nvmm_x86.h:1.4	Wed Feb 13 06:32:45 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86.h	Thu Feb 14 14:30:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86.h,v 1.4 2019/02/13 06:32:45 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86.h,v 1.5 2019/02/14 14:30:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -98,11 +98,10 @@
 #define NVMM_X64_NMSR			10
 
 /* Misc. */
-#define NVMM_X64_MISC_CPL		0
-#define NVMM_X64_MISC_INT_SHADOW	1
-#define NVMM_X64_MISC_INT_WINDOW_EXIT	2
-#define NVMM_X64_MISC_NMI_WINDOW_EXIT	3
-#define NVMM_X64_NMISC			4
+#define NVMM_X64_MISC_INT_SHADOW	0
+#define NVMM_X64_MISC_INT_WINDOW_EXIT	1
+#define NVMM_X64_MISC_NMI_WINDOW_EXIT	2
+#define NVMM_X64_NMISC			3
 
 #ifndef ASM_NVMM
 

Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.22 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.23
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.22	Wed Feb 13 10:55:13 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Thu Feb 14 14:30:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.22 2019/02/13 10:55:13 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.23 2019/02/14 14:30:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.22 2019/02/13 10:55:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.23 2019/02/14 14:30:20 maxv Exp $");
 
 #include 
 #include 
@@ -576,10 +576,6 @@ svm_vmcb_cache_update(struct vmcb *vmcb,
 		vmcb->ctrl.vmcb_clean &=
 		~(VMCB_CTRL_VMCB_CLEAN_CR | VMCB_CTRL_VMCB_CLEAN_NP);
 	}
-	if (flags & NVMM_X64_STATE_MISC) {
-		/* SEG for CPL. */
-		vmcb->ctrl.vmcb_clean &= ~VMCB_CTRL_VMCB_CLEAN_SEG;
-	}
 }
 
 static inline void
@@ -1764,6 +1760,8 @@ svm_vcpu_setstate(struct nvmm_cpu *vcpu,
 		>state.ldt);
 		svm_vcpu_setstate_seg(>segs[NVMM_X64_SEG_TR],
 		>state.tr);
+
+		vmcb->state.cpl = state->segs[NVMM_X64_SEG_SS].attrib.dpl;
 	}
 
 	CTASSERT(sizeof(cpudata->gprs) == sizeof(state->gprs));
@@ -1822,8 +1820,6 @@ svm_vcpu_setstate(struct nvmm_cpu *vcpu,
 	}
 
 	if (flags & NVMM_X64_STATE_MISC) {
-		vmcb->state.cpl = state->misc[NVMM_X64_MISC_CPL];
-
 		if (state->misc[NVMM_X64_MISC_INT_SHADOW]) {
 			vmcb->ctrl.intr |= VMCB_CTRL_INTR_SHADOW;
 		} else {
@@ -1889,6 +1885,8 @@ svm_vcpu_getstate(struct 

CVS commit: src/bin/sh

2019-02-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb 14 13:27:59 UTC 2019

Modified Files:
src/bin/sh: show.c

Log Message:
DEBUG mode only change.   When pretty-printing a word from a parse
tree, don't display a CTLESC which is there only to protect a CTL*
char (a data char that happens to have the same value).  No actual
CTL* chars are printed as data, so no escaping is needed to protect
data which just happens to look the same.  Dropping this avoids the
possibility of confusion/ambiguity in what the word actually contains.

NFC for any normal shell build (very little of this file gets compiled there)


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/sh/show.c

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

Modified files:

Index: src/bin/sh/show.c
diff -u src/bin/sh/show.c:1.52 src/bin/sh/show.c:1.53
--- src/bin/sh/show.c:1.52	Tue Jan 22 13:48:28 2019
+++ src/bin/sh/show.c	Thu Feb 14 13:27:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: show.c,v 1.52 2019/01/22 13:48:28 kre Exp $	*/
+/*	$NetBSD: show.c,v 1.53 2019/02/14 13:27:59 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)show.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: show.c,v 1.52 2019/01/22 13:48:28 kre Exp $");
+__RCSID("$NetBSD: show.c,v 1.53 2019/02/14 13:27:59 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -645,7 +645,8 @@ sharg(union node *arg, TFILE *fp)
 	for (p = arg->narg.text ; *p ; p++) {
 		switch (*p) {
 		case CTLESC:
-			trace_putc('\\', fp);
+			if (BASESYNTAX[p[1]] != CCTL)
+trace_putc('\\', fp);
 			trace_putc(*++p, fp);
 			break;
 



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

2019-02-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 14 12:49:28 UTC 2019

Modified Files:
src/distrib/sets/lists/comp: md.amd64

Log Message:
Sort, and add a couple obsolete files for binutils=231.


To generate a diff of this commit:
cvs rdiff -u -r1.267 -r1.268 src/distrib/sets/lists/comp/md.amd64

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

Modified files:

Index: src/distrib/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.267 src/distrib/sets/lists/comp/md.amd64:1.268
--- src/distrib/sets/lists/comp/md.amd64:1.267	Sat Feb  2 22:39:32 2019
+++ src/distrib/sets/lists/comp/md.amd64	Thu Feb 14 12:49:28 2019
@@ -1,5 +1,4 @@
-# $NetBSD: md.amd64,v 1.267 2019/02/02 22:39:32 mrg Exp $
-
+# $NetBSD: md.amd64,v 1.268 2019/02/14 12:49:28 wiz Exp $
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
 ./usr/include/amd64/aout_machdep.h		comp-c-include
@@ -333,6 +332,8 @@
 ./usr/include/clang-5.0/xsaveoptintrin.h	comp-obsolete		obsolete
 ./usr/include/clang-5.0/xsavesintrin.h		comp-obsolete		obsolete
 ./usr/include/clang-5.0/xtestintrin.h		comp-obsolete		obsolete
+./usr/include/clang-7.0/__wmmintrin_aes.h	comp-c-include		llvm
+./usr/include/clang-7.0/__wmmintrin_pclmul.h	comp-c-include		llvm
 ./usr/include/clang-7.0/adxintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/ammintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/avx2intrin.h		comp-c-include		llvm
@@ -379,8 +380,8 @@
 ./usr/include/clang-7.0/lwpintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/lzcntintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/mm3dnow.h		comp-c-include		llvm
-./usr/include/clang-7.0/mmintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/mm_malloc.h		comp-c-include		llvm
+./usr/include/clang-7.0/mmintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/movdirintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/mwaitxintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/nmmintrin.h		comp-c-include		llvm
@@ -401,9 +402,7 @@
 ./usr/include/clang-7.0/vpclmulqdqintrin.h	comp-c-include		llvm
 ./usr/include/clang-7.0/waitpkgintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/wbnoinvdintrin.h	comp-c-include		llvm
-./usr/include/clang-7.0/__wmmintrin_aes.h	comp-c-include		llvm
 ./usr/include/clang-7.0/wmmintrin.h		comp-c-include		llvm
-./usr/include/clang-7.0/__wmmintrin_pclmul.h	comp-c-include		llvm
 ./usr/include/clang-7.0/x86intrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/xmmintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/xopintrin.h		comp-c-include		llvm
@@ -412,6 +411,11 @@
 ./usr/include/clang-7.0/xsaveoptintrin.h	comp-c-include		llvm
 ./usr/include/clang-7.0/xsavesintrin.h		comp-c-include		llvm
 ./usr/include/clang-7.0/xtestintrin.h		comp-c-include		llvm
+./usr/include/dev/nvmmcomp-c-include
+./usr/include/dev/nvmm/nvmm.h			comp-c-include
+./usr/include/dev/nvmm/nvmm_ioctl.h		comp-c-include
+./usr/include/dev/nvmm/x86			comp-c-include
+./usr/include/dev/nvmm/x86/nvmm_x86.h		comp-c-include
 ./usr/include/emmintrin.h			comp-obsolete		obsolete
 ./usr/include/g++/bits/i386			comp-c-include		compat
 ./usr/include/g++/bits/i386/c++config.h		comp-c-include		gcc,compat
@@ -740,11 +744,6 @@
 ./usr/include/ieeefp.hcomp-c-include
 ./usr/include/mm_malloc.h			comp-obsolete		obsolete
 ./usr/include/mmintrin.h			comp-obsolete		obsolete
-./usr/include/dev/nvmmcomp-c-include
-./usr/include/dev/nvmm/nvmm.h			comp-c-include
-./usr/include/dev/nvmm/nvmm_ioctl.h		comp-c-include
-./usr/include/dev/nvmm/x86			comp-c-include
-./usr/include/dev/nvmm/x86/nvmm_x86.h		comp-c-include
 ./usr/include/nvmm.hcomp-c-include
 ./usr/include/pmmintrin.h			comp-obsolete		obsolete
 ./usr/include/x64_64comp-obsolete		obsolete
@@ -918,10 +917,15 @@
 ./usr/libdata/ldscripts/elf_x86_64.xsw		comp-util-bin		binutils
 ./usr/libdata/ldscripts/elf_x86_64.xu		comp-util-bin		binutils
 ./usr/libdata/ldscripts/elf_x86_64.xw		comp-util-bin		binutils
+./usr/libdata/ldscripts/i386nbsd.x		comp-obsolete		binutils=231
 ./usr/libdata/ldscripts/i386nbsd.x		comp-util-bin		binutils=227
+./usr/libdata/ldscripts/i386nbsd.xbn		comp-obsolete		binutils=231
 ./usr/libdata/ldscripts/i386nbsd.xbn		comp-util-bin		binutils=227
+./usr/libdata/ldscripts/i386nbsd.xn		comp-obsolete		binutils=231
 ./usr/libdata/ldscripts/i386nbsd.xn		comp-util-bin		binutils=227
+./usr/libdata/ldscripts/i386nbsd.xr		comp-obsolete		binutils=231
 ./usr/libdata/ldscripts/i386nbsd.xr		comp-util-bin		binutils=227
+./usr/libdata/ldscripts/i386nbsd.xu		comp-obsolete		binutils=231
 ./usr/libdata/ldscripts/i386nbsd.xu		comp-util-bin		binutils=227
 ./usr/libdata/lint/llib-lnvmm.ln		comp-c-lintlib		lint
 ./usr/libdata/lint/llib-lx86_64.ln		comp-c-lintlib		lint



CVS commit: src/usr.bin/crunch/crunchgen

2019-02-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 14 12:22:06 UTC 2019

Modified Files:
src/usr.bin/crunch/crunchgen: crunchgen.c

Log Message:
remove the hack to remove .eh_frame -- gcc7 is fixed it seems.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/crunch/crunchgen/crunchgen.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/crunch/crunchgen/crunchgen.c
diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.91 src/usr.bin/crunch/crunchgen/crunchgen.c:1.92
--- src/usr.bin/crunch/crunchgen/crunchgen.c:1.91	Wed Feb 13 20:48:56 2019
+++ src/usr.bin/crunch/crunchgen/crunchgen.c	Thu Feb 14 12:22:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 mrg Exp $	*/
+/*	$NetBSD: crunchgen.c,v 1.92 2019/02/14 12:22:06 mrg Exp $	*/
 /*
  * Copyright (c) 1994 University of Maryland
  * All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 mrg Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.92 2019/02/14 12:22:06 mrg Exp $");
 #endif
 
 #include 
@@ -964,11 +964,7 @@ top_makefile_rules(FILE *outmk)
 
 fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n");
 
-fprintf(outmk, ".if !(${MACHINE} == \"sparc\" || \\\n");
-fprintf(outmk, "  ${MACHINE} == \"sparc64\" || \\\n");
-fprintf(outmk, "  ${MACHINE_ARCH:C/mips(e|64e)[bl]/mips/} == \"mips\")\n");
 fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n");
-fprintf(outmk, ".endif\n");
 fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n");
 fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .note.netbsd.mcmodel\n");
 fprintf(outmk, ".endif\n\n");



CVS commit: src/bin/sh

2019-02-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb 14 11:15:24 UTC 2019

Modified Files:
src/bin/sh: builtins.def sh.1 var.c

Log Message:
Add the "specialvar" built-in command.   Discussed (well, mentioned
anway) on tech-userlevel with no adverse response.

This allows the magic of vars like HOSTNAME SECONDS, ToD (etc) to be
restored should it be lost - perhaps by having a var of the same name
imported from the environment (which needs to remove the magic in case
a set of scripts are using the env to pass data, and the var name chosen
happens to be one of our magic ones).

No change to SMALL shells (or smaller) - none of the magic vars (except
LINENO, which is exempt from all of this) exist in those, hence such a
shell has no need for this command either.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/sh/builtins.def
cvs rdiff -u -r1.219 -r1.220 src/bin/sh/sh.1
cvs rdiff -u -r1.77 -r1.78 src/bin/sh/var.c

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

Modified files:

Index: src/bin/sh/builtins.def
diff -u src/bin/sh/builtins.def:1.25 src/bin/sh/builtins.def:1.26
--- src/bin/sh/builtins.def:1.25	Mon May 15 20:00:36 2017
+++ src/bin/sh/builtins.def	Thu Feb 14 11:15:24 2019
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: builtins.def,v 1.25 2017/05/15 20:00:36 kre Exp $
+#	$NetBSD: builtins.def,v 1.26 2019/02/14 11:15:24 kre Exp $
 #
 # Copyright (c) 1991, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -76,6 +76,9 @@ setcmd		-s set
 fdflagscmd	fdflags
 setvarcmd	setvar
 shiftcmd	-s shift
+#ifndef SMALL
+specialvarcmd	specialvar
+#endif
 timescmd	-s times
 trapcmd		-s trap
 truecmd		-s : -u true

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.219 src/bin/sh/sh.1:1.220
--- src/bin/sh/sh.1:1.219	Mon Feb  4 12:18:36 2019
+++ src/bin/sh/sh.1	Thu Feb 14 11:15:24 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.219 2019/02/04 12:18:36 wiz Exp $
+.\"	$NetBSD: sh.1,v 1.220 2019/02/14 11:15:24 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,7 +31,7 @@
 .\"
 .\"	@(#)sh.1	8.6 (Berkeley) 5/4/95
 .\"
-.Dd February 4, 2019
+.Dd February 14, 2019
 .Dt SH 1
 .\" everything except c o and s (keep them ordered)
 .ds flags abCEeFfhIiLmnpquVvXx
@@ -3351,6 +3351,39 @@ positional parameters (
 .Dq Li $# )
 before the shift.
 .\"
+.It Ic specialvar Ar variable ...
+For each
+.Ar variable
+name given,
+if the variable named is one which,
+in this
+.Nm ,
+could be treated as a special variable,
+then cause that
+.Ar variable
+to be made special, undoing any effects of an earlier
+.Ic unset
+or assignment to the variable.
+If all
+.Ar variable Ns s
+given are recognized special variables in this
+.Nm
+the
+.Ic specialvar
+command will exit with status 0, otherwise 1.
+Invalid usage will result in an exit status of 2.
+.Pp
+Note that all variables capable of being special are created
+that way, this command is not required to cause that to happen.
+However should such a variable be imported from the environment,
+that will cause (for those special variables so designated)
+the special effects for that variable to be lost.
+Consequently, as the contents of the environment cannot be controlled,
+any script which desires to make use of the properties
+of most of the special variables should use this command,
+naming the variables required,
+to ensure that their special properties are available.
+.\"
 .It Ic times
 Prints two lines to standard output.
 Each line contains two accumulated time values, expressed
@@ -4093,6 +4126,9 @@ is expanded, so changes to the shell's e
 cause updates without further action.
 If unset, it returns nothing.
 If set it loses its special properties, and is simply a variable.
+See the
+.Ic specialvar
+built-in command for remedial action.
 .It Ev HISTSIZE
 The number of lines in the history buffer for the shell.
 .It Ev HOME
@@ -4112,6 +4148,9 @@ is expanded, so changes to the system's 
 without further action.
 If unset, it returns nothing.
 If set it loses its special properties, and is simply a variable.
+See the
+.Ic specialvar
+built-in command for remedial action.
 .It Ev IFS
 Input Field Separators.
 This is normally set to
@@ -4284,6 +4323,9 @@ not be as unpredictable as they otherwis
 Returns the number of seconds since the current shell was started.
 If unset, it remains unset, and returns nothing, unless set again.
 If set, it loses its special properties, and becomes a normal variable.
+See the
+.Ic specialvar
+built-in command for remedial action.
 .It Ev START_TIME
 Initialized by the shell to the number of seconds since the Epoch
 (see
@@ -4318,6 +4360,9 @@ If unset
 .Ev ToD
 returns nothing.
 If set, it loses its special properties, and becomes a normal variable.
+See the
+.Ic specialvar
+built-in command for remedial action.
 .It Ev ToD_FORMAT
 Can be set to the
 .Xr strftime 3

Index: 

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

2019-02-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 14 10:36:33 UTC 2019

Modified Files:
src/tests/lib/libc/arch/hppa: return_one.S
src/tests/lib/libc/arch/mips: return_one.S
src/tests/lib/libc/arch/powerpc64: return_one.S
src/tests/lib/libc/arch/vax: return_one.S

Log Message:
implement return_one for hppa, mips, ppc64, and vax.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/arch/hppa/return_one.S
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/arch/mips/return_one.S
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/arch/powerpc64/return_one.S
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/arch/vax/return_one.S

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

Modified files:

Index: src/tests/lib/libc/arch/hppa/return_one.S
diff -u src/tests/lib/libc/arch/hppa/return_one.S:1.1 src/tests/lib/libc/arch/hppa/return_one.S:1.2
--- src/tests/lib/libc/arch/hppa/return_one.S:1.1	Mon Jul 18 23:16:09 2011
+++ src/tests/lib/libc/arch/hppa/return_one.S	Thu Feb 14 10:36:33 2019
@@ -1,8 +1,10 @@
-/*	$NetBSD: return_one.S,v 1.1 2011/07/18 23:16:09 jym Exp $ */
+/*	$NetBSD: return_one.S,v 1.2 2019/02/14 10:36:33 mrg Exp $ */
 
 #include 
 
 .globl	return_one, return_one_end;
 
-return_one: return_one_end:
-	nop
+return_one:
+	bv %r0(%r2)
+	ldi 1,%r28
+return_one_end:

Index: src/tests/lib/libc/arch/mips/return_one.S
diff -u src/tests/lib/libc/arch/mips/return_one.S:1.1 src/tests/lib/libc/arch/mips/return_one.S:1.2
--- src/tests/lib/libc/arch/mips/return_one.S:1.1	Mon Jul 18 23:16:10 2011
+++ src/tests/lib/libc/arch/mips/return_one.S	Thu Feb 14 10:36:33 2019
@@ -1,8 +1,11 @@
-/*	$NetBSD: return_one.S,v 1.1 2011/07/18 23:16:10 jym Exp $ */
+/*	$NetBSD: return_one.S,v 1.2 2019/02/14 10:36:33 mrg Exp $ */
 
 #include 
 
 .globl	return_one, return_one_end;
 
-return_one: return_one_end:
-	nop
+return_one:
+	jr	$31
+	li	$2,1
+
+return_one_end:

Index: src/tests/lib/libc/arch/powerpc64/return_one.S
diff -u src/tests/lib/libc/arch/powerpc64/return_one.S:1.1 src/tests/lib/libc/arch/powerpc64/return_one.S:1.2
--- src/tests/lib/libc/arch/powerpc64/return_one.S:1.1	Mon Jul 18 23:16:10 2011
+++ src/tests/lib/libc/arch/powerpc64/return_one.S	Thu Feb 14 10:36:33 2019
@@ -1,8 +1,10 @@
-/*	$NetBSD: return_one.S,v 1.1 2011/07/18 23:16:10 jym Exp $ */
+/*	$NetBSD: return_one.S,v 1.2 2019/02/14 10:36:33 mrg Exp $ */
 
 #include 
 
 .globl	return_one, return_one_end;
 
-return_one: return_one_end:
-	nop
+return_one:
+	li 3,1
+	blr
+return_one_end:

Index: src/tests/lib/libc/arch/vax/return_one.S
diff -u src/tests/lib/libc/arch/vax/return_one.S:1.1 src/tests/lib/libc/arch/vax/return_one.S:1.2
--- src/tests/lib/libc/arch/vax/return_one.S:1.1	Mon Jul 18 23:16:10 2011
+++ src/tests/lib/libc/arch/vax/return_one.S	Thu Feb 14 10:36:33 2019
@@ -1,8 +1,12 @@
-/*	$NetBSD: return_one.S,v 1.1 2011/07/18 23:16:10 jym Exp $ */
+/*	$NetBSD: return_one.S,v 1.2 2019/02/14 10:36:33 mrg Exp $ */
 
 #include 
 
 .globl	return_one, return_one_end;
 
-return_one: return_one_end:
-	nop
+return_one:
+	.word 0
+	subl2 $4,%sp
+	movl $1,%r0
+	ret
+return_one_end:



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

2019-02-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 14 10:29:58 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/gcc: output.h varasm.c

Log Message:
put joerg's varasm.c patch back with additional upstream fixes.  now
crtbegin.o has a read-only .eh_frame, and libstdc++ builds.

2017-09-01  Joerg Sonnenberger  
Jeff Law  

* varasm.c (bss_initializer_p): Do not put constants into .bss
(categorize_decl_for_section): Handle bss_initializer_p returning
false when DECL_INITIAL is NULL.

2017-11-27  Jakub Jelinek  

PR target/83100
* varasm.c (bss_initializer_p): Return true for DECL_COMMON
TREE_READONLY decls.

2018-02-09  Jakub Jelinek  

PR middle-end/84237
* output.h (bss_initializer_p): Add NAMED argument, defaulted to false.
* varasm.c (bss_initializer_p): Add NAMED argument, if true, ignore
TREE_READONLY bit.
(get_variable_section): For decls in named .bss* sections pass true as
second argument to bss_initializer_p.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gcc/dist/gcc/output.h \
src/external/gpl3/gcc/dist/gcc/varasm.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/output.h
diff -u src/external/gpl3/gcc/dist/gcc/output.h:1.7 src/external/gpl3/gcc/dist/gcc/output.h:1.8
--- src/external/gpl3/gcc/dist/gcc/output.h:1.7	Sat Jan 19 12:10:04 2019
+++ src/external/gpl3/gcc/dist/gcc/output.h	Thu Feb 14 10:29:58 2019
@@ -556,7 +556,7 @@ extern void output_file_directive (FILE 
 extern unsigned int default_section_type_flags (tree, const char *, int);
 
 extern bool have_global_bss_p (void);
-extern bool bss_initializer_p (const_tree);
+extern bool bss_initializer_p (const_tree, bool = false);
 
 extern void default_no_named_section (const char *, unsigned int, tree);
 extern void default_elf_asm_named_section (const char *, unsigned int, tree);
Index: src/external/gpl3/gcc/dist/gcc/varasm.c
diff -u src/external/gpl3/gcc/dist/gcc/varasm.c:1.7 src/external/gpl3/gcc/dist/gcc/varasm.c:1.8
--- src/external/gpl3/gcc/dist/gcc/varasm.c:1.7	Thu Jan 31 08:53:07 2019
+++ src/external/gpl3/gcc/dist/gcc/varasm.c	Thu Feb 14 10:29:58 2019
@@ -972,18 +972,18 @@ decode_reg_name (const char *name)
 /* Return true if DECL's initializer is suitable for a BSS section.  */
 
 bool
-bss_initializer_p (const_tree decl)
+bss_initializer_p (const_tree decl, bool named)
 {
-  return (DECL_INITIAL (decl) == NULL
-	  /* In LTO we have no errors in program; error_mark_node is used
-	 to mark offlined constructors.  */
-	  || (DECL_INITIAL (decl) == error_mark_node
-	  && !in_lto_p)
-	  || (flag_zero_initialized_in_bss
-	  /* Leave constant zeroes in .rodata so they
-		 can be shared.  */
-	  && !TREE_READONLY (decl)
-	  && initializer_zerop (DECL_INITIAL (decl;
+  /* Do not put non-common constants into the .bss section, they belong in
+ a readonly section, except when NAMED is true.  */
+  return ((!TREE_READONLY (decl) || DECL_COMMON (decl) || named)
+	  && (DECL_INITIAL (decl) == NULL
+	  /* In LTO we have no errors in program; error_mark_node is used
+	 to mark offlined constructors.  */
+	  || (DECL_INITIAL (decl) == error_mark_node
+	  && !in_lto_p)
+	  || (flag_zero_initialized_in_bss
+	  && initializer_zerop (DECL_INITIAL (decl);
 }
 
 /* Compute the alignment of variable specified by DECL.
@@ -1154,7 +1154,8 @@ get_variable_section (tree decl, bool pr
 {
   section *sect = get_named_section (decl, NULL, reloc);
 
-  if ((sect->common.flags & SECTION_BSS) && !bss_initializer_p (decl))
+  if ((sect->common.flags & SECTION_BSS)
+	  && !bss_initializer_p (decl, true))
 	{
 	  error_at (DECL_SOURCE_LOCATION (decl),
 		"only zero initializers are allowed in section %qs",
@@ -6465,7 +6466,8 @@ categorize_decl_for_section (const_tree 
 	ret = SECCAT_BSS;
   else if (! TREE_READONLY (decl)
 	   || TREE_SIDE_EFFECTS (decl)
-	   || ! TREE_CONSTANT (DECL_INITIAL (decl)))
+	   || (DECL_INITIAL (decl)
+		   && ! TREE_CONSTANT (DECL_INITIAL (decl
 	{
 	  /* Here the reloc_rw_mask is not testing whether the section should
 	 be read-only or not, but whether the dynamic link will have to
@@ -6485,7 +6487,8 @@ categorize_decl_for_section (const_tree 
 	   location.  -fmerge-all-constants allows even that (at the
 	   expense of not conforming).  */
 	ret = SECCAT_RODATA;
-  else if (TREE_CODE (DECL_INITIAL (decl)) == STRING_CST)
+  else if (DECL_INITIAL (decl)
+	   && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST)
 	ret = SECCAT_RODATA_MERGE_STR_INIT;
   else
 	ret = SECCAT_RODATA_MERGE_CONST;



CVS commit: src/sys/dev/nvmm/x86

2019-02-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Feb 14 09:37:32 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_vmx.c

Log Message:
On AMD, the segments have a simple "present" bit. On Intel however there
is an extra "unusable" bit, which has a twisted meaning. We can't just
ignore this bit, because when unset, the CPU performs extra checks on the
other attributes, which may cause VMENTRY to fail and the guest to be
killed.

Typically, on Qemu, some guests like Windows XP trigger two consecutive
getstate+setstate calls, and while processing them, we end up wrongfully
removing the "unusable" bits that were previously set.

Fix that by forcing "unusable = !present". Each hypervisor I could check
does something different, but this seems to be the least problematic
solution for now.

While here, the fields of vmx_guest_segs are VMX indexes, so they should
be uint64_t (no functional change).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/nvmm/x86/nvmm_x86_vmx.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.1 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.2
--- src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.1	Wed Feb 13 16:03:16 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Thu Feb 14 09:37:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_vmx.c,v 1.1 2019/02/13 16:03:16 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.2 2019/02/14 09:37:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.1 2019/02/13 16:03:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.2 2019/02/14 09:37:31 maxv Exp $");
 
 #include 
 #include 
@@ -674,9 +674,9 @@ struct vmx_cpudata {
 };
 
 static const struct {
-	uint16_t selector;
-	uint16_t attrib;
-	uint32_t limit;
+	uint64_t selector;
+	uint64_t attrib;
+	uint64_t limit;
 	uint64_t base;
 } vmx_guest_segs[NVMM_X64_NSEG] = {
 	[NVMM_X64_SEG_ES] = {
@@ -2113,7 +2113,8 @@ vmx_vcpu_setstate_seg(struct nvmm_x64_st
 	__SHIFTIN(segs[idx].attrib.avl, VMX_SEG_ATTRIB_AVL) |
 	__SHIFTIN(segs[idx].attrib.lng, VMX_SEG_ATTRIB_LONG) |
 	__SHIFTIN(segs[idx].attrib.def32, VMX_SEG_ATTRIB_DEF32) |
-	__SHIFTIN(segs[idx].attrib.gran, VMX_SEG_ATTRIB_GRAN);
+	__SHIFTIN(segs[idx].attrib.gran, VMX_SEG_ATTRIB_GRAN) |
+	(!segs[idx].attrib.p ? VMX_SEG_ATTRIB_UNUSABLE : 0);
 
 	if (idx != NVMM_X64_SEG_GDT && idx != NVMM_X64_SEG_IDT) {
 		vmx_vmwrite(vmx_guest_segs[idx].selector, segs[idx].selector);
@@ -2142,6 +2143,9 @@ vmx_vcpu_getstate_seg(struct nvmm_x64_st
 	segs[idx].attrib.lng = __SHIFTOUT(attrib, VMX_SEG_ATTRIB_LONG);
 	segs[idx].attrib.def32 = __SHIFTOUT(attrib, VMX_SEG_ATTRIB_DEF32);
 	segs[idx].attrib.gran = __SHIFTOUT(attrib, VMX_SEG_ATTRIB_GRAN);
+	if (attrib & VMX_SEG_ATTRIB_UNUSABLE) {
+		segs[idx].attrib.p = 0;
+	}
 }
 
 static inline bool



CVS commit: src/sys/arch

2019-02-14 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 14 08:18:26 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S machdep.c spl.S vector.S
src/sys/arch/amd64/include: frame.h
src/sys/arch/i386/i386: machdep.c vector.S
src/sys/arch/i386/include: frame.h frameasm.h
src/sys/arch/x86/include: cpu.h intr.h
src/sys/arch/x86/x86: cpu.c intr.c mainbus.c pmap.c x86_machdep.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/x86: xen_intr.c xen_mainbus.c
src/sys/arch/xen/xen: hypervisor.c if_xennet_xenbus.c
Added Files:
src/sys/arch/amd64/conf: XEN3_PVHVM
src/sys/arch/i386/conf: XEN3PAE_PVHVM

Log Message:
Welcome XENPVHVM mode.

It is UP only, has xbd(4) and xennet(4) as PV drivers.

The console is com0 at isa and the native portion is very
rudimentary AT architecture, so is probably suboptimal to
run without PV support.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.325 -r1.326 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/conf/XEN3_PVHVM
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/frame.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/conf/XEN3PAE_PVHVM
cvs rdiff -u -r1.815 -r1.816 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/include/frame.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/mainbus.c
cvs rdiff -u -r1.322 -r1.323 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/x86/xen_mainbus.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/if_xennet_xenbus.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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.177 src/sys/arch/amd64/amd64/locore.S:1.178
--- src/sys/arch/amd64/amd64/locore.S:1.177	Wed Feb 13 05:36:59 2019
+++ src/sys/arch/amd64/amd64/locore.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.177 2019/02/13 05:36:59 cherry Exp $	*/
+/*	$NetBSD: locore.S,v 1.178 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1112,7 +1112,7 @@ ENTRY(cpu_switchto)
 .Lskip_svs:
 #endif
 
-#ifndef XENPV
+#ifndef XEN
 	movq	%r13,%rdi
 	movq	%r12,%rsi
 	callq	_C_LABEL(speculation_barrier)

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.325 src/sys/arch/amd64/amd64/machdep.c:1.326
--- src/sys/arch/amd64/amd64/machdep.c:1.325	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.325 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.326 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.325 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.326 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -193,7 +193,9 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 
-#endif
+#include 
+#include 
+#endif /* XEN */
 
 #ifdef DDB
 #include 
@@ -1693,7 +1695,7 @@ init_x86_64(paddr_t first_avail)
 	svs_init();
 #endif
 	cpu_init_msrs(_info_primary, true);
-#ifndef XENPV
+#ifndef XEN
 	cpu_speculation_init(_info_primary);
 #endif
 
@@ -1905,6 +1907,7 @@ init_x86_64(paddr_t first_avail)
 	(unsigned long) Xsyscall))
 		panic("HYPERVISOR_set_callbacks() failed");
 #endif /* XENPV */
+
 	cpu_init_idt();
 
 	init_x86_64_ksyms();

Index: src/sys/arch/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.39 src/sys/arch/amd64/amd64/spl.S:1.40
--- src/sys/arch/amd64/amd64/spl.S:1.39	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/spl.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.39 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.40 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -211,7 +211,9 @@ IDTVEC(resume_preempt)
 	cli
 	jmp	*%r13			/* back to Xdoreti */
 IDTVEC_END(resume_preempt)
+#endif /* XEN */
 
+#ifndef XENPV
 /*
  * void