CVS commit: src/sys/arch

2020-04-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 13 05:40:26 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_machdep.c cpuswitch.S pmap.c
pmapboot.c trap.c vectors.S
src/sys/arch/aarch64/conf: Makefile.aarch64
src/sys/arch/arm/conf: files.arm
src/sys/arch/arm/include: asm.h
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
Add support for Branch Target Identification (BTI).

On the executable pages that have the GP (Guarded Page) bit, the semantic
of the "br" and "blr" instructions is changed: the CPU expects the first
instruction of the jump/call target to be "bti", and faults if it isn't.

We add the GP bit on the kernel .text pages (and incidentally the .rodata
pages, but we don't care). The compiler adds a "bti c" instruction at the
beginning of each C function. We modify the ENTRY() macros to manually add
"bti c" in the asm functions.

cpuswitch.S needs a specific change: with "br x27" the CPU expects "bti j",
which is bad because the functions begin with "bti c"; switch to "br x16",
for the CPU to accept "bti c".

BTI helps defend against JOP/COP. Tested on Qemu.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/aarch64/aarch64/aarch64_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/aarch64/pmapboot.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/aarch64/aarch64/trap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/vectors.S
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/aarch64/conf/Makefile.aarch64
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/arm/conf/files.arm
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/include/asm.h
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/evbarm/conf/GENERIC64

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/aarch64/aarch64/aarch64_machdep.c
diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.41 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.42
--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.41	Sun Apr 12 07:49:58 2020
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c	Mon Apr 13 05:40:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.41 2020/04/12 07:49:58 maxv Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.42 2020/04/13 05:40:25 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.41 2020/04/12 07:49:58 maxv Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.42 2020/04/13 05:40:25 maxv Exp $");
 
 #include "opt_arm_debug.h"
+#include "opt_cpuoptions.h"
 #include "opt_ddb.h"
 #include "opt_kernhist.h"
 #include "opt_modular.h"
@@ -112,6 +113,24 @@ uint32_t dumpmag = 0x8fca0101;  /* magic
 int dumpsize = 0;   /* also for savecore */
 longdumplo = 0;
 
+int aarch64_bti_enabled __read_mostly;
+
+static void
+bti_init(void)
+{
+#ifdef ARMV85_BTI
+	extern uint64_t pmap_attr_gp;
+	uint64_t reg;
+
+	reg = reg_id_aa64pfr1_el1_read();
+
+	if (reg >= ID_AA64PFR1_EL1_BT_SUPPORTED) {
+		pmap_attr_gp = LX_BLKPAG_GP;
+		aarch64_bti_enabled = 1;
+	}
+#endif
+}
+
 void
 cpu_kernel_vm_init(uint64_t memory_start __unused, uint64_t memory_size __unused)
 {
@@ -121,6 +140,8 @@ cpu_kernel_vm_init(uint64_t memory_start
 	extern char __rodata_start[];
 	u_int blk;
 
+	bti_init();
+
 	vaddr_t kernstart = trunc_page((vaddr_t)__kernel_text);
 	vaddr_t kernend = round_page((vaddr_t)_end);
 	paddr_t kernstart_phys = KERN_VTOPHYS(kernstart);
@@ -464,6 +485,14 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 	NULL, 0,
 	_pac_enabled, 0,
 	CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(clog, 0, NULL, NULL,
+	CTLFLAG_PERMANENT,
+	CTLTYPE_INT, "bti",
+	SYSCTL_DESCR("Whether Branch Target Identification is enabled"),
+	NULL, 0,
+	_bti_enabled, 0,
+	CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 }
 
 void

Index: src/sys/arch/aarch64/aarch64/cpuswitch.S
diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.16 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.17
--- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.16	Sun Apr 12 07:49:58 2020
+++ src/sys/arch/aarch64/aarch64/cpuswitch.S	Mon Apr 13 05:40:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.16 2020/04/12 07:49:58 maxv Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.17 2020/04/13 05:40:25 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include "opt_ddb.h"
 #include "opt_kasan.h"
 
-RCSID("$NetBSD: cpuswitch.S,v 1.16 2020/04/12 07:49:58 maxv Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.17 2020/04/13 05:40:25 maxv Exp $")
 
 	ARMV8_DEFINE_OPTIONS
 
@@ -262,7 +262,8 @@ ENTRY_NP(lwp_trampoline)
 	 */
 	adr	x30, el0_trap_exit	/* tail call via lr */
 	mov	x0, x28			/* mov arg into place */
-	br	x27			/* call function with arg */

CVS commit: src

2020-04-12 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Apr 13 00:27:17 UTC 2020

Modified Files:
src/share/man/man9: pool.9 pool_cache.9
src/sys/arch/arm/arm32: pmap.c
src/sys/arch/xen/x86: xen_shm_machdep.c
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/dev/ic: ncr53c9x.c
src/sys/dev/raidframe: rf_netbsdkintf.c rf_reconmap.c
src/sys/dev/scsipi: scsipi_base.c
src/sys/kern: subr_pool.c
src/sys/opencrypto: cryptodev.c
src/sys/sys: pool.h

Log Message:
slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit()
and pool_prime() (and their pool_cache_* counterparts):

 - the pool_set*wat() APIs are supposed to specify thresholds for the count of
   free items in the pool before pool pages are automatically allocated or freed
   during pool_get() / pool_put(), whereas pool_sethardlimit() and pool_prime()
   are supposed to specify minimum and maximum numbers of total items
   in the pool (both free and allocated).  these were somewhat conflated
   in the existing code, so separate them as they were intended.

 - change pool_prime() to take an absolute number of items to preallocate
   rather than an increment over whatever was done before, and wait for
   any memory allocations to succeed.  since pool_prime() can no longer fail
   after this, change its return value to void and adjust all callers.

 - pool_setlowat() is documented as not immediately attempting to allocate
   any memory, but it was changed some time ago to immediately try to allocate
   up to the lowat level, so just fix the manpage to describe the current
   behaviour.

 - add a pool_cache_prime() to complete the API set.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/share/man/man9/pool.9
cvs rdiff -u -r1.20 -r1.21 src/share/man/man9/pool_cache.9
cvs rdiff -u -r1.402 -r1.403 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/x86/xen_shm_machdep.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/ic/ncr53c9x.c
cvs rdiff -u -r1.381 -r1.382 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_reconmap.c
cvs rdiff -u -r1.185 -r1.186 src/sys/dev/scsipi/scsipi_base.c
cvs rdiff -u -r1.266 -r1.267 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.104 -r1.105 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.89 -r1.90 src/sys/sys/pool.h

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

Modified files:

Index: src/share/man/man9/pool.9
diff -u src/share/man/man9/pool.9:1.47 src/share/man/man9/pool.9:1.48
--- src/share/man/man9/pool.9:1.47	Sun Feb 10 17:15:45 2019
+++ src/share/man/man9/pool.9	Mon Apr 13 00:27:16 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pool.9,v 1.47 2019/02/10 17:15:45 christos Exp $
+.\"	$NetBSD: pool.9,v 1.48 2020/04/13 00:27:16 chs Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2007 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 10, 2019
+.Dd April 12, 2020
 .Dt POOL 9
 .Os
 .Sh NAME
@@ -59,8 +59,8 @@
 .Fn pool_get "struct pool *pp" "int flags"
 .Ft void
 .Fn pool_put "struct pool *pp" "void *item"
-.Ft int
-.Fn pool_prime "struct pool *pp" "int nitems"
+.Ft void
+.Fn pool_prime "struct pool *pp" "int n"
 .Ft void
 .Fn pool_sethiwat "struct pool *pp" "int n"
 .Ft void
@@ -193,28 +193,7 @@ The handle identifying the pool resource
 A pointer to a pool item previously obtained by
 .Fn pool_get .
 .El
-.Ss PRIMING A POOL
-.Fn pool_prime
-adds items to the pool.
-Storage space for the items is allocated by using the page allocation
-routine specified to
-.Fn pool_create .
-.Pp
-The arguments to
-.Fn pool_prime
-are:
-.Bl -tag -offset indent -width "storage"
-.It Fa pp
-The handle identifying the pool resource instance.
-.It Fa nitems
-The number of items to add to the pool.
-.El
 .Pp
-This function may return
-.Dv ENOMEM
-in case the requested number of items could not be allocated.
-Otherwise,
-the return value is 0.
 .Ss SETTING POOL RESOURCE WATERMARKS AND LIMITS
 A pool will attempt to increase its resource usage to keep up with the demand
 for its items.
@@ -222,8 +201,8 @@ Conversely,
 it will return unused memory to the system should the number of accumulated
 unused items in the pool exceed a programmable limit.
 .Pp
-The limits for the minimum and maximum number of items which a pool should keep
-at hand are known as the high and low
+The targets for the minimum and maximum number of free items which a pool should
+try to keep available are known as the high and low
 .Sy watermarks .
 The functions
 .Fn pool_sethiwat
@@ -231,20 +210,27 @@ and
 .Fn pool_setlowat
 set a pool's high and low watermarks, respectively.
 .Pp
-The hard limit represents the maximum number of items a pool is allowed
-to 

CVS commit: src/tests/fs/ffs

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 23:52:20 UTC 2020

Modified Files:
src/tests/fs/ffs: t_extattr.c

Log Message:
make sure that 0 length files get their extattrs cleaned up on deletion
(there was an optimization to not call truncate if size == 0).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/ffs/t_extattr.c

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

Modified files:

Index: src/tests/fs/ffs/t_extattr.c
diff -u src/tests/fs/ffs/t_extattr.c:1.1 src/tests/fs/ffs/t_extattr.c:1.2
--- src/tests/fs/ffs/t_extattr.c:1.1	Fri Apr 10 18:58:47 2020
+++ src/tests/fs/ffs/t_extattr.c	Sun Apr 12 19:52:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_extattr.c,v 1.1 2020/04/10 22:58:47 christos Exp $	*/
+/*	$NetBSD: t_extattr.c,v 1.2 2020/04/12 23:52:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_extattr.c,v 1.1 2020/04/10 22:58:47 christos Exp $");
+__RCSID("$NetBSD: t_extattr.c,v 1.2 2020/04/12 23:52:20 christos Exp $");
 
 #include 
 #include 
@@ -51,14 +51,6 @@ __RCSID("$NetBSD: t_extattr.c,v 1.1 2020
 
 #include "h_macros.h"
 
-ATF_TC_WITH_CLEANUP(extattr);
-ATF_TC_HEAD(extattr, tc)
-{
-	atf_tc_set_md_var(tc, "descr", "test extended attribute support in "
-	"ffsv2");
-	atf_tc_set_md_var(tc, "timeout", "5");
-}
-
 #define IMGNAME "extattr.img"
 
 #define G "/garage"
@@ -90,12 +82,9 @@ check_list(const char *buf, ssize_t nr)
 const char *newfs = "newfs -O 2 -F -s 1 " IMGNAME;
 #define FAKEBLK "/dev/formula1"
 
-ATF_TC_BODY(extattr, tc)
-{
+static void
+start(void) {
 	struct ufs_args args;
-	ssize_t nr;
-	int fd;
-	char buf[512];
 
 	if (system(newfs) == -1)
 		atf_tc_fail_errno("newfs failed");
@@ -113,6 +102,33 @@ ATF_TC_BODY(extattr, tc)
 	/* create extattr */
 	if (rump_sys_chdir(G) == 1)
 		atf_tc_fail_errno("chdir");
+}
+
+static void
+finish(void) {
+	if (rump_sys_chdir("/") == 1)
+		atf_tc_fail_errno("chdir");
+	if (rump_sys_unmount(G, 0) == -1)
+		atf_tc_fail_errno("unmount failed");
+}
+
+
+ATF_TC_WITH_CLEANUP(extattr_simple);
+ATF_TC_HEAD(extattr_simple, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "test extended attribute creation"
+	" and removal ffsv2");
+	atf_tc_set_md_var(tc, "timeout", "5");
+}
+
+ATF_TC_BODY(extattr_simple, tc)
+{
+	ssize_t nr;
+	int fd;
+	char buf[512];
+
+	start();
+
 	if ((fd = rump_sys_open(M, O_RDWR | O_CREAT, 0600)) == -1)
 		atf_tc_fail_errno("open");
 	if (rump_sys_write(fd, "hi mom\n", 7) != 7)
@@ -161,9 +177,46 @@ ATF_TC_BODY(extattr, tc)
 		atf_tc_fail_errno("close");
 	if (rump_sys_unlink(M) == -1)
 		atf_tc_fail_errno("unlink");
+
+	finish();
+}
+
+ATF_TC_CLEANUP(extattr_simple, tc)
+{
+
+	unlink(IMGNAME);
+}
+
+ATF_TC_WITH_CLEANUP(extattr_create_unlink);
+ATF_TC_HEAD(extattr_create_unlink, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "test extended attribute creation"
+	" and unlinking file with ACLs");
+	atf_tc_set_md_var(tc, "timeout", "5");
+}
+
+ATF_TC_BODY(extattr_create_unlink, tc)
+{
+	int fd;
+
+	start();
+	if ((fd = rump_sys_open(M, O_RDWR | O_CREAT, 0600)) == -1)
+		atf_tc_fail_errno("open");
+
+	if (rump_sys_close(fd) == -1)
+		atf_tc_fail_errno("close");
+
+	/* create extattr */
+	if (rump_sys_extattr_set_file(M, EXTATTR_NAMESPACE_USER, T, S, 9) == -1)
+		atf_tc_fail_errno("extattr_set_file");
+
+	if (rump_sys_unlink(M) == -1)
+		atf_tc_fail_errno("unlink");
+	finish();
+
 }
 
-ATF_TC_CLEANUP(extattr, tc)
+ATF_TC_CLEANUP(extattr_create_unlink, tc)
 {
 
 	unlink(IMGNAME);
@@ -171,6 +224,7 @@ ATF_TC_CLEANUP(extattr, tc)
 
 ATF_TP_ADD_TCS(tp)
 {
-	ATF_TP_ADD_TC(tp, extattr);
+	ATF_TP_ADD_TC(tp, extattr_simple);
+	ATF_TP_ADD_TC(tp, extattr_create_unlink);
 	return atf_no_error();
 }



CVS commit: src/sys/kern

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 22:06:18 UTC 2020

Modified Files:
src/sys/kern: syscalls.master

Log Message:
put back the MODULAR attributes accidentally removed.


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/sys/kern/syscalls.master

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

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.300 src/sys/kern/syscalls.master:1.301
--- src/sys/kern/syscalls.master:1.300	Sun Apr 12 09:37:12 2020
+++ src/sys/kern/syscalls.master	Sun Apr 12 18:06:17 2020
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.300 2020/04/12 13:37:12 christos Exp $
+	$NetBSD: syscalls.master,v 1.301 2020/04/12 22:06:17 christos Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -331,7 +331,7 @@
 152	UNIMPL
 153	UNIMPL
 154	UNIMPL
-155	STD	RUMP  { int|sys||nfssvc(int flag, void *argp); }
+155	STD MODULAR nfsserver RUMP  { int|sys||nfssvc(int flag, void *argp); }
 156	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||getdirentries(int fd, char *buf, \
 			u_int count, long *basep); } ogetdirentries
@@ -516,18 +516,18 @@
 245	STD		{ int|sys||sigqueueinfo(pid_t pid, \
 			const siginfo_t *info); }
 246	STD	RUMP	{ int|sys||modctl(int cmd, void *arg); }
