CVS commit: src/sys/rump/fs/lib/libnofifovfs

2020-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 00:43:15 UTC 2020

Added Files:
src/sys/rump/fs/lib/libnofifovfs: Makefile nofifo_vnops.c

Log Message:
PR/55102: Kamil Rytarowski: Duplicate fifo_vnodeop_entries,
fifo_vnodeop_opv_desc symbols.

Missed adding those in previous


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/rump/fs/lib/libnofifovfs/Makefile \
src/sys/rump/fs/lib/libnofifovfs/nofifo_vnops.c

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

Added files:

Index: src/sys/rump/fs/lib/libnofifovfs/Makefile
diff -u /dev/null src/sys/rump/fs/lib/libnofifovfs/Makefile:1.1
--- /dev/null	Fri May 15 20:43:15 2020
+++ src/sys/rump/fs/lib/libnofifovfs/Makefile	Fri May 15 20:43:15 2020
@@ -0,0 +1,10 @@
+#	$NetBSD: Makefile,v 1.1 2020/05/16 00:43:15 christos Exp $
+#
+
+LIB=	rumpvfs_nofifofs
+COMMENT=File system null FIFO support
+
+SRCS=	nofifo_vnops.c
+
+.include 
+.include 
Index: src/sys/rump/fs/lib/libnofifovfs/nofifo_vnops.c
diff -u /dev/null src/sys/rump/fs/lib/libnofifovfs/nofifo_vnops.c:1.1
--- /dev/null	Fri May 15 20:43:15 2020
+++ src/sys/rump/fs/lib/libnofifovfs/nofifo_vnops.c	Fri May 15 20:43:15 2020
@@ -0,0 +1,43 @@
+/*  $NetBSD: nofifo_vnops.c,v 1.1 2020/05/16 00:43:15 christos Exp $*/
+
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: nofifo_vnops.c,v 1.1 2020/05/16 00:43:15 christos Exp $");
+
+#include 
+#include 
+#include  
+
+int (**fifo_vnodeop_p)(void *);
+
+const struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
+	{ _default_desc, vn_default_error },
+	{ _putpages_desc, genfs_null_putpages },
+	{ NULL, NULL }
+};
+
+const struct vnodeopv_desc fifo_vnodeop_opv_desc =
+	{ _vnodeop_p, fifo_vnodeop_entries };
+



CVS commit: src/external/cddl/osnet/dev/profile

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 23:57:17 UTC 2020

Modified Files:
src/external/cddl/osnet/dev/profile: profile.c

Log Message:
Bump PROF_ARTIFICIAL_FRAMES to 4 now that cyclics are run from statclock().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/dev/profile/profile.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/cddl/osnet/dev/profile/profile.c
diff -u src/external/cddl/osnet/dev/profile/profile.c:1.10 src/external/cddl/osnet/dev/profile/profile.c:1.11
--- src/external/cddl/osnet/dev/profile/profile.c:1.10	Fri Jun 29 11:33:46 2018
+++ src/external/cddl/osnet/dev/profile/profile.c	Fri May 15 23:57:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.c,v 1.10 2018/06/29 11:33:46 kamil Exp $	*/
+/*	$NetBSD: profile.c,v 1.11 2020/05/15 23:57:17 ad Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -169,7 +169,7 @@ struct profile_probe_percpu;
 #endif /* __FreeBSD__ */
 
 #ifdef __NetBSD__
-#define	PROF_ARTIFICIAL_FRAMES	3
+#define	PROF_ARTIFICIAL_FRAMES	4
 #endif
 
 typedef struct profile_probe {



CVS commit: src

2020-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May 15 23:32:28 UTC 2020

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/debug: mi shl.mi
src/sys/rump/fs: Makefile.rumpfscomp
src/sys/rump/librump/rumpvfs: rumpfs.c
src/tests: Makefile.inc
src/tests/fs/ffs: Makefile
src/tests/fs/puffs: Makefile

Log Message:
PR/55102: Kamil Rytarowski: Duplicate fifo_vnodeop_entries,
fifo_vnodeop_opv_desc symbols.

Many filesystems ffs, lfs, ulfs, chfs, ext2fs etc. use fifofs
internally for their fifo vnops. NFS does too, but it also needs
networking anyway.  Unfortunately fifofs brings in a lot of the
networking code so that the rumpkernel is not well partition. In
addition the fifo code is rarely used.

The existing hack depended on duplicating the above symbols and
adding minimal functionality for the majority of the the tests
(except the ffs and the puffs one). In these two cases both symbols
were loaded and the symbol sizes clashed which broke the sanitizers.
While this can be fixed with weak symbols and other kinds of
indirection, it is more straight forward to select between the
minimal and the full fifofs implementation by introducing a new
shared library librumpvfs_nofifofs.


To generate a diff of this commit:
cvs rdiff -u -r1.885 -r1.886 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2325 -r1.2326 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.331 -r1.332 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.309 -r1.310 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.246 -r1.247 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/fs/Makefile.rumpfscomp
cvs rdiff -u -r1.160 -r1.161 src/sys/rump/librump/rumpvfs/rumpfs.c
cvs rdiff -u -r1.6 -r1.7 src/tests/Makefile.inc
cvs rdiff -u -r1.21 -r1.22 src/tests/fs/ffs/Makefile
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/puffs/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.885 src/distrib/sets/lists/base/shl.mi:1.886
--- src/distrib/sets/lists/base/shl.mi:1.885	Fri May 15 10:57:33 2020
+++ src/distrib/sets/lists/base/shl.mi	Fri May 15 19:32:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.885 2020/05/15 14:57:33 joerg Exp $
+# $NetBSD: shl.mi,v 1.886 2020/05/15 23:32:27 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -844,6 +844,9 @@
 ./usr/lib/librumpvfs_layerfs.so			base-rump-shlib		rump
 ./usr/lib/librumpvfs_layerfs.so.0		base-rump-shlib		rump
 ./usr/lib/librumpvfs_layerfs.so.0.0		base-rump-shlib		rump
+./usr/lib/librumpvfs_nofifofs.so		base-rump-shlib		rump
+./usr/lib/librumpvfs_nofifofs.so.0		base-rump-shlib		rump
+./usr/lib/librumpvfs_nofifofs.so.0.0		base-rump-shlib		rump
 ./usr/lib/libsaslc.sobase-sys-shlib		compatfile
 ./usr/lib/libsaslc.so.0base-sys-shlib		compatfile
 ./usr/lib/libsaslc.so.0.0			base-sys-shlib		compatfile

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2325 src/distrib/sets/lists/comp/mi:1.2326
--- src/distrib/sets/lists/comp/mi:1.2325	Wed May  6 12:17:36 2020
+++ src/distrib/sets/lists/comp/mi	Fri May 15 19:32:27 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2325 2020/05/06 16:17:36 nia Exp $
+#	$NetBSD: mi,v 1.2326 2020/05/15 23:32:27 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -3863,6 +3863,8 @@
 ./usr/lib/librumpvfs_fifofs_p.a			comp-c-proflib		rump,profile
 ./usr/lib/librumpvfs_layerfs.a			comp-c-lib		rump
 ./usr/lib/librumpvfs_layerfs_p.a		comp-c-proflib		rump,profile
+./usr/lib/librumpvfs_nofifofs.a			comp-c-lib		rump
+./usr/lib/librumpvfs_nofifofs_p.a		comp-c-proflib		rump,profile
 ./usr/lib/librumpvfs_p.a			comp-c-proflib		compatfile,rump,profile
 ./usr/lib/libsaslc.acomp-c-clib		compatfile
 ./usr/lib/libsaslc_p.acomp-c-proflib		compatfile,profile

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.331 src/distrib/sets/lists/comp/shl.mi:1.332
--- src/distrib/sets/lists/comp/shl.mi:1.331	Sat Apr  4 15:26:51 2020
+++ src/distrib/sets/lists/comp/shl.mi	Fri May 15 19:32:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.331 2020/04/04 19:26:51 christos Exp $
+# $NetBSD: shl.mi,v 1.332 2020/05/15 23:32:28 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -252,6 +252,7 @@
 ./usr/lib/librumpvfs_aio_pic.a			comp-c-piclib		picinstall,rump
 ./usr/lib/librumpvfs_fifofs_pic.a		comp-c-piclib		picinstall,rump
 ./usr/lib/librumpvfs_layerfs_pic.a		comp-c-piclib		picinstall,rump
+./usr/lib/librumpvfs_nofifofs_pic.a		comp-c-piclib		picinstall,rump
 ./usr/lib/librumpvfs_pic.a			comp-c-piclib		compatfile,picinstall,rump
 

CVS commit: src/usr.bin/sed

2020-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May 15 22:39:54 UTC 2020

Modified Files:
src/usr.bin/sed: defs.h main.c process.c

Log Message:
sed(1): Don't force a newline on last line, if input stream doesn't have one

While here, change how we check if the current line is the last one.
Before, we just checked if there were more files after the current one.
Now, we check the actual content of those files: they files may not have
a line at all. This matches the definition of the "last line" by the
Open Group.

The new behavior is closer to GNU sed.

>From FreeBSD (9dd857db3dc558dc61dc8674d204ebc83cac0739), requested by mrg@


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/sed/defs.h
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/sed/main.c
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/sed/process.c

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

Modified files:

Index: src/usr.bin/sed/defs.h
diff -u src/usr.bin/sed/defs.h:1.12 src/usr.bin/sed/defs.h:1.13
--- src/usr.bin/sed/defs.h:1.12	Fri Jun  6 17:56:39 2014
+++ src/usr.bin/sed/defs.h	Fri May 15 18:39:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.12 2014/06/06 21:56:39 wiz Exp $	*/
+/*	$NetBSD: defs.h,v 1.13 2020/05/15 22:39:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -145,6 +145,7 @@ typedef struct {
 	char *space;		/* Current space pointer. */
 	size_t len;		/* Current length. */
 	int deleted;		/* If deleted. */
+	int append_newline;	/* If originally terminated by \n. */
 	char *back;		/* Backing memory. */
 	size_t blen;		/* Backing memory length. */
 } SPACE;

Index: src/usr.bin/sed/main.c
diff -u src/usr.bin/sed/main.c:1.35 src/usr.bin/sed/main.c:1.36
--- src/usr.bin/sed/main.c:1.35	Sat Oct  5 16:22:36 2019
+++ src/usr.bin/sed/main.c	Fri May 15 18:39:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.35 2019/10/05 20:22:36 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.36 2020/05/15 22:39:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 Johann 'Myrkraverk' Oskarsson.
@@ -39,7 +39,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: main.c,v 1.35 2019/10/05 20:22:36 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.36 2020/05/15 22:39:54 christos Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/main.c 252231 2013-06-26 04:14:19Z pfg $");
 #endif
@@ -465,8 +465,14 @@ mf_fgets(SPACE *sp, enum e_spflag spflag
 	ssize_t slen = getline(, , infile);
 	if (slen == -1)
 		err(1, "%s", fname);
-	if (slen != 0 && p[slen - 1] == '\n')
+	if (slen != 0 && p[slen - 1] == '\n') {
+		sp->append_newline = 1;
 		slen--;
+	} else if (!lastline()) {
+		sp->append_newline = 1;
+	} else {
+		sp->append_newline = 0;
+	}
 	cspace(sp, p, (size_t)slen, spflag);
 
 	linenum++;
@@ -505,15 +511,49 @@ add_file(char *s)
 	fl_nextp = >next;
 }
 
+static int
+next_files_have_lines(void)
+{
+	struct s_flist *file;
+	FILE *file_fd;
+	int ch;
+
+	file = files;
+	while ((file = file->next) != NULL) {
+		if ((file_fd = fopen(file->fname, "r")) == NULL)
+			continue;
+
+		if ((ch = getc(file_fd)) != EOF) {
+			/*
+			 * This next file has content, therefore current
+			 * file doesn't contains the last line.
+			 */
+			ungetc(ch, file_fd);
+			fclose(file_fd);
+			return (1);
+		}
+
+		fclose(file_fd);
+	}
+
+	return (0);
+}
+
 int
 lastline(void)
 {
 	int ch;
 
-	if (files->next != NULL && (inplace == NULL || ispan))
-		return (0);
-	if ((ch = getc(infile)) == EOF)
-		return (1);
+	if (feof(infile)) {
+		return !(
+		(inplace == NULL || ispan) &&
+		next_files_have_lines());
+	}
+	if ((ch = getc(infile)) == EOF) {
+		return !(
+		(inplace == NULL || ispan) &&
+		next_files_have_lines());
+	}
 	ungetc(ch, infile);
 	return (0);
 }

Index: src/usr.bin/sed/process.c
diff -u src/usr.bin/sed/process.c:1.52 src/usr.bin/sed/process.c:1.53
--- src/usr.bin/sed/process.c:1.52	Thu Mar 12 08:40:41 2015
+++ src/usr.bin/sed/process.c	Fri May 15 18:39:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: process.c,v 1.52 2015/03/12 12:40:41 christos Exp $	*/
+/*	$NetBSD: process.c,v 1.53 2020/05/15 22:39:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: process.c,v 1.52 2015/03/12 12:40:41 christos Exp $");
+__RCSID("$NetBSD: process.c,v 1.53 2020/05/15 22:39:54 christos Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/process.c 192732 2009-05-25 06:45:33Z brian $");
 #endif
@@ -72,6 +72,7 @@ static SPACE HS, PS, SS, YS;
 #define	pd		PS.deleted
 #define	ps		PS.space
 #define	psl		PS.len
+#define	psanl		PS.append_newline
 #define	hs		HS.space
 #define	hsl		HS.len
 
@@ -94,7 +95,10 @@ static regex_t *defpreg;
 size_t maxnsub;
 regmatch_t *match;
 
-#define OUT() do {fwrite(ps, 1, psl, outfile); fputc('\n', outfile);} while (0)
+#define OUT() do {			\
+	fwrite(ps, 1, psl, outfile);	\
+	if (psanl) fputc('\n', outfile);\
+} while (0)
 
 void
 process(void)
@@ -103,6 

CVS commit: src/sys/uvm

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:35:05 UTC 2020

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
Reported-by: syzbot+3e3c7cfa8093f8de0...@syzkaller.appspotmail.com

Comment out an assertion that's now bogus and add a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/uvm/uvm_fault.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/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.225 src/sys/uvm/uvm_fault.c:1.226
--- src/sys/uvm/uvm_fault.c:1.225	Mon Apr 13 22:22:19 2020
+++ src/sys/uvm/uvm_fault.c	Fri May 15 22:35:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.225 2020/04/13 22:22:19 ad Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.226 2020/05/15 22:35:05 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.225 2020/04/13 22:22:19 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.226 2020/05/15 22:35:05 ad Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1701,9 +1701,13 @@ uvm_fault_upper_enter(
 		 * but rather that the pmap should be designed such that it
 		 * never needs to fail when the new mapping is replacing an
 		 * existing mapping and the new page has no existing mappings.
+		 *
+		 * XXX This can't be asserted safely any more because many
+		 * LWPs and/or many processes could simultaneously fault on
+		 * the same VA and some might succeed.
 		 */
 
-		KASSERT(!pmap_extract(pmap, va, NULL));
+		/* KASSERT(!pmap_extract(pmap, va, NULL)); */
 
 		/*
 		 * ensure that the page is queued in the case that



CVS commit: src/sys/uvm

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:27:04 UTC 2020

Modified Files:
src/sys/uvm: uvm_aobj.c

Log Message:
PR kern/55268: tmpfs is slow

uao_get(): in the PGO_LOCKED case, we're okay to allocate a new page as long
as the caller holds a write lock.  PGO_NOBUSY doesn't put a stop to that.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/uvm/uvm_aobj.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/uvm_aobj.c
diff -u src/sys/uvm/uvm_aobj.c:1.139 src/sys/uvm/uvm_aobj.c:1.140
--- src/sys/uvm/uvm_aobj.c:1.139	Sun Mar 22 18:32:42 2020
+++ src/sys/uvm/uvm_aobj.c	Fri May 15 22:27:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_aobj.c,v 1.139 2020/03/22 18:32:42 ad Exp $	*/
+/*	$NetBSD: uvm_aobj.c,v 1.140 2020/05/15 22:27:04 ad Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.139 2020/03/22 18:32:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.140 2020/05/15 22:27:04 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -827,6 +827,7 @@ uao_get(struct uvm_object *uobj, voff_t 
  	 */
 
 	if (flags & PGO_LOCKED) {
+		krw_t lktype = rw_lock_op(uobj->vmobjlock);
 
 		/*
  		 * step 1a: get pages that are already resident.   only do
@@ -845,11 +846,11 @@ uao_get(struct uvm_object *uobj, voff_t 
 
 			/*
  			 * if page is new, attempt to allocate the page,
-			 * zero-fill'd.  we can only do this if busying
-			 * pages, as otherwise the object is read locked.
+			 * zero-fill'd.  we can only do this if the caller
+			 * holds a write lock.
  			 */
 
-			if ((flags & PGO_NOBUSY) == 0 && ptmp == NULL &&
+			if (ptmp == NULL && lktype == RW_WRITER &&
 			uao_find_swslot(uobj,
 			current_offset >> PAGE_SHIFT) == 0) {
 ptmp = uao_pagealloc(uobj, current_offset,
@@ -859,6 +860,8 @@ uao_get(struct uvm_object *uobj, voff_t 
 	ptmp->flags &= ~(PG_FAKE);
 	uvm_pagemarkdirty(ptmp,
 	UVM_PAGE_STATUS_UNKNOWN);
+	if ((flags & PGO_NOBUSY) != 0)
+		ptmp->flags &= ~PG_BUSY;
 	goto gotpage;
 }
 			}



CVS commit: src/sys/uvm

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:25:18 UTC 2020

Modified Files:
src/sys/uvm: uvm_page_status.c

Log Message:
uvm_pagemarkdirty(): no need to set radix tree tag unless page is currently
marked clean.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/uvm/uvm_page_status.c

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

Modified files:

Index: src/sys/uvm/uvm_page_status.c
diff -u src/sys/uvm/uvm_page_status.c:1.4 src/sys/uvm/uvm_page_status.c:1.5
--- src/sys/uvm/uvm_page_status.c:1.4	Sat Mar 14 20:45:23 2020
+++ src/sys/uvm/uvm_page_status.c	Fri May 15 22:25:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page_status.c,v 1.4 2020/03/14 20:45:23 ad Exp $	*/
+/*	$NetBSD: uvm_page_status.c,v 1.5 2020/05/15 22:25:18 ad Exp $	*/
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page_status.c,v 1.4 2020/03/14 20:45:23 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page_status.c,v 1.5 2020/05/15 22:25:18 ad Exp $");
 
 #include 
 #include 
@@ -108,7 +108,7 @@ uvm_pagemarkdirty(struct vm_page *pg, un
 		if (newstatus == UVM_PAGE_STATUS_CLEAN) {
 			radix_tree_clear_tag(>uo_pages, idx,
 			UVM_PAGE_DIRTY_TAG);
-		} else {
+		} else if (oldstatus == UVM_PAGE_STATUS_CLEAN) {
 			/*
 			 * on first dirty page, mark the object dirty.
 			 * for vnodes this inserts to the syncer worklist.



CVS commit: src/sys/arch/x86/x86

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:22:44 UTC 2020

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
PTP pages are zeroed before free again.


To generate a diff of this commit:
cvs rdiff -u -r1.391 -r1.392 src/sys/arch/x86/x86/pmap.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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.391 src/sys/arch/x86/x86/pmap.c:1.392
--- src/sys/arch/x86/x86/pmap.c:1.391	Fri May 15 22:22:06 2020
+++ src/sys/arch/x86/x86/pmap.c	Fri May 15 22:22:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.391 2020/05/15 22:22:06 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.392 2020/05/15 22:22:44 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.391 2020/05/15 22:22:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.392 2020/05/15 22:22:44 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -5433,10 +5433,7 @@ pmap_update(struct pmap *pmap)
 		uvm_pagerealloc(ptp, NULL, 0);
 		PMAP_DUMMY_UNLOCK(pmap);
 
-		/*
-		 * XXX for PTPs freed by pmap_remove_ptes() but not
-		 * pmap_zap_ptp(), we could mark them PG_ZERO.
-		 */
+		ptp->flags |= PG_ZERO;
 		uvm_pagefree(ptp);
 	}
 	while ((pvp = LIST_FIRST(>pm_pvp_full)) != NULL) {



CVS commit: src/sys/arch/x86/x86

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:22:06 UTC 2020

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Reported-by: syzbot+0f38e4aed17c14cf0...@syzkaller.appspotmail.com
Reported-by: syzbot+c1770938bb3fa7c08...@syzkaller.appspotmail.com
Reported-by: syzbot+92ca248f1137c4b34...@syzkaller.appspotmail.com
Reported-by: syzbot+acfd688740461f7ed...@syzkaller.appspotmail.com

Be careful with pmap_lock in pmap_update().  It can happen that pmap_kernel
has work pending that gets noticed in interrupt context, before process
context has a chance to deal with it.


To generate a diff of this commit:
cvs rdiff -u -r1.390 -r1.391 src/sys/arch/x86/x86/pmap.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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.390 src/sys/arch/x86/x86/pmap.c:1.391
--- src/sys/arch/x86/x86/pmap.c:1.390	Fri May 15 22:19:01 2020
+++ src/sys/arch/x86/x86/pmap.c	Fri May 15 22:22:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.390 2020/05/15 22:19:01 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.391 2020/05/15 22:22:06 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.390 2020/05/15 22:19:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.391 2020/05/15 22:22:06 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3035,10 +3035,17 @@ pmap_zap_ptp(struct pmap *pmap, struct v
 	pte += ((va - startva) >> PAGE_SHIFT);
 
 	for (cnt = ptp->wire_count; cnt > 1; pte++, va += PAGE_SIZE) {
+		/*
+		 * No need for an atomic to clear the PTE.  Nothing else can
+		 * see the address space any more and speculative access (if
+		 * possible) won't modify.  Therefore there's no need to
+		 * track the accessed/dirty bits.
+		 */
 		opte = *pte;
 		if (!pmap_valid_entry(opte)) {
 			continue;
 		}
+		pmap_pte_set(pte, 0);
 
 		/*
 		 * Count the PTE.  If it's not for a managed mapping
@@ -5380,6 +5387,7 @@ pmap_update(struct pmap *pmap)
 	struct pv_page *pvp;
 	struct pmap_page *pp;
 	struct vm_page *ptp;
+	uintptr_t sum;
 
 	/*
 	 * Initiate any pending TLB shootdowns.  Wait for them to
@@ -5393,45 +5401,52 @@ pmap_update(struct pmap *pmap)
 	 * Now that shootdowns are complete, process deferred frees.  This
 	 * is an unlocked check, but is safe as we're only interested in
 	 * work done in this LWP - we won't get a false negative.
-	 */
-	if (__predict_false(!LIST_EMPTY(>pm_gc_ptp) ||
-	!LIST_EMPTY(>pm_pvp_full))) {
-		mutex_enter(>pm_lock);
-		while ((ptp = LIST_FIRST(>pm_gc_ptp)) != NULL) {
-			KASSERT(ptp->wire_count == 0);
-			KASSERT(ptp->uanon == NULL);
-			LIST_REMOVE(ptp, mdpage.mp_pp.pp_link);
-			pp = VM_PAGE_TO_PP(ptp);
-			LIST_INIT(>pp_pvlist);
-			pp->pp_attrs = 0;
-			pp->pp_pte.pte_ptp = NULL;
-			pp->pp_pte.pte_va = 0;
-			PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
+	 *
+	 * If pmap_kernel(), this can be called from interrupt context or
+	 * while holding a spinlock so we can't wait on the pmap lock.  No
+	 * big deal as we'll catch up eventually (even for user pmaps, in
+	 * pmap_destroy() when there's never contention on the lock).
+	 */
+	sum = (uintptr_t)atomic_load_relaxed(>pm_gc_ptp.lh_first);
+	sum |= (uintptr_t)atomic_load_relaxed(>pm_pvp_full.lh_first);
+	if (__predict_true(sum == 0 || cpu_intr_p() ||
+	!mutex_tryenter(>pm_lock))) {
+		return;
+	}	
+	while ((ptp = LIST_FIRST(>pm_gc_ptp)) != NULL) {
+		KASSERT(ptp->wire_count == 0);
+		KASSERT(ptp->uanon == NULL);
+		LIST_REMOVE(ptp, mdpage.mp_pp.pp_link);
+		pp = VM_PAGE_TO_PP(ptp);
+		LIST_INIT(>pp_pvlist);
+		pp->pp_attrs = 0;
+		pp->pp_pte.pte_ptp = NULL;
+		pp->pp_pte.pte_va = 0;
+		PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
 
-			/*
-			 * XXX Hack to avoid extra locking, and lock
-			 * assertions in uvm_pagefree().  Despite uobject
-			 * being set, this isn't a managed page.
-			 */
-			PMAP_DUMMY_LOCK(pmap);
-			uvm_pagerealloc(ptp, NULL, 0);
-			PMAP_DUMMY_UNLOCK(pmap);
+		/*
+		 * XXX Hack to avoid extra locking, and lock
+		 * assertions in uvm_pagefree().  Despite uobject
+		 * being set, this isn't a managed page.
+		 */
+		PMAP_DUMMY_LOCK(pmap);
+		uvm_pagerealloc(ptp, NULL, 0);
+		PMAP_DUMMY_UNLOCK(pmap);
 
-			/*
-			 * XXX for PTPs freed by pmap_remove_ptes() but not
-			 * pmap_zap_ptp(), we could mark them PG_ZERO.
-			 */
-			uvm_pagefree(ptp);
-		}
-		while ((pvp = LIST_FIRST(>pm_pvp_full)) != NULL) {
-			LIST_REMOVE(pvp, pvp_list);
-			KASSERT(pvp->pvp_pmap == pmap);
-			KASSERT(pvp->pvp_nfree == PVE_PER_PVP);
-			pvp->pvp_pmap = NULL;
-			pool_cache_put(_pvp_cache, pvp);
-		}
-		mutex_exit(>pm_lock);
+		/*
+		 * XXX for PTPs freed by pmap_remove_ptes() but not
+		 * pmap_zap_ptp(), we could mark them PG_ZERO.
+		 */
+		uvm_pagefree(ptp);
 	}
+	while ((pvp = LIST_FIRST(>pm_pvp_full)) != NULL) {
+		LIST_REMOVE(pvp, pvp_list);
+		

CVS commit: src/sys/arch/x86/x86

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:19:01 UTC 2020

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
PR kern/55268: tmpfs is slow

pmap_clear_attrs(): if a brand new page with no mappings just zap pp_attrs.


To generate a diff of this commit:
cvs rdiff -u -r1.389 -r1.390 src/sys/arch/x86/x86/pmap.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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.389 src/sys/arch/x86/x86/pmap.c:1.390
--- src/sys/arch/x86/x86/pmap.c:1.389	Fri May  8 00:49:43 2020
+++ src/sys/arch/x86/x86/pmap.c	Fri May 15 22:19:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.389 2020/05/08 00:49:43 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.390 2020/05/15 22:19:01 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.389 2020/05/08 00:49:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.390 2020/05/15 22:19:01 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4567,7 +4567,19 @@ pmap_clear_attrs(struct vm_page *pg, uns
 	pp = VM_PAGE_TO_PP(pg);
 	pa = VM_PAGE_TO_PHYS(pg);
 
-	return pmap_pp_clear_attrs(pp, pa, clearbits);
+	/*
+	 * If this is a new page, assert it has no mappings and simply zap
+	 * the stored attributes without taking any locks.
+	 */
+	if ((pg->flags & PG_FAKE) != 0) {
+		KASSERT(atomic_load_relaxed(>pp_pte.pte_va) == 0);
+		KASSERT(atomic_load_relaxed(>pp_pte.pte_ptp) == NULL);
+		KASSERT(atomic_load_relaxed(>pp_pvlist.lh_first) == NULL);
+		atomic_store_relaxed(>pp_attrs, 0);
+		return false;
+	} else {
+		return pmap_pp_clear_attrs(pp, pa, clearbits);
+	}
 }
 
 /*



CVS commit: src/sys/arch

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:17:45 UTC 2020

Modified Files:
src/sys/arch/amd64/include: pmap.h
src/sys/arch/i386/include: pmap.h

Log Message:
Revert previous after thinking about it.  It was wrong, don't need to use
an atomic to clear a PTE or set initial version unless the circumstances
call for it.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/i386/include/pmap.h

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

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.65 src/sys/arch/amd64/include/pmap.h:1.66
--- src/sys/arch/amd64/include/pmap.h:1.65	Tue Mar 17 18:17:07 2020
+++ src/sys/arch/amd64/include/pmap.h	Fri May 15 22:17:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.65 2020/03/17 18:17:07 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.66 2020/05/15 22:17:45 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -202,8 +202,7 @@ extern bool svs_pcid;
 #ifndef XENPV
 #define pmap_pa2pte(a)			(a)
 #define pmap_pte2pa(a)			((a) & PTE_FRAME)
-#define pmap_pte_set(p, n)		\
-(void)atomic_swap_ulong((volatile unsigned long *)p, n)
+#define pmap_pte_set(p, n)		do { *(p) = (n); } while (0)
 #define pmap_pte_cas(p, o, n)		atomic_cas_64((p), (o), (n))
 #define pmap_pte_testset(p, n)		\
 atomic_swap_ulong((volatile unsigned long *)p, n)

Index: src/sys/arch/i386/include/pmap.h
diff -u src/sys/arch/i386/include/pmap.h:1.124 src/sys/arch/i386/include/pmap.h:1.125
--- src/sys/arch/i386/include/pmap.h:1.124	Tue Mar 17 18:17:07 2020
+++ src/sys/arch/i386/include/pmap.h	Fri May 15 22:17:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.124 2020/03/17 18:17:07 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.125 2020/05/15 22:17:45 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -294,11 +294,10 @@
 #ifndef XENPV
 #define pmap_pa2pte(a)			(a)
 #define pmap_pte2pa(a)			((a) & PTE_FRAME)
+#define pmap_pte_set(p, n)		do { *(p) = (n); } while (0)
 #define pmap_pte_flush()		/* nothing */
 
 #ifdef PAE
-#define pmap_pte_set(p, n)		\
-(void)atomic_swap_64((volatile uint64_t *)p, n)
 #define pmap_pte_cas(p, o, n)		atomic_cas_64((p), (o), (n))
 #define pmap_pte_testset(p, n)		\
 atomic_swap_64((volatile uint64_t *)p, n)
@@ -307,8 +306,6 @@
 #define pmap_pte_clearbits(p, b)	\
 atomic_and_64((volatile uint64_t *)p, ~(b))
 #else /* PAE */
-#define pmap_pte_set(p, n)		\
-(void)atomic_swap_ulong((volatile unsigned long *)p, n)
 #define pmap_pte_cas(p, o, n)		atomic_cas_32((p), (o), (n))
 #define pmap_pte_testset(p, n)		\
 atomic_swap_ulong((volatile unsigned long *)p, n)



CVS commit: src/sys/fs/tmpfs

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 22:15:43 UTC 2020

Modified Files:
src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
PR kern/55268: tmpfs is slow

Enter dotdot into the namecache.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/fs/tmpfs/tmpfs_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/fs/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.136 src/sys/fs/tmpfs/tmpfs_vnops.c:1.137
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.136	Thu Apr 23 21:47:08 2020
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Fri May 15 22:15:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.136 2020/04/23 21:47:08 ad Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.137 2020/05/15 22:15:43 ad Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.136 2020/04/23 21:47:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.137 2020/05/15 22:15:43 ad Exp $");
 
 #include 
 #include 
@@ -202,11 +202,11 @@ tmpfs_lookup(void *v)
 		pnode = dnode->tn_spec.tn_dir.tn_parent;
 		if (pnode == NULL) {
 			error = ENOENT;
-			goto out;
+			goto done;
 		}
 
 		error = vcache_get(dvp->v_mount, , sizeof(pnode), vpp);
-		goto out;
+		goto done;
 	} else if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
 		/*
 		 * Lookup of "." case.



CVS commit: src/sys/dev/ata

2020-05-15 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May 15 21:56:14 UTC 2020

Modified Files:
src/sys/dev/ata: atareg.h

Log Message:
remove unused atacmd_tostatq()


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ata/atareg.h

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

Modified files:

Index: src/sys/dev/ata/atareg.h
diff -u src/sys/dev/ata/atareg.h:1.44 src/sys/dev/ata/atareg.h:1.45
--- src/sys/dev/ata/atareg.h:1.44	Sat Oct  7 16:05:32 2017
+++ src/sys/dev/ata/atareg.h	Fri May 15 21:56:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atareg.h,v 1.44 2017/10/07 16:05:32 jdolecek Exp $	*/
+/*	$NetBSD: atareg.h,v 1.45 2020/05/15 21:56:14 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -186,23 +186,6 @@ atacmd_to48(int cmd32)
 #define	WDCC_READ_FPDMA_QUEUED	0x60	/* SATA native queued read (48bit) */
 #define	WDCC_WRITE_FPDMA_QUEUED	0x61	/* SATA native queued write (48bit) */
 
-#ifdef _KERNEL
-/* Convert a 32-bit command to a Native SATA Queued command. */
-static __inline int
-atacmd_tostatq(int cmd32)
-{
-	switch (cmd32) {
-	case WDCC_READDMA:
-		return WDCC_READ_FPDMA_QUEUED;
-	case WDCC_WRITEDMA:
-		return WDCC_WRITE_FPDMA_QUEUED;
-	default:
-		panic("atacmd_tosataq: illegal 32-bit command: %d", cmd32);
-		/* NOTREACHED */
-	}
-}
-#endif /* _KERNEL */
-
 /* Subcommands for SET_FEATURES (features register) */
 #define	WDSF_8BIT_PIO_EN	0x01
 #define	WDSF_WRITE_CACHE_EN	0x02



CVS commit: src/sys

2020-05-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 15 19:28:10 UTC 2020

Modified Files:
src/sys/arch/arm/sunxi: sun8i_crypto.c
src/sys/dev/i2c: ibmhawk.c
src/sys/dev/ic: ciss.c
src/sys/dev/usb: if_cdce.c
src/sys/fs/puffs: puffs_msgif.c puffs_vnops.c
src/sys/net/agr: ieee8023ad_lacp_sm_tx.c

Log Message:
hardclock_ticks -> getticks()


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/sun8i_crypto.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/ibmhawk.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/ic/ciss.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.105 -r1.106 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.215 -r1.216 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.3 -r1.4 src/sys/net/agr/ieee8023ad_lacp_sm_tx.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/arm/sunxi/sun8i_crypto.c
diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.13 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.14
--- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.13	Thu Apr 30 03:40:53 2020
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c	Fri May 15 19:28:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sun8i_crypto.c,v 1.13 2020/04/30 03:40:53 riastradh Exp $	*/
+/*	$NetBSD: sun8i_crypto.c,v 1.14 2020/05/15 19:28:09 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.13 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.14 2020/05/15 19:28:09 maxv Exp $");
 
 #include 
 #include 
@@ -614,7 +614,7 @@ sun8i_crypto_submit(struct sun8i_crypto_
 
 	/* Loaded up and ready to go.  Start a timer ticking.  */
 	sc->sc_chan[i].cc_task = task;
-	sc->sc_chan[i].cc_starttime = atomic_load_relaxed(_ticks);
+	sc->sc_chan[i].cc_starttime = getticks();
 	callout_schedule(>sc_timeout, SUN8I_CRYPTO_TIMEOUT);
 
 	/* XXX Consider polling if cold to get entropy earlier.  */
@@ -725,7 +725,7 @@ sun8i_crypto_worker(struct work *wk, voi
 	sc->sc_esr = 0;
 
 	/* Check the time to determine what's timed out.  */
-	now = atomic_load_relaxed(_ticks);
+	now = getticks();
 
 	/* Process the channels.  */
 	for (i = 0; i < SUN8I_CRYPTO_NCHAN; i++) {

Index: src/sys/dev/i2c/ibmhawk.c
diff -u src/sys/dev/i2c/ibmhawk.c:1.8 src/sys/dev/i2c/ibmhawk.c:1.9
--- src/sys/dev/i2c/ibmhawk.c:1.8	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/i2c/ibmhawk.c	Fri May 15 19:28:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ibmhawk.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $ */
+/* $NetBSD: ibmhawk.c,v 1.9 2020/05/15 19:28:09 maxv Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -365,13 +365,13 @@ ibmhawk_refresh(struct sysmon_envsys *sm
 	struct ibmhawk_softc *sc = sme->sme_cookie;
 
 	/* No more than two refreshes per second. */
-	if (hardclock_ticks-sc->sc_refresh < hz/2)
+	if (getticks() - sc->sc_refresh < hz/2)
 		return;
 #if IBMHAWK_DEBUG > 1
 	aprint_normal_dev(sc->sc_dev, "refresh \"%s\" delta %d\n",
-	edata->desc, hardclock_ticks-sc->sc_refresh);
+	edata->desc, getticks() - sc->sc_refresh);
 #endif
-	sc->sc_refresh = hardclock_ticks;
+	sc->sc_refresh = getticks();
 	ibmhawk_refreshall(sc, false);
 }
 

Index: src/sys/dev/ic/ciss.c
diff -u src/sys/dev/ic/ciss.c:1.41 src/sys/dev/ic/ciss.c:1.42
--- src/sys/dev/ic/ciss.c:1.41	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/ciss.c	Fri May 15 19:28:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.41 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: ciss.c,v 1.42 2020/05/15 19:28:10 maxv Exp $	*/
 /*	$OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.41 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.42 2020/05/15 19:28:10 maxv Exp $");
 
 #include "bio.h"
 
@@ -501,7 +501,7 @@ ciss_wait(struct ciss_softc *sc, struct 
 	tohz = mstohz(ms);
 	if (tohz == 0)
 		tohz = 1;
-	etick = hardclock_ticks + tohz;
+	etick = getticks() + tohz;
 
 	for (;;) {
 		ccb->ccb_state = CISS_CCB_POLL;
@@ -517,7 +517,7 @@ ciss_wait(struct ciss_softc *sc, struct 
 			ciss_done(ccb);
 			return 0;
 		}
-		tohz = etick - hardclock_ticks;
+		tohz = etick - getticks();
 		if (tohz <= 0)
 			return EWOULDBLOCK;
 		CISS_DPRINTF(CISS_D_CMD, ("T"));

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.71 src/sys/dev/usb/if_cdce.c:1.72
--- src/sys/dev/usb/if_cdce.c:1.71	Fri May  8 06:24:28 2020
+++ src/sys/dev/usb/if_cdce.c	Fri May 15 19:28:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.71 2020/05/08 06:24:28 skrll Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.72 2020/05/15 19:28:10 maxv Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.71 2020/05/08 06:24:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 

CVS commit: src/share/mk

2020-05-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 15 19:07:01 UTC 2020

Modified Files:
src/share/mk: bsd.sys.mk

Log Message:
Don't add KCOV instrumentation on top of the KUBSAN instrumentation,
this is useless and too bloated.


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/share/mk/bsd.sys.mk

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

Modified files:

Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.300 src/share/mk/bsd.sys.mk:1.301
--- src/share/mk/bsd.sys.mk:1.300	Sat Apr  4 07:03:57 2020
+++ src/share/mk/bsd.sys.mk	Fri May 15 19:07:01 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.300 2020/04/04 07:03:57 maxv Exp $
+#	$NetBSD: bsd.sys.mk,v 1.301 2020/05/15 19:07:01 maxv Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -238,7 +238,7 @@ AFLAGS+=	${CPUFLAGS}
 
 .if ${KCOV:U0} > 0
 KCOVFLAGS=	-fsanitize-coverage=trace-pc
-.for f in subr_kcov.c subr_asan.c subr_csan.c subr_msan.c
+.for f in subr_kcov.c subr_asan.c subr_csan.c subr_msan.c ubsan.c
 KCOVFLAGS.${f}=		# empty
 .endfor
 CFLAGS+=	${KCOVFLAGS.${.IMPSRC:T}:U${KCOVFLAGS}}



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

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 18:45:08 UTC 2020

Modified Files:
src/sys/arch/sparc/include: cpu.h

Log Message:
PR port-sparc/55261: sparc still panics running ATF tests

Put cpu_data at the end of cpu_info to see how that modifies the symptom.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/sparc/include/cpu.h

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

Modified files:

Index: src/sys/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.105 src/sys/arch/sparc/include/cpu.h:1.106
--- src/sys/arch/sparc/include/cpu.h:1.105	Tue Mar 10 03:48:05 2020
+++ src/sys/arch/sparc/include/cpu.h	Fri May 15 18:45:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.105 2020/03/10 03:48:05 christos Exp $ */
+/*	$NetBSD: cpu.h,v 1.106 2020/05/15 18:45:08 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -175,8 +175,6 @@ struct xpmsg {
  */
 
 struct cpu_info {
-	struct cpu_data ci_data;	/* MI per-cpu data */
-
 	/*
 	 * Primary Inter-processor message area.  Keep this aligned
 	 * to a cache line boundary if possible, as the structure
@@ -395,6 +393,8 @@ struct cpu_info {
 	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
+
+	struct cpu_data ci_data;	/* MI per-cpu data */
 };
 
 #endif /* _KERNEL || _KMEMUSER */



CVS commit: src/sys/dev/ata

2020-05-15 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May 15 16:58:28 UTC 2020

Modified Files:
src/sys/dev/ata: ata_wdc.c

Log Message:
whitespace (bad indent)


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/ata/ata_wdc.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/ata/ata_wdc.c
diff -u src/sys/dev/ata/ata_wdc.c:1.115 src/sys/dev/ata/ata_wdc.c:1.116
--- src/sys/dev/ata/ata_wdc.c:1.115	Mon Apr 13 10:49:34 2020
+++ src/sys/dev/ata/ata_wdc.c	Fri May 15 16:58:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_wdc.c,v 1.115 2020/04/13 10:49:34 jdolecek Exp $	*/
+/*	$NetBSD: ata_wdc.c,v 1.116 2020/05/15 16:58:28 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.115 2020/04/13 10:49:34 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.116 2020/05/15 16:58:28 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -557,8 +557,8 @@ _wdc_ata_bio_start(struct ata_channel *c
 		/* The number of blocks in the last stretch may be smaller. */
 		nblks = xfer->c_bcount / drvp->lp->d_secsize;
 		if (ata_bio->nblks > nblks) {
-		ata_bio->nblks = nblks;
-		ata_bio->nbytes = xfer->c_bcount;
+			ata_bio->nblks = nblks;
+			ata_bio->nbytes = xfer->c_bcount;
 		}
 	}
 	/* If this was a write and not using DMA, push the data. */



CVS commit: src

2020-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May 15 16:34:44 UTC 2020

Modified Files:
src: Makefile

Log Message:
automatically remove old debug files for modules.


To generate a diff of this commit:
cvs rdiff -u -r1.331 -r1.332 src/Makefile

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.331 src/Makefile:1.332
--- src/Makefile:1.331	Tue Aug 27 18:48:54 2019
+++ src/Makefile	Fri May 15 12:34:44 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.331 2019/08/27 22:48:54 kamil Exp $
+#	$NetBSD: Makefile,v 1.332 2020/05/15 16:34:44 christos Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -207,6 +207,7 @@ postinstall-fix-obsolete: .NOTMAIN .PHON
 postinstall-fix-obsolete_stand: .NOTMAIN .PHONY
 	@echo "   === Removing obsolete files ==="
 	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand
+	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand_debug
 	@echo "   ==="
 
 



CVS commit: src/usr.sbin/postinstall

2020-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May 15 16:33:38 UTC 2020

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Add a function to remove the debug bits of the stand files.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/postinstall/postinstall.in

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.20 src/usr.sbin/postinstall/postinstall.in:1.21
--- src/usr.sbin/postinstall/postinstall.in:1.20	Sun Apr 19 18:10:24 2020
+++ src/usr.sbin/postinstall/postinstall.in	Fri May 15 12:33:38 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.20 2020/04/19 22:10:24 roy Exp $
+# $NetBSD: postinstall.in,v 1.21 2020/05/15 16:33:38 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2295,19 +2295,20 @@ do_varshm()
 #
 #	obsolete_stand
 #
-adddisableditem obsolete_stand "remove obsolete files from /stand"
-do_obsolete_stand()
+obsolete_stand_internal()
 {
-	[ -n "$1" ] || err 3 "USAGE: do_obsolete_stnd  fix|check"
-	op="$1"
-	failed=0
+	local prefix="$1"
+	shift
+	[ -n "$1" ] || err 3 "USAGE: do_obsolete_stand  fix|check"
+	local op="$1"
+	local failed=0
 
 	for dir in \
-	/stand/${MACHINE} \
-	/stand/${MACHINE}-4xx \
-	/stand/${MACHINE}-booke \
-	/stand/${MACHINE}-xen \
-	/stand/${MACHINE}pae-xen
+	${prefix}/stand/${MACHINE} \
+	${prefix}/stand/${MACHINE}-4xx \
+	${prefix}/stand/${MACHINE}-booke \
+	${prefix}/stand/${MACHINE}-xen \
+	${prefix}/stand/${MACHINE}pae-xen
 	do
 		[ -d "${DESTDIR}${dir}" ] && obsolete_stand "${dir}"
 	done | obsolete_paths "${op}"
@@ -2316,6 +2317,20 @@ do_obsolete_stand()
 	return ${failed}
 }
 
+adddisableditem obsolete_stand "remove obsolete files from /stand"
+do_obsolete_stand()
+{
+	obsolete_stand_internal "" "$@"
+	return $?
+}
+
+adddisableditem obsolete_stand_debug "remove obsolete files from /usr/libdata/debug/stand"
+do_obsolete_stand_debug()
+{
+	obsolete_stand_internal "/usr/libdata/debug" "$@"
+	return $?
+}
+
 listarchsubdirs() {
 	if ! $SOURCEMODE; then
 		echo "@ARCHSUBDIRS@"



CVS commit: src/common/lib/libc/atomic

2020-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 15 15:20:40 UTC 2020

Modified Files:
src/common/lib/libc/atomic: atomic_init_testset.c

Log Message:
PR 55239: initialize all RAS sections for non-MP configurations


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/common/lib/libc/atomic/atomic_init_testset.c

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

Modified files:

Index: src/common/lib/libc/atomic/atomic_init_testset.c
diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.16 src/common/lib/libc/atomic/atomic_init_testset.c:1.17
--- src/common/lib/libc/atomic/atomic_init_testset.c:1.16	Mon Feb 18 11:22:56 2019
+++ src/common/lib/libc/atomic/atomic_init_testset.c	Fri May 15 15:20:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_init_testset.c,v 1.16 2019/02/18 11:22:56 martin Exp $	*/
+/*	$NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: atomic_init_testset.c,v 1.16 2019/02/18 11:22:56 martin Exp $");
+__RCSID("$NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $");
 
 #include "atomic_op_namespace.h"
 
@@ -296,30 +296,28 @@ __libc_atomic_init(void)
 		return;
 	if (ncpu > 1)
 		return;
+
 	if (rasctl(RAS_ADDR(_atomic_cas), RAS_SIZE(_atomic_cas),
 	RAS_INSTALL) == 0) {
 		_atomic_cas_fn = _atomic_cas_up;
-		return;
 	}
 
+
 #ifdef	__HAVE_ATOMIC_CAS_64_UP
 	if (rasctl(RAS_ADDR(_atomic_cas_64), RAS_SIZE(_atomic_cas_64),
 	RAS_INSTALL) == 0) {
 		_atomic_cas_64_fn = _atomic_cas_64_up;
-		return;
 	}
 #endif
 
 	if (rasctl(RAS_ADDR(_atomic_cas_16), RAS_SIZE(_atomic_cas_16),
 	RAS_INSTALL) == 0) {
 		_atomic_cas_16_fn = _atomic_cas_16_up;
-		return;
 	}
 
 	if (rasctl(RAS_ADDR(_atomic_cas_8), RAS_SIZE(_atomic_cas_8),
 	RAS_INSTALL) == 0) {
 		_atomic_cas_8_fn = _atomic_cas_8_up;
-		return;
 	}
 }
 



CVS commit: src

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:57:33 UTC 2020

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

Log Message:
Bump libc minor version for malloc lock change


To generate a diff of this commit:
cvs rdiff -u -r1.884 -r1.885 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.245 -r1.246 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.286 -r1.287 src/lib/libc/shlib_version

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.884 src/distrib/sets/lists/base/shl.mi:1.885
--- src/distrib/sets/lists/base/shl.mi:1.884	Sat Apr  4 19:26:51 2020
+++ src/distrib/sets/lists/base/shl.mi	Fri May 15 14:57:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.884 2020/04/04 19:26:51 christos Exp $
+# $NetBSD: shl.mi,v 1.885 2020/05/15 14:57:33 joerg Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -21,7 +21,7 @@
 ./lib/libblacklist.so.0.0			base-sys-shlib		dynamicroot
 ./lib/libc.so	base-sys-shlib		dynamicroot
 ./lib/libc.so.12base-sys-shlib		dynamicroot
-./lib/libc.so.12.215base-sys-shlib		dynamicroot
+./lib/libc.so.12.216base-sys-shlib		dynamicroot
 ./lib/libcrypt.sobase-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1base-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1.0base-sys-shlib		dynamicroot
@@ -249,7 +249,7 @@
 ./usr/lib/libc++.so.1.0base-sys-shlib		compatfile,libcxx
 ./usr/lib/libc.sobase-sys-shlib		compatfile
 ./usr/lib/libc.so.12base-sys-shlib		compatfile
-./usr/lib/libc.so.12.215			base-sys-shlib		compatfile
+./usr/lib/libc.so.12.216			base-sys-shlib		compatfile
 ./usr/lib/libcbor.sobase-sys-shlib		compatfile
 ./usr/lib/libcbor.so.0base-sys-shlib		compatfile
 ./usr/lib/libcbor.so.0.5			base-sys-shlib		compatfile

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.245 src/distrib/sets/lists/debug/shl.mi:1.246
--- src/distrib/sets/lists/debug/shl.mi:1.245	Sat Apr  4 19:26:51 2020
+++ src/distrib/sets/lists/debug/shl.mi	Fri May 15 14:57:33 2020
@@ -1,9 +1,9 @@
-# $NetBSD: shl.mi,v 1.245 2020/04/04 19:26:51 christos Exp $
+# $NetBSD: shl.mi,v 1.246 2020/05/15 14:57:33 joerg Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
-./usr/libdata/debug/lib/libc.so.12.215.debug			comp-sys-debug	debug,dynamicroot
+./usr/libdata/debug/lib/libc.so.12.216.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypt.so.1.0.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypto.so.12.0.debug			comp-sys-debug	debug,dynamicroot,openssl=10
 ./usr/libdata/debug/lib/libcrypto.so.14.0.debug			comp-sys-debug	debug,dynamicroot,openssl=11
@@ -82,7 +82,7 @@
 ./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug			comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libc++.so.1.0.debug			comp-sys-debug	debug,compatfile,libcxx
-./usr/libdata/debug/usr/lib/libc.so.12.215.debug		comp-sys-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libc.so.12.216.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libcbor.so.0.5.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libcom_err.so.8.0.debug		comp-krb5-debug	debug,compatfile,kerberos
 ./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug		comp-sys-debug	debug,compatfile

Index: src/lib/libc/shlib_version
diff -u src/lib/libc/shlib_version:1.286 src/lib/libc/shlib_version:1.287
--- src/lib/libc/shlib_version:1.286	Sun Mar  8 22:27:38 2020
+++ src/lib/libc/shlib_version	Fri May 15 14:57:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.286 2020/03/08 22:27:38 mgorny Exp $
+#	$NetBSD: shlib_version,v 1.287 2020/05/15 14:57:33 joerg Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -54,4 +54,4 @@
 # - move statfs() to libcompat since we have statvfs()
 # - the syscall stubs for the (obsolete) lfs syscalls should be removed
 major=12
-minor=215
+minor=216



CVS commit: src/external/lgpl3/mpfr/lib/libmpfr

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:44:05 UTC 2020

Modified Files:
src/external/lgpl3/mpfr/lib/libmpfr: Makefile

Log Message:
Ignore warnings for tautological compares for clang.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/lgpl3/mpfr/lib/libmpfr/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/lgpl3/mpfr/lib/libmpfr/Makefile
diff -u src/external/lgpl3/mpfr/lib/libmpfr/Makefile:1.19 src/external/lgpl3/mpfr/lib/libmpfr/Makefile:1.20
--- src/external/lgpl3/mpfr/lib/libmpfr/Makefile:1.19	Sat Jun  1 08:29:16 2019
+++ src/external/lgpl3/mpfr/lib/libmpfr/Makefile	Fri May 15 14:44:05 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.19 2019/06/01 08:29:16 mrg Exp $
+#	$NetBSD: Makefile,v 1.20 2020/05/15 14:44:05 joerg Exp $
 
 .include 
 
@@ -310,6 +310,7 @@ CPPFLAGS+=	-DHAVE_DOUBLE_IEEE_BIG_ENDIAN
 CPPFLAGS+=	-DHAVE_LITTLE_ENDIAN=1
 .endif
 
+CWARNFLAGS.clang+=	-Wno-error=tautological-constant-out-of-range-compare
 
 WITHOUT_MAN=	yes
 



CVS commit: src

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:37:21 UTC 2020

Modified Files:
src/external/bsd/jemalloc/dist/src: jemalloc.c
src/lib/libc/gen: pthread_atfork.c
src/lib/libc/include: extern.h
src/lib/libc/stdlib: jemalloc.c malloc.c

Log Message:
Hook up proper fork lock handling for malloc:
- lock all relevant mutexes just before fork
- unlock all mutexes just after fork in the parent
- full reinit non-spinlocks in the child
This is not using the normal pthread_atfork interface to ensure order of
operation, malloc is used as implementation detail too often.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/jemalloc/dist/src/jemalloc.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/gen/pthread_atfork.c
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/include/extern.h
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/stdlib/jemalloc.c
cvs rdiff -u -r1.59 -r1.60 src/lib/libc/stdlib/malloc.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/jemalloc/dist/src/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.8 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.9
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.8	Thu Oct  3 16:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c	Fri May 15 14:37:21 2020
@@ -1,5 +1,9 @@
 #include 
 
+#ifdef __NetBSD__
+#include "extern.h"
+#endif
+
 #define JEMALLOC_C_
 #include "jemalloc/internal/jemalloc_preamble.h"
 #include "jemalloc/internal/jemalloc_internal_includes.h"
@@ -1383,7 +1387,7 @@ malloc_init_hard_recursible(void) {
 
 #if (defined(JEMALLOC_HAVE_PTHREAD_ATFORK) && !defined(JEMALLOC_MUTEX_INIT_CB) \
 && !defined(JEMALLOC_ZONE) && !defined(_WIN32) && \
-!defined(__native_client__))
+!defined(__native_client__) && !defined(__NetBSD__))
 	/* LinuxThreads' pthread_atfork() allocates. */
 	if (pthread_atfork(jemalloc_prefork, jemalloc_postfork_parent,
 	jemalloc_postfork_child) != 0) {
@@ -3221,7 +3225,7 @@ jemalloc_constructor(void) {
 }
 #endif
 
-#ifndef JEMALLOC_MUTEX_INIT_CB
+#if !defined(JEMALLOC_MUTEX_INIT_CB) && !defined(__NetBSD__)
 void
 jemalloc_prefork(void)
 #else
@@ -3294,7 +3298,7 @@ _malloc_prefork(void)
 	prof_prefork1(tsd_tsdn(tsd));
 }
 
-#ifndef JEMALLOC_MUTEX_INIT_CB
+#if !defined(JEMALLOC_MUTEX_INIT_CB) && !defined(__NetBSD__)
 void
 jemalloc_postfork_parent(void)
 #else
@@ -3332,8 +3336,14 @@ _malloc_postfork(void)
 	ctl_postfork_parent(tsd_tsdn(tsd));
 }
 
+#if !defined(__NetBSD__)
 void
-jemalloc_postfork_child(void) {
+jemalloc_postfork_child(void)
+#else
+JEMALLOC_EXPORT void
+_malloc_postfork_child(void)
+#endif
+{
 	tsd_t *tsd;
 	unsigned i, narenas;
 

Index: src/lib/libc/gen/pthread_atfork.c
diff -u src/lib/libc/gen/pthread_atfork.c:1.14 src/lib/libc/gen/pthread_atfork.c:1.15
--- src/lib/libc/gen/pthread_atfork.c:1.14	Sun Apr 19 01:06:15 2020
+++ src/lib/libc/gen/pthread_atfork.c	Fri May 15 14:37:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_atfork.c,v 1.14 2020/04/19 01:06:15 joerg Exp $	*/
+/*	$NetBSD: pthread_atfork.c,v 1.15 2020/05/15 14:37:21 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pthread_atfork.c,v 1.14 2020/04/19 01:06:15 joerg Exp $");
+__RCSID("$NetBSD: pthread_atfork.c,v 1.15 2020/05/15 14:37:21 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -40,6 +40,7 @@ __RCSID("$NetBSD: pthread_atfork.c,v 1.1
 #include 
 #include 
 #include 
+#include "extern.h"
 #include "reentrant.h"
 
 #ifdef __weak_alias
@@ -163,6 +164,7 @@ fork(void)
 	mutex_lock(_lock);
 	SIMPLEQ_FOREACH(iter, , next)
 		(*iter->fn)();
+	_malloc_prefork();
 
 	ret = __locked_fork();
 
@@ -171,11 +173,13 @@ fork(void)
 		 * We are the parent. It doesn't matter here whether
 		 * the fork call succeeded or failed.
 		 */
+		_malloc_postfork();
 		SIMPLEQ_FOREACH(iter, , next)
 			(*iter->fn)();
 		mutex_unlock(_lock);
 	} else {
 		/* We are the child */
+		_malloc_postfork_child();
 		SIMPLEQ_FOREACH(iter, , next)
 			(*iter->fn)();
 		/*

Index: src/lib/libc/include/extern.h
diff -u src/lib/libc/include/extern.h:1.25 src/lib/libc/include/extern.h:1.26
--- src/lib/libc/include/extern.h:1.25	Thu Jan 12 00:43:55 2017
+++ src/lib/libc/include/extern.h	Fri May 15 14:37:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.25 2017/01/12 00:43:55 christos Exp $	*/
+/*	$NetBSD: extern.h,v 1.26 2020/05/15 14:37:21 joerg Exp $	*/
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -69,6 +69,7 @@ void	vsyslogp_ss(int, struct syslog_data
 
 void	_malloc_prefork(void);
 void	_malloc_postfork(void);
+void	_malloc_postfork_child(void);
 
 int	_sys_setcontext(const ucontext_t *);
 

Index: src/lib/libc/stdlib/jemalloc.c
diff -u src/lib/libc/stdlib/jemalloc.c:1.52 src/lib/libc/stdlib/jemalloc.c:1.53
--- 

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

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:34:42 UTC 2020

Modified Files:
src/external/bsd/jemalloc/dist/src: mutex.c

Log Message:
When using default mutex types, don't setup attributes for init.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/mutex.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/jemalloc/dist/src/mutex.c
diff -u src/external/bsd/jemalloc/dist/src/mutex.c:1.2 src/external/bsd/jemalloc/dist/src/mutex.c:1.3
--- src/external/bsd/jemalloc/dist/src/mutex.c:1.2	Mon Mar  4 17:16:46 2019
+++ src/external/bsd/jemalloc/dist/src/mutex.c	Fri May 15 14:34:41 2020
@@ -157,6 +157,9 @@ malloc_mutex_init(malloc_mutex_t *mutex,
 			return true;
 		}
 	}
+#elif MALLOC_MUTEX_TYPE == PTHREAD_MUTEX_DEFAULT
+	if (pthread_mutex_init(>lock, NULL) == -1)
+		return true;
 #else
 	pthread_mutexattr_t attr;
 



CVS commit: src/lib/libpthread

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:30:23 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Lock/unlock/reinit pthread__deadqueue_lock over fork.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.168 src/lib/libpthread/pthread.c:1.169
--- src/lib/libpthread/pthread.c:1.168	Tue Apr 14 23:35:07 2020
+++ src/lib/libpthread/pthread.c	Fri May 15 14:30:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.168 2020/04/14 23:35:07 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.169 2020/05/15 14:30:23 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.168 2020/04/14 23:35:07 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.169 2020/05/15 14:30:23 joerg Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -82,7 +82,6 @@ static void	pthread__create_tramp(void *
 static void	pthread__initthread(pthread_t);
 static void	pthread__scrubthread(pthread_t, char *, int);
 static void	pthread__initmain(pthread_t *);
-static void	pthread__fork_callback(void);
 static void	pthread__reap(pthread_t);
 
 void	pthread__init(void);
@@ -155,6 +154,32 @@ static union hashlock {
 	char		pad[64];
 } hashlocks[NHASHLOCK] __aligned(64);
 
+static void
+pthread__prefork(void)
+{
+	pthread_mutex_lock(__deadqueue_lock);
+}
+
+static void
+pthread__fork_parent(void)
+{
+	pthread_mutex_unlock(__deadqueue_lock);
+}
+
+static void
+pthread__fork_child(void)
+{
+	struct __pthread_st *self = pthread__self();
+
+	pthread_mutex_init(__deadqueue_lock, NULL);
+
+	/* lwpctl state is not copied across fork. */
+	if (_lwp_ctl(LWPCTL_FEATURE_CURCPU, >pt_lwpctl)) {
+		err(EXIT_FAILURE, "_lwp_ctl");
+	}
+	self->pt_lid = _lwp_self();
+}
+
 /*
  * This needs to be started by the library loading code, before main()
  * gets to run, for various things that use the state of the initial thread
@@ -256,22 +281,10 @@ pthread__init(void)
 	}
 
 	/* Tell libc that we're here and it should role-play accordingly. */
-	pthread_atfork(NULL, NULL, pthread__fork_callback);
+	pthread_atfork(pthread__prefork, pthread__fork_parent, pthread__fork_child);
 	__isthreaded = 1;
 }
 
-static void
-pthread__fork_callback(void)
-{
-	struct __pthread_st *self = pthread__self();
-
-	/* lwpctl state is not copied across fork. */
-	if (_lwp_ctl(LWPCTL_FEATURE_CURCPU, >pt_lwpctl)) {
-		err(EXIT_FAILURE, "_lwp_ctl");
-	}
-	self->pt_lid = _lwp_self();
-}
-
 /* General-purpose thread data structure sanitization. */
 /* ARGSUSED */
 static void



CVS commit: src/external/gpl3/gcc/lib/libgomp

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:29:29 UTC 2020

Modified Files:
src/external/gpl3/gcc/lib/libgomp: Makefile

Log Message:
Don't allow building with clang, uses GCC-specific attributes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/external/gpl3/gcc/lib/libgomp/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/gpl3/gcc/lib/libgomp/Makefile
diff -u src/external/gpl3/gcc/lib/libgomp/Makefile:1.24 src/external/gpl3/gcc/lib/libgomp/Makefile:1.25
--- src/external/gpl3/gcc/lib/libgomp/Makefile:1.24	Sat Feb  9 00:48:59 2019
+++ src/external/gpl3/gcc/lib/libgomp/Makefile	Fri May 15 14:29:29 2020
@@ -1,10 +1,12 @@
-#	$NetBSD: Makefile,v 1.24 2019/02/09 00:48:59 mrg Exp $
+#	$NetBSD: Makefile,v 1.25 2020/05/15 14:29:29 joerg Exp $
 
 # build GCC's libgomp, so that -fopenmp works.
 
 # XXX
 NOLINT=	# defined
 
+UNSUPPORTED_COMPILER.clang=	# defined
+
 .include 
 
 .if !defined(NO_LIBGOMP)	# {
@@ -29,8 +31,6 @@ CPPFLAGS+= \
 	-I${ARCHDIR}
 CFLAGS+=-pthread
 
-CWARNFLAGS.clang+=	-Wno-conversion
-
 SHLIB_MAJOR=	2
 SHLIB_MINOR=	0
 



CVS commit: src/external/gpl3/gcc/lib/liblsan

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:29:53 UTC 2020

Modified Files:
src/external/gpl3/gcc/lib/liblsan: Makefile

Log Message:
Ignore unused private fields when building with clang


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc/lib/liblsan/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/gpl3/gcc/lib/liblsan/Makefile
diff -u src/external/gpl3/gcc/lib/liblsan/Makefile:1.6 src/external/gpl3/gcc/lib/liblsan/Makefile:1.7
--- src/external/gpl3/gcc/lib/liblsan/Makefile:1.6	Mon Oct 28 16:25:05 2019
+++ src/external/gpl3/gcc/lib/liblsan/Makefile	Fri May 15 14:29:53 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2019/10/28 16:25:05 christos Exp $
+# $NetBSD: Makefile,v 1.7 2020/05/15 14:29:53 joerg Exp $
 
 .include 
 
@@ -25,4 +25,6 @@ LIB=	lsan
 SRCS+=	${LSAN_SRCS}
 LIBDPLIBS+= rt ${NETBSDSRCDIR}/lib/librt
 
+CWARNFLAGS.clang+=	-Wno-error=unused-private-field
+
 .include 



CVS commit: src/sys

2020-05-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 15 13:09:02 UTC 2020

Modified Files:
src/sys/kern: subr_kcov.c subr_lockdebug.c
src/sys/sys: kcov.h

Log Message:
Introduce kcov_silence_enter() and kcov_silence_leave(), to allow to
temporarily disable KCOV on the current lwp. Should be used in the rare
but problematic cases where extreme noise is introduced by an
uninteresting subsystem.

Use this capability to silence KCOV during the LOCKDEBUG lookups. This
divides the size of the KCOV output by more than two in my KCOV+vHCI
tests.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_kcov.c
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/subr_lockdebug.c
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/kcov.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_kcov.c
diff -u src/sys/kern/subr_kcov.c:1.13 src/sys/kern/subr_kcov.c:1.14
--- src/sys/kern/subr_kcov.c:1.13	Fri May 15 12:34:52 2020
+++ src/sys/kern/subr_kcov.c	Fri May 15 13:09:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kcov.c,v 1.13 2020/05/15 12:34:52 maxv Exp $	*/
+/*	$NetBSD: subr_kcov.c,v 1.14 2020/05/15 13:09:02 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -108,6 +108,7 @@ typedef struct kcov_desc {
 	/* Local only */
 	kmutex_t lock;
 	bool lwpfree;
+	bool silenced;
 
 	/* Pointer to the end of the structure, if any */
 	struct kcov_desc *remote;
@@ -423,6 +424,26 @@ kcov_disable(kcov_t *kd)
 
 /* -- */
 
+void
+kcov_silence_enter(void)
+{
+	kcov_t *kd = curlwp->l_kcov;
+
+	if (kd != NULL)
+		kd->silenced = true;
+}
+
+void
+kcov_silence_leave(void)
+{
+	kcov_t *kd = curlwp->l_kcov;
+
+	if (kd != NULL)
+		kd->silenced = false;
+}
+
+/* -- */
+
 static int
 kcov_open(dev_t dev, int flag, int mode, struct lwp *l)
 {
@@ -581,6 +602,11 @@ __sanitizer_cov_trace_pc(void)
 		return;
 	}
 
+	if (__predict_false(kd->silenced)) {
+		/* Silenced. */
+		return;
+	}
+
 	if (kd->mode != KCOV_MODE_TRACE_PC) {
 		/* PC tracing mode not enabled */
 		return;

Index: src/sys/kern/subr_lockdebug.c
diff -u src/sys/kern/subr_lockdebug.c:1.76 src/sys/kern/subr_lockdebug.c:1.77
--- src/sys/kern/subr_lockdebug.c:1.76	Fri Apr 10 17:16:21 2020
+++ src/sys/kern/subr_lockdebug.c	Fri May 15 13:09:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_lockdebug.c,v 1.76 2020/04/10 17:16:21 ad Exp $	*/
+/*	$NetBSD: subr_lockdebug.c,v 1.77 2020/05/15 13:09:02 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.76 2020/04/10 17:16:21 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.77 2020/05/15 13:09:02 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_lockdeb
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -209,7 +210,10 @@ lockdebug_lookup(const char *func, size_
 {
 	lockdebug_t *ld;
 
+	kcov_silence_enter();
 	ld = lockdebug_lookup1(lock);
+	kcov_silence_leave();
+
 	if (__predict_false(ld == NULL)) {
 		panic("%s,%zu: uninitialized lock (lock=%p, from=%08"
 		PRIxPTR ")", func, line, lock, where);
@@ -675,6 +679,8 @@ lockdebug_mem_check(const char *func, si
 	if (__predict_false(panicstr != NULL || ld_panic))
 		return;
 
+	kcov_silence_enter();
+
 	s = splhigh();
 	ci = curcpu();
 	__cpu_simple_lock(>ci_data.cpu_ld_lock);
@@ -693,9 +699,12 @@ lockdebug_mem_check(const char *func, si
 		__cpu_simple_lock(>ld_spinlock);
 		lockdebug_abort1(func, line, ld, s,
 		"allocation contains active lock", !cold);
+		kcov_silence_leave();
 		return;
 	}
 	splx(s);
+
+	kcov_silence_leave();
 }
 #endif /* _KERNEL */
 

Index: src/sys/sys/kcov.h
diff -u src/sys/sys/kcov.h:1.8 src/sys/sys/kcov.h:1.9
--- src/sys/sys/kcov.h:1.8	Fri May 15 12:34:52 2020
+++ src/sys/sys/kcov.h	Fri May 15 13:09:02 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: kcov.h,v 1.8 2020/05/15 12:34:52 maxv Exp $*/
+/*  $NetBSD: kcov.h,v 1.9 2020/05/15 13:09:02 maxv Exp $*/
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -66,11 +66,15 @@ typedef volatile uint64_t kcov_int_t;
 void kcov_remote_register(uint64_t, uint64_t);
 void kcov_remote_enter(uint64_t, uint64_t);
 void kcov_remote_leave(uint64_t, uint64_t);
+void kcov_silence_enter(void);
+void kcov_silence_leave(void);
 void kcov_lwp_free(struct lwp *);
 #else
 #define kcov_remote_register(s, i)	__nothing
 #define kcov_remote_enter(s, i)		__nothing
 #define kcov_remote_leave(s, i)		__nothing
+#define kcov_silence_enter()		__nothing
+#define kcov_silence_leave()		__nothing
 #define kcov_lwp_free(a) __nothing
 #endif
 #endif



CVS commit: src/sys

2020-05-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 15 12:34:52 UTC 2020

Modified Files:
src/sys/dev/usb: uhub.c usbdivar.h vhci.c
src/sys/kern: subr_kcov.c
src/sys/sys: kcov.h

Log Message:
Introduce KCOV remote support. This allows to collect KCOV coverage on
threads other than curlwp, which is useful when fuzzing components that
defer processing, such as the network stack (partially runs in softints)
and the USB stack (partially runs in uhub kthreads).

A subsystem that whishes to provide coverage for its threads creates a
"mailbox" via kcov_remote_register() and gives it a (subsystem, id)
identifier. There is one mailbox per "target lwp". The target lwp(s)
must then call kcov_remote_enter() and kcov_remote_leave() with the
identifier, to respectively enable and disable coverage within the
thread.

On the userland side, the fuzzer has access to the mailboxes on the
system with the KCOV_IOC_REMOTE_ATTACH and KCOV_IOC_REMOTE_DETACH ioctls.
When attached to a mailbox with a given identifier, the KCOV_IOC_ENABLE,
KCOV_IOC_DISABLE and mmap() operations will affect the mailbox.

As a demonstrator, the vHCI subsystem is changed to use KCOV mailboxes.
When the vHCI bus attaches it creates as many mailboxes as it has USB
ports, each mailbox being associated with a distinct port. Uhub is changed
to enable KCOV coverage in usbd_new_device(). With that in place, all of
the USB enumeration procedure can be traced with KCOV.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/dev/usb/uhub.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/usb/usbdivar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/vhci.c
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/subr_kcov.c
cvs rdiff -u -r1.7 -r1.8 src/sys/sys/kcov.h

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

Modified files:

Index: src/sys/dev/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.144 src/sys/dev/usb/uhub.c:1.145
--- src/sys/dev/usb/uhub.c:1.144	Tue Jan  7 06:42:26 2020
+++ src/sys/dev/usb/uhub.c	Fri May 15 12:34:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.144 2020/01/07 06:42:26 maxv Exp $	*/
+/*	$NetBSD: uhub.c,v 1.145 2020/05/15 12:34:52 maxv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 /*	$OpenBSD: uhub.c,v 1.86 2015/06/29 18:27:40 mpi Exp $ */
 
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.144 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.145 2020/05/15 12:34:52 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.1
 #include 
 #include 
 #include 
-
+#include 
 
 #include 
 #include 
@@ -755,9 +755,16 @@ uhub_explore(struct usbd_device *dev)
 port);
 		}
 
+		if (dev->ud_bus->ub_hctype == USBHCTYPE_VHCI)
+			kcov_remote_enter(KCOV_REMOTE_VHCI, port);
+
 		/* Get device info and set its address. */
 		err = usbd_new_device(sc->sc_dev, dev->ud_bus,
 			  dev->ud_depth + 1, speed, port, up);
+
+		if (dev->ud_bus->ub_hctype == USBHCTYPE_VHCI)
+			kcov_remote_leave(KCOV_REMOTE_VHCI, port);
+
 		/* XXX retry a few times? */
 		if (err) {
 			DPRINTF("uhub%jd: usbd_new_device failed, error %jd",

Index: src/sys/dev/usb/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.122 src/sys/dev/usb/usbdivar.h:1.123
--- src/sys/dev/usb/usbdivar.h:1.122	Wed Feb 12 16:01:00 2020
+++ src/sys/dev/usb/usbdivar.h	Fri May 15 12:34:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.122 2020/02/12 16:01:00 riastradh Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.123 2020/05/15 12:34:52 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -157,7 +157,14 @@ struct usbd_bus {
 #define USBREV_3_0	5
 #define USBREV_3_1	6
 #define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1", "2.0", "3.0", "3.1" }
-
+	int			ub_hctype;
+#define USBHCTYPE_UNKNOWN	0
+#define USBHCTYPE_MOTG		1
+#define USBHCTYPE_OHCI		2
+#define USBHCTYPE_UHCI		3
+#define USBHCTYPE_EHCI		4
+#define USBHCTYPE_XHCI		5
+#define USBHCTYPE_VHCI		6
 	const struct usbd_bus_methods
 			   *ub_methods;
 	uint32_t		ub_pipesize;	/* size of a pipe struct */

Index: src/sys/dev/usb/vhci.c
diff -u src/sys/dev/usb/vhci.c:1.16 src/sys/dev/usb/vhci.c:1.17
--- src/sys/dev/usb/vhci.c:1.16	Tue Mar 31 16:34:25 2020
+++ src/sys/dev/usb/vhci.c	Fri May 15 12:34:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vhci.c,v 1.16 2020/03/31 16:34:25 maxv Exp $ */
+/*	$NetBSD: vhci.c,v 1.17 2020/05/15 12:34:52 maxv Exp $ */
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.16 2020/03/31 16:34:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.17 2020/05/15 12:34:52 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1282,6 +1283,7 @@ 

CVS commit: src/external/mpl/dhcp/dist/common

2020-05-15 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri May 15 12:31:04 UTC 2020

Modified Files:
src/external/mpl/dhcp/dist/common: bpf.c discover.c lpf.c packet.c
raw.c socket.c

Log Message:
crunchgen fix

Make sure local_port is not shared within a crunchgen binary. There is
more to do to get full functionnality in crunchgen, but at least this
change makes dhcpd listen on the right port again.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mpl/dhcp/dist/common/bpf.c
cvs rdiff -u -r1.2 -r1.3 src/external/mpl/dhcp/dist/common/discover.c \
src/external/mpl/dhcp/dist/common/lpf.c \
src/external/mpl/dhcp/dist/common/packet.c \
src/external/mpl/dhcp/dist/common/raw.c \
src/external/mpl/dhcp/dist/common/socket.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/mpl/dhcp/dist/common/bpf.c
diff -u src/external/mpl/dhcp/dist/common/bpf.c:1.3 src/external/mpl/dhcp/dist/common/bpf.c:1.4
--- src/external/mpl/dhcp/dist/common/bpf.c:1.3	Fri Jun  1 00:42:49 2018
+++ src/external/mpl/dhcp/dist/common/bpf.c	Fri May 15 12:31:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.3 2018/06/01 00:42:49 christos Exp $	*/
+/*	$NetBSD: bpf.c,v 1.4 2020/05/15 12:31:03 manu Exp $	*/
 
 /* bpf.c
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: bpf.c,v 1.3 2018/06/01 00:42:49 christos Exp $");
+__RCSID("$NetBSD: bpf.c,v 1.4 2020/05/15 12:31:03 manu Exp $");
 
 #include "dhcpd.h"
 #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)	\
@@ -366,7 +366,7 @@ void if_register_receive (info)
 		dhcp_bpf_relay_filter [10].k = ntohs (relay_port);
 	}
 #endif
-	p.bf_insns [8].k = ntohs (local_port);
+	p.bf_insns [8].k = ntohs (*libdhcp_callbacks.local_port);
 
 	if (ioctl (info -> rfdesc, BIOCSETF, ) < 0)
 		log_fatal ("Can't install packet filter program: %m");

Index: src/external/mpl/dhcp/dist/common/discover.c
diff -u src/external/mpl/dhcp/dist/common/discover.c:1.2 src/external/mpl/dhcp/dist/common/discover.c:1.3
--- src/external/mpl/dhcp/dist/common/discover.c:1.2	Sat Apr  7 22:37:29 2018
+++ src/external/mpl/dhcp/dist/common/discover.c	Fri May 15 12:31:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: discover.c,v 1.2 2018/04/07 22:37:29 christos Exp $	*/
+/*	$NetBSD: discover.c,v 1.3 2020/05/15 12:31:03 manu Exp $	*/
 
 /* discover.c
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: discover.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: discover.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
 
 #include "dhcpd.h"
 
@@ -47,8 +47,6 @@ __RCSID("$NetBSD: discover.c,v 1.2 2018/
 struct interface_info *interfaces, *dummy_interfaces, *fallback_interface;
 int interfaces_invalidated;
 int quiet_interface_discovery;
-u_int16_t local_port;
-u_int16_t remote_port;
 u_int16_t relay_port = 0;
 int dhcpv4_over_dhcpv6 = 0;
 int (*dhcp_interface_setup_hook) (struct interface_info *, struct iaddr *);
Index: src/external/mpl/dhcp/dist/common/lpf.c
diff -u src/external/mpl/dhcp/dist/common/lpf.c:1.2 src/external/mpl/dhcp/dist/common/lpf.c:1.3
--- src/external/mpl/dhcp/dist/common/lpf.c:1.2	Sat Apr  7 22:37:29 2018
+++ src/external/mpl/dhcp/dist/common/lpf.c	Fri May 15 12:31:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpf.c,v 1.2 2018/04/07 22:37:29 christos Exp $	*/
+/*	$NetBSD: lpf.c,v 1.3 2020/05/15 12:31:03 manu Exp $	*/
 
 /* lpf.c
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: lpf.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: lpf.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
 
 #include "dhcpd.h"
 #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
@@ -278,7 +278,7 @@ static void lpf_gen_filter_setup (info)
 		dhcp_bpf_relay_filter [10].k = ntohs (relay_port);
 	}
 #endif
-	dhcp_bpf_filter [8].k = ntohs (local_port);
+	dhcp_bpf_filter [8].k = ntohs (*libdhcp_callbacks.local_port);
 
 	if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, ,
 			sizeof p) < 0) {
Index: src/external/mpl/dhcp/dist/common/packet.c
diff -u src/external/mpl/dhcp/dist/common/packet.c:1.2 src/external/mpl/dhcp/dist/common/packet.c:1.3
--- src/external/mpl/dhcp/dist/common/packet.c:1.2	Sat Apr  7 22:37:29 2018
+++ src/external/mpl/dhcp/dist/common/packet.c	Fri May 15 12:31:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: packet.c,v 1.2 2018/04/07 22:37:29 christos Exp $	*/
+/*	$NetBSD: packet.c,v 1.3 2020/05/15 12:31:03 manu Exp $	*/
 
 /* packet.c
 
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: packet.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: packet.c,v 1.3 2020/05/15 12:31:03 manu Exp $");
 
 #include "dhcpd.h"
 
@@ -308,10 +308,10 @@ decode_udp_ip_header(struct interface_in
 
   /* Is it to the port we're serving? */
 #if defined(RELAY_PORT)
-  if ((udp.uh_dport != local_port) &&
+  if ((udp.uh_dport != *libdhcp_callbacks.local_port) &&
   ((relay_port == 0) || (udp.uh_dport != relay_port)))
 #else
-  if (udp.uh_dport != local_port)
+  if 

CVS commit: src

2020-05-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri May 15 09:21:59 UTC 2020

Modified Files:
src/distrib/notes/common: legal.common
src/share/man/man4: adb.4

Log Message:
Fix typo

Reported by vezhlys on IRC.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/distrib/notes/common/legal.common
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/adb.4

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/common/legal.common
diff -u src/distrib/notes/common/legal.common:1.125 src/distrib/notes/common/legal.common:1.126
--- src/distrib/notes/common/legal.common:1.125	Fri Apr 10 17:02:33 2020
+++ src/distrib/notes/common/legal.common	Fri May 15 09:21:59 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: legal.common,v 1.125 2020/04/10 17:02:33 tsutsui Exp $
+.\" $NetBSD: legal.common,v 1.126 2020/05/15 09:21:59 kamil Exp $
 .\"
 .\" Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -85,7 +85,7 @@ Hannum.
 This product includes software developed by Alex Zepeda.
 .It
 This product includes software developed by Alex Zepeda, and
-Colin Wood for the NetBSD Projet.
+Colin Wood for the NetBSD Project.
 .It
 This product includes software developed by Allen Briggs.
 .It

Index: src/share/man/man4/adb.4
diff -u src/share/man/man4/adb.4:1.4 src/share/man/man4/adb.4:1.5
--- src/share/man/man4/adb.4:1.4	Fri Aug 31 19:36:28 2018
+++ src/share/man/man4/adb.4	Fri May 15 09:21:59 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: adb.4,v 1.4 2018/08/31 19:36:28 sevan Exp $
+.\"	$NetBSD: adb.4,v 1.5 2020/05/15 09:21:59 kamil Exp $
 .\"
 .\" Copyright (c) 2003 Alex Zepeda 
 .\" Copyright (c) 1997 Colin Wood
@@ -15,7 +15,7 @@
 .\" 3. All advertising materials mentioning features or use of this software
 .\"must display the following acknowledgement:
 .\"  This product includes software developed by Alex Zepeda, and
-.\"  Colin Wood for the NetBSD Projet.
+.\"  Colin Wood for the NetBSD Project.
 .\" 4. The name of the author may not be used to endorse or promote products
 .\"derived from this software without specific prior written permission.
 .\"



CVS commit: src/sys/arch/aarch64/aarch64

2020-05-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri May 15 09:08:10 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: cpuswitch.S vectors.S

Log Message:
use ldp if possible


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/aarch64/vectors.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/aarch64/aarch64/cpuswitch.S
diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.18 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.19
--- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.18	Mon Apr 13 06:02:03 2020
+++ src/sys/arch/aarch64/aarch64/cpuswitch.S	Fri May 15 09:08:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.18 2020/04/13 06:02:03 maxv Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.19 2020/05/15 09:08:10 ryo 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.18 2020/04/13 06:02:03 maxv Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.19 2020/05/15 09:08:10 ryo Exp $")
 
 	ARMV8_DEFINE_OPTIONS
 
@@ -85,8 +85,12 @@ ENTRY_NP(cpu_switchto)
 	adrl	x4, _C_LABEL(aarch64_pac_enabled)
 	ldr	w4, [x4]
 	cbz	w4, 1f
+#if L_MD_IA_KERN_LO + 8 == L_MD_IA_KERN_HI
+	ldp	x5, x6, [x1, #L_MD_IA_KERN_LO]
+#else
 	ldr	x5, [x1, #L_MD_IA_KERN_LO]
 	ldr	x6, [x1, #L_MD_IA_KERN_HI]
+#endif
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
 1:
@@ -152,8 +156,12 @@ ENTRY_NP(cpu_switchto_softint)
 	adrl	x4, _C_LABEL(aarch64_pac_enabled)
 	ldr	w4, [x4]
 	cbz	w4, 1f
+#if L_MD_IA_KERN_LO + 8 == L_MD_IA_KERN_HI
+	ldp	x5, x6, [x0, #L_MD_IA_KERN_LO]
+#else
 	ldr	x5, [x0, #L_MD_IA_KERN_LO]
 	ldr	x6, [x0, #L_MD_IA_KERN_HI]
+#endif
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
 1:
@@ -191,8 +199,12 @@ ENTRY_NP(cpu_switchto_softint)
 	adrl	x4, _C_LABEL(aarch64_pac_enabled)
 	ldr	w4, [x4]
 	cbz	w4, 1f
+#if L_MD_IA_KERN_LO + 8 == L_MD_IA_KERN_HI
+	ldp	x5, x6, [x19, #L_MD_IA_KERN_LO]
+#else
 	ldr	x5, [x19, #L_MD_IA_KERN_LO]
 	ldr	x6, [x19, #L_MD_IA_KERN_HI]
+#endif
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
 1:
@@ -373,8 +385,12 @@ ENTRY_NP(el0_trap_exit)
 	adrl	x4, _C_LABEL(aarch64_pac_enabled)
 	ldr	w4, [x4]
 	cbz	w4, 1f
+#if L_MD_IA_USER_LO + 8 == L_MD_IA_USER_HI
+	ldp	x5, x6, [x9, #L_MD_IA_USER_LO]
+#else
 	ldr	x5, [x9, #L_MD_IA_USER_LO]
 	ldr	x6, [x9, #L_MD_IA_USER_HI]
+#endif
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
 1:

Index: src/sys/arch/aarch64/aarch64/vectors.S
diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.15 src/sys/arch/aarch64/aarch64/vectors.S:1.16
--- src/sys/arch/aarch64/aarch64/vectors.S:1.15	Thu Apr 16 08:59:16 2020
+++ src/sys/arch/aarch64/aarch64/vectors.S	Fri May 15 09:08:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.S,v 1.15 2020/04/16 08:59:16 skrll Exp $	*/
+/*	$NetBSD: vectors.S,v 1.16 2020/05/15 09:08:10 ryo Exp $	*/
 
 #include 
 #include "assym.h"
@@ -91,8 +91,12 @@ ENTRY_NBTI(\func)
 	adrl	x4, _C_LABEL(aarch64_pac_enabled)
 	ldr	w4, [x4]
 	cbz	w4, 1f
+#if L_MD_IA_KERN_LO + 8 == L_MD_IA_KERN_HI
+	ldp	x5, x6, [x1, #L_MD_IA_KERN_LO]
+#else
 	ldr	x5, [x1, #L_MD_IA_KERN_LO]
 	ldr	x6, [x1, #L_MD_IA_KERN_HI]
+#endif
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
 1:



CVS commit: src/sys/dev/usb

2020-05-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 15 07:51:49 UTC 2020

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

Log Message:
It should be allowed to have exactly a usb_descriptor_t.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/usb/usbdi_util.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/usbdi_util.c
diff -u src/sys/dev/usb/usbdi_util.c:1.82 src/sys/dev/usb/usbdi_util.c:1.83
--- src/sys/dev/usb/usbdi_util.c:1.82	Fri Mar 13 18:17:41 2020
+++ src/sys/dev/usb/usbdi_util.c	Fri May 15 07:51:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi_util.c,v 1.82 2020/03/13 18:17:41 christos Exp $	*/
+/*	$NetBSD: usbdi_util.c,v 1.83 2020/05/15 07:51:49 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.82 2020/03/13 18:17:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.83 2020/05/15 07:51:49 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -733,7 +733,7 @@ usb_desc_iter_peek(usbd_desc_iter_t *ite
 {
 	const usb_descriptor_t *desc;
 
-	if (iter->cur + sizeof(usb_descriptor_t) >= iter->end) {
+	if (iter->cur + sizeof(usb_descriptor_t) > iter->end) {
 		if (iter->cur != iter->end)
 			printf("%s: bad descriptor\n", __func__);
 		return NULL;



CVS commit: src/sys/kern

2020-05-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 15 07:47:54 UTC 2020

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

Log Message:
Use a generic description when scanning mbufs.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/subr_msan.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/subr_msan.c
diff -u src/sys/kern/subr_msan.c:1.10 src/sys/kern/subr_msan.c:1.11
--- src/sys/kern/subr_msan.c:1.10	Wed Apr 15 16:28:28 2020
+++ src/sys/kern/subr_msan.c	Fri May 15 07:47:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_msan.c,v 1.10 2020/04/15 16:28:28 maxv Exp $	*/
+/*	$NetBSD: subr_msan.c,v 1.11 2020/05/15 07:47:53 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.10 2020/04/15 16:28:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.11 2020/05/15 07:47:53 maxv Exp $");
 
 #include 
 #include 
@@ -513,7 +513,7 @@ kmsan_check_mbuf(void *buf)
 	struct mbuf *m = buf;
 
 	do {
-		kmsan_shadow_check(mtod(m, void *), m->m_len, "if_transmit()");
+		kmsan_shadow_check(mtod(m, void *), m->m_len, "MbufChain");
 	} while ((m = m->m_next) != NULL);
 }
 



CVS commit: src/sys/arch/xen

2020-05-15 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May 15 07:42:58 UTC 2020

Modified Files:
src/sys/arch/xen/include: intr.h
src/sys/arch/xen/x86: pintr.c

Log Message:
use short for irq2port[] to save memory (4KB), it only needs to store
numbers <= NR_EVENT_CHANNELS (2048)


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/x86/pintr.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/include/intr.h
diff -u src/sys/arch/xen/include/intr.h:1.56 src/sys/arch/xen/include/intr.h:1.57
--- src/sys/arch/xen/include/intr.h:1.56	Thu May 14 19:36:02 2020
+++ src/sys/arch/xen/include/intr.h	Fri May 15 07:42:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.56 2020/05/14 19:36:02 jdolecek Exp $	*/
+/*	$NetBSD: intr.h,v 1.57 2020/05/15 07:42:58 jdolecek Exp $	*/
 /*	NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp	*/
 
 /*-
@@ -64,7 +64,7 @@ struct evtsource {
 };
 
 extern struct intrstub xenev_stubs[];
-extern int irq2port[NR_EVENT_CHANNELS]; /* actually port + 1, so that 0 is invaid */
+extern short irq2port[NR_EVENT_CHANNELS]; /* actually port + 1, so that 0 is invaid */
 
 #ifdef MULTIPROCESSOR
 int xen_intr_biglock_wrapper(void *);

Index: src/sys/arch/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.15 src/sys/arch/xen/x86/pintr.c:1.16
--- src/sys/arch/xen/x86/pintr.c:1.15	Fri May 15 07:31:07 2020
+++ src/sys/arch/xen/x86/pintr.c	Fri May 15 07:42:58 2020
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.15 2020/05/15 07:31:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.16 2020/05/15 07:42:58 jdolecek Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -148,7 +148,7 @@ struct intrstub x2apic_level_stubs[MAX_I
 #endif /* NIOAPIC */
 
 // XXX NR_EVENT_CHANNELS is 2048, use some sparse structure?
-int irq2port[NR_EVENT_CHANNELS] = {0}; /* actually port + 1, so that 0 is invaid */
+short irq2port[NR_EVENT_CHANNELS] = {0}; /* actually port + 1, so that 0 is invaid */
 
 #if NACPICA > 0
 #include 



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

2020-05-15 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May 15 07:31:07 UTC 2020

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
only call PHYSDEVOP_map_pirq for a shared interrupt once, same as previous code

fixes boot problem reported privately by Frank Kardel and Patrick Welche


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/pintr.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/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.14 src/sys/arch/xen/x86/pintr.c:1.15
--- src/sys/arch/xen/x86/pintr.c:1.14	Mon May  4 15:55:56 2020
+++ src/sys/arch/xen/x86/pintr.c	Fri May 15 07:31:07 2020
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.14 2020/05/04 15:55:56 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.15 2020/05/15 07:31:07 jdolecek Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -194,6 +194,11 @@ xen_pic_to_gsi(struct pic *pic, int pin)
 	{
 		KASSERT(gsi < 255);
 
+		if (irq2port[gsi] != 0) {
+			/* Already mapped the shared interrupt */
+			break;
+		}
+
 		memset(_irq, 0, sizeof(map_irq));
 		map_irq.domid = DOMID_SELF;
 		map_irq.type = MAP_PIRQ_TYPE_GSI;
@@ -201,7 +206,8 @@ xen_pic_to_gsi(struct pic *pic, int pin)
 		map_irq.pirq = gsi;
 		ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, _irq);
 		if (ret != 0)
-			panic("physdev_op(PHYSDEVOP_map_pirq) fail");
+			panic("physdev_op(PHYSDEVOP_map_pirq) GSI fail %d",
+			ret);
 		break;
 	}
 	case PIC_MSI:
@@ -226,7 +232,8 @@ xen_pic_to_gsi(struct pic *pic, int pin)
 		}
 		ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, _irq);
 		if (ret != 0)
-			panic("physdev_op(PHYSDEVOP_map_pirq) fail");
+			panic("physdev_op(PHYSDEVOP_map_pirq) MSI fail %d",
+			ret);
 		KASSERT(map_irq.entry_nr == i->mp_veccnt);
 		gsi = map_irq.pirq;
 		break;



CVS commit: src/sys/netinet

2020-05-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May 15 06:34:34 UTC 2020

Modified Files:
src/sys/netinet: igmp.c

Log Message:
igmp_sendpkt() expects ip_output() to set 'imo.imo_multicast_ttl' into
'ip->ip_ttl'; but ip_output() won't if the target is not a multicast
address, meaning that the uninitialized 'ip->ip_ttl' byte gets sent to
the network. This leaks one byte of kernel heap.

Fix this by filling 'ip->ip_ttl' with a TTL of one.

Found by KMSAN.

Reported-by: syzbot+e49f7b8a8fec5a477...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/netinet/igmp.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/netinet/igmp.c
diff -u src/sys/netinet/igmp.c:1.69 src/sys/netinet/igmp.c:1.70
--- src/sys/netinet/igmp.c:1.69	Fri Sep 14 05:09:51 2018
+++ src/sys/netinet/igmp.c	Fri May 15 06:34:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: igmp.c,v 1.69 2018/09/14 05:09:51 maxv Exp $	*/
+/*	$NetBSD: igmp.c,v 1.70 2020/05/15 06:34:34 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.69 2018/09/14 05:09:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.70 2020/05/15 06:34:34 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -613,6 +613,7 @@ igmp_sendpkt(struct in_multi *inm, int t
 	ip->ip_tos = 0;
 	ip->ip_len = htons(sizeof(struct ip) + IGMP_MINLEN);
 	ip->ip_off = htons(0);
+	ip->ip_ttl = IP_DEFAULT_MULTICAST_TTL;
 	ip->ip_p = IPPROTO_IGMP;
 	ip->ip_src = zeroin_addr;
 	ip->ip_dst = inm->inm_addr;



CVS commit: src/sys/dev/usb

2020-05-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 15 06:26:44 UTC 2020

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

Log Message:
Use howmany.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/usb_mem.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/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.76 src/sys/dev/usb/usb_mem.c:1.77
--- src/sys/dev/usb/usb_mem.c:1.76	Sun Apr  5 20:59:38 2020
+++ src/sys/dev/usb/usb_mem.c	Fri May 15 06:26:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.c,v 1.76 2020/04/05 20:59:38 skrll Exp $	*/
+/*	$NetBSD: usb_mem.c,v 1.77 2020/05/15 06:26:44 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.76 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.77 2020/05/15 06:26:44 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -152,7 +152,7 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 		/* Caller wants one segment */
 		b->nsegs = 1;
 	else
-		b->nsegs = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
+		b->nsegs = howmany(size, PAGE_SIZE);
 
 	b->segs = kmem_alloc(b->nsegs * sizeof(*b->segs), KM_SLEEP);
 	b->nsegs_alloc = b->nsegs;



CVS commit: src/sys/dev/usb

2020-05-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 15 06:23:54 UTC 2020

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

Log Message:
Use ux_length in isoc usb_syncmem.  Missed in previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/sys/dev/usb/ohci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.304 src/sys/dev/usb/ohci.c:1.305
--- src/sys/dev/usb/ohci.c:1.304	Fri May 15 06:15:42 2020
+++ src/sys/dev/usb/ohci.c	Fri May 15 06:23:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.304 2020/05/15 06:15:42 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.305 2020/05/15 06:23:54 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.304 2020/05/15 06:15:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.305 2020/05/15 06:23:54 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3464,7 +3464,7 @@ ohci_device_isoc_enter(struct usbd_xfer 
 	(UE_GET_DIR(xfer->ux_pipe->up_endpoint->ue_edesc->bEndpointAddress) == UE_DIR_IN);
 
 	if (xfer->ux_length)
-		usb_syncmem(>ux_dmabuf, 0, xfer->ux_bufsize,
+		usb_syncmem(>ux_dmabuf, 0, xfer->ux_length,
 		isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 
 	if (isoc->next == -1) {



CVS commit: src/sys

2020-05-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 15 06:15:42 UTC 2020

Modified Files:
src/sys/dev/usb: ehci.c ohci.c uhci.c usbdi.c
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Update ux_length in usbd_setup_isoc_xfer and use this to usb_syncmem
in the HCDs


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.303 -r1.304 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.300 -r1.301 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.200 -r1.201 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.73 -r1.74 src/sys/external/bsd/dwc2/dwc2.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.278 src/sys/dev/usb/ehci.c:1.279
--- src/sys/dev/usb/ehci.c:1.278	Sun Apr  5 20:59:38 2020
+++ src/sys/dev/usb/ehci.c	Fri May 15 06:15:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.278 2020/04/05 20:59:38 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.279 2020/05/15 06:15:42 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.278 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.279 2020/05/15 06:15:42 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -4301,14 +4301,13 @@ ehci_device_fs_isoc_transfer(struct usbd
 	ehci_soft_sitd_t *sitd;
 	usb_dma_t *dma_buf;
 	int i, j, k, frames;
-	int offs, total_length;
+	int offs;
 	int frindex;
 	u_int dir;
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
 	sitd = NULL;
-	total_length = 0;
 
 	DPRINTF("xfer %#jx len %jd flags %jd", (uintptr_t)xfer, xfer->ux_length,
 	xfer->ux_flags, 0);
@@ -4354,7 +4353,6 @@ ehci_device_fs_isoc_transfer(struct usbd
 		/* Set page0 index and offset - TP and T-offset are set below */
 		sitd->sitd.sitd_buffer[0] = htole32(DMAADDR(dma_buf, offs));
 
-		total_length += xfer->ux_frlengths[i];
 		offs += xfer->ux_frlengths[i];
 
 		sitd->sitd.sitd_buffer[1] =
@@ -4432,8 +4430,8 @@ ehci_device_fs_isoc_transfer(struct usbd
 	sizeof(sitd->sitd.sitd_trans),
 	BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 
-	if (total_length)
-		usb_syncmem(>ex_xfer.ux_dmabuf, 0, total_length,
+	if (xfer->ux_length)
+		usb_syncmem(>ex_xfer.ux_dmabuf, 0, xfer->ux_length,
 		BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	/*
@@ -4672,7 +4670,7 @@ ehci_device_isoc_transfer(struct usbd_xf
 	usb_dma_t *dma_buf;
 	int i, j;
 	int frames, uframes, ufrperframe;
-	int trans_count, offs, total_length;
+	int trans_count, offs;
 	int frindex;
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
@@ -4680,7 +4678,6 @@ ehci_device_isoc_transfer(struct usbd_xf
 	prev = NULL;
 	itd = NULL;
 	trans_count = 0;
-	total_length = 0;
 
 	DPRINTF("xfer %#jx flags %jd", (uintptr_t)xfer, xfer->ux_flags, 0, 0);
 
@@ -4765,7 +4762,6 @@ ehci_device_isoc_transfer(struct usbd_xf
 			EHCI_ITD_SET_PG(addr) |
 			EHCI_ITD_SET_OFFS(EHCI_PAGE_OFFSET(DMAADDR(dma_buf,offs;
 
-			total_length += xfer->ux_frlengths[trans_count];
 			offs += xfer->ux_frlengths[trans_count];
 			trans_count++;
 
@@ -4820,8 +4816,8 @@ ehci_device_isoc_transfer(struct usbd_xf
 		prev = itd;
 	} /* End of frame */
 
-	if (total_length)
-		usb_syncmem(>ex_xfer.ux_dmabuf, 0, total_length,
+	if (xfer->ux_length)
+		usb_syncmem(>ex_xfer.ux_dmabuf, 0, xfer->ux_length,
 		BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	/*

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.303 src/sys/dev/usb/ohci.c:1.304
--- src/sys/dev/usb/ohci.c:1.303	Wed May 13 19:33:48 2020
+++ src/sys/dev/usb/ohci.c	Fri May 15 06:15:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.303 2020/05/13 19:33:48 jakllsch Exp $	*/
+/*	$NetBSD: ohci.c,v 1.304 2020/05/15 06:15:42 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.303 2020/05/13 19:33:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.304 2020/05/15 06:15:42 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3463,8 +3463,9 @@ ohci_device_isoc_enter(struct usbd_xfer 
 	int isread =
 	(UE_GET_DIR(xfer->ux_pipe->up_endpoint->ue_edesc->bEndpointAddress) == UE_DIR_IN);
 
-	usb_syncmem(>ux_dmabuf, 0, xfer->ux_bufsize,
-	isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
+	if (xfer->ux_length)
+		usb_syncmem(>ux_dmabuf, 0, xfer->ux_bufsize,
+		isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 
 	if (isoc->next == -1) {
 		/* Not in use yet, schedule it a few frames ahead. */

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.300 src/sys/dev/usb/uhci.c:1.301
--- src/sys/dev/usb/uhci.c:1.300	Sun Apr  5 20:59:38 2020
+++ src/sys/dev/usb/uhci.c	Fri May 15 06:15:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.300 2020/04/05 20:59:38 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.301 2020/05/15 06:15:42 skrll Exp $	*/
 
 /*
 

CVS commit: src/sys/arch/evbarm/fdt

2020-05-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 15 06:01:26 UTC 2020

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c

Log Message:
Fix build on arm


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/evbarm/fdt/fdt_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/sys/arch/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.71 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.72
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.71	Thu May 14 19:26:28 2020
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Fri May 15 06:01:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.71 2020/05/14 19:26:28 riastradh Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.72 2020/05/15 06:01:26 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.71 2020/05/14 19:26:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.72 2020/05/15 06:01:26 skrll Exp $");
 
 #include "opt_machdep.h"
 #include "opt_bootconfig.h"
@@ -381,12 +381,14 @@ fdt_map_range(uint64_t start, uint64_t e
 	if (*psize == 0)
 		return NULL;
 
+	const vaddr_t voff = start & PAGE_MASK;
+
 	va = uvm_km_alloc(kernel_map, *psize, 0, UVM_KMF_VAONLY|UVM_KMF_NOWAIT);
 	if (va == 0) {
 		printf("Failed to allocate VA for %s\n", purpose);
 		return NULL;
 	}
-	ptr = (void *)(va + (start & (PAGE_SIZE-1)));
+	ptr = (void *)(va + voff);
 
 	for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE)
 		pmap_kenter_pa(va, pa, VM_PROT_READ|VM_PROT_WRITE, 0);