CVS commit: src/sys/external/bsd/drm2/drm

2019-11-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 16 04:10:33 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
Added Files:
src/sys/external/bsd/drm2/drm: drm_stub.c

Log Message:
Add a stub for drm_ioctl() so that compat32 links with kernels without drmkms.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/drm/drm_stub.c
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/drm/files.drmkms

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



CVS commit: src/sys/external/bsd/drm2/drm

2019-11-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov 16 04:10:33 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms
Added Files:
src/sys/external/bsd/drm2/drm: drm_stub.c

Log Message:
Add a stub for drm_ioctl() so that compat32 links with kernels without drmkms.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/drm/drm_stub.c
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/drm/files.drmkms

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

Modified files:

Index: src/sys/external/bsd/drm2/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.30 src/sys/external/bsd/drm2/drm/files.drmkms:1.31
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.30	Mon Aug 27 23:41:39 2018
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Fri Nov 15 23:10:33 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.30 2018/08/28 03:41:39 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.31 2019/11/16 04:10:33 christos Exp $
 
 include "external/bsd/drm2/linux/files.drmkms_linux"
 
@@ -100,3 +100,4 @@ file	external/bsd/drm2/drm/drm_sysfs.c	d
 file	external/bsd/drm2/dist/drm/drm_trace_points.c	drmkms
 file	external/bsd/drm2/drm/drm_vm.c	drmkms
 file	external/bsd/drm2/drm/drm_vma_manager.c	drmkms
+file	external/bsd/drm2/drm/drm_stub.c	!drmkms

Added files:

Index: src/sys/external/bsd/drm2/drm/drm_stub.c
diff -u /dev/null src/sys/external/bsd/drm2/drm/drm_stub.c:1.1
--- /dev/null	Fri Nov 15 23:10:33 2019
+++ src/sys/external/bsd/drm2/drm/drm_stub.c	Fri Nov 15 23:10:33 2019
@@ -0,0 +1,41 @@
+/*	$NetBSD: drm_stub.c,v 1.1 2019/11/16 04:10:33 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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: drm_stub.c,v 1.1 2019/11/16 04:10:33 christos Exp $");
+
+#include 
+
+int drm_ioctl(int, unsigned long, ...);
+
+int
+drm_ioctl(int fd, unsigned long cmd, ...) {
+	return ENOSYS;
+}



CVS commit: src/sys/kern

2019-11-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Nov 16 03:26:19 UTC 2019

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

Log Message:
Remove some XXX'd comments that were remnants of when I was working
on the [pgoyette-compat] code.

NFC


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/compat_stub.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/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.17 src/sys/kern/compat_stub.c:1.18
--- src/sys/kern/compat_stub.c:1.17	Sun Nov 10 14:20:50 2019
+++ src/sys/kern/compat_stub.c	Sat Nov 16 03:26:19 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.17 2019/11/10 14:20:50 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.18 2019/11/16 03:26:19 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -118,13 +118,6 @@ struct raidframe_netbsd32_ioctl_hook_t r
 struct puffs_out_50_hook_t puffs_out_50_hook;
 struct puffs_in_50_hook_t puffs_in_50_hook;
 
-/* XXX
-int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **,
-ssize_t *) = (void *)enosys;
-void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) =
-(void *)voidop;
-   XXX */
-
 /*
  * wsevents compatability
  */



CVS commit: src/sys/kern

2019-11-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Nov 16 03:26:19 UTC 2019

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

Log Message:
Remove some XXX'd comments that were remnants of when I was working
on the [pgoyette-compat] code.

NFC


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/compat_stub.c

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



Re: CVS commit: src/share/mk

2019-11-15 Thread Roy Marples

On 15/11/2019 13:41, Greg Troxel wrote:

Me too.


#metoo

Roy


CVS commit: src/sys/arch/powerpc/powerpc

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov 16 00:16:56 UTC 2019

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
fix pasto - don't limit OF_finddevice() to 32 characters
now this works again


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/powerpc/powerpc/openfirm.c

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



CVS commit: src/sys/arch/powerpc/powerpc

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov 16 00:16:56 UTC 2019

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
fix pasto - don't limit OF_finddevice() to 32 characters
now this works again


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/powerpc/powerpc/openfirm.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/powerpc/powerpc/openfirm.c
diff -u src/sys/arch/powerpc/powerpc/openfirm.c:1.28 src/sys/arch/powerpc/powerpc/openfirm.c:1.29
--- src/sys/arch/powerpc/powerpc/openfirm.c:1.28	Fri Nov 15 23:41:47 2019
+++ src/sys/arch/powerpc/powerpc/openfirm.c	Sat Nov 16 00:16:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.29 2019/11/16 00:16:55 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.29 2019/11/16 00:16:55 macallan Exp $");
 
 #include 
 #include 
@@ -278,7 +278,7 @@ OF_finddevice(const char *name)
 	};
 
 	ofw_stack();
-	strncpy(OF_buf, name, 32);
+	strncpy(OF_buf, name, NBPG);
 	args.device = OF_buf;
 	if (openfirmware(&args) == -1)
 		return -1;



CVS commit: src/sys/arch/powerpc/oea

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:43:13 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S

Log Message:
bump OF_buf(fer) since we may put extra parameters in there


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_subr.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/powerpc/oea/ofw_subr.S
diff -u src/sys/arch/powerpc/oea/ofw_subr.S:1.10 src/sys/arch/powerpc/oea/ofw_subr.S:1.11
--- src/sys/arch/powerpc/oea/ofw_subr.S:1.10	Wed Jul 27 22:04:23 2011
+++ src/sys/arch/powerpc/oea/ofw_subr.S	Fri Nov 15 23:43:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.S,v 1.10 2011/07/27 22:04:23 macallan Exp $	*/
+/*	$NetBSD: ofw_subr.S,v 1.11 2019/11/15 23:43:12 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -39,7 +39,7 @@
 	.local	OF_buffer
 
 	.lcomm	firmstk,NBPG,16
-	.lcomm	OF_buffer,NBPG,4
+	.lcomm	OF_buffer,NBPG + 36,4
 	.comm	openfirmware_entry,4,4	/* openfirmware entry point */
 	.lcomm	ofwsrsave,64,4		/* openfirmware SR savearea */
 	.comm	ofwmsr,20,4		/* msr & sprg[0-3] used in OF */



CVS commit: src/sys/arch/powerpc/oea

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:43:13 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S

Log Message:
bump OF_buf(fer) since we may put extra parameters in there


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_subr.S

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



CVS commit: src/sys/arch/powerpc/powerpc

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:41:47 UTC 2019

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
stuff name parameters into OF_buf before calling OF
now things like ofctl work on my TiBook with FIRMWORKSBUGS


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/powerpc/openfirm.c

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



CVS commit: src/sys/arch/powerpc/powerpc

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:41:47 UTC 2019

Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c

Log Message:
stuff name parameters into OF_buf before calling OF
now things like ofctl work on my TiBook with FIRMWORKSBUGS


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/powerpc/openfirm.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/powerpc/powerpc/openfirm.c
diff -u src/sys/arch/powerpc/powerpc/openfirm.c:1.27 src/sys/arch/powerpc/powerpc/openfirm.c:1.28
--- src/sys/arch/powerpc/powerpc/openfirm.c:1.27	Tue Jan  8 07:46:11 2019
+++ src/sys/arch/powerpc/powerpc/openfirm.c	Fri Nov 15 23:41:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.27 2019/01/08 07:46:11 mrg Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.27 2019/01/08 07:46:11 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $");
 
 #include 
 #include 
@@ -159,8 +159,9 @@ OF_getproplen(int handle, const char *pr
 	};
 
 	ofw_stack();
+	strncpy(OF_buf, prop, 32);
 	args.phandle = handle;
-	args.prop = prop;
+	args.prop = OF_buf;
 	if (openfirmware(&args) == -1)
 		return -1;
 	return args.proplen;
@@ -187,16 +188,17 @@ OF_getprop(int handle, const char *prop,
 	ofw_stack();
 	if (buflen > PAGE_SIZE)
 		return -1;
+	strncpy(OF_buf, prop, 32);
 	args.phandle = handle;
-	args.prop = prop;
-	args.buf = OF_buf;
+	args.prop = OF_buf;
+	args.buf = &OF_buf[33];
 	args.buflen = buflen;
 	if (openfirmware(&args) == -1)
 		return -1;
 	if (args.size > buflen)
 		args.size = buflen;
 	if (args.size > 0)
-		ofbcopy(OF_buf, buf, args.size);
+		ofbcopy(&OF_buf[33], buf, args.size);
 	return args.size;
 }
 
@@ -250,12 +252,13 @@ OF_nextprop(int handle, const char *prop
 	};
 
 	ofw_stack();
+	strncpy(OF_buf, prop, 32);
 	args.phandle = handle;
-	args.prop = prop;
-	args.buf = OF_buf;
+	args.prop = OF_buf;
+	args.buf = &OF_buf[33];
 	if (openfirmware(&args) == -1)
 		return -1;
-	strncpy(nextprop, OF_buf, 32);
+	strncpy(nextprop, &OF_buf[33], 32);
 	return args.flag;
 }
 
@@ -275,7 +278,8 @@ OF_finddevice(const char *name)
 	};
 
 	ofw_stack();
-	args.device = name;
+	strncpy(OF_buf, name, 32);
+	args.device = OF_buf;
 	if (openfirmware(&args) == -1)
 		return -1;
 	return args.phandle;



CVS commit: src/sys/kern

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 15:51:57 UTC 2019

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

Log Message:
NULL-check the structure pointer, not the address of its first field. This
is clearer and also appeases syzbot.

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


To generate a diff of this commit:
cvs rdiff -u -r1.472 -r1.473 src/sys/kern/vfs_subr.c

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



CVS commit: src/sys/kern

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 15:51:57 UTC 2019

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

Log Message:
NULL-check the structure pointer, not the address of its first field. This
is clearer and also appeases syzbot.

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


To generate a diff of this commit:
cvs rdiff -u -r1.472 -r1.473 src/sys/kern/vfs_subr.c

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

Modified files:

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.472 src/sys/kern/vfs_subr.c:1.473
--- src/sys/kern/vfs_subr.c:1.472	Sun Sep 22 22:59:39 2019
+++ src/sys/kern/vfs_subr.c	Fri Nov 15 15:51:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.472 2019/09/22 22:59:39 christos Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.473 2019/11/15 15:51:57 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.472 2019/09/22 22:59:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.473 2019/11/15 15:51:57 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -758,6 +758,7 @@ sched_sync(void *arg)
 {
 	mount_iterator_t *iter;
 	synclist_t *slp;
+	struct vnode_impl *vi;
 	struct vnode *vp;
 	struct mount *mp;
 	time_t starttime;
@@ -790,7 +791,8 @@ sched_sync(void *arg)
 		if (syncer_delayno >= syncer_last)
 			syncer_delayno = 0;
 
-		while ((vp = VIMPL_TO_VNODE(TAILQ_FIRST(slp))) != NULL) {
+		while ((vi = TAILQ_FIRST(slp)) != NULL) {
+			vp = VIMPL_TO_VNODE(vi);
 			synced = lazy_sync_vnode(vp);
 
 			/*



Re: CVS commit: src/share/mk

2019-11-15 Thread Greg Troxel
David Brownlee  writes:

> On Thu, 14 Nov 2019 at 21:05, Christos Zoulas  wrote:
>>
>> The first issue is that I prefer to have tar respect existing
>> symlinks (ones that it did not create by default -- without having
>> to specify extra flags) since to do this (in my opinion) does not
>> pose a security risk. Yes my implementation is Q+D, but it works.
>>
>> https://www.netbsd.org/~christos/track-symlinks.diff
>>
>> The second issue is that the way libarchive-tar overwrites existing
>> files is by removing them first, and writing them directly to the
>> final destination pathname. This creates a significant amount of
>> time where the file is either not available or not completely
>> written. Imagine trying to replace shared libraries or programs
>> frequently used. Pax-as-tar wrote the file to a temporary one first
>> and used rename(2) to atomically replace it. I've written a patch
>> to do the same for libarchive-tar:
>>
>> https://www.netbsd.org/~christos/libarchive-atomic.diff
>>
>> With those two patches we can put libarchive as tar back and we don't
>> need to make any other changes since behavioraly the old pax-as-tar
>> and libarchive-tar behave the same for those two cases that bothered us.
>>
>> I am inclined to just commit them and flip the default again.
>
> I could see an argument for having an option to turn off the
> extract-to-temp-and-rename behaviour (not that I'd use it), but I'd be
> very happy to see both above changes in as defaults and us back onto
> libarchive-tar

Me too.

My sense of the list is that

  most people want unpacking sets over a system to work as well as it
  used to work

  some people really want a tar that handles newer formats, and probably
  everything thinks this would be good

  some concern has been expresseed over performance, but more people
  have expressed the notion that things working correctly (which does
  not have a universal definition) is more important.

so Christos's proposal seems to steer very well to this rough consensus.

> Thanks for working on this!

Seconded!


CVS commit: src/sys/dev/ic

2019-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 15 13:25:53 UTC 2019

Modified Files:
src/sys/dev/ic: rtl81x9reg.h

Log Message:
 Sort RTK_HWREV_* by value.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/rtl81x9reg.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/ic/rtl81x9reg.h
diff -u src/sys/dev/ic/rtl81x9reg.h:1.50 src/sys/dev/ic/rtl81x9reg.h:1.51
--- src/sys/dev/ic/rtl81x9reg.h:1.50	Fri Apr  5 23:46:04 2019
+++ src/sys/dev/ic/rtl81x9reg.h	Fri Nov 15 13:25:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl81x9reg.h,v 1.50 2019/04/05 23:46:04 uwe Exp $	*/
+/*	$NetBSD: rtl81x9reg.h,v 1.51 2019/11/15 13:25:53 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998
@@ -149,7 +149,7 @@
 #define RTK_TXCFG_IFG		0x0300	/* interframe gap */
 #define RTK_TXCFG_HWREV		0x7CC0
 
-#define RTK_LOOPTEST_OFF		0x
+#define RTK_LOOPTEST_OFF	0x
 #define RTK_LOOPTEST_ON		0x0002
 #define RTK_LOOPTEST_ON_CPLUS	0x0006
 
@@ -166,11 +166,6 @@
 #define RTK_HWREV_8168E		0x2C00
 #define RTK_HWREV_8168E_VL	0x2C80
 #define RTK_HWREV_8168_SPIN1	0x3000
-#define RTK_HWREV_8168G		0x4c00
-#define RTK_HWREV_8168G_SPIN1	0x4c10
-#define RTK_HWREV_8168G_SPIN2	0x5090
-#define RTK_HWREV_8168G_SPIN4	0x5c80
-#define RTK_HWREV_8168GU	0x5080
 #define RTK_HWREV_8100E		0x3080
 #define RTK_HWREV_8101E		0x3400
 #define RTK_HWREV_8102E		0x3480
@@ -181,18 +176,23 @@
 #define RTK_HWREV_8168C_SPIN2	0x3C40
 #define RTK_HWREV_8168CP	0x3C80
 #define RTK_HWREV_8168F		0x4800
+#define RTK_HWREV_8168G		0x4c00
+#define RTK_HWREV_8168G_SPIN1	0x4c10
+#define RTK_HWREV_8168GU	0x5080
+#define RTK_HWREV_8168G_SPIN2	0x5090
 #define RTK_HWREV_8168H		0x5400
 #define RTK_HWREV_8168H_SPIN1	0x5410
+#define RTK_HWREV_8168G_SPIN4	0x5c80
 #define RTK_HWREV_8139		0x6000
 #define RTK_HWREV_8139A		0x7000
 #define RTK_HWREV_8139AG	0x7080
-#define RTK_HWREV_8139B		0x7800
-#define RTK_HWREV_8130		0x7C00
 #define RTK_HWREV_8139C		0x7400
 #define RTK_HWREV_8139D		0x7440
 #define RTK_HWREV_8139CPLUS	0x7480
 #define RTK_HWREV_8101		0x74c0
+#define RTK_HWREV_8139B		0x7800
 #define RTK_HWREV_8100		0x7880
+#define RTK_HWREV_8130		0x7C00
 #define RTK_HWREV_8169_8110SBL	0x7cc0
 
 #define RTK_TXDMA_16BYTES	0x



CVS commit: src/sys/dev/ic

2019-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 15 13:25:53 UTC 2019

Modified Files:
src/sys/dev/ic: rtl81x9reg.h

Log Message:
 Sort RTK_HWREV_* by value.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/rtl81x9reg.h

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



CVS commit: src/sys/dev/pci

2019-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 15 12:38:09 UTC 2019

Modified Files:
src/sys/dev/pci: if_msk.c if_skreg.h

Log Message:
 Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

 At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_skreg.h

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



CVS commit: src/sys/dev/pci

2019-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 15 12:38:09 UTC 2019

Modified Files:
src/sys/dev/pci: if_msk.c if_skreg.h

Log Message:
 Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

 At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_skreg.h

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.93 src/sys/dev/pci/if_msk.c:1.94
--- src/sys/dev/pci/if_msk.c:1.93	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/if_msk.c	Fri Nov 15 12:38:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.93 2019/11/10 21:16:36 chs Exp $ */
+/* $NetBSD: if_msk.c,v 1.94 2019/11/15 12:38:09 msaitoh Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.93 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.94 2019/11/15 12:38:09 msaitoh Exp $");
 
 #include 
 #include 
@@ -881,10 +881,27 @@ void
 mskc_reset(struct sk_softc *sc)
 {
 	uint32_t imtimer_ticks, reg1;
+	uint16_t status;
 	int reg;
 
 	DPRINTFN(2, ("mskc_reset\n"));
 
+	/* Disable ASF */
+	if ((sc->sk_type == SK_YUKON_EX) || (sc->sk_type == SK_YUKON_SUPR)) {
+		CSR_WRITE_4(sc, SK_Y2_CPU_WDOG, 0);
+		status = CSR_READ_2(sc, SK_Y2_ASF_HCU_CCSR);
+		/* Clear AHB bridge & microcontroller reset. */
+		status &= ~(SK_Y2_ASF_HCU_CSSR_ARB_RST |
+		SK_Y2_ASF_HCU_CSSR_CPU_RST_MODE);
+		/* Clear ASF microcontroller state. */
+		status &= ~SK_Y2_ASF_HCU_CSSR_UC_STATE_MSK;
+		status &= ~SK_Y2_ASF_HCU_CSSR_CPU_CLK_DIVIDE_MSK;
+		CSR_WRITE_2(sc, SK_Y2_ASF_HCU_CCSR, status);
+		CSR_WRITE_4(sc, SK_Y2_CPU_WDOG, 0);
+	} else
+		CSR_WRITE_1(sc, SK_Y2_ASF_CSR, SK_Y2_ASF_RESET);
+	CSR_WRITE_2(sc, SK_CSR, SK_CSR_ASF_OFF);
+
 	CSR_WRITE_1(sc, SK_CSR, SK_CSR_SW_RESET);
 	CSR_WRITE_1(sc, SK_CSR, SK_CSR_MASTER_RESET);
 
@@ -957,10 +974,6 @@ mskc_reset(struct sk_softc *sc)
 	DPRINTFN(2, ("mskc_reset: sk_link_ctrl=%x\n",
 		 CSR_READ_2(sc, SK_LINK_CTRL)));
 
-	/* Disable ASF */
-	CSR_WRITE_1(sc, SK_Y2_ASF_CSR, SK_Y2_ASF_RESET);
-	CSR_WRITE_2(sc, SK_CSR, SK_CSR_ASF_OFF);
-
 	/* Clear I2C IRQ noise */
 	CSR_WRITE_4(sc, SK_I2CHWIRQ, 1);
 
@@ -1096,9 +1109,9 @@ msk_reset(struct sk_if_softc *sc_if)
 {
 	/* GMAC and GPHY Reset */
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_SET);
-	SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
+	SK_IF_WRITE_1(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
 	DELAY(1000);
-	SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_CLEAR);
+	SK_IF_WRITE_1(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_CLEAR);
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_LOOP_OFF |
 		  SK_GMAC_PAUSE_ON | SK_GMAC_RESET_CLEAR);
 }
@@ -2404,17 +2417,31 @@ msk_init_yukon(struct sk_if_softc *sc_if
 
 	/* Configure RX MAC FIFO */
 	SK_IF_WRITE_1(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_RESET_CLEAR);
-	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_OPERATION_ON |
-	SK_RFCTL_FIFO_FLUSH_ON);
-
-	/* Increase flush threshold to 64 bytes */
-	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_FLUSH_THRESHOLD,
-	SK_RFCTL_FIFO_THRESHOLD + 1);
+	v =  SK_RFCTL_OPERATION_ON | SK_RFCTL_FIFO_FLUSH_ON;
+	if ((sc->sk_type == SK_YUKON_EX) || (sc->sk_type == SK_YUKON_FE_P))
+		v |= SK_RFCTL_RX_OVER_ON;
+	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_CTRL_TEST, v);
+
+	if ((sc->sk_type == SK_YUKON_FE_P) &&
+	(sc->sk_rev == SK_YUKON_FE_P_REV_A0))
+		v = 0x178; /* Magic value */
+	else {
+		/* Increase flush threshold to 64 bytes */
+		v = SK_RFCTL_FIFO_THRESHOLD + 1;
+	}
+	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_FLUSH_THRESHOLD, v);
 
 	/* Configure TX MAC FIFO */
 	SK_IF_WRITE_1(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_RESET_CLEAR);
 	SK_IF_WRITE_2(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_OPERATION_ON);
 
+	if ((sc->sk_type == SK_YUKON_FE_P) &&
+	(sc->sk_rev == SK_YUKON_FE_P_REV_A0)) {
+		v = SK_IF_READ_2(sc_if, 0, SK_TXMF1_END);
+		v &= ~SK_TXEND_WM_ON;
+		SK_IF_WRITE_2(sc_if, 0, SK_TXMF1_END, v);
+	}	
+
 #if 1
 	SK_YU_WRITE_2(sc_if, YUKON_GPCR, YU_GPCR_TXEN | YU_GPCR_RXEN);
 #endif
@@ -2451,7 +2478,7 @@ msk_init(struct ifnet *ifp)
 	/* Configure transmit arbiter(s) */
 	SK_IF_WRITE_1(sc_if, 0, SK_TXAR1_COUNTERCTL, SK_TXARCTL_ON);
 #if 0
-	SK_TXARCTL_ON | SK_TXARCTL_FSYNC_ON);
+/*	SK_TXARCTL_ON | SK_TXARCTL_FSYNC_ON); */
 #endif
 
 	if (sc->sk_ramsize) {
@@ -2559,6 +2586,13 @@ msk_init(struct ifnet *ifp)
 	SK_IF_WRITE_2(sc_if, 0, SK_RXQ1_Y2_PREF_PUTIDX,
 	sc_if->sk_cdata.sk_rx_prod);
 
+	
+	if ((sc->sk_type == SK_YUKON_EX) || (sc->sk_type == SK_YUKON_SUPR)) {
+		/* Disable flushing of non-ASF packets. */
+		SK_IF_WRITE_4(sc_if, 0, SK_RXMF1_CTRL_TEST,
+		SK_RFCTL_RX_MACSEC_FLUSH_OFF);
+	}
+
 	/* Configure inte

Re: CVS commit: src/share/mk

2019-11-15 Thread David Brownlee
On Thu, 14 Nov 2019 at 21:05, Christos Zoulas  wrote:
>
> In article <2c05e1ed-8410-fa0f-d786-06ee6e1c4...@marples.name>,
> Roy Marples   wrote:
> >On 14/11/2019 05:47, Martin Husemann wrote:
> >> On Thu, Nov 14, 2019 at 03:53:02PM +1100, matthew green wrote:
> >>> i'm not happy about this change.  i wish that bsdtar was
> >>> fixed to not be unfriendly, because it mostly is a better
> >>> implementation.  just these edge cases are rather ..
> >>> problematic yet these issues are being ignored or
> >>> rejected as being irrelevant.
> >>
> >> Me neither, especially as we now effectively have different command line
> >> args passed from sysinst to tar depending on the tar invocation (and this
> >> is all hard coded). I'll have to make it a define in sysinst depending
> >> on the seleted tar variant :-/.
> >
> >Just for the record, I don't really care about different cmd line args,
> >symlinks and security involved.
> >
> >My expectation is that a modern NetBSD tar can extract a modern tar
> >archive from other sources.
> >
> >If it cannot do this we have failed.
>
> So I am trying to find some time to pursue the two issues I have
> with upstream and understand if they will accept the following two
> changes (or versions thereof):
>
> The first issue is that I prefer to have tar respect existing
> symlinks (ones that it did not create by default -- without having
> to specify extra flags) since to do this (in my opinion) does not
> pose a security risk. Yes my implementation is Q+D, but it works.
>
> https://www.netbsd.org/~christos/track-symlinks.diff
>
> The second issue is that the way libarchive-tar overwrites existing
> files is by removing them first, and writing them directly to the
> final destination pathname. This creates a significant amount of
> time where the file is either not available or not completely
> written. Imagine trying to replace shared libraries or programs
> frequently used. Pax-as-tar wrote the file to a temporary one first
> and used rename(2) to atomically replace it. I've written a patch
> to do the same for libarchive-tar:
>
> https://www.netbsd.org/~christos/libarchive-atomic.diff
>
> With those two patches we can put libarchive as tar back and we don't
> need to make any other changes since behavioraly the old pax-as-tar
> and libarchive-tar behave the same for those two cases that bothered us.
>
> I am inclined to just commit them and flip the default again.

I could see an argument for having an option to turn off the
extract-to-temp-and-rename behaviour (not that I'd use it), but I'd be
very happy to see both above changes in as defaults and us back onto
libarchive-tar

Thanks for working on this!

David


CVS commit: src/sys

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 12:18:46 UTC 2019

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

Log Message:
Instrument ufetch/ustore in kMSan, these were the last remaining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/subr_msan.c
cvs rdiff -u -r1.290 -r1.291 src/sys/sys/systm.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_msan.c
diff -u src/sys/kern/subr_msan.c:1.1 src/sys/kern/subr_msan.c:1.2
--- src/sys/kern/subr_msan.c:1.1	Thu Nov 14 16:23:52 2019
+++ src/sys/kern/subr_msan.c	Fri Nov 15 12:18:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_msan.c,v 1.1 2019/11/14 16:23:52 maxv Exp $	*/
+/*	$NetBSD: subr_msan.c,v 1.2 2019/11/15 12:18:46 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define KMSAN_NO_INST
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.1 2019/11/14 16:23:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.2 2019/11/15 12:18:46 maxv Exp $");
 
 #include 
 #include 
@@ -870,6 +870,191 @@ kmsan_copyoutstr(const void *kaddr, void
 
 /* -- */
 
+#undef _ucas_32
+#undef _ucas_32_mp
+#undef _ucas_64
+#undef _ucas_64_mp
+#undef _ufetch_8
+#undef _ufetch_16
+#undef _ufetch_32
+#undef _ufetch_64
+#undef _ustore_8
+#undef _ustore_16
+#undef _ustore_32
+#undef _ustore_64
+
+int _ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *);
+int kmsan__ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *);
+int
+kmsan__ucas_32(volatile uint32_t *uaddr, uint32_t old, uint32_t new,
+uint32_t *ret)
+{
+	int _ret;
+	kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
+	sizeof(new) + sizeof(ret), "ucas_32");
+	_ret = _ucas_32(uaddr, old, new, ret);
+	if (_ret == 0)
+		kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
+	kmsan_init_ret(sizeof(int));
+	return _ret;
+}
+
+#ifdef __HAVE_UCAS_MP
+int _ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *);
+int kmsan__ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *);
+int
+kmsan__ucas_32_mp(volatile uint32_t *uaddr, uint32_t old, uint32_t new,
+uint32_t *ret)
+{
+	int _ret;
+	kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
+	sizeof(new) + sizeof(ret), "ucas_32_mp");
+	_ret = _ucas_32_mp(uaddr, old, new, ret);
+	if (_ret == 0)
+		kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
+	kmsan_init_ret(sizeof(int));
+	return _ret;
+}
+#endif
+
+#ifdef _LP64
+int _ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *);
+int kmsan__ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *);
+int
+kmsan__ucas_64(volatile uint64_t *uaddr, uint64_t old, uint64_t new,
+uint64_t *ret)
+{
+	int _ret;
+	kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
+	sizeof(new) + sizeof(ret), "ucas_64");
+	_ret = _ucas_64(uaddr, old, new, ret);
+	if (_ret == 0)
+		kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
+	kmsan_init_ret(sizeof(int));
+	return _ret;
+}
+
+#ifdef __HAVE_UCAS_MP
+int _ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *);
+int kmsan__ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *);
+int
+kmsan__ucas_64_mp(volatile uint64_t *uaddr, uint64_t old, uint64_t new,
+uint64_t *ret)
+{
+	int _ret;
+	kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
+	sizeof(new) + sizeof(ret), "ucas_64_mp");
+	_ret = _ucas_64_mp(uaddr, old, new, ret);
+	if (_ret == 0)
+		kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
+	kmsan_init_ret(sizeof(int));
+	return _ret;
+}
+#endif
+#endif
+
+int _ufetch_8(const uint8_t *, uint8_t *);
+int kmsan__ufetch_8(const uint8_t *, uint8_t *);
+int
+kmsan__ufetch_8(const uint8_t *uaddr, uint8_t *valp)
+{
+	int _ret;
+	kmsan_check_arg(sizeof(uaddr) + sizeof(valp), "ufetch_8");
+	_ret = _ufetch_8(uaddr, valp);
+	if (_ret == 0)
+		kmsan_shadow_fill(valp, KMSAN_STATE_INITED, sizeof(*valp));
+	kmsan_init_ret(sizeof(int));
+	return _ret;
+}
+
+int _ufetch_16(const uint16_t *, uint16_t *);
+int kmsan__ufetch_16(const uint16_t *, uint16_t *);
+int
+kmsan__ufetch_16(const uint16_t *uaddr, uint16_t *valp)
+{
+	int _ret;
+	kmsan_check_arg(sizeof(uaddr) + sizeof(valp), "ufetch_16");
+	_ret = _ufetch_16(uaddr, valp);
+	if (_ret == 0)
+		kmsan_shadow_fill(valp, KMSAN_STATE_INITED, sizeof(*valp));
+	kmsan_init_ret(sizeof(int));
+	return _ret;
+}
+
+int _ufetch_32(const uint32_t *, uint32_t *);
+int kmsan__ufetch_32(const uint32_t *, uint32_t *);
+int
+kmsan__ufetch_32(const uint32_t *uaddr, uint32_t *valp)
+{
+	int _ret;
+	kmsan_check_arg(sizeof(uaddr) + sizeof(valp), "ufetch_32");
+	_ret = _ufetch_32(uaddr, valp);
+	if (_ret == 0)
+		kmsan_shadow_fill(valp, KMSAN_STATE_INITED, sizeof(*valp));
+	kmsan_init_ret(sizeof(int));
+	return _ret;
+}
+
+#ifdef _LP64
+int _ufetch_64(const uint64_t *, uint64_t *);
+int kmsan__u

CVS commit: src/sys

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 12:18:46 UTC 2019

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

Log Message:
Instrument ufetch/ustore in kMSan, these were the last remaining functions.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/subr_msan.c
cvs rdiff -u -r1.290 -r1.291 src/sys/sys/systm.h

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



CVS commit: src/sys/arch/amd64/amd64

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 09:50:01 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: cpu_in_cksum.S

Log Message:
Since cpu_in_cksum.S can be built outside of the kernel, add an ugly #ifdef
_KERNEL for kMSan.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/amd64/cpu_in_cksum.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/amd64/amd64/cpu_in_cksum.S
diff -u src/sys/arch/amd64/amd64/cpu_in_cksum.S:1.4 src/sys/arch/amd64/amd64/cpu_in_cksum.S:1.5
--- src/sys/arch/amd64/amd64/cpu_in_cksum.S:1.4	Thu Nov 14 16:23:52 2019
+++ src/sys/arch/amd64/amd64/cpu_in_cksum.S	Fri Nov 15 09:50:01 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_in_cksum.S,v 1.4 2019/11/14 16:23:52 maxv Exp $ */
+/* $NetBSD: cpu_in_cksum.S,v 1.5 2019/11/15 09:50:01 maxv Exp $ */
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger .
@@ -30,7 +30,11 @@
  */
 
 #include 
+#ifdef _KERNEL
 #include 
+#else
+#define KMSAN_INIT_RET(sz)	/* nothing */
+#endif
 #include "assym.h"
 
 ENTRY(cpu_in_cksum)



CVS commit: src/sys/arch/amd64/amd64

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 09:50:01 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: cpu_in_cksum.S

Log Message:
Since cpu_in_cksum.S can be built outside of the kernel, add an ugly #ifdef
_KERNEL for kMSan.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/amd64/cpu_in_cksum.S

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



CVS commit: src

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 09:44:44 UTC 2019

Modified Files:
src/share/mk: bsd.sys.mk
src/sys/kern: subr_kcov.c

Log Message:
Make kMSan compatible with KCOV. With kMSan we are forced to stay with the
fsanitize flag on subr_kcov.c, which means that kMSan will instrument KCOV.
We add a bunch of __nomsan attributes to reduce this instrumentation, but
it does not remove it completely. That's fine.


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/share/mk/bsd.sys.mk
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_kcov.c

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.295 src/share/mk/bsd.sys.mk:1.296
--- src/share/mk/bsd.sys.mk:1.295	Tue Nov  5 20:19:17 2019
+++ src/share/mk/bsd.sys.mk	Fri Nov 15 09:44:44 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.295 2019/11/05 20:19:17 maxv Exp $
+#	$NetBSD: bsd.sys.mk,v 1.296 2019/11/15 09:44:44 maxv Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -247,7 +247,7 @@ CFLAGS+=	${KLEAKFLAGS.${.IMPSRC:T}:U${KL
 .if ${KCOV:U0} > 0
 KCOVFLAGS=	-fsanitize-coverage=trace-pc
 .for f in subr_kcov.c subr_lwp_specificdata.c subr_specificdata.c subr_asan.c \
-	subr_csan.c
+	subr_csan.c subr_msan.c
 KCOVFLAGS.${f}=		# empty
 .endfor
 CFLAGS+=	${KCOVFLAGS.${.IMPSRC:T}:U${KCOVFLAGS}}

Index: src/sys/kern/subr_kcov.c
diff -u src/sys/kern/subr_kcov.c:1.8 src/sys/kern/subr_kcov.c:1.9
--- src/sys/kern/subr_kcov.c:1.8	Sun May 26 05:41:45 2019
+++ src/sys/kern/subr_kcov.c	Fri Nov 15 09:44:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kcov.c,v 1.8 2019/05/26 05:41:45 kamil Exp $	*/
+/*	$NetBSD: subr_kcov.c,v 1.9 2019/11/15 09:44:44 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -339,7 +339,7 @@ out:
 	return error;
 }
 
-static inline bool
+static inline bool __nomsan
 in_interrupt(void)
 {
 	return curcpu()->ci_idepth >= 0;
@@ -347,7 +347,7 @@ in_interrupt(void)
 
 void __sanitizer_cov_trace_pc(void);
 
-void
+void __nomsan
 __sanitizer_cov_trace_pc(void)
 {
 	extern int cold;
@@ -388,7 +388,7 @@ __sanitizer_cov_trace_pc(void)
 	}
 }
 
-static void
+static void __nomsan
 trace_cmp(uint64_t type, uint64_t arg1, uint64_t arg2, intptr_t pc)
 {
 	extern int cold;
@@ -433,7 +433,7 @@ trace_cmp(uint64_t type, uint64_t arg1, 
 
 void __sanitizer_cov_trace_cmp1(uint8_t arg1, uint8_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp1(uint8_t arg1, uint8_t arg2)
 {
 
@@ -443,7 +443,7 @@ __sanitizer_cov_trace_cmp1(uint8_t arg1,
 
 void __sanitizer_cov_trace_cmp2(uint16_t arg1, uint16_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp2(uint16_t arg1, uint16_t arg2)
 {
 
@@ -453,7 +453,7 @@ __sanitizer_cov_trace_cmp2(uint16_t arg1
 
 void __sanitizer_cov_trace_cmp4(uint32_t arg1, uint32_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp4(uint32_t arg1, uint32_t arg2)
 {
 
@@ -463,7 +463,7 @@ __sanitizer_cov_trace_cmp4(uint32_t arg1
 
 void __sanitizer_cov_trace_cmp8(uint64_t arg1, uint64_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp8(uint64_t arg1, uint64_t arg2)
 {
 
@@ -473,7 +473,7 @@ __sanitizer_cov_trace_cmp8(uint64_t arg1
 
 void __sanitizer_cov_trace_const_cmp1(uint8_t arg1, uint8_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp1(uint8_t arg1, uint8_t arg2)
 {
 
@@ -483,7 +483,7 @@ __sanitizer_cov_trace_const_cmp1(uint8_t
 
 void __sanitizer_cov_trace_const_cmp2(uint16_t arg1, uint16_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp2(uint16_t arg1, uint16_t arg2)
 {
 
@@ -493,7 +493,7 @@ __sanitizer_cov_trace_const_cmp2(uint16_
 
 void __sanitizer_cov_trace_const_cmp4(uint32_t arg1, uint32_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp4(uint32_t arg1, uint32_t arg2)
 {
 
@@ -503,7 +503,7 @@ __sanitizer_cov_trace_const_cmp4(uint32_
 
 void __sanitizer_cov_trace_const_cmp8(uint64_t arg1, uint64_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp8(uint64_t arg1, uint64_t arg2)
 {
 
@@ -513,7 +513,7 @@ __sanitizer_cov_trace_const_cmp8(uint64_
 
 void __sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases);
 
-void
+void __nomsan
 __sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases)
 {
 	uint64_t i, nbits, ncases, type;



CVS commit: src

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 09:44:44 UTC 2019

Modified Files:
src/share/mk: bsd.sys.mk
src/sys/kern: subr_kcov.c

Log Message:
Make kMSan compatible with KCOV. With kMSan we are forced to stay with the
fsanitize flag on subr_kcov.c, which means that kMSan will instrument KCOV.
We add a bunch of __nomsan attributes to reduce this instrumentation, but
it does not remove it completely. That's fine.


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/share/mk/bsd.sys.mk
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_kcov.c

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



Re: CVS commit: src/sys

2019-11-15 Thread Martin Husemann
On Thu, Nov 14, 2019 at 04:23:54PM +, Maxime Villard wrote:
> Module Name:  src
> Committed By: maxv
> Date: Thu Nov 14 16:23:53 UTC 2019
> 
> Modified Files:
>   src/sys/arch/amd64/amd64: amd64_trap.S busfunc.S cpu_in_cksum.S
[..]
> Log Message:
> Add support for Kernel Memory Sanitizer (kMSan). It detects uninitialized
> memory used by the kernel at run time, and just like kASan and kCSan, it
> is an excellent feature. It has already detected 38 uninitialized variables
> in the kernel during my testing, which I have since discreetly fixed.
[..]
> To generate a diff of this commit:
> cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/amd64/amd64_trap.S
> cvs rdiff -u -r1.11 -r1.12 src/sys/arch/amd64/amd64/busfunc.S

This breaks the build for me in src/tests/net/in_cksum:

#   compile  in_cksum/cpu_in_cksum.o
/usr/tools/bin/x86_64--netbsd-gcc   -fPIE   --sysroot=/ -DHAVE_CPU_IN_CKSUM 
-I/usr/src/tests/net/in_cksum -I/usr/src/sys/netinet 
-I/usr/src/tests/net/in_cksum/../.. -D_KERNTYPES  -x assembler-with-cpp -c
/usr/src/sys/arch/amd64/amd64/cpu_in_cksum.S
/usr/src/sys/arch/amd64/amd64/cpu_in_cksum.S:33:10: fatal error: 
machine/frameasm.h: No such file or directory
 #include 
  ^~~~
compilation terminated.


Martin


CVS commit: src/sys/arch

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 09:03:26 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S
src/sys/arch/x86/include: pio.h

Log Message:
Remove the ins* and outs* functions. Not sanitizer-friendly, and unused
anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/pio.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/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.47 src/sys/arch/amd64/amd64/cpufunc.S:1.48
--- src/sys/arch/amd64/amd64/cpufunc.S:1.47	Thu Nov 14 16:23:52 2019
+++ src/sys/arch/amd64/amd64/cpufunc.S	Fri Nov 15 09:03:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.47 2019/11/14 16:23:52 maxv Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.48 2019/11/15 09:03:26 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -349,15 +349,6 @@ ENTRY(inb)
 	ret
 END(inb)
 
-ENTRY(insb)
-	movl	%edx, %ecx
-	movl	%edi, %edx
-	movq	%rsi, %rdi
-	rep
-	insb
-	ret
-END(insb)
-
 ENTRY(inw)
 	movq	%rdi, %rdx
 	xorq	%rax, %rax
@@ -366,15 +357,6 @@ ENTRY(inw)
 	ret
 END(inw)
 
-ENTRY(insw)
-	movl	%edx, %ecx
-	movl	%edi, %edx
-	movq	%rsi, %rdi
-	rep
-	insw
-	ret
-END(insw)
-
 ENTRY(inl)
 	movq	%rdi, %rdx
 	xorq	%rax, %rax
@@ -383,15 +365,6 @@ ENTRY(inl)
 	ret
 END(inl)
 
-ENTRY(insl)
-	movl	%edx, %ecx
-	movl	%edi, %edx
-	movq	%rsi, %rdi
-	rep
-	insl
-	ret
-END(insl)
-
 ENTRY(outb)
 	movq	%rdi, %rdx
 	movq	%rsi, %rax
@@ -399,14 +372,6 @@ ENTRY(outb)
 	ret
 END(outb)
 
-ENTRY(outsb)
-	movl	%edx, %ecx
-	movl	%edi, %edx
-	rep
-	outsb
-	ret
-END(outsb)
-
 ENTRY(outw)
 	movq	%rdi, %rdx
 	movq	%rsi, %rax
@@ -414,25 +379,9 @@ ENTRY(outw)
 	ret
 END(outw)
 
-ENTRY(outsw)
-	movl	%edx, %ecx
-	movl	%edi, %edx
-	rep
-	outsw
-	ret
-END(outsw)
-
 ENTRY(outl)
 	movq	%rdi, %rdx
 	movq	%rsi, %rax
 	outl	%eax, %dx
 	ret
 END(outl)
-
-ENTRY(outsl)
-	movl	%edx, %ecx
-	movl	%edi, %edx
-	rep
-	outsl
-	ret
-END(outsl)

Index: src/sys/arch/i386/i386/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.36 src/sys/arch/i386/i386/cpufunc.S:1.37
--- src/sys/arch/i386/i386/cpufunc.S:1.36	Wed Oct 30 17:06:57 2019
+++ src/sys/arch/i386/i386/cpufunc.S	Fri Nov 15 09:03:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.36 2019/10/30 17:06:57 maxv Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.37 2019/11/15 09:03:26 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.36 2019/10/30 17:06:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.37 2019/11/15 09:03:26 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -247,17 +247,6 @@ ENTRY(inb)
 	ret
 END(inb)
 
-ENTRY(insb)
-	pushl	%edi
-	movl	8(%esp), %edx
-	movl	12(%esp), %edi
-	movl	16(%esp), %ecx
-	rep
-	insb
-	popl	%edi
-	ret
-END(insb)
-
 ENTRY(inw)
 	movl	4(%esp), %edx
 	xorl	%eax, %eax
@@ -265,34 +254,12 @@ ENTRY(inw)
 	ret
 END(inw)
 
-ENTRY(insw)
-	pushl	%edi
-	movl	8(%esp), %edx
-	movl	12(%esp), %edi
-	movl	16(%esp), %ecx
-	rep
-	insw
-	popl	%edi
-	ret
-END(insw)
-
 ENTRY(inl)
 	movl	4(%esp), %edx
 	inl	%dx, %eax
 	ret
 END(inl)
 
-ENTRY(insl)
-	pushl	%edi
-	movl	8(%esp), %edx
-	movl	12(%esp), %edi
-	movl	16(%esp), %ecx
-	rep
-	insl
-	popl	%edi
-	ret
-END(insl)
-
 ENTRY(outb)
 	movl	4(%esp), %edx
 	movl	8(%esp), %eax
@@ -300,17 +267,6 @@ ENTRY(outb)
 	ret
 END(outb)
 
-ENTRY(outsb)
-	pushl	%esi
-	movl	8(%esp), %edx
-	movl	12(%esp), %esi
-	movl	16(%esp), %ecx
-	rep
-	outsb
-	popl	%esi
-	ret
-END(outsb)
-
 ENTRY(outw)
 	movl	4(%esp), %edx
 	movl	8(%esp), %eax
@@ -318,31 +274,9 @@ ENTRY(outw)
 	ret
 END(outw)
 
-ENTRY(outsw)
-	pushl	%esi
-	movl	8(%esp), %edx
-	movl	12(%esp), %esi
-	movl	16(%esp), %ecx
-	rep
-	outsw
-	popl	%esi
-	ret
-END(outsw)
-
 ENTRY(outl)
 	movl	4(%esp), %edx
 	movl	8(%esp), %eax
 	outl	%eax, %dx
 	ret
 END(outl)
-
-ENTRY(outsl)
-	pushl	%esi
-	movl	8(%esp), %edx
-	movl	12(%esp), %esi
-	movl	16(%esp), %ecx
-	rep
-	outsl
-	popl	%esi
-	ret
-END(outsl)

Index: src/sys/arch/x86/include/pio.h
diff -u src/sys/arch/x86/include/pio.h:1.9 src/sys/arch/x86/include/pio.h:1.10
--- src/sys/arch/x86/include/pio.h:1.9	Sun May 22 16:01:43 2011
+++ src/sys/arch/x86/include/pio.h	Fri Nov 15 09:03:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pio.h,v 1.9 2011/05/22 16:01:43 christos Exp $	*/
+/*	$NetBSD: pio.h,v 1.10 2019/11/15 09:03:26 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,17 +37,11 @@
  */
 
 uint8_t		inb(unsigned);
-void		insb(unsigned, void *, int);
 uint16_t	inw(unsigned);
-void		insw(unsigned, void *, int);
 uint32_t	inl(unsigned);
-void		insl(unsigned, void *, int);
 
 void		outb(unsigned, uint8_t);
-void		outsb(unsigned, void *, int);
 void		outw(unsigned, u

CVS commit: src/sys/arch

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 09:03:26 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S
src/sys/arch/x86/include: pio.h

Log Message:
Remove the ins* and outs* functions. Not sanitizer-friendly, and unused
anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/pio.h

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



CVS commit: src/sys/dev/hyperv

2019-11-15 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 15 08:51:27 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/if_hvn.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.3 src/sys/dev/hyperv/hvkbd.c:1.4
--- src/sys/dev/hyperv/hvkbd.c:1.3	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Nov 15 08:51:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.3 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.3 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $");
 
 #include 
 #include 
@@ -210,11 +210,6 @@ hvkbd_attach(device_t parent, device_t s
 	hvkbd_alloc_keybuf(sc);
 
 	sc->sc_buf = kmem_zalloc(HVKBD_BUFSIZE, KM_SLEEP);
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(self))) {
-		aprint_error_dev(self,
-		"failed to create the interrupt thread\n");
-		goto free_buf;
-	}
 
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 	if (vmbus_channel_open(sc->sc_chan,

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.5 src/sys/dev/hyperv/if_hvn.c:1.6
--- src/sys/dev/hyperv/if_hvn.c:1.5	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/if_hvn.c	Fri Nov 15 08:51:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.5 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.5 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -922,12 +922,6 @@ hvn_nvs_attach(struct hvn_softc *sc)
 
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(sc->sc_dev))) {
-		aprint_error_dev(sc->sc_dev,
-		"failed to create the interrupt thread\n");
-		return -1;
-	}
-
 	/* Associate our interrupt handler with the channel */
 	if (vmbus_channel_open(sc->sc_chan, ringsize, NULL, 0,
 	hvn_nvs_intr, sc)) {



CVS commit: src/sys/dev/hyperv

2019-11-15 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 15 08:51:27 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: src/sys

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 08:11:37 UTC 2019

Modified Files:
src/sys/kern: subr_csan.c
src/sys/sys: systm.h

Log Message:
Instrument copyout() in kCSan, for parity with kMSan.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_csan.c
cvs rdiff -u -r1.289 -r1.290 src/sys/sys/systm.h

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



CVS commit: src/sys

2019-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 15 08:11:37 UTC 2019

Modified Files:
src/sys/kern: subr_csan.c
src/sys/sys: systm.h

Log Message:
Instrument copyout() in kCSan, for parity with kMSan.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_csan.c
cvs rdiff -u -r1.289 -r1.290 src/sys/sys/systm.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_csan.c
diff -u src/sys/kern/subr_csan.c:1.4 src/sys/kern/subr_csan.c:1.5
--- src/sys/kern/subr_csan.c:1.4	Thu Nov 14 16:56:13 2019
+++ src/sys/kern/subr_csan.c	Fri Nov 15 08:11:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_csan.c,v 1.4 2019/11/14 16:56:13 maxv Exp $	*/
+/*	$NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.4 2019/11/14 16:56:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $");
 
 #include 
 #include 
@@ -326,17 +326,20 @@ kcsan_strlen(const char *str)
 #undef copyinstr
 #undef copyoutstr
 #undef copyin
+#undef copyout
 
 int	kcsan_kcopy(const void *, void *, size_t);
 int	kcsan_copystr(const void *, void *, size_t, size_t *);
 int	kcsan_copyinstr(const void *, void *, size_t, size_t *);
 int	kcsan_copyoutstr(const void *, void *, size_t, size_t *);
 int	kcsan_copyin(const void *, void *, size_t);
+int	kcsan_copyout(const void *, void *, size_t);
 int	kcopy(const void *, void *, size_t);
 int	copystr(const void *, void *, size_t, size_t *);
 int	copyinstr(const void *, void *, size_t, size_t *);
 int	copyoutstr(const void *, void *, size_t, size_t *);
 int	copyin(const void *, void *, size_t);
+int	copyout(const void *, void *, size_t);
 
 int
 kcsan_kcopy(const void *src, void *dst, size_t len)
@@ -361,6 +364,13 @@ kcsan_copyin(const void *uaddr, void *ka
 }
 
 int
+kcsan_copyout(const void *kaddr, void *uaddr, size_t len)
+{
+	kcsan_access((uintptr_t)kaddr, len, false, false, __RET_ADDR);
+	return copyout(kaddr, uaddr, len);
+}
+
+int
 kcsan_copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done)
 {
 	kcsan_access((uintptr_t)kaddr, len, true, false, __RET_ADDR);

Index: src/sys/sys/systm.h
diff -u src/sys/sys/systm.h:1.289 src/sys/sys/systm.h:1.290
--- src/sys/sys/systm.h:1.289	Thu Nov 14 16:23:53 2019
+++ src/sys/sys/systm.h	Fri Nov 15 08:11:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: systm.h,v 1.289 2019/11/14 16:23:53 maxv Exp $	*/
+/*	$NetBSD: systm.h,v 1.290 2019/11/15 08:11:36 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -299,11 +299,12 @@ int	kcsan_copystr(const void *, void *, 
 int	kcsan_copyinstr(const void *, void *, size_t, size_t *);
 int	kcsan_copyoutstr(const void *, void *, size_t, size_t *);
 int	kcsan_copyin(const void *, void *, size_t);
-int	copyout(const void *, void *, size_t);
+int	kcsan_copyout(const void *, void *, size_t);
 #define copystr		kcsan_copystr
 #define copyinstr	kcsan_copyinstr
 #define copyoutstr	kcsan_copyoutstr
 #define copyin		kcsan_copyin
+#define copyout		kcsan_copyout
 #elif defined(_KERNEL) && defined(KMSAN)
 int	kmsan_copystr(const void *, void *, size_t, size_t *);
 int	kmsan_copyinstr(const void *, void *, size_t, size_t *);