-247	STD	RUMP { int|sys||_ksem_init(unsigned int value, intptr_t *idp); }
-248	STD	RUMP { int|sys||_ksem_open(const char *name, int oflag, \
+247	STD MODULAR ksem RUMP { int|sys||_ksem_init(unsigned int value, intptr_t *idp); }
+248	STD MODULAR ksem RUMP { int|sys||_ksem_open(const char *name, int oflag, \
 			mode_t mode, unsigned int value, intptr_t *idp); }
-249	STD	RUMP { int|sys||_ksem_unlink(const char *name); }
-250	STD	RUMP { int|sys||_ksem_close(intptr_t id); }
-251	STD	RUMP { int|sys||_ksem_post(intptr_t id); }
-252	STD	RUMP { int|sys||_ksem_wait(intptr_t id); }
-253	STD	RUMP { int|sys||_ksem_trywait(intptr_t id); }
-254	STD	RUMP { int|sys||_ksem_getvalue(intptr_t id, \
+249	STD MODULAR ksem RUMP { int|sys||_ksem_unlink(const char *name); }
+250	STD MODULAR ksem RUMP { int|sys||_ksem_close(intptr_t id); }
+251	STD MODULAR ksem RUMP { int|sys||_ksem_post(intptr_t id); }
+252	STD MODULAR ksem RUMP { int|sys||_ksem_wait(intptr_t id); }
+253	STD MODULAR ksem RUMP { int|sys||_ksem_trywait(intptr_t id); }
+254	STD MODULAR ksem RUMP { int|sys||_ksem_getvalue(intptr_t id, \
 			unsigned int *value); }
-255	STD	RUMP { int|sys||_ksem_destroy(intptr_t id); }
-256	STD	RUMP { int|sys||_ksem_timedwait(intptr_t id, \
+255	STD MODULAR ksem RUMP { int|sys||_ksem_destroy(intptr_t id); }
+256	STD MODULAR ksem RUMP { int|sys||_ksem_timedwait(intptr_t id, \
 const struct timespec *abstime); }
 257	STD MODULAR mqueue	\
 			{ mqd_t|sys||mq_open(const char * name, int oflag, \
@@ -819,22 +819,22 @@
 			size_t fh_size, struct stat30 *sb); }
 
 ; Asynchronous I/O system calls
-399	STD	RUMP	\
+399	STD MODULAR aio RUMP	\
 		{ int|sys||aio_cancel(int fildes, struct aiocb *aiocbp); }
-400	STD	RUMP	\
+400	STD MODULAR aio RUMP	\
 		{ int|sys||aio_error(const struct aiocb *aiocbp); }
-401	STD	RUMP	\
+401	STD MODULAR aio RUMP	\
 		{ int|sys||aio_fsync(int op, struct aiocb *aiocbp); }
-402	STD	RUMP	\
+402	STD MODULAR aio RUMP	\
 		{ int|sys||aio_read(struct aiocb *aiocbp); }
-403	STD	RUMP	\
+403	STD MODULAR aio RUMP	\
 		{ int|sys||aio_return(struct aiocb *aiocbp); }
 404	COMPAT_50 MODULAR compat	\
 		{ int|sys||aio_suspend(const struct aiocb *const *list, \
 		int nent, const struct timespec50 *timeout); }
-405	STD	RUMP	\
+405	STD MODULAR aio RUMP	\
 		{ int|sys||aio_write(struct aiocb *aiocbp); }
-406	STD	RUMP	\
+406	STD MODULAR aio RUMP	\
 		{ int|sys||lio_listio(int mode, struct aiocb *const *list, \
 		int nent, struct sigevent *sig); }
 
@@ -912,7 +912,7 @@
 			const sigset_t *mask); }
 437	STD	RUMP	{ int|sys|50|pollts(struct pollfd *fds, u_int nfds, \
 			const struct timespec *ts, const sigset_t *mask); }
-438	STD	RUMP { int|sys|50|aio_suspend( \
+438	STD MODULAR aio RUMP { int|sys|50|aio_suspend( \
 			const struct aiocb *const *list, \
 			int nent, const struct timespec *timeout); }
 439	STD	RUMP	{ int|sys|50|stat(const char *path, struct stat *ub); }



CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/conf

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 21:20:16 UTC 2020

Modified Files:
src/sys/arch/amd64/conf [bouyer-xenpvh]: XEN3_DOM0

Log Message:
no MULTIPROCESSOR so NO_PREEMTION


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.175.4.1 src/sys/arch/amd64/conf/XEN3_DOM0

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/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.175 src/sys/arch/amd64/conf/XEN3_DOM0:1.175.4.1
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.175	Sun Feb  9 16:06:18 2020
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sun Apr 12 21:20:16 2020
@@ -1,9 +1,10 @@
-# $NetBSD: XEN3_DOM0,v 1.175 2020/02/09 16:06:18 jmcneill Exp $
+# $NetBSD: XEN3_DOM0,v 1.175.4.1 2020/04/12 21:20:16 bouyer Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
 options		XENPV		# PV dom0 support
 #options 	MULTIPROCESSOR	# (not yet - dom0 stuff is not MP-safe)
+options 	NO_PREEMPTION
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
@@ -11,7 +12,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.175 $"
+#ident		"XEN3_DOM0-$Revision: 1.175.4.1 $"
 
 maxusers	32		# estimated number of users
 
@@ -60,7 +61,7 @@ options 	DDB_ONPANIC=1	# see also sysctl
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #options 	KGDB		# remote debugger
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
-#makeoptions	DEBUG="-g"	# compile full symbol table
+makeoptions	DEBUG="-g"	# compile full symbol table
 makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
 options DDB_COMMANDONENTER="show registers"
 



CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 21:19:49 UTC 2020

Modified Files:
src/sys/arch/xen/x86 [bouyer-xenpvh]: autoconf.c

Log Message:
remove stray 'else'


To generate a diff of this commit:
cvs rdiff -u -r1.23.8.1 -r1.23.8.2 src/sys/arch/xen/x86/autoconf.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/xen/x86/autoconf.c
diff -u src/sys/arch/xen/x86/autoconf.c:1.23.8.1 src/sys/arch/xen/x86/autoconf.c:1.23.8.2
--- src/sys/arch/xen/x86/autoconf.c:1.23.8.1	Wed Apr  8 17:59:16 2020
+++ src/sys/arch/xen/x86/autoconf.c	Sun Apr 12 21:19:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.23.8.1 2020/04/08 17:59:16 bouyer Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.23.8.2 2020/04/12 21:19:49 bouyer Exp $	*/
 /*	NetBSD: autoconf.c,v 1.75 2003/12/30 12:33:22 pk Exp 	*/
 
 /*-
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23.8.1 2020/04/08 17:59:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23.8.2 2020/04/12 21:19:49 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "opt_multiprocessor.h"
@@ -126,7 +126,7 @@ cpu_configure(void)
 		/* identify hypervisor type from SMBIOS */
 		identify_hypervisor();
 #endif /* NBIOS32 > 0 */
-	} else
+	}
 #endif /* DOM0OPS */
 #ifdef PCIBIOS
 	pcibios_init();



CVS commit: src/sys/arch/xen/xen

2020-04-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 12 20:17:36 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
convert to bus_dma(9)

simplify and fix error handling in xbd_handler(), expect backend
to not use the grant once request is finished, and avoid leaking
bounce buffer when the request using it happens to end with error

in xbd_diskstart() only do the RING_PUSH_REQUESTS_AND_CHECK_NOTIFY()
when actually the request was pushed successfully


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/xen/xen/xbd_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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.104 src/sys/arch/xen/xen/xbd_xenbus.c:1.105
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.104	Sun Apr 12 18:14:09 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Sun Apr 12 20:17:36 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.104 2020/04/12 18:14:09 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.105 2020/04/12 20:17:36 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.104 2020/04/12 18:14:09 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.105 2020/04/12 20:17:36 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -100,10 +100,10 @@ __KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c
 struct xbd_req {
 	SLIST_ENTRY(xbd_req) req_next;
 	uint16_t req_id; /* ID passed to backend */
+	bus_dmamap_t req_dmamap;
 	union {
 	struct {
 		grant_ref_t req_gntref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
-		int req_nr_segments; /* number of segments in this request */
 		struct buf *req_bp; /* buffer associated with this request */
 		void *req_data; /* pointer to the data buffer */
 	} req_rw;
@@ -114,7 +114,6 @@ struct xbd_req {
 	} u;
 };
 #define req_gntref	u.req_rw.req_gntref
-#define req_nr_segments	u.req_rw.req_nr_segments
 #define req_bp		u.req_rw.req_bp
 #define req_data	u.req_rw.req_data
 #define req_sync	u.req_sync
@@ -288,6 +287,16 @@ xbd_xenbus_attach(device_t parent, devic
 	evcnt_attach_dynamic(>sc_cnt_map_unalign, EVCNT_TYPE_MISC,
 	NULL, device_xname(self), "map unaligned");
 
+	for (i = 0; i < XBD_RING_SIZE; i++) {
+		if (bus_dmamap_create(sc->sc_xbusd->xbusd_dmat,
+		XBD_MAX_XFER, BLKIF_MAX_SEGMENTS_PER_REQUEST,
+		PAGE_SIZE, PAGE_SIZE, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
+		>sc_reqs[i].req_dmamap) != 0) {
+			aprint_error_dev(self, "can't alloc dma maps\n");
+			return;
+		}
+	}
+
 	/* resume shared structures and tell backend that we are ready */
 	if (xbd_xenbus_resume(self, PMF_Q_NONE) == false) {
 		uvm_km_free(kernel_map, (vaddr_t)ring, PAGE_SIZE,
@@ -371,6 +380,14 @@ xbd_xenbus_detach(device_t dev, int flag
 	uvm_km_free(kernel_map, (vaddr_t)sc->sc_ring.sring,
 	PAGE_SIZE, UVM_KMF_WIRED);
 
+	for (i = 0; i < XBD_RING_SIZE; i++) {
+		if (sc->sc_reqs[i].req_dmamap != NULL) {
+			bus_dmamap_destroy(sc->sc_xbusd->xbusd_dmat,
+			sc->sc_reqs[i].req_dmamap);
+			sc->sc_reqs[i].req_dmamap = NULL;
+		}
+	}
+
 	evcnt_detach(>sc_cnt_map_unalign);
 
 	pmf_device_deregister(dev);
@@ -686,41 +703,38 @@ again:
 			continue;
 		}
 
-		for (seg = xbdreq->req_nr_segments - 1; seg >= 0; seg--) {
-			if (__predict_false(
-			xengnt_status(xbdreq->req_gntref[seg]))) {
-aprint_verbose_dev(sc->sc_dksc.sc_dev,
-	"grant still used by backend\n");
-sc->sc_ring.rsp_cons = i;
-xbdreq->req_nr_segments = seg + 1;
-goto done;
-			}
+		for (seg = 0; seg < xbdreq->req_dmamap->dm_nsegs; seg++) {
+			/*
+			 * We are not allowing persistent mappings, so
+			 * expect the backend to release the grant
+			 * immediately.
+			 */
+			KASSERT(xengnt_status(xbdreq->req_gntref[seg]) == 0);
 			xengnt_revoke_access(xbdreq->req_gntref[seg]);
-			xbdreq->req_nr_segments--;
 		}
-		KASSERT(xbdreq->req_nr_segments == 0);
+
+		bus_dmamap_unload(sc->sc_xbusd->xbusd_dmat, xbdreq->req_dmamap);
 
 		bp = xbdreq->req_bp;
-		KASSERT(bp != NULL);
+		KASSERT(bp != NULL && bp->b_data != NULL);
 		DPRINTF(("%s(%p): b_bcount = %ld\n", __func__,
 		bp, (long)bp->b_bcount));
 
+		if (__predict_false(bp->b_data != xbdreq->req_data))
+			xbd_unmap_align(xbdreq);
+		xbdreq->req_bp = xbdreq->req_data = NULL;
+
+		/* b_resid was set in dk_start, only override on error */
 		if (rep->status != BLKIF_RSP_OKAY) {
 			bp->b_error = EIO;
 			bp->b_resid = bp->b_bcount;
-			goto next;
 		}
-		/* b_resid was set in dk_start */
-		if (__predict_false(
-		xbdreq->req_data != NULL && bp->b_data != xbdreq->req_data))
-			xbd_unmap_align(xbdreq);
-next:
-		xbdreq->req_bp = NULL;
+
 		dk_done(>sc_dksc, bp);
 
 		SLIST_INSERT_HEAD(>sc_xbdreq_head, xbdreq, req_next);
 	}
-done:
+
 	xen_rmb();
 	sc->sc_ring.rsp_cons = i;
 
@@ -937,9 +951,8 @@ xbd_diskstart(device_t self, struct buf 
 	struct 

CVS commit: src/sys/kern

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 19:56:14 UTC 2020

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
Oops missed one more NULL -> NOCRED


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/sys/kern/vfs_vnops.c

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

Modified files:

Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.209 src/sys/kern/vfs_vnops.c:1.210
--- src/sys/kern/vfs_vnops.c:1.209	Sun Apr 12 11:55:53 2020
+++ src/sys/kern/vfs_vnops.c	Sun Apr 12 15:56:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.209 2020/04/12 15:55:53 christos Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.210 2020/04/12 19:56:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.209 2020/04/12 15:55:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.210 2020/04/12 19:56:14 christos Exp $");
 
 #include "veriexec.h"
 
@@ -1161,7 +1161,7 @@ vn_extattr_rm(struct vnode *vp, int iofl
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	}
 
-	error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, NULL);
+	error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, NOCRED);
 	if (error == EOPNOTSUPP)
 		error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
 		NOCRED);



CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 19:53:37 UTC 2020

Modified Files:
src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c

Log Message:
We need to call x86_init_preempt() for all CPUs now.


To generate a diff of this commit:
cvs rdiff -u -r1.21.2.2 -r1.21.2.3 src/sys/arch/xen/x86/xen_intr.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/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.21.2.2 src/sys/arch/xen/x86/xen_intr.c:1.21.2.3
--- src/sys/arch/xen/x86/xen_intr.c:1.21.2.2	Sun Apr 12 17:25:52 2020
+++ src/sys/arch/xen/x86/xen_intr.c	Sun Apr 12 19:53:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.21.2.2 2020/04/12 17:25:52 bouyer Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.2 2020/04/12 17:25:52 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -306,6 +306,11 @@ void xen_cpu_intr_init(struct cpu_info *
 void
 xen_cpu_intr_init(struct cpu_info *ci)
 {
+#if defined(__HAVE_PREEMPTION)
+	x86_init_preempt(ci);
+#endif
+	x86_intr_calculatemasks(ci);
+
 #if defined(INTRSTACKSIZE)
 	vaddr_t istack;
 



CVS commit: src/sys/arch/xen/xen

2020-04-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 12 18:14:09 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
add KASSERT() for unaligned case to make sure it indeed happens only
for requests via physio


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/xen/xen/xbd_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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.103 src/sys/arch/xen/xen/xbd_xenbus.c:1.104
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.103	Sat Apr 11 17:52:01 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Sun Apr 12 18:14:09 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.103 2020/04/11 17:52:01 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.104 2020/04/12 18:14:09 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.103 2020/04/11 17:52:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.104 2020/04/12 18:14:09 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -985,6 +985,9 @@ xbd_diskstart(device_t self, struct buf 
 	xbdreq->req_bp = bp;
 	xbdreq->req_data = bp->b_data;
 	if (__predict_false((vaddr_t)bp->b_data & (XEN_BSIZE - 1))) {
+		/* Only can get here if this is physio() request */
+		KASSERT(bp->b_saveaddr != NULL);
+
 		sc->sc_cnt_map_unalign.ev_count++;
 
 		if (__predict_false(xbd_map_align(xbdreq) != 0)) {



CVS commit: [netbsd-9] src/external/bsd/dhcpcd/dist/src

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 17:57:13 UTC 2020

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-9]: dhcp6.c

Log Message:
Fix SMALL builds (requested by roy informally)


To generate a diff of this commit:
cvs rdiff -u -r1.11.2.6 -r1.11.2.7 src/external/bsd/dhcpcd/dist/src/dhcp6.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/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.6 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.7
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.6	Sun Apr 12 17:33:24 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Sun Apr 12 17:57:13 2020
@@ -2950,11 +2950,13 @@ dhcp6_bind(struct interface *ifp, const 
 	if (!timedout) {
 		logmessage(loglevel, "%s: %s received from %s",
 		ifp->name, op, sfrom);
+#ifndef SMALL
 		/* If we delegated from an unconfirmed lease we MUST drop
 		 * them now. Hopefully we have new delegations. */
 		if (state->reason != NULL &&
 		strcmp(state->reason, "TIMEOUT6") == 0)
 			dhcp6_delete_delegates(ifp);
+#endif
 		state->reason = NULL;
 	} else
 		state->reason = "TIMEOUT6";



CVS commit: src/doc

2020-04-12 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Sun Apr 12 17:49:00 UTC 2020

Modified Files:
src/doc: HACKS

Log Message:
Hack removed in src/external/bsd/nvi/usr.bin/nvi/Makefile,-r1.21

It is no longer needed, per PR bin/54656.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.200 src/doc/HACKS:1.201
--- src/doc/HACKS:1.200	Sat Apr  4 16:25:17 2020
+++ src/doc/HACKS	Sun Apr 12 17:49:00 2020
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.200 2020/04/04 16:25:17 jdolecek Exp $
+# $NetBSD: HACKS,v 1.201 2020/04/12 17:49:00 leot Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -900,14 +900,6 @@ file	/cvsroot/src/external/mit/xorg/lib/
 descr	gallium does not compile.
 kcah
 
-port	aarch64
-hack	compile ex_filter.c in vi with -O0
-cdate	Mon Oct 28 14:39:35 EDT 2019
-who	christos
-file	/cvsroot/src/external/bsd/nvi/usr.bin/nvi/Makefile 1.20
-descr	":%! sort" core-dumps, tm is NULL but was not NULL on entry.
-kcah
-
 port	sh3
 hack	compile parse.c in battlestar with -Wno-restrict
 cdate	Mon Oct 28 14:39:35 EDT 2019



CVS commit: [netbsd-9] src/doc

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 17:34:34 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Ticket #830


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.33 -r1.1.2.34 src/doc/CHANGES-9.1

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

Modified files:

Index: src/doc/CHANGES-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.33 src/doc/CHANGES-9.1:1.1.2.34
--- src/doc/CHANGES-9.1:1.1.2.33	Sun Apr 12 08:50:25 2020
+++ src/doc/CHANGES-9.1	Sun Apr 12 17:34:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.33 2020/04/12 08:50:25 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.34 2020/04/12 17:34:34 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -892,3 +892,9 @@ sys/dev/acpi/acpi_ec.c1.78-1.81
 	Reject overly large widths.
 	[riastradh, ticket #829]
 
+external/bsd/dhcpcd/dist/src/dhcp6.c		(apply patch)
+external/bsd/dhcpcd/dist/src/defs.h		(apply patch)
+doc/3RDPARTY	(apply patch)
+
+	Update to dhcpcd-8.1.8 which fixes a compile issue.
+	[roy, ticket #830]



CVS commit: [netbsd-9] src

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 17:33:24 UTC 2020

Modified Files:
src/doc [netbsd-9]: 3RDPARTY
src/external/bsd/dhcpcd/dist/src [netbsd-9]: defs.h dhcp6.c

Log Message:
Apply patch, requested by roy in ticket #830:

external/bsd/dhcpcd/dist/src/dhcp6.c(apply patch)
external/bsd/dhcpcd/dist/src/defs.h (apply patch)
doc/3RDPARTY(apply patch)

Update to dhcpcd-8.1.8 which fixes a compile issue.


To generate a diff of this commit:
cvs rdiff -u -r1.1640.2.13 -r1.1640.2.14 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.25.2.7 -r1.1.1.25.2.8 \
src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.11.2.5 -r1.11.2.6 src/external/bsd/dhcpcd/dist/src/dhcp6.c

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.1640.2.13 src/doc/3RDPARTY:1.1640.2.14
--- src/doc/3RDPARTY:1.1640.2.13	Sun Apr 12 08:29:40 2020
+++ src/doc/3RDPARTY	Sun Apr 12 17:33:24 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1640.2.13 2020/04/12 08:29:40 martin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1640.2.14 2020/04/12 17:33:24 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -341,12 +341,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	8.1.7
-Current Vers:	8.1.7
+Version:	8.1.8
+Current Vers:	8.1.8
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-04-10
+Date:		2020-04-12
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/external/bsd/dhcpcd/dist/src/defs.h
diff -u src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.7 src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.8
--- src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.7	Sun Apr 12 08:29:40 2020
+++ src/external/bsd/dhcpcd/dist/src/defs.h	Sun Apr 12 17:33:24 2020
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"8.1.7"
+#define VERSION			"8.1.8"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"

Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.5 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.6
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.5	Sun Apr 12 08:29:40 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Sun Apr 12 17:33:24 2020
@@ -3943,16 +3943,17 @@ dhcp6_free(struct interface *ifp)
 void
 dhcp6_abort(struct interface *ifp)
 {
-#ifdef ND6_ADVERTISE
 	struct dhcp6_state *state;
+#ifdef ND6_ADVERTISE
 	struct ipv6_addr *ia;
 #endif
 
 	eloop_timeout_delete(ifp->ctx->eloop, dhcp6_start1, ifp);
-#ifdef ND6_ADVERTISE
 	state = D6_STATE(ifp);
 	if (state == NULL)
 		return;
+
+#ifdef ND6_ADVERTISE
 	TAILQ_FOREACH(ia, >addrs, next) {
 		ipv6nd_advertise(ia);
 	}



CVS commit: src/external/bsd/nvi/usr.bin/nvi

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 17:28:57 UTC 2020

Modified Files:
src/external/bsd/nvi/usr.bin/nvi: Makefile

Log Message:
Remove no longer needed workaround for PR/54656.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/nvi/usr.bin/nvi/Makefile

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

Modified files:

Index: src/external/bsd/nvi/usr.bin/nvi/Makefile
diff -u src/external/bsd/nvi/usr.bin/nvi/Makefile:1.20 src/external/bsd/nvi/usr.bin/nvi/Makefile:1.21
--- src/external/bsd/nvi/usr.bin/nvi/Makefile:1.20	Tue Oct 29 21:14:37 2019
+++ src/external/bsd/nvi/usr.bin/nvi/Makefile	Sun Apr 12 17:28:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2019/10/29 21:14:37 christos Exp $
+#	$NetBSD: Makefile,v 1.21 2020/04/12 17:28:57 martin Exp $
 
 .include 
 
@@ -114,10 +114,6 @@ version.h:	../../Makefile.inc
 #	${_MKTARGET_CREATE}
 #	${TOOL_PERL} -n ${.ALLSRC} > ${.TARGET}
 
-.if ${MACHINE_ARCH} == "aarch64"
-COPTS.ex_filter.c+=-O0
-.endif
-
 
 .include "${.CURDIR}/../../Makefile.inc"
 



CVS commit: [bouyer-xenpvh] src/sys/arch

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 17:25:53 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64 [bouyer-xenpvh]: genassym.cf lock_stubs.S
spl.S vector.S
src/sys/arch/i386/i386 [bouyer-xenpvh]: genassym.cf i386_trap.S
locore.S spl.S vector.S
src/sys/arch/x86/include [bouyer-xenpvh]: cpu.h intrdefs.h
src/sys/arch/x86/isa [bouyer-xenpvh]: isa_machdep.c
src/sys/arch/x86/x86 [bouyer-xenpvh]: i8259.c intr.c
src/sys/arch/xen/include [bouyer-xenpvh]: hypervisor.h intr.h
src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c xen_intr.c
src/sys/arch/xen/xen [bouyer-xenpvh]: clock.c evtchn.c xenevt.c

Log Message:
Get rid of xen-specific ci_x* interrupt handling:
- use the general SIR mechanism, reserving 3 more slots for IPL_VM, IPL_SCHED
  and IPL_HIGH
- remove specific handling from C sources, or change to ipending
- convert IPL number to SIR number in various places
- Remove XUNMASK/XPENDING in assembly or change to IUNMASK/IPENDING
- remove Xen-specific ci_xsources, ci_xmask, ci_xunmask, ci_xpending from
  struct cpu_info
- for now remove a KASSERT that there are no pending interrupts in
  idle_block(). We can get there with some software interrupts pending
  in autoconf XXX needs to be looked at.


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.2 -r1.82.4.3 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.35.6.1 -r1.35.6.2 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.43.4.5 -r1.43.4.6 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.73.6.2 -r1.73.6.3 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.119.4.2 -r1.119.4.3 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.179.2.1 -r1.179.2.2 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.50.4.4 -r1.50.4.5 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.85.6.3 -r1.85.6.4 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.117.4.3 -r1.117.4.4 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/arch/x86/include/intrdefs.h
cvs rdiff -u -r1.44 -r1.44.10.1 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.23 -r1.23.10.1 src/sys/arch/x86/x86/i8259.c
cvs rdiff -u -r1.150.6.1 -r1.150.6.2 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.49 -r1.49.10.1 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.53 -r1.53.6.1 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.36 -r1.36.8.1 src/sys/arch/xen/x86/hypervisor_machdep.c
cvs rdiff -u -r1.21.2.1 -r1.21.2.2 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.80.6.1 -r1.80.6.2 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.88.2.2 -r1.88.2.3 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.56 -r1.56.2.1 src/sys/arch/xen/xen/xenevt.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/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.82.4.2 src/sys/arch/amd64/amd64/genassym.cf:1.82.4.3
--- src/sys/arch/amd64/amd64/genassym.cf:1.82.4.2	Sat Apr 11 10:11:30 2020
+++ src/sys/arch/amd64/amd64/genassym.cf	Sun Apr 12 17:25:52 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.82.4.2 2020/04/11 10:11:30 bouyer Exp $
+#	$NetBSD: genassym.cf,v 1.82.4.3 2020/04/12 17:25:52 bouyer Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -323,6 +323,8 @@ define	IPL_NONE		IPL_NONE
 define	IPL_PREEMPT		IPL_PREEMPT
 define	IPL_NET			IPL_NET
 define	IPL_CLOCK		IPL_CLOCK
+define	IPL_VM			IPL_VM
+define	IPL_SCHED		IPL_SCHED
 define	IPL_HIGH		IPL_HIGH
 
 define	LIR_IPI			LIR_IPI
@@ -362,10 +364,9 @@ define	VM_GUEST_XENPV		VM_GUEST_XENPV
 
 ifdef XEN
 define CPU_INFO_VCPU		offsetof(struct cpu_info, ci_vcpu)
-define CPU_INFO_XPENDING	offsetof(struct cpu_info, ci_xpending)
-define CPU_INFO_XMASK		offsetof(struct cpu_info, ci_xmask)
-define CPU_INFO_XUNMASK		offsetof(struct cpu_info, ci_xunmask)
-define CPU_INFO_XSOURCES	offsetof(struct cpu_info, ci_xsources)
+define SIR_XENIPL_VM		SIR_XENIPL_VM
+define SIR_XENIPL_SCHED		SIR_XENIPL_SCHED
+define SIR_XENIPL_HIGH		SIR_XENIPL_HIGH
 define EVTCHN_UPCALL_MASK	offsetof(struct vcpu_info, evtchn_upcall_mask)
 ifdef XENPV
 define XEN_PT_BASE		offsetof(struct start_info, pt_base)

Index: src/sys/arch/amd64/amd64/lock_stubs.S
diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.1 src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.2
--- src/sys/arch/amd64/amd64/lock_stubs.S:1.35.6.1	Sat Apr 11 18:26:06 2020
+++ src/sys/arch/amd64/amd64/lock_stubs.S	Sun Apr 12 17:25:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.35.6.1 2020/04/11 18:26:06 bouyer Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.35.6.2 2020/04/12 17:25:52 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -130,11 +130,6 @@ ENTRY(mutex_spin_exit)
 	CLI(ax)
 	testl	CPU_INFO_IPENDING(%r8), %esi
 	jnz	_C_LABEL(Xspllower)
-#if defined(XEN)
-	movl	

CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 17:17:38 UTC 2020

Modified Files:
src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_ipi.c

Log Message:
Add XEN_IPI_KPREEMPT to list of valid IPIs


To generate a diff of this commit:
cvs rdiff -u -r1.35.6.1 -r1.35.6.2 src/sys/arch/xen/x86/xen_ipi.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/xen/x86/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.35.6.1 src/sys/arch/xen/x86/xen_ipi.c:1.35.6.2
--- src/sys/arch/xen/x86/xen_ipi.c:1.35.6.1	Sat Apr 11 18:26:07 2020
+++ src/sys/arch/xen/x86/xen_ipi.c	Sun Apr 12 17:17:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.35.6.1 2020/04/11 18:26:07 bouyer Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc.
@@ -33,10 +33,10 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.1 2020/04/11 18:26:07 bouyer Exp $");
+ * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $");
  */
 
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.1 2020/04/11 18:26:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.2 2020/04/12 17:17:38 bouyer Exp $");
 
 #include "opt_ddb.h"
 
@@ -156,7 +156,7 @@ valid_ipimask(uint32_t ipimask)
 {
 	uint32_t masks = XEN_IPI_GENERIC | XEN_IPI_HVCB | XEN_IPI_XCALL |
 		 XEN_IPI_DDB | XEN_IPI_SYNCH_FPU |
-		 XEN_IPI_HALT | XEN_IPI_KICK | XEN_IPI_AST;
+		 XEN_IPI_HALT | XEN_IPI_KICK | XEN_IPI_AST | XEN_IPI_KPREEMPT;
 
 	if (ipimask & ~masks) {
 		return false;



CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 17:16:58 UTC 2020

Modified Files:
src/sys/arch/xen/x86 [bouyer-xenpvh]: xenfunc.c

Log Message:
kpreempt_disable() only for x86_64 (which calls pmap_changeprot_local)).
On i386 curcpu() is not valid yet and we don't need preemption disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.26.8.1 -r1.26.8.2 src/sys/arch/xen/x86/xenfunc.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/xen/x86/xenfunc.c
diff -u src/sys/arch/xen/x86/xenfunc.c:1.26.8.1 src/sys/arch/xen/x86/xenfunc.c:1.26.8.2
--- src/sys/arch/xen/x86/xenfunc.c:1.26.8.1	Sat Apr 11 18:26:07 2020
+++ src/sys/arch/xen/x86/xenfunc.c	Sun Apr 12 17:16:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenfunc.c,v 1.26.8.1 2020/04/11 18:26:07 bouyer Exp $	*/
+/*	$NetBSD: xenfunc.c,v 1.26.8.2 2020/04/12 17:16:58 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2004 Christian Limpach.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.26.8.1 2020/04/11 18:26:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.26.8.2 2020/04/12 17:16:58 bouyer Exp $");
 
 #include 
 
@@ -61,7 +61,9 @@ lidt(struct region_descriptor *rd)
 	 * will be available at the boot stage when this is called.
 	 */
 	static char xen_idt_page[PAGE_SIZE] __attribute__((__aligned__ (PAGE_SIZE)));
+#if defined(__x86_64__)
 	kpreempt_disable();
+#endif
 	memset(xen_idt_page, 0, PAGE_SIZE);
 	
 	struct trap_info *xen_idt = (void * )xen_idt_page;
@@ -96,8 +98,8 @@ lidt(struct region_descriptor *rd)
 #if defined(__x86_64__)
 	/* reset */
 	pmap_changeprot_local((vaddr_t) xen_idt, VM_PROT_READ|VM_PROT_WRITE);
-#endif /* __x86_64 */
 	kpreempt_enable();
+#endif /* __x86_64 */
 }
 
 void



CVS commit: src/distrib/notes/hp300

2020-04-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Apr 12 17:13:30 UTC 2020

Modified Files:
src/distrib/notes/hp300: hardware

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/distrib/notes/hp300/hardware

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

Modified files:

Index: src/distrib/notes/hp300/hardware
diff -u src/distrib/notes/hp300/hardware:1.20 src/distrib/notes/hp300/hardware:1.21
--- src/distrib/notes/hp300/hardware:1.20	Sat Mar 25 23:33:11 2017
+++ src/distrib/notes/hp300/hardware	Sun Apr 12 17:13:29 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.20 2017/03/25 23:33:11 tsutsui Exp $
+.\"	$NetBSD: hardware,v 1.21 2020/04/12 17:13:29 tsutsui Exp $
 .
 .Nx*M
 \*V will run on most HP 9000/300- and 400-series machines.
@@ -63,7 +63,7 @@ up to 128 MB RAM)
 .Ql SERVICE/NORMAL
 .Em "switch on the back panel is turned to"
 .Ql SERVICE
-.Em "potision."
+.Em "position."
 .It
 433s, 433t, 433dl (33 MHz 68040 with built-in SCSI, up to 128 MB RAM)
 .bullet)



CVS commit: src/sys/kern

2020-04-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 12 17:02:52 UTC 2020

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
fix wapbl_discard() to actually discard the queued bufs properly - need
to set BC_INVAL for them, and also need to explicitly remove them
from the BQ_LOCKED queue

fixes DIAGNOSTIC panic when force unmounting unresponsive disk device
PR kern/51178 by Michael van Elst


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/kern/vfs_wapbl.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/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.107 src/sys/kern/vfs_wapbl.c:1.108
--- src/sys/kern/vfs_wapbl.c:1.107	Sun Apr 12 08:51:41 2020
+++ src/sys/kern/vfs_wapbl.c	Sun Apr 12 17:02:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.107 2020/04/12 08:51:41 jdolecek Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.108 2020/04/12 17:02:52 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.107 2020/04/12 08:51:41 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.108 2020/04/12 17:02:52 jdolecek Exp $");
 
 #include 
 #include 
@@ -777,12 +777,16 @@ wapbl_discard(struct wapbl *wl)
 	mutex_enter(>wl_mtx);
 	while ((bp = TAILQ_FIRST(>wl_bufs)) != NULL) {
 		if (bbusy(bp, 0, 0, >wl_mtx) == 0) {
+			KASSERT(bp->b_flags & B_LOCKED);
+			KASSERT(bp->b_oflags & BO_DELWRI);
 			/*
+			 * Buffer is already on BQ_LOCKED queue.
 			 * The buffer will be unlocked and
-			 * removed from the transaction in brelse
+			 * removed from the transaction in brelsel()
 			 */
 			mutex_exit(>wl_mtx);
-			brelsel(bp, 0);
+			bremfree(bp);
+			brelsel(bp, BC_INVAL);
 			mutex_enter(>wl_mtx);
 		}
 	}



CVS commit: [bouyer-xenpvh] src/sys/arch/i386/i386

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 16:35:49 UTC 2020

Modified Files:
src/sys/arch/i386/i386 [bouyer-xenpvh]: vector.S

Log Message:
The critical section handling is gone, remove comment about it


To generate a diff of this commit:
cvs rdiff -u -r1.85.6.2 -r1.85.6.3 src/sys/arch/i386/i386/vector.S

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/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.85.6.2 src/sys/arch/i386/i386/vector.S:1.85.6.3
--- src/sys/arch/i386/i386/vector.S:1.85.6.2	Sat Apr 11 12:01:42 2020
+++ src/sys/arch/i386/i386/vector.S	Sun Apr 12 16:35:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $	*/
+/*	$NetBSD: vector.S,v 1.85.6.3 2020/04/12 16:35:49 bouyer Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.2 2020/04/11 12:01:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.3 2020/04/12 16:35:49 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1062,19 +1062,6 @@ END(xenev_stubs)
 
 #ifdef XEN
 
-/*
- * A note on the "critical region" in our callback handler.
- * We want to avoid stacking callback handlers due to events occurring
- * during handling of the last event. To do this, we keep events disabled
- * until weve done all processing. HOWEVER, we must enable events before
- * popping the stack frame (cant be done atomically) and so it would still
- * be possible to get enough handler activations to overflow the stack.
- * Although unlikely, bugs of that kind are hard to track down, so wed
- * like to avoid the possibility.
- * So, on entry to the handler we detect whether we interrupted an
- * existing activation in its critical region -- if so, we pop the current
- * activation and restart the handler using the previous one.
- */
 ENTRY(hypervisor_callback)
 IDTVEC(hypervisor_pvhvm_callback)	
 	pushl	$0			/* dummy error code */



CVS commit: src/sys/kern

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 15:55:53 UTC 2020

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
delete debugging printf.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/sys/kern/vfs_vnops.c

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

Modified files:

Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.208 src/sys/kern/vfs_vnops.c:1.209
--- src/sys/kern/vfs_vnops.c:1.208	Sun Apr 12 09:12:42 2020
+++ src/sys/kern/vfs_vnops.c	Sun Apr 12 11:55:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.208 2020/04/12 13:12:42 christos Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.209 2020/04/12 15:55:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.208 2020/04/12 13:12:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.209 2020/04/12 15:55:53 christos Exp $");
 
 #include "veriexec.h"
 
@@ -1107,7 +1107,6 @@ vn_extattr_get(struct vnode *vp, int iof
 
 	error = VOP_GETEXTATTR(vp, attrnamespace, attrname, , NULL,
 	NOCRED);
-	printf("%s: %d\n", __func__, error);
 
 	if ((ioflg & IO_NODELOCKED) == 0)
 		VOP_UNLOCK(vp);



CVS commit: src/sys/uvm/pmap

2020-04-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Apr 12 15:36:18 UTC 2020

Modified Files:
src/sys/uvm/pmap: pmap.c pmap_tlb.c

Log Message:
Use UVMHIST_CALLARGS


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/pmap/pmap_tlb.c

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

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.48 src/sys/uvm/pmap/pmap.c:1.49
--- src/sys/uvm/pmap/pmap.c:1.48	Sat Mar 14 14:05:44 2020
+++ src/sys/uvm/pmap/pmap.c	Sun Apr 12 15:36:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.48 2020/03/14 14:05:44 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.49 2020/04/12 15:36:18 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.48 2020/03/14 14:05:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.49 2020/04/12 15:36:18 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -581,7 +581,8 @@ pmap_init(void)
 	UVMHIST_INIT_STATIC(pmapexechist, pmapexechistbuf);
 	UVMHIST_INIT_STATIC(pmaphist, pmaphistbuf);
 
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLED(pmaphist);
 
 	/*
 	 * Initialize the segtab lock.
@@ -623,7 +624,8 @@ pmap_init(void)
 pmap_t
 pmap_create(void)
 {
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLED(pmaphist);
 	PMAP_COUNT(create);
 
 	pmap_t pmap = pool_get(_pmap_pool, PR_WAITOK);
@@ -658,8 +660,8 @@ pmap_create(void)
 void
 pmap_destroy(pmap_t pmap)
 {
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-	UVMHIST_LOG(pmaphist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0);
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmaphist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0);
 
 	if (atomic_dec_uint_nv(>pm_count) > 0) {
 		PMAP_COUNT(dereference);
@@ -694,8 +696,8 @@ pmap_destroy(pmap_t pmap)
 void
 pmap_reference(pmap_t pmap)
 {
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-	UVMHIST_LOG(pmaphist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0);
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmaphist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0);
 	PMAP_COUNT(reference);
 
 	if (pmap != NULL) {
@@ -713,8 +715,8 @@ pmap_activate(struct lwp *l)
 {
 	pmap_t pmap = l->l_proc->p_vmspace->vm_map.pmap;
 
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-	UVMHIST_LOG(pmaphist, "(l=%#jx pmap=%#jx)", (uintptr_t)l,
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmaphist, "(l=%#jx pmap=%#jx)", (uintptr_t)l,
 	(uintptr_t)pmap, 0, 0);
 	PMAP_COUNT(activate);
 
@@ -744,9 +746,8 @@ pmap_page_remove(struct vm_page *pg)
 	VM_PAGEMD_PVLIST_LOCK(mdpg);
 	pmap_pvlist_check(mdpg);
 
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-
-	UVMHIST_LOG(pmapexechist, "pg %#jx (pa %#jx) [page removed]: "
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmapexechist, "pg %#jx (pa %#jx) [page removed]: "
 	"execpage cleared", (uintptr_t)pg, VM_PAGE_TO_PHYS(pg), 0, 0);
 #ifdef PMAP_VIRTUAL_CACHE_ALIASES
 	pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE|VM_PAGEMD_UNCACHED);
@@ -862,8 +863,8 @@ pmap_deactivate(struct lwp *l)
 {
 	pmap_t pmap = l->l_proc->p_vmspace->vm_map.pmap;
 
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-	UVMHIST_LOG(pmaphist, "(l=%#jx pmap=%#jx)", (uintptr_t)l,
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmaphist, "(l=%#jx pmap=%#jx)", (uintptr_t)l,
 	(uintptr_t)pmap, 0, 0);
 	PMAP_COUNT(deactivate);
 
@@ -885,8 +886,8 @@ pmap_deactivate(struct lwp *l)
 void
 pmap_update(struct pmap *pmap)
 {
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-	UVMHIST_LOG(pmaphist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0);
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmaphist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0);
 	PMAP_COUNT(update);
 
 	kpreempt_disable();
@@ -930,10 +931,10 @@ pmap_pte_remove(pmap_t pmap, vaddr_t sva
 	const pt_entry_t npte = flags;
 	const bool is_kernel_pmap_p = (pmap == pmap_kernel());
 
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-	UVMHIST_LOG(pmaphist, "(pmap=%#jx kernel=%c va=%#jx..%#jx)",
-	(uintptr_t)pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva);
-	UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx",
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmaphist, "(pmap=%#jx kernel=%jx va=%#jx..%#jx)",
+	(uintptr_t)pmap, (pmap == pmap_kernel() ? 1 : 0), sva, eva);
+	UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx)",
 	(uintptr_t)ptep, flags, 0, 0);
 
 	KASSERT(kpreempt_disabled());
@@ -977,8 +978,8 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
 	const bool is_kernel_pmap_p = (pmap == pmap_kernel());
 	const pt_entry_t npte = pte_nv_entry(is_kernel_pmap_p);
 
-	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
-	UVMHIST_LOG(pmaphist, "(pmap=%#jx, va=%#jx..%#jx)",
+	UVMHIST_FUNC(__func__);
+	UVMHIST_CALLARGS(pmaphist, "(pmap=%#jx, va=%#jx..%#jx)",
 	(uintptr_t)pmap, 

CVS commit: src/sys/arch/xen/xen

2020-04-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 12 13:57:07 UTC 2020

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c

Log Message:
move IFNET_UNLOCK() immediatelly after xennet_stop() call in detach,
doesn't need to be held for the disestablish


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 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/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.113 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.114
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.113	Sun Apr 12 13:55:06 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sun Apr 12 13:57:07 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.113 2020/04/12 13:55:06 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.114 2020/04/12 13:57:07 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.113 2020/04/12 13:55:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.114 2020/04/12 13:57:07 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -413,11 +413,11 @@ xennet_xenbus_detach(device_t self, int 
 	/* stop interface */
 	IFNET_LOCK(ifp);
 	xennet_stop(ifp, 1);
+	IFNET_UNLOCK(ifp);
 	if (sc->sc_ih != NULL) {
 		xen_intr_disestablish(sc->sc_ih);
 		sc->sc_ih = NULL;
 	}
-	IFNET_UNLOCK(ifp);
 
 	/* collect any outstanding TX responses */
 	mutex_enter(>sc_tx_lock);



CVS commit: src/sys/arch/xen/xen

2020-04-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 12 13:55:06 UTC 2020

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c

Log Message:
fix locking against myself panic in xennet_stop() on 'ifconfig xennet0 down'

xennet_stop() is called with IFNET already held


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 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/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.112 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.113
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.112	Sat Apr 11 11:01:12 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sun Apr 12 13:55:06 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.112 2020/04/11 11:01:12 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.113 2020/04/12 13:55:06 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.112 2020/04/11 11:01:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.113 2020/04/12 13:55:06 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -411,11 +411,13 @@ xennet_xenbus_detach(device_t self, int 
 	DPRINTF(("%s: xennet_xenbus_detach\n", device_xname(self)));
 
 	/* stop interface */
+	IFNET_LOCK(ifp);
 	xennet_stop(ifp, 1);
 	if (sc->sc_ih != NULL) {
 		xen_intr_disestablish(sc->sc_ih);
 		sc->sc_ih = NULL;
 	}
+	IFNET_UNLOCK(ifp);
 
 	/* collect any outstanding TX responses */
 	mutex_enter(>sc_tx_lock);
@@ -1146,9 +1148,9 @@ xennet_stop(struct ifnet *ifp, int disab
 {
 	struct xennet_xenbus_softc *sc = ifp->if_softc;
 
-	IFNET_LOCK(ifp);
+	KASSERT(IFNET_LOCKED(ifp));
+
 	ifp->if_flags &= ~IFF_RUNNING;
-	IFNET_UNLOCK(ifp);
 	hypervisor_mask_event(sc->sc_evtchn);
 }
 



CVS commit: src/sys/kern

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 13:37:12 UTC 2020

Modified Files:
src/sys/kern: syscalls.master

Log Message:
change ' \t' to '\t'


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/kern/syscalls.master

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

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.299 src/sys/kern/syscalls.master:1.300
--- src/sys/kern/syscalls.master:1.299	Sun Apr 12 09:30:16 2020
+++ src/sys/kern/syscalls.master	Sun Apr 12 09:37:12 2020
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.299 2020/04/12 13:30:16 christos Exp $
+	$NetBSD: syscalls.master,v 1.300 2020/04/12 13:37:12 christos Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -70,8 +70,8 @@
 
 0	INDIR		{ int|sys||syscall(int code, \
 			... register_t args[SYS_MAXSYSARGS]); }
-1	STD 		{ void|sys||exit(int rval); }
-2	STD 		{ int|sys||fork(void); }
+1	STD		{ void|sys||exit(int rval); }
+2	STD		{ int|sys||fork(void); }
 3	STD	RUMP	{ ssize_t|sys||read(int fd, void *buf, size_t nbyte); }
 4	STD	RUMP	{ ssize_t|sys||write(int fd, const void *buf, \
 			size_t nbyte); }
@@ -92,21 +92,21 @@
 15	STD	RUMP	{ int|sys||chmod(const char *path, mode_t mode); }
 16	STD	RUMP	{ int|sys||chown(const char *path, uid_t uid, \
 			gid_t gid); }
-17	STD 		{ int|sys||obreak(char *nsize); } break
+17	STD		{ int|sys||obreak(char *nsize); } break
 18	COMPAT_20 MODULAR compat_20 { int|sys||getfsstat(struct statfs12 *buf, \
 			long bufsize, int flags); }
 19	COMPAT_43 MODULAR compat_43	\
 		{ long|sys||lseek(int fd, long offset, int whence); }\
 			olseek
-20	NOERR 	RUMP	{ pid_t|sys||getpid_with_ppid(void); } getpid
+20	NOERR	RUMP	{ pid_t|sys||getpid_with_ppid(void); } getpid
 21	COMPAT_40 MODULAR compat_40	\
 		{ int|sys||mount(const char *type, const char *path, \
 			int flags, void *data); }
 22	STD	RUMP	{ int|sys||unmount(const char *path, int flags); }
 23	STD	RUMP	{ int|sys||setuid(uid_t uid); }
-24	NOERR 	RUMP	{ uid_t|sys||getuid_with_euid(void); } getuid
-25	NOERR 	RUMP	{ uid_t|sys||geteuid(void); }
-26	STD 	MODULAR ptrace	\
+24	NOERR	RUMP	{ uid_t|sys||getuid_with_euid(void); } getuid
+25	NOERR	RUMP	{ uid_t|sys||geteuid(void); }
+26	STD	MODULAR ptrace	\
 			{ int|sys||ptrace(int req, pid_t pid, void *addr, \
 			int data); }
 27	STD	RUMP	{ ssize_t|sys||recvmsg(int s, struct msghdr *msg, \
@@ -125,30 +125,30 @@
 33	STD	RUMP	{ int|sys||access(const char *path, int flags); }
 34	STD	RUMP	{ int|sys||chflags(const char *path, u_long flags); }
 35	STD	RUMP	{ int|sys||fchflags(int fd, u_long flags); }
-36	NOERR 	 RUMP	{ void|sys||sync(void); }
-37	STD 		{ int|sys||kill(pid_t pid, int signum); }
+36	NOERR	RUMP	{ void|sys||sync(void); }
+37	STD		{ int|sys||kill(pid_t pid, int signum); }
 38	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||stat(const char *path, struct stat43 *ub); } stat43
-39	NOERR 	RUMP	{ pid_t|sys||getppid(void); }
+39	NOERR	RUMP	{ pid_t|sys||getppid(void); }
 40	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||lstat(const char *path, \
 			struct stat43 *ub); } lstat43
 41	STD	RUMP	{ int|sys||dup(int fd); }
 42	STD	RUMP	{ int|sys||pipe(void); }
-43	NOERR 	RUMP	{ gid_t|sys||getegid(void); }
-44	STD 		{ int|sys||profil(char *samples, size_t size, \
+43	NOERR	RUMP	{ gid_t|sys||getegid(void); }
+44	STD		{ int|sys||profil(char *samples, size_t size, \
 			u_long offset, u_int scale); }
 45	STD	RUMP	{ int|sys||ktrace(const char *fname, int ops, \
 			int facs, pid_t pid); }
 46	COMPAT_13 MODULAR compat_13 { int|sys||sigaction(int signum, \
 			const struct sigaction13 *nsa, \
 			struct sigaction13 *osa); } sigaction13
-47	NOERR 	RUMP	{ gid_t|sys||getgid_with_egid(void); } getgid
+47	NOERR	RUMP	{ gid_t|sys||getgid_with_egid(void); } getgid
 48	COMPAT_13 MODULAR compat_13 { int|sys||sigprocmask(int how, \
 			int mask); } sigprocmask13
 49	STD	RUMP	{ int|sys||__getlogin(char *namebuf, size_t namelen); }
-50	STD	RUMP 	{ int|sys||__setlogin(const char *namebuf); }
-51	STD 		{ int|sys||acct(const char *path); }
+50	STD	RUMP	{ int|sys||__setlogin(const char *namebuf); }
+51	STD		{ int|sys||acct(const char *path); }
 52	COMPAT_13 MODULAR compat_13 { int|sys||sigpending(void); } sigpending13
 53	COMPAT_13 MODULAR compat_13 { int|sys||sigaltstack( \
 			const struct sigaltstack13 *nss, \
@@ -161,7 +161,7 @@
 			const char *link); }
 58	STD	RUMP	{ ssize_t|sys||readlink(const char *path, char *buf, \
 			size_t count); }
-59	STD 		{ int|sys||execve(const char *path, \
+59	STD		{ int|sys||execve(const char *path, \
 			char * const *argp, char * const *envp); }
 60	STD	RUMP	{ mode_t|sys||umask(mode_t newmask); }
 61	STD	RUMP	{ int|sys||chroot(const char *path); }
@@ -174,23 +174,23 @@
 		{ int|sys||getpagesize(void); } ogetpagesize
 65	COMPAT_12 MODULAR compat_12 { int|sys||msync(void *addr, size_t len); }
 ; 

CVS commit: src/sys/kern

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 13:30:16 UTC 2020

Modified Files:
src/sys/kern: syscalls.master

Log Message:
Change STD[:random-whitespace:]RUMP to STD\tRUMP


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/sys/kern/syscalls.master

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

Modified files:

Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.298 src/sys/kern/syscalls.master:1.299
--- src/sys/kern/syscalls.master:1.298	Sat Apr  4 16:20:12 2020
+++ src/sys/kern/syscalls.master	Sun Apr 12 09:30:16 2020
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.298 2020/04/04 20:20:12 thorpej Exp $
+	$NetBSD: syscalls.master,v 1.299 2020/04/12 13:30:16 christos Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -72,25 +72,25 @@
 			... register_t args[SYS_MAXSYSARGS]); }
 1	STD 		{ void|sys||exit(int rval); }
 2	STD 		{ int|sys||fork(void); }
-3	STD 	 RUMP	{ ssize_t|sys||read(int fd, void *buf, size_t nbyte); }
-4	STD 	 RUMP	{ ssize_t|sys||write(int fd, const void *buf, \
+3	STD	RUMP	{ ssize_t|sys||read(int fd, void *buf, size_t nbyte); }
+4	STD	RUMP	{ ssize_t|sys||write(int fd, const void *buf, \
 			size_t nbyte); }
-5	STD 	 RUMP	{ int|sys||open(const char *path, \
+5	STD	RUMP	{ int|sys||open(const char *path, \
 			int flags, ... mode_t mode); }
-6	STD	 RUMP	{ int|sys||close(int fd); }
+6	STD	RUMP	{ int|sys||close(int fd); }
 7	COMPAT_50 MODULAR compat_50 { int|sys||wait4(pid_t pid, int *status, \
 			int options, struct rusage50 *rusage); }
 8	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||creat(const char *path, mode_t mode); } ocreat
-9	STD 	 RUMP	{ int|sys||link(const char *path, const char *link); }
-10	STD 	 RUMP	{ int|sys||unlink(const char *path); }
+9	STD	RUMP	{ int|sys||link(const char *path, const char *link); }
+10	STD	RUMP	{ int|sys||unlink(const char *path); }
 11	OBSOL		execv
-12	STD 	 RUMP	{ int|sys||chdir(const char *path); }
-13	STD 	 RUMP	{ int|sys||fchdir(int fd); }
+12	STD	RUMP	{ int|sys||chdir(const char *path); }
+13	STD	RUMP	{ int|sys||fchdir(int fd); }
 14	COMPAT_50 MODULAR compat_50 RUMP	\
 		{ int|sys||mknod(const char *path, mode_t mode, uint32_t dev); }
-15	STD 	 RUMP	{ int|sys||chmod(const char *path, mode_t mode); }
-16	STD 	 RUMP	{ int|sys||chown(const char *path, uid_t uid, \
+15	STD	RUMP	{ int|sys||chmod(const char *path, mode_t mode); }
+16	STD	RUMP	{ int|sys||chown(const char *path, uid_t uid, \
 			gid_t gid); }
 17	STD 		{ int|sys||obreak(char *nsize); } break
 18	COMPAT_20 MODULAR compat_20 { int|sys||getfsstat(struct statfs12 *buf, \
@@ -102,18 +102,18 @@
 21	COMPAT_40 MODULAR compat_40	\
 		{ int|sys||mount(const char *type, const char *path, \
 			int flags, void *data); }
-22	STD 	RUMP	{ int|sys||unmount(const char *path, int flags); }
-23	STD 	RUMP	{ int|sys||setuid(uid_t uid); }
+22	STD	RUMP	{ int|sys||unmount(const char *path, int flags); }
+23	STD	RUMP	{ int|sys||setuid(uid_t uid); }
 24	NOERR 	RUMP	{ uid_t|sys||getuid_with_euid(void); } getuid
 25	NOERR 	RUMP	{ uid_t|sys||geteuid(void); }
 26	STD 	MODULAR ptrace	\
 			{ int|sys||ptrace(int req, pid_t pid, void *addr, \
 			int data); }
-27	STD 	RUMP	{ ssize_t|sys||recvmsg(int s, struct msghdr *msg, \
+27	STD	RUMP	{ ssize_t|sys||recvmsg(int s, struct msghdr *msg, \
 			int flags); }
-28	STD 	RUMP	{ ssize_t|sys||sendmsg(int s, \
+28	STD	RUMP	{ ssize_t|sys||sendmsg(int s, \
 			const struct msghdr *msg, int flags); }
-29	STD 	RUMP	{ ssize_t|sys||recvfrom(int s, void *buf, size_t len, \
+29	STD	RUMP	{ ssize_t|sys||recvfrom(int s, void *buf, size_t len, \
 			int flags, struct sockaddr *from, \
 			socklen_t *fromlenaddr); }
 30	STD	RUMP	{ int|sys||accept(int s, struct sockaddr *name, \
@@ -122,9 +122,9 @@
 			socklen_t *alen); }
 32	STD	RUMP	{ int|sys||getsockname(int fdes, struct sockaddr *asa, \
 			socklen_t *alen); }
-33	STD 	RUMP	{ int|sys||access(const char *path, int flags); }
-34	STD 	 RUMP	{ int|sys||chflags(const char *path, u_long flags); }
-35	STD 	RUMP	{ int|sys||fchflags(int fd, u_long flags); }
+33	STD	RUMP	{ int|sys||access(const char *path, int flags); }
+34	STD	RUMP	{ int|sys||chflags(const char *path, u_long flags); }
+35	STD	RUMP	{ int|sys||fchflags(int fd, u_long flags); }
 36	NOERR 	 RUMP	{ void|sys||sync(void); }
 37	STD 		{ int|sys||kill(pid_t pid, int signum); }
 38	COMPAT_43 MODULAR compat_43	\
@@ -133,12 +133,12 @@
 40	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||lstat(const char *path, \
 			struct stat43 *ub); } lstat43
-41	STD 	RUMP	{ int|sys||dup(int fd); }
-42	STD 	RUMP	{ int|sys||pipe(void); }
+41	STD	RUMP	{ int|sys||dup(int fd); }
+42	STD	RUMP	{ int|sys||pipe(void); }
 43	NOERR 	RUMP	{ gid_t|sys||getegid(void); }
 44	STD 		{ int|sys||profil(char *samples, size_t size, \
 			u_long offset, u_int scale); }
-45	STD 	RUMP	{ int|sys||ktrace(const char *fname, int ops, \

CVS commit: src/sys/kern

2020-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 12 13:12:42 UTC 2020

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
Pass NOCRED instead of NULL for credentials. These routines are supposed
to be accessing system ACL's on behalf of the kernel. This code appears
to be copied from FreeBSD, but there it works because in FreeBSD NOCRED
is 0, ours is -1. I guess nobody has used system extended attributes on
NetBSD yet :-)


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/sys/kern/vfs_vnops.c

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

Modified files:

Index: src/sys/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.207 src/sys/kern/vfs_vnops.c:1.208
--- src/sys/kern/vfs_vnops.c:1.207	Thu Feb 27 17:12:54 2020
+++ src/sys/kern/vfs_vnops.c	Sun Apr 12 09:12:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.207 2020/02/27 22:12:54 ad Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.208 2020/04/12 13:12:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.207 2020/02/27 22:12:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.208 2020/04/12 13:12:42 christos Exp $");
 
 #include "veriexec.h"
 
@@ -1105,7 +1105,9 @@ vn_extattr_get(struct vnode *vp, int iof
 	if ((ioflg & IO_NODELOCKED) == 0)
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 
-	error = VOP_GETEXTATTR(vp, attrnamespace, attrname, , NULL, NULL);
+	error = VOP_GETEXTATTR(vp, attrnamespace, attrname, , NULL,
+	NOCRED);
+	printf("%s: %d\n", __func__, error);
 
 	if ((ioflg & IO_NODELOCKED) == 0)
 		VOP_UNLOCK(vp);
@@ -1141,7 +1143,7 @@ vn_extattr_set(struct vnode *vp, int iof
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	}
 
-	error = VOP_SETEXTATTR(vp, attrnamespace, attrname, , NULL);
+	error = VOP_SETEXTATTR(vp, attrnamespace, attrname, , NOCRED);
 
 	if ((ioflg & IO_NODELOCKED) == 0) {
 		VOP_UNLOCK(vp);
@@ -1162,7 +1164,8 @@ vn_extattr_rm(struct vnode *vp, int iofl
 
 	error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, NULL);
 	if (error == EOPNOTSUPP)
-		error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL, NULL);
+		error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
+		NOCRED);
 
 	if ((ioflg & IO_NODELOCKED) == 0) {
 		VOP_UNLOCK(vp);



CVS commit: src/sys/netinet6

2020-04-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Apr 12 12:13:52 UTC 2020

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

Log Message:
nd6: RTM_MISS reports RTA_AUTHOR once more

Just moves the logic to send RTM_MISS after the ICMP6 report as we
rely on that function to extract the requesting address.

Fixes PR kern/55164.


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/netinet6/nd6.c

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

Modified files:

Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.268 src/sys/netinet6/nd6.c:1.269
--- src/sys/netinet6/nd6.c:1.268	Fri Apr  3 14:04:27 2020
+++ src/sys/netinet6/nd6.c	Sun Apr 12 12:13:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.268 2020/04/03 14:04:27 christos Exp $	*/
+/*	$NetBSD: nd6.c,v 1.269 2020/04/12 12:13:52 roy Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.268 2020/04/03 14:04:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.269 2020/04/12 12:13:52 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -458,12 +458,11 @@ nd6_llinfo_timer(void *arg)
 	struct ifnet *ifp;
 	struct nd_ifinfo *ndi = NULL;
 	bool send_ns = false;
-	struct in6_addr mdaddr6 = zeroin6_addr;
 	const struct in6_addr *daddr6 = NULL;
 	const struct in6_addr *taddr6 = >r_l3addr.addr6;
 	struct sockaddr_in6 dsin6, tsin6;
-	struct sockaddr *sa;
 	struct mbuf *m = NULL;
+	bool missed = false;
 
 	SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
 
@@ -493,6 +492,9 @@ nd6_llinfo_timer(void *arg)
 			break;
 		}
 
+		missed = true;
+		sockaddr_in6_init(, taddr6, 0, 0, 0);
+
 		if (ln->ln_hold) {
 			struct mbuf *m0;
 
@@ -508,15 +510,6 @@ nd6_llinfo_timer(void *arg)
 			clear_llinfo_pqueue(ln);
 		}
 
-		sockaddr_in6_init(, taddr6, 0, 0, 0);
-		if (!IN6_IS_ADDR_UNSPECIFIED()) {
-			sockaddr_in6_init(, , 0, 0, 0);
-			sa = sin6tosa();
-		} else
-			sa = NULL;
-
-		rt_clonedmsg(RTM_MISS, sa, sin6tosa(), NULL, ifp);
-
 		/*
 		 * Move to the ND6_LLINFO_WAITDELETE state for another
 		 * interval at which point the llentry will be freed
@@ -586,9 +579,19 @@ out:
 	if (ln != NULL)
 		LLE_FREE_LOCKED(ln);
 	SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
-	if (m) {
-		icmp6_error2(m, ICMP6_DST_UNREACH,
-		ICMP6_DST_UNREACH_ADDR, 0, ifp, );
+	if (missed) {
+		struct in6_addr mdaddr6 = zeroin6_addr;
+		struct sockaddr *sa;
+
+		if (m != NULL)
+			icmp6_error2(m, ICMP6_DST_UNREACH,
+			ICMP6_DST_UNREACH_ADDR, 0, ifp, );
+		if (!IN6_IS_ADDR_UNSPECIFIED()) {
+			sockaddr_in6_init(, , 0, 0, 0);
+			sa = sin6tosa();
+		} else
+			sa = NULL;
+		rt_clonedmsg(RTM_MISS, sa, sin6tosa(), NULL, ifp);
 	}
 }
 



CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen

2020-04-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 12 11:16:59 UTC 2020

Modified Files:
src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c

Log Message:
Now that we return from hypervisor_callback via Xdoreti, no need to emulate it
in evtchn_do_event() any more.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.1 -r1.88.2.2 src/sys/arch/xen/xen/evtchn.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/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.88.2.1 src/sys/arch/xen/xen/evtchn.c:1.88.2.2
--- src/sys/arch/xen/xen/evtchn.c:1.88.2.1	Fri Apr 10 14:38:19 2020
+++ src/sys/arch/xen/xen/evtchn.c	Sun Apr 12 11:16:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.88.2.1 2020/04/10 14:38:19 bouyer Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.88.2.2 2020/04/12 11:16:58 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.1 2020/04/10 14:38:19 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.2 2020/04/12 11:16:58 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -316,8 +316,6 @@ evtchn_do_event(int evtch, struct intrfr
 	struct intrhand *ih;
 	int	(*ih_fun)(void *, void *);
 	uint32_t iplmask;
-	int i;
-	uint32_t iplbit;
 
 	KASSERTMSG(evtch >= 0, "negative evtch: %d", evtch);
 	KASSERTMSG(evtch < NR_EVENT_CHANNELS,
@@ -404,35 +402,6 @@ evtchn_do_event(int evtch, struct intrfr
 #endif /* NPCI > 0 || NISA > 0 */		
 
 splx:
-	/*
-	 * C version of spllower(). ASTs will be checked when
-	 * hypevisor_callback() exits, so no need to check here.
-	 */
-	iplmask = (XUNMASK(ci, ilevel) & ci->ci_xpending);
-	while (iplmask != 0) {
-		iplbit = 1 << (NIPL - 1);
-		i = (NIPL - 1);
-		while (iplmask != 0 && i > ilevel) {
-			while (iplmask & iplbit) {
-ci->ci_xpending &= ~iplbit;
-ci->ci_ilevel = i;
-for (ih = ci->ci_xsources[i]->is_handlers;
-ih != NULL; ih = ih->ih_next) {
-	KASSERT(ih->ih_cpu == ci);
-	x86_enable_intr();
-	ih_fun = (void *)ih->ih_fun;
-	ih_fun(ih->ih_arg, regs);
-	x86_disable_intr();
-}
-hypervisor_enable_ipl(i);
-/* more pending IPLs may have been registered */
-iplmask =
-(XUNMASK(ci, ilevel) & ci->ci_xpending);
-			}
-			i--;
-			iplbit >>= 1;
-		}
-	}
 	ci->ci_ilevel = ilevel;
 	return 0;
 }



CVS commit: src/sys/kern

2020-04-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 12 08:51:41 UTC 2020

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
fix race between wapbl_discard() and wapbl_biodone() on forced
unmount on shutdown with slow I/O device

wapbl_discard() needs to hold both wl_mtx and bufcache_lock while
manipulating wl_entries - the rw lock is not enough, because
wapbl_biodone() only takes wl_mtx while removing the finished entry
from list

wapbl_biodone() must take bufcache_lock before reading we->we_wapbl,
so it's blocked until wapbl_discard() finishes, and takes !wl path
appropriately

this is supposed to fix panic on shutdown:
[ 67549.6304123] forcefully unmounting / (/dev/wd0a)...
...
[ 67549.7272030] panic: mutex_vector_enter,510: uninitialized lock 
(lock=0xa722a4f4f5b0, from=80a884fa)
...
[ 67549.7272030] wapbl_biodone() at netbsd:wapbl_biodone+0x4d
[ 67549.7272030] biointr() at netbsd:biointr+0x7d
[ 67549.7272030] softint_dispatch() at netbsd:softint_dispatch+0x12c
[ 67549.7272030] Xsoftintr() at netbsd:Xsoftintr+0x4f


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/vfs_wapbl.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/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.106 src/sys/kern/vfs_wapbl.c:1.107
--- src/sys/kern/vfs_wapbl.c:1.106	Mon Mar 16 21:20:10 2020
+++ src/sys/kern/vfs_wapbl.c	Sun Apr 12 08:51:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.106 2020/03/16 21:20:10 pgoyette Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.107 2020/04/12 08:51:41 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.106 2020/03/16 21:20:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.107 2020/04/12 08:51:41 jdolecek Exp $");
 
 #include 
 #include 
@@ -226,7 +226,7 @@ struct wapbl {
 	u_long wl_inohashmask;
 	int wl_inohashcnt;
 
-	SIMPLEQ_HEAD(, wapbl_entry) wl_entries; /* On disk transaction
+	SIMPLEQ_HEAD(, wapbl_entry) wl_entries; /* m: On disk transaction
 		   accounting */
 
 	/* buffers for wapbl_buffered_write() */
@@ -786,12 +786,10 @@ wapbl_discard(struct wapbl *wl)
 			mutex_enter(>wl_mtx);
 		}
 	}
-	mutex_exit(>wl_mtx);
-	mutex_exit(_lock);
 
 	/*
 	 * Remove references to this wl from wl_entries, free any which
-	 * no longer have buffers, others will be freed in wapbl_biodone
+	 * no longer have buffers, others will be freed in wapbl_biodone()
 	 * when they no longer have any buffers.
 	 */
 	while ((we = SIMPLEQ_FIRST(>wl_entries)) != NULL) {
@@ -807,6 +805,9 @@ wapbl_discard(struct wapbl *wl)
 		}
 	}
 
+	mutex_exit(>wl_mtx);
+	mutex_exit(_lock);
+
 	/* Discard list of deallocs */
 	while ((wd = TAILQ_FIRST(>wl_dealloclist)) != NULL)
 		wapbl_deallocation_free(wl, wd, true);
@@ -1604,11 +1605,15 @@ void
 wapbl_biodone(struct buf *bp)
 {
 	struct wapbl_entry *we = bp->b_private;
-	struct wapbl *wl = we->we_wapbl;
+	struct wapbl *wl;
 #ifdef WAPBL_DEBUG_BUFBYTES
 	const int bufsize = bp->b_bufsize;
 #endif
 
+	mutex_enter(_lock);
+	wl = we->we_wapbl;
+	mutex_exit(_lock);
+
 	/*
 	 * Handle possible flushing of buffers after log has been
 	 * decomissioned.



CVS commit: [netbsd-9] src/sys/dev/acpi

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 08:48:57 UTC 2020

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi_ec.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #829):

sys/dev/acpi/acpi_ec.c: revision 1.78
sys/dev/acpi/acpi_ec.c: revision 1.79
sys/dev/acpi/acpi_ec.c: revision 1.80
sys/dev/acpi/acpi_ec.c: revision 1.81

Revert acpi_ec.c 1.77.
We will do this another way.
ok msaitoh

Revert acpi_ec.c 1.76.
We will do this another way, and separate KNF fixes from the critical
functional change.
ok msaitoh

KNF

Reject overly large widths, from mlelstv.
We are returning an ACPI_INTEGER (= uint64_t), so it doesn't make
sense to handle more than 64 bits.

Apparently there are some ACPIs out there that ask for unreasonably
large widths here.  Just reject those requests, rather than writing
past the caller's stack buffer.

Previously we attempted to fix this by copying byte by byte as large
as the caller asked, in order to avoid the undefined behaviour of
shifting past the size of ACPI_INTEGER, but that just turned a shift
(which might have been harmless on real machines) into a stack buffer
overflow (!).

ok msaitoh


To generate a diff of this commit:
cvs rdiff -u -r1.75.20.1 -r1.75.20.2 src/sys/dev/acpi/acpi_ec.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/acpi/acpi_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.75.20.1 src/sys/dev/acpi/acpi_ec.c:1.75.20.2
--- src/sys/dev/acpi/acpi_ec.c:1.75.20.1	Fri Aug  9 16:13:35 2019
+++ src/sys/dev/acpi/acpi_ec.c	Sun Apr 12 08:48:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.75.20.1 2019/08/09 16:13:35 martin Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.75.20.2 2020/04/12 08:48:56 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.75.20.1 2019/08/09 16:13:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.75.20.2 2020/04/12 08:48:56 martin Exp $");
 
 #include 
 #include 
@@ -657,36 +657,42 @@ static ACPI_STATUS
 acpiec_space_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS paddr,
 uint32_t width, ACPI_INTEGER *value, void *arg, void *region_arg)
 {
-	device_t dv = arg;
+	device_t dv;
 	ACPI_STATUS rv;
-	uint8_t addr;
-	uint8_t *reg;
+	uint8_t addr, reg;
+	unsigned int i;
 
-	if ((func != ACPI_READ) && (func != ACPI_WRITE)) {
-		aprint_error("%s: invalid Address Space function called: %x\n",
-		device_xname(dv), (unsigned int)func);
-		return AE_BAD_PARAMETER;
-	}
-	if (paddr > 0xff || width % 8 != 0 || value == NULL || arg == NULL ||
-	paddr + width / 8 > 0x100)
+	if (paddr > 0xff || width % 8 != 0 || width > sizeof(ACPI_INTEGER)*8 ||
+	value == NULL || arg == NULL || paddr + width / 8 > 0x100)
 		return AE_BAD_PARAMETER;
 
 	addr = paddr;
-	reg = (uint8_t *)value;
+	dv = arg;
 
 	rv = AE_OK;
 
-	if (func == ACPI_READ)
+	switch (func) {
+	case ACPI_READ:
 		*value = 0;
-
-	for (addr = paddr; addr < (paddr + width / 8); addr++, reg++) {
-		if (func == ACPI_READ)
-			rv = acpiec_read(dv, addr, reg);
-		else
-			rv = acpiec_write(dv, addr, *reg);
-
-		if (rv != AE_OK)
-			break;
+		for (i = 0; i < width; i += 8, ++addr) {
+			rv = acpiec_read(dv, addr, );
+			if (rv != AE_OK)
+break;
+			*value |= (ACPI_INTEGER)reg << i;
+		}
+		break;
+	case ACPI_WRITE:
+		for (i = 0; i < width; i += 8, ++addr) {
+			reg = (*value >> i) & 0xff;
+			rv = acpiec_write(dv, addr, reg);
+			if (rv != AE_OK)
+break;
+		}
+		break;
+	default:
+		aprint_error("%s: invalid Address Space function called: %x\n",
+		device_xname(dv), (unsigned int)func);
+		return AE_BAD_PARAMETER;
 	}
 
 	return rv;



CVS commit: [netbsd-9] src/doc

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 08:50:25 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #824 - #829


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/doc/CHANGES-9.1

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

Modified files:

Index: src/doc/CHANGES-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.32 src/doc/CHANGES-9.1:1.1.2.33
--- src/doc/CHANGES-9.1:1.1.2.32	Thu Apr  9 11:29:33 2020
+++ src/doc/CHANGES-9.1	Sun Apr 12 08:50:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.32 2020/04/09 11:29:33 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.33 2020/04/12 08:50:25 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -817,3 +817,78 @@ usr.bin/man/man.c1.68
 	Exit successfully after printing the search path (-p option).
 	[maya, ticket #824]
 
+external/bsd/dhcpcd/dist/src/arp.c		(apply patch)
+external/bsd/dhcpcd/dist/src/arp.h		(apply patch)
+external/bsd/dhcpcd/dist/src/bpf.c		(apply patch)
+external/bsd/dhcpcd/dist/src/bpf.h		(apply patch)
+external/bsd/dhcpcd/dist/src/common.h		(apply patch)
+external/bsd/dhcpcd/dist/src/defs.h		(apply patch)
+external/bsd/dhcpcd/dist/src/dhcp.c		(apply patch)
+external/bsd/dhcpcd/dist/src/dhcp6.c		(apply patch)
+external/bsd/dhcpcd/dist/src/dhcp6.h		(apply patch)
+external/bsd/dhcpcd/dist/src/dhcpcd.c		(apply patch)
+external/bsd/dhcpcd/dist/src/eloop.h		(apply patch)
+external/bsd/dhcpcd/dist/src/if-bsd.c		(apply patch)
+external/bsd/dhcpcd/dist/src/if-options.c	(apply patch)
+external/bsd/dhcpcd/dist/src/if.c		(apply patch)
+external/bsd/dhcpcd/dist/src/if.h		(apply patch)
+external/bsd/dhcpcd/dist/src/ipv4ll.c		(apply patch)
+external/bsd/dhcpcd/dist/src/ipv6.c		(apply patch)
+external/bsd/dhcpcd/dist/src/ipv6nd.c		(apply patch)
+external/bsd/dhcpcd/dist/src/ipv6nd.h		(apply patch)
+external/bsd/dhcpcd/dist/src/logerr.c		(apply patch)
+external/bsd/dhcpcd/dist/src/logerr.h		(apply patch)
+doc/3RDPARTY	(apply patch)
+
+	Update to dhcpcd-8.1.7 which fixes the following issues:
+	* Decode interface complex interface names eth0.100:2 eth0i100:2.
+	  This allows us to ignore some virtual interfaces by default
+	* ARP: Report L2 header address on conflict for more clarity
+	* DHCP: Support jumbo frames (untested)
+	* DHCP6: Clean up old lease on failure to confirm/rebind, etc
+	* RA: Prefer older routers - fixes PR bin/54997
+	* INET6: Obscure prefixes are now calculated correctly
+	* macro logerr commands to allow an alternative logger
+	[roy, ticket #825]
+
+lib/libpthread/arch/powerpc/pthread_md.h	1.9
+sys/arch/powerpc/powerpc/sig_machdep.c		1.48
+
+	Remove a bogus assertion.
+	[rin, ticket #826]
+
+sys/external/bsd/ipf/netinet/fil.c		1.32
+sys/external/bsd/ipf/netinet/fil.c		1.33
+sys/external/bsd/ipf/netinet/ip_frag.c		1.8
+
+	PR/55137: 
+	- fix incorrect byte order in ipfstat -f output.
+	- make sure frag is initialized to 0
+	- initialize ipfr_p field
+	PR/55149: get "morefrag" before we strip it out from "off"
+	[christos, ticket #827]
+
+distrib/sets/lists/man/mi			1.1687
+share/man/man4/Makefile1.704 (via patch)
+share/man/man4/ucom.41.28
+share/man/man4/uxrcom.41.1
+share/man/man4/uxrcom.41.2
+sys/dev/usb/files.usb1.173
+sys/dev/usb/ukyopon.c1.26
+sys/dev/usb/umodem.c1.74
+sys/dev/usb/umodem_common.c			1.33
+sys/dev/usb/usbdevices.config			1.38
+sys/dev/usb/usbdevs1.781
+sys/dev/usb/uxrcom.c1.1
+sys/dev/usb/usbdevs.h(regen)
+sys/dev/usb/usbdevs_data.h			(regen)
+
+	Add uxrcom driver for Exar XR21V141x USB serial adapters.
+	[simonb, ticket #828]
+
+sys/dev/acpi/acpi_ec.c1.78-1.81
+
+	Revert acpi_ec.c 1.76 and 1.77.
+	Reject overly large widths.
+	[riastradh, ticket #829]
+



CVS commit: [netbsd-9] src

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 08:44:43 UTC 2020

Modified Files:
src/distrib/sets/lists/man [netbsd-9]: mi
src/share/man/man4 [netbsd-9]: Makefile ucom.4
src/sys/dev/usb [netbsd-9]: files.usb ukyopon.c umodem.c
umodem_common.c usbdevices.config usbdevs
Added Files:
src/share/man/man4 [netbsd-9]: uxrcom.4
src/sys/dev/usb [netbsd-9]: uxrcom.c

Log Message:
Pull up following revision(s) (requested by simonb in ticket #828):

share/man/man4/uxrcom.4: revision 1.1
distrib/sets/lists/man/mi: revision 1.1687
share/man/man4/uxrcom.4: revision 1.2
share/man/man4/ucom.4: revision 1.28
sys/dev/usb/uxrcom.c: revision 1.1
sys/dev/usb/umodem.c: revision 1.74
sys/dev/usb/umodem_common.c: revision 1.33
sys/dev/usb/ukyopon.c: revision 1.26
sys/dev/usb/files.usb: revision 1.173
share/man/man4/Makefile: revision 1.704
sys/dev/usb/usbdevs: revision 1.781
sys/dev/usb/usbdevices.config: revision 1.38

Add uxrcom driver for Exar XR21V141x USB serial adapters.  Based in part
on the OpenBSD single-port XR21V1410 uxrcom driver, but adds support
for multi-port chipsets and uses the common umodem framework instead of
being a standalone driver.

Thanks to skrll@ for much USB clue and mrg@ for financing the
development of this driver.

Add NetBSD CVS tag.


To generate a diff of this commit:
cvs rdiff -u -r1.1649.2.5 -r1.1649.2.6 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.680.2.3 -r1.680.2.4 src/share/man/man4/Makefile
cvs rdiff -u -r1.27 -r1.27.2.1 src/share/man/man4/ucom.4
cvs rdiff -u -r0 -r1.2.2.2 src/share/man/man4/uxrcom.4
cvs rdiff -u -r1.156.2.1 -r1.156.2.2 src/sys/dev/usb/files.usb
cvs rdiff -u -r1.24 -r1.24.2.1 src/sys/dev/usb/ukyopon.c
cvs rdiff -u -r1.72 -r1.72.2.1 src/sys/dev/usb/umodem.c
cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/dev/usb/umodem_common.c
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/dev/usb/usbdevices.config
cvs rdiff -u -r1.770.4.3 -r1.770.4.4 src/sys/dev/usb/usbdevs
cvs rdiff -u -r0 -r1.1.2.2 src/sys/dev/usb/uxrcom.c

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1649.2.5 src/distrib/sets/lists/man/mi:1.1649.2.6
--- src/distrib/sets/lists/man/mi:1.1649.2.5	Mon Nov 25 20:47:25 2019
+++ src/distrib/sets/lists/man/mi	Sun Apr 12 08:44:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1649.2.5 2019/11/25 20:47:25 martin Exp $
+# $NetBSD: mi,v 1.1649.2.6 2020/04/12 08:44:42 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1918,6 +1918,7 @@
 ./usr/share/man/cat4/uvideo.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uvisor.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uvscom.0			man-sys-catman		.cat
+./usr/share/man/cat4/uxrcom.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uyap.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uyurex.0			man-sys-catman		.cat
 ./usr/share/man/cat4/vald.0			man-sys-catman		.cat
@@ -5017,6 +5018,7 @@
 ./usr/share/man/html4/uvideo.html		man-sys-htmlman		html
 ./usr/share/man/html4/uvisor.html		man-sys-htmlman		html
 ./usr/share/man/html4/uvscom.html		man-sys-htmlman		html
+./usr/share/man/html4/uxrcom.html		man-sys-htmlman		html
 ./usr/share/man/html4/uyap.html			man-sys-htmlman		html
 ./usr/share/man/html4/uyurex.html		man-sys-htmlman		html
 ./usr/share/man/html4/vald.html			man-sys-htmlman		html
@@ -8040,6 +8042,7 @@
 ./usr/share/man/man4/uvideo.4			man-sys-man		.man
 ./usr/share/man/man4/uvisor.4			man-sys-man		.man
 ./usr/share/man/man4/uvscom.4			man-sys-man		.man
+./usr/share/man/man4/uxrcom.4			man-sys-man		.man
 ./usr/share/man/man4/uyap.4			man-sys-man		.man
 ./usr/share/man/man4/uyurex.4			man-sys-man		.man
 ./usr/share/man/man4/vald.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.680.2.3 src/share/man/man4/Makefile:1.680.2.4
--- src/share/man/man4/Makefile:1.680.2.3	Mon Nov 25 20:47:25 2019
+++ src/share/man/man4/Makefile	Sun Apr 12 08:44:42 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.680.2.3 2019/11/25 20:47:25 martin Exp $
+#	$NetBSD: Makefile,v 1.680.2.4 2020/04/12 08:44:42 martin Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -85,9 +85,8 @@ MAN+=	atu.4 aubtfwl.4 aue.4 axe.4 axen.4
 	ulpt.4 umass.4 umcs.4 umct.4 umidi.4 umodem.4 ums.4 upgt.4 upl.4 \
 	uplcom.4 ure.4 urio.4 url.4 urndis.4 urtw.4 urtwn.4 \
 	usb.4 uscanner.4 uslsa.4 usmsc.4 usscanner.4 \
-	ustir.4 uthum.4 utoppy.4 uts.4 uvideo.4 uvisor.4 uvscom.4 uyap.4 \
-	uyurex.4 \
-	xhci.4 \
+	ustir.4 uthum.4 utoppy.4 uts.4 uvideo.4 uvisor.4 uvscom.4 uxrcom.4 \
+	uyap.4 uyurex.4 xhci.4
 
 # Ir devices
 MAN+=	irframe.4 cir.4 irframetty.4 oboe.4

Index: src/share/man/man4/ucom.4
diff -u src/share/man/man4/ucom.4:1.27 

CVS commit: [netbsd-9] src/sys/external/bsd/ipf/netinet

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 08:39:42 UTC 2020

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-9]: fil.c ip_frag.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #827):

sys/external/bsd/ipf/netinet/fil.c: revision 1.32
sys/external/bsd/ipf/netinet/fil.c: revision 1.33
sys/external/bsd/ipf/netinet/ip_frag.c: revision 1.8

PR/55137: Kouichi Hashikawa: ipfstat -f incorrect output
Fix incorrect byte order.

PR/55137: Kouichi Hashikawa: ipfstat -f incorrect output
- make sure frag is initialized to 0
- initialize ipfr_p field

PR/55149: Kouichi Hashikawa: Get morefrag before we strip it out from off


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.7 -r1.7.6.1 src/sys/external/bsd/ipf/netinet/ip_frag.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/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.29.2.2 src/sys/external/bsd/ipf/netinet/fil.c:1.29.2.3
--- src/sys/external/bsd/ipf/netinet/fil.c:1.29.2.2	Thu Oct  3 17:18:32 2019
+++ src/sys/external/bsd/ipf/netinet/fil.c	Sun Apr 12 08:39:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.29.2.2 2019/10/03 17:18:32 martin Exp $	*/
+/*	$NetBSD: fil.c,v 1.29.2.3 2020/04/12 08:39:42 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -141,7 +141,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.29.2.2 2019/10/03 17:18:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.29.2.3 2020/04/12 08:39:42 martin Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -1696,7 +1696,7 @@ ipf_pr_ipv4hdr(fr_info_t *fin)
 	fi->fi_p = p;
 	fin->fin_crc = p;
 	fi->fi_tos = ip->ip_tos;
-	fin->fin_id = ip->ip_id;
+	fin->fin_id = ntohs(ip->ip_id);
 	off = ntohs(ip->ip_off);
 
 	/* Get both TTL and protocol */
@@ -1724,11 +1724,10 @@ ipf_pr_ipv4hdr(fr_info_t *fin)
 	 */
 	off &= IP_MF|IP_OFFMASK;
 	if (off != 0) {
+		int morefrag = off & IP_MF;
 		fi->fi_flx |= FI_FRAG;
 		off &= IP_OFFMASK;
 		if (off != 0) {
-			int morefrag = off & IP_MF;
-
 			if (off == 1 && p == IPPROTO_TCP) {
 fin->fin_flx |= FI_SHORT;   /* RFC 3128 */
 DT1(ipf_fi_tcp_frag_off_1, fr_info_t *, fin);

Index: src/sys/external/bsd/ipf/netinet/ip_frag.c
diff -u src/sys/external/bsd/ipf/netinet/ip_frag.c:1.7 src/sys/external/bsd/ipf/netinet/ip_frag.c:1.7.6.1
--- src/sys/external/bsd/ipf/netinet/ip_frag.c:1.7	Sun Jun  3 10:37:23 2018
+++ src/sys/external/bsd/ipf/netinet/ip_frag.c	Sun Apr 12 08:39:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_frag.c,v 1.7 2018/06/03 10:37:23 maxv Exp $	*/
+/*	$NetBSD: ip_frag.c,v 1.7.6.1 2020/04/12 08:39:42 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -86,7 +86,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.7 2018/06/03 10:37:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.7.6.1 2020/04/12 08:39:42 martin Exp $");
 #else
 static const char sccsid[] = "@(#)ip_frag.c	1.11 3/24/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_frag.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -393,6 +393,7 @@ ipfr_frag_new(
 		}
 	}
 
+	memset(, 0, sizeof(frag));
 	frag.ipfr_v = fin->fin_v;
 	idx = fin->fin_v;
 	frag.ipfr_p = fin->fin_p;
@@ -441,6 +442,7 @@ ipfr_frag_new(
 		FBUMPD(ifs_nomem);
 		return NULL;
 	}
+	memset(fran, 0, sizeof(*fran));
 
 	WRITE_ENTER(lock);
 
@@ -478,6 +480,7 @@ ipfr_frag_new(
 	table[idx] = fra;
 	bcopy((char *)_ifp, (char *)>ipfr_ifp, IPFR_CMPSZ);
 	fra->ipfr_v = fin->fin_v;
+	fra->ipfr_p = fin->fin_p;
 	fra->ipfr_ttl = softc->ipf_ticks + softf->ipfr_ttl;
 	fra->ipfr_firstend = frag.ipfr_firstend;
 
@@ -655,6 +658,7 @@ ipf_frag_lookup(
 	 *
 	 * build up a hash value to index the table with.
 	 */
+	memset(, 0, sizeof(frag));
 	frag.ipfr_v = fin->fin_v;
 	idx = fin->fin_v;
 	frag.ipfr_p = fin->fin_p;



CVS commit: [netbsd-9] src

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 08:35:40 UTC 2020

Modified Files:
src/lib/libpthread/arch/powerpc [netbsd-9]: pthread_md.h
src/sys/arch/powerpc/powerpc [netbsd-9]: sig_machdep.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #826):

lib/libpthread/arch/powerpc/pthread_md.h: revision 1.9
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.48

Revert previous:
http://mail-index.netbsd.org/source-changes/2020/02/20/msg114173.html
Comment turned out to be wrong, and KASSERT fires for oea.

XXX
Need to revisit shortly...


To generate a diff of this commit:
cvs rdiff -u -r1.7.46.1 -r1.7.46.2 \
src/lib/libpthread/arch/powerpc/pthread_md.h
cvs rdiff -u -r1.46.4.1 -r1.46.4.2 src/sys/arch/powerpc/powerpc/sig_machdep.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/libpthread/arch/powerpc/pthread_md.h
diff -u src/lib/libpthread/arch/powerpc/pthread_md.h:1.7.46.1 src/lib/libpthread/arch/powerpc/pthread_md.h:1.7.46.2
--- src/lib/libpthread/arch/powerpc/pthread_md.h:1.7.46.1	Thu Feb 27 18:48:12 2020
+++ src/lib/libpthread/arch/powerpc/pthread_md.h	Sun Apr 12 08:35:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_md.h,v 1.7.46.1 2020/02/27 18:48:12 martin Exp $	*/
+/*	$NetBSD: pthread_md.h,v 1.7.46.2 2020/04/12 08:35:40 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -53,10 +53,7 @@ pthread__sp(void)
 /*
  * Set initial, sane values for registers whose values aren't just
  * "don't care".
- *
- * XXX
- * "Sane value" for MSR differs between oea/booke/ibm4xx, but no way to
- * obtain from userland. It should be corrected by cpu_setmcontext().
+ * 0xd032 is PSL_USERSET from arch/powerpc/include/psl.h
  */
 #define _INITCONTEXT_U_MD(ucp)		\
 	(ucp)->uc_mcontext.__gregs[_REG_MSR] = 0xd032;

Index: src/sys/arch/powerpc/powerpc/sig_machdep.c
diff -u src/sys/arch/powerpc/powerpc/sig_machdep.c:1.46.4.1 src/sys/arch/powerpc/powerpc/sig_machdep.c:1.46.4.2
--- src/sys/arch/powerpc/powerpc/sig_machdep.c:1.46.4.1	Thu Feb 27 18:48:12 2020
+++ src/sys/arch/powerpc/powerpc/sig_machdep.c	Sun Apr 12 08:35:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.46.4.1 2020/02/27 18:48:12 martin Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.46.4.2 2020/04/12 08:35:40 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.46.4.1 2020/02/27 18:48:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.46.4.2 2020/04/12 08:35:40 martin Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_altivec.h"
@@ -191,8 +191,6 @@ cpu_getmcontext(struct lwp *l, mcontext_
 int
 cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
 {
-
-	KASSERT(PSL_USEROK_P(mcp->__gregs[_REG_MSR]));
 	return 0;
 }
 



CVS commit: [netbsd-9] src

2020-04-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 12 08:29:41 UTC 2020

Modified Files:
src/doc [netbsd-9]: 3RDPARTY
src/external/bsd/dhcpcd/dist/src [netbsd-9]: arp.c arp.h bpf.c bpf.h
common.h defs.h dhcp.c dhcp6.c dhcp6.h dhcpcd.c eloop.h if-bsd.c
if-options.c if.c if.h ipv4ll.c ipv6.c ipv6nd.c ipv6nd.h logerr.c
logerr.h

Log Message:
Apply patch, requested by roy in ticket #825:

external/bsd/dhcpcd/dist/src/arp.c  (apply patch)
external/bsd/dhcpcd/dist/src/arp.h  (apply patch)
external/bsd/dhcpcd/dist/src/bpf.c  (apply patch)
external/bsd/dhcpcd/dist/src/bpf.h  (apply patch)
external/bsd/dhcpcd/dist/src/common.h   (apply patch)
external/bsd/dhcpcd/dist/src/defs.h (apply patch)
external/bsd/dhcpcd/dist/src/dhcp.c (apply patch)
external/bsd/dhcpcd/dist/src/dhcp6.c(apply patch)
external/bsd/dhcpcd/dist/src/dhcp6.h(apply patch)
external/bsd/dhcpcd/dist/src/dhcpcd.c   (apply patch)
external/bsd/dhcpcd/dist/src/eloop.h(apply patch)
external/bsd/dhcpcd/dist/src/if-bsd.c   (apply patch)
external/bsd/dhcpcd/dist/src/if-options.c   (apply patch)
external/bsd/dhcpcd/dist/src/if.c   (apply patch)
external/bsd/dhcpcd/dist/src/if.h   (apply patch)
external/bsd/dhcpcd/dist/src/ipv4ll.c   (apply patch)
external/bsd/dhcpcd/dist/src/ipv6.c (apply patch)
external/bsd/dhcpcd/dist/src/ipv6nd.c   (apply patch)
external/bsd/dhcpcd/dist/src/ipv6nd.h   (apply patch)
external/bsd/dhcpcd/dist/src/logerr.c   (apply patch)
external/bsd/dhcpcd/dist/src/logerr.h   (apply patch)
doc/3RDPARTY(apply patch)

Update to dhcpcd-8.1.7 which fixes the following issues:
* Decode interface complex interface names eth0.100:2 eth0i100:2.
  This allows us to ignore some virtual interfaces by default
* ARP: Report L2 header address on conflict for more clarity
* DHCP: Support jumbo frames (untested)
* DHCP6: Clean up old lease on failure to confirm/rebind, etc
* RA: Prefer older routers - fixes PR bin/54997
* INET6: Obscure prefixes are now calculated correctly
* macro logerr commands to allow an alternative logger


To generate a diff of this commit:
cvs rdiff -u -r1.1640.2.12 -r1.1640.2.13 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.11.2.2 -r1.1.1.11.2.3 \
src/external/bsd/dhcpcd/dist/src/arp.c
cvs rdiff -u -r1.1.1.8.2.1 -r1.1.1.8.2.2 \
src/external/bsd/dhcpcd/dist/src/arp.h \
src/external/bsd/dhcpcd/dist/src/common.h
cvs rdiff -u -r1.11.2.2 -r1.11.2.3 src/external/bsd/dhcpcd/dist/src/bpf.c
cvs rdiff -u -r1.1.1.6.2.1 -r1.1.1.6.2.2 \
src/external/bsd/dhcpcd/dist/src/bpf.h
cvs rdiff -u -r1.1.1.25.2.6 -r1.1.1.25.2.7 \
src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.23.2.6 -r1.23.2.7 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.11.2.4 -r1.11.2.5 src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.1.1.12 -r1.1.1.12.2.1 \
src/external/bsd/dhcpcd/dist/src/dhcp6.h
cvs rdiff -u -r1.23.2.5 -r1.23.2.6 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.1.1.5.2.1 -r1.1.1.5.2.2 \
src/external/bsd/dhcpcd/dist/src/eloop.h
cvs rdiff -u -r1.10.2.4 -r1.10.2.5 src/external/bsd/dhcpcd/dist/src/if-bsd.c
cvs rdiff -u -r1.16.2.3 -r1.16.2.4 \
src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.1.1.14.2.3 -r1.1.1.14.2.4 \
src/external/bsd/dhcpcd/dist/src/if.c
cvs rdiff -u -r1.1.1.10.2.3 -r1.1.1.10.2.4 \
src/external/bsd/dhcpcd/dist/src/if.h
cvs rdiff -u -r1.1.1.9.2.1 -r1.1.1.9.2.2 \
src/external/bsd/dhcpcd/dist/src/ipv4ll.c
cvs rdiff -u -r1.3.2.5 -r1.3.2.6 src/external/bsd/dhcpcd/dist/src/ipv6.c
cvs rdiff -u -r1.10.2.5 -r1.10.2.6 src/external/bsd/dhcpcd/dist/src/ipv6nd.c
cvs rdiff -u -r1.1.1.10.2.2 -r1.1.1.10.2.3 \
src/external/bsd/dhcpcd/dist/src/ipv6nd.h
cvs rdiff -u -r1.2 -r1.2.2.1 src/external/bsd/dhcpcd/dist/src/logerr.c
cvs rdiff -u -r1.1.1.5 -r1.1.1.5.2.1 \
src/external/bsd/dhcpcd/dist/src/logerr.h

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.1640.2.12 src/doc/3RDPARTY:1.1640.2.13
--- src/doc/3RDPARTY:1.1640.2.12	Tue Jan 28 09:48:33 2020
+++ src/doc/3RDPARTY	Sun Apr 12 08:29:40 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1640.2.12 2020/01/28 09:48:33 martin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1640.2.13 2020/04/12 08:29:40 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -341,12 +341,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	8.1.6

CVS commit: src/sys/arch

2020-04-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 12 07:49:58 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_machdep.c cpufunc.c cpuswitch.S
db_trace.c genassym.cf locore.S vectors.S vm_machdep.c
src/sys/arch/aarch64/conf: Makefile.aarch64
src/sys/arch/aarch64/include: armreg.h asm.h cpufunc.h proc.h
src/sys/arch/arm/conf: files.arm
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
Add support for Pointer Authentication (PAC).

We use the "pac-ret" option, to sign the return instruction pointer on
function entry, and authenticate it on function exit. This acts as a
mitigation against ROP.

The authentication uses a per-lwp (secret) I-A key stored in the 128bit
APIAKey register and part of the lwp context. During lwp creation, the
kernel generates a random key, and during context switches, it installs
the key of the target lwp on the CPU.

Userland cannot read the APIAKey register directly. However, it can sign
its pointers with it, because the register is architecturally shared
between userland and the kernel. Although part of the CPU design, it is
a bit of an undesired behavior, because it allows to forge valid kernel
pointers from userland. To avoid that, we don't share the key with
userland, and rather switch it in EL0<->EL1 transitions. This means that
when userland executes, a different key is loaded in APIAKey than the one
the kernel uses. For now the userland key is a fixed 128bit zero value.

The DDB stack unwinder is changed to strip the authentication code from
the pointers in lr.

Two problems are known:

 * Currently the idlelwps' keys are not really secret. This is because
   the RNG is not yet available when we spawn these lwps. Not overly
   important, but would be nice to fix with UEFI RNG.
 * The key switching in EL0<->EL1 transitions is not the most optimized
   code on the planet. Instead of checking aarch64_pac_enabled, it would
   be better to hot-patch the code at boot time, but there currently is
   no hot-patch support on aarch64.

Tested on Qemu.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/aarch64/aarch64/aarch64_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/aarch64/cpufunc.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/db_trace.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/aarch64/vectors.S
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/vm_machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/conf/Makefile.aarch64
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/include/asm.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/include/cpufunc.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/include/proc.h
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/arm/conf/files.arm
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/evbarm/conf/GENERIC64

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/aarch64/aarch64/aarch64_machdep.c
diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.40 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.41
--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.40	Sat Feb 29 21:36:03 2020
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c	Sun Apr 12 07:49:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.40 2020/02/29 21:36:03 ryo Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.41 2020/04/12 07:49:58 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.40 2020/02/29 21:36:03 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.41 2020/04/12 07:49:58 maxv Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -456,6 +456,14 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 	SYSCTL_DESCR("top byte ignored in the address calculation"),
 	sysctl_machdep_tagged_address, 0, NULL, 0,
 	CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(clog, 0, NULL, NULL,
+	CTLFLAG_PERMANENT,
+	CTLTYPE_INT, "pac",
+	SYSCTL_DESCR("Whether Pointer Authentication is enabled"),
+	NULL, 0,
+	_pac_enabled, 0,
+	CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 }
 
 void

Index: src/sys/arch/aarch64/aarch64/cpufunc.c
diff -u src/sys/arch/aarch64/aarch64/cpufunc.c:1.16 src/sys/arch/aarch64/aarch64/cpufunc.c:1.17
--- src/sys/arch/aarch64/aarch64/cpufunc.c:1.16	Sun Apr  5 22:54:51 2020
+++ src/sys/arch/aarch64/aarch64/cpufunc.c	Sun Apr 12 07:49:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.16 2020/04/05 22:54:51 jmcneill Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.17 2020/04/12 07:49:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -26,10 

CVS commit: src/sys/dev/usb

2020-04-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 12 07:41:11 UTC 2020

Modified Files:
src/sys/dev/usb: ums.c

Log Message:
further tweaks for USB_PRODUCT_MICROSOFT_24GHZ_XCVR80 from PR kern/55161

remove case for USB_PRODUCT_MICROSOFT_24GHZ_XCVR70, likely needs similar
tweaks and can't really be added untested


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/usb/ums.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/usb/ums.c
diff -u src/sys/dev/usb/ums.c:1.97 src/sys/dev/usb/ums.c:1.98
--- src/sys/dev/usb/ums.c:1.97	Sat Apr 11 06:57:32 2020
+++ src/sys/dev/usb/ums.c	Sun Apr 12 07:41:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ums.c,v 1.97 2020/04/11 06:57:32 jdolecek Exp $	*/
+/*	$NetBSD: ums.c,v 1.98 2020/04/12 07:41:11 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.97 2020/04/11 06:57:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.98 2020/04/12 07:41:11 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -164,6 +164,7 @@ ums_attach(device_t parent, device_t sel
 
 	if (uha->uiaa->uiaa_vendor == USB_VENDOR_MICROSOFT) {
 		int fixpos;
+		int woffset = 8;
 		/*
 		 * The Microsoft Wireless Laser Mouse 6000 v2.0 and the
 		 * Microsoft Comfort Mouse 2.0 report a bad position for
@@ -173,11 +174,13 @@ ums_attach(device_t parent, device_t sel
 		switch (uha->uiaa->uiaa_product) {
 		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR10:
 		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR20:
-		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR70:
-		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR80:
 		case USB_PRODUCT_MICROSOFT_NATURAL_6000:
 			fixpos = 24;
 			break;
+		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR80:
+			fixpos = 40;
+			woffset = sc->sc_ms.hidms_loc_z.size;
+			break;
 		case USB_PRODUCT_MICROSOFT_CM6000:
 			fixpos = 40;
 			break;
@@ -192,7 +195,7 @@ ums_attach(device_t parent, device_t sel
 			if ((sc->sc_ms.flags & HIDMS_W) &&
 			sc->sc_ms.hidms_loc_w.pos == 0)
 sc->sc_ms.hidms_loc_w.pos =
-sc->sc_ms.hidms_loc_z.pos + 8;
+sc->sc_ms.hidms_loc_z.pos + woffset;
 		}
 	}
 



CVS commit: src/sys

2020-04-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 12 07:16:09 UTC 2020

Modified Files:
src/sys/kern: subr_cprng.c
src/sys/sys: cprng.h

Log Message:
Don't inline cprng_strong{32,64}(), so they can be called from asm.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/subr_cprng.c
cvs rdiff -u -r1.15 -r1.16 src/sys/sys/cprng.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/kern/subr_cprng.c
diff -u src/sys/kern/subr_cprng.c:1.34 src/sys/kern/subr_cprng.c:1.35
--- src/sys/kern/subr_cprng.c:1.34	Wed Dec  4 05:36:34 2019
+++ src/sys/kern/subr_cprng.c	Sun Apr 12 07:16:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cprng.c,v 1.34 2019/12/04 05:36:34 riastradh Exp $ */
+/*	$NetBSD: subr_cprng.c,v 1.35 2020/04/12 07:16:09 maxv Exp $ */
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.34 2019/12/04 05:36:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.35 2020/04/12 07:16:09 maxv Exp $");
 
 #include 
 #include 
@@ -251,6 +251,22 @@ out:	mutex_exit(>cs_lock);
 	return result;
 }
 
+uint32_t
+cprng_strong32(void)
+{
+	uint32_t r;
+	cprng_strong(kern_cprng, , sizeof(r), 0);
+	return r;
+}
+
+uint64_t
+cprng_strong64(void)
+{
+	uint64_t r;
+	cprng_strong(kern_cprng, , sizeof(r), 0);
+	return r;
+}
+
 static void
 filt_cprng_detach(struct knote *kn)
 {

Index: src/sys/sys/cprng.h
diff -u src/sys/sys/cprng.h:1.15 src/sys/sys/cprng.h:1.16
--- src/sys/sys/cprng.h:1.15	Mon Sep  2 20:09:30 2019
+++ src/sys/sys/cprng.h	Sun Apr 12 07:16:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cprng.h,v 1.15 2019/09/02 20:09:30 riastradh Exp $ */
+/*	$NetBSD: cprng.h,v 1.16 2020/04/12 07:16:09 maxv Exp $ */
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -71,20 +71,7 @@ int	cprng_strong_poll(cprng_strong_t *, 
 
 extern cprng_strong_t	*kern_cprng;
 
-static __inline uint32_t
-cprng_strong32(void)
-{
-	uint32_t r;
-	cprng_strong(kern_cprng, , sizeof(r), 0);
-	return r;
-}
-
-static __inline uint64_t
-cprng_strong64(void)
-{
-	uint64_t r;
-	cprng_strong(kern_cprng, , sizeof(r), 0);
-	return r;
-}
+uint32_t cprng_strong32(void);
+uint64_t cprng_strong64(void);
 
 #endif	/* _CPRNG_H */



CVS commit: src/sys/arch/sparc/conf

2020-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr 12 06:05:34 UTC 2020

Modified Files:
src/sys/arch/sparc/conf: INSTALL

Log Message:
base INSTALL kernel upon GENERIC with many "no ...".


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sparc/conf/INSTALL

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/sparc/conf/INSTALL
diff -u src/sys/arch/sparc/conf/INSTALL:1.103 src/sys/arch/sparc/conf/INSTALL:1.104
--- src/sys/arch/sparc/conf/INSTALL:1.103	Sun Jan 19 01:25:07 2020
+++ src/sys/arch/sparc/conf/INSTALL	Sun Apr 12 06:05:34 2020
@@ -1,18 +1,13 @@
-#	$NetBSD: INSTALL,v 1.103 2020/01/19 01:25:07 thorpej Exp $
+#	$NetBSD: INSTALL,v 1.104 2020/04/12 06:05:34 mrg Exp $
 #
 # from: NetBSD: GENERIC,v 1.84 1999/06/06 13:00:03 mrg Exp
 #
-# floppy install kernel.  try to keep this in sync with GENERIC but
-# leave as much disabled as possible.
+# floppy install kernel.  based upon GENERIC, with much turned off.
 
-include "arch/sparc/conf/std.sparc"
-
-#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+include "arch/sparc/conf/GENERIC"
 
 makeoptions	COPTS="-Os"		# Optimise for space. Implies -O2
 
-maxusers	32
-
 # Enable the hooks used for initializing the root memory-disk.
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -24,546 +19,79 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 
 pseudo-device	md			# memory disk device (ramdisk)
 
-## System kernel configuration.  See options(4) for more detail.
-
-
-# Options for variants of the Sun SPARC architecure.
-# We currently support three architecture types; at least one is required.
-options 	SUN4		# sun4/100, sun4/200, sun4/300
-options 	SUN4C		# sun4c - SS1, 1+, 2, ELC, SLC, IPC, IPX, etc.
-options 	SUN4M		# sun4m - SS10, SS20, Classic, etc.
-
-options 	SUN4_MMU3L	# 3-level MMU on sun4/400
-
-## System options specific to the sparc machine type
-
-# Blink the power LED on some machines to indicate the system load.
-#options 	BLINK
-
-# wscons stuff
-#options 	WSEMUL_SUN
-options 	WSEMUL_VT100
+no options 	SUN4D
 options 	WSDISPLAY_DEFAULTSCREENS=1
-#options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	WSDISPLAY_COMPAT_RAWKBD
-options 	WSDISPLAY_CUSTOM_OUTPUT
-options 	WS_DEFAULT_FG=WSCOL_BLACK
-options 	WS_DEFAULT_BG=WSCOL_LIGHT_WHITE
-options 	WS_KERNEL_FG=WSCOL_GREEN
-options 	WS_KERNEL_BG=WSCOL_LIGHT_WHITE
-options 	FONT_GALLANT12x22	# the console font
-options 	FONT_BOLD8x16		# a somewhat smaller font
-
- System options that are the same for all ports
-
-## Root device configuration: change the ?'s if you are going to use a
-## nonstandard root partition (other than where the kernel is booted from)
-## and/or nonstandard root type (not ffs or nfs).  Normally this can be
-## automagically determined at boot time.
-
-config		netbsd	root on ? type ?
-
-## System call tracing (see ktrace(1)).
-#options 	KTRACE
-
-## System V compatible IPC subsystem.  (msgctl(2), semctl(2), and shmctl(2))
-#options 	SYSVMSG		# System V message queues
-#options 	SYSVSEM		# System V semaphores
-#options 	SYSVSHM		# System V shared memory
-
-options 	USERCONF	# userconf(4) support
-options 	PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
-#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
-
-## NFS boot options; tries DHCP/BOOTP then BOOTPARAM
-options 	NFS_BOOT_BOOTPARAM
-#options 	NFS_BOOT_BOOTP
-options 	NFS_BOOT_DHCP
-
- Debugging options
-
-## The DDB in-kernel debugger runs at panic (unless DDB_ONPANIC=0), or at
-## serial console break or keyboard reset, where the PROM would normally
-## intercept.  DDB_HISTORY_SIZE adds up/down arrow command history.
-#options 	DDB			# kernel dynamic debugger
-#options 	DDB_HISTORY_SIZE=100	# enable history editing in DDB
-#options 	DDB_ONPANIC=1		# see also sysctl(7): `ddb.onpanic'
-
-## You may also use gdb, on another computer connected to this machine over
-## a serial port.  Both KGDB_DEV and KGDB_DEVRATE should be specified;
-## KGDB_DEV is a dev_t encoded device number of the serial port to use.
-## (0xc01 = ttya, 0xc02 = ttyb.)
-#options 	KGDB			# support for kernel gdb
-#options 	KGDB_DEV=0xc01		# kgdb device number (this is `ttyb')
-#options 	KGDB_DEVRATE=38400	# baud rate
-
-
-## Compile the kernel with debugging symbols (`netbsd.gdb' is the debug file),
-## such that gdb(1) can be used on a kernel coredump.
-
-#makeoptions	DEBUG="-g"
-
-
-## Adds code to the kernel that does internal consistency checks, and will
-## cause the kernel to panic if corruption of internal data structures
-## is detected.
-#options 	DIAGNOSTIC	# extra kernel sanity checking
-
-## Enable (possibly expensive) debugging code that may also display messages
-## on the system console
-#options 	DEBUG
-
-#options 	MIIVERBOSE	# verbose PHY autoconfig messages
-
-## Make SCSI error messages more verbose when