CVS commit: src/sys/dev

2019-10-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Oct  5 05:28:44 UTC 2019

Modified Files:
src/sys/dev: dksubr.c

Log Message:
Bail when dkdriver hasn't been initialized. This can happen when
attachment failed or when it hasn't finished yet.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/dksubr.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/dksubr.c
diff -u src/sys/dev/dksubr.c:1.109 src/sys/dev/dksubr.c:1.110
--- src/sys/dev/dksubr.c:1.109	Fri Jun 28 14:56:46 2019
+++ src/sys/dev/dksubr.c	Sat Oct  5 05:28:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.109 2019/06/28 14:56:46 jmcneill Exp $ */
+/* $NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.109 2019/06/28 14:56:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $");
 
 #include 
 #include 
@@ -147,6 +147,12 @@ dk_open(struct dk_softc *dksc, dev_t dev
 		goto done;
 	}
 
+	/* If no dkdriver attached, bail */
+	if (dkd == NULL) {
+		ret = ENXIO;
+		goto done;
+	}
+
 	/*
 	 * initialize driver for the first opener
 	 */



CVS commit: src/sys/dev

2019-10-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Oct  5 05:28:44 UTC 2019

Modified Files:
src/sys/dev: dksubr.c

Log Message:
Bail when dkdriver hasn't been initialized. This can happen when
attachment failed or when it hasn't finished yet.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/dksubr.c

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



CVS commit: src/sys/dev/pcmcia

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 01:35:26 UTC 2019

Modified Files:
src/sys/dev/pcmcia: xirc.c

Log Message:
add missing break.

(this code is fun.  it has switch inside switch, and both switches
have two cases, one with an identifier and one with a magic number.)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pcmcia/xirc.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/pcmcia/xirc.c
diff -u src/sys/dev/pcmcia/xirc.c:1.35 src/sys/dev/pcmcia/xirc.c:1.36
--- src/sys/dev/pcmcia/xirc.c:1.35	Sat Dec  8 17:46:14 2018
+++ src/sys/dev/pcmcia/xirc.c	Sat Oct  5 01:35:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xirc.c,v 1.35 2018/12/08 17:46:14 thorpej Exp $	*/
+/*	$NetBSD: xirc.c,v 1.36 2019/10/05 01:35:26 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xirc.c,v 1.35 2018/12/08 17:46:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xirc.c,v 1.36 2019/10/05 01:35:26 mrg Exp $");
 
 #include "opt_inet.h"
 
@@ -694,6 +694,7 @@ xi_xirc_lan_nid_ciscallback(struct pcmci
 myla[i] = pcmcia_tuple_read_1(tuple, i + 3);
 			return (1);
 		}
+		break;
 
 	case 0x89:
 		if (pcmcia_tuple_read_1(tuple, 0) != 0x04 ||



CVS commit: src/sys/dev/pcmcia

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 01:35:26 UTC 2019

Modified Files:
src/sys/dev/pcmcia: xirc.c

Log Message:
add missing break.

(this code is fun.  it has switch inside switch, and both switches
have two cases, one with an identifier and one with a magic number.)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pcmcia/xirc.c

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-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 01:30:29 UTC 2019

Modified Files:
src/sys/dev/pci: esm.c

Log Message:
add missing break.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/pci/esm.c

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-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Oct  5 01:30:29 UTC 2019

Modified Files:
src/sys/dev/pci: esm.c

Log Message:
add missing break.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/pci/esm.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/pci/esm.c
diff -u src/sys/dev/pci/esm.c:1.63 src/sys/dev/pci/esm.c:1.64
--- src/sys/dev/pci/esm.c:1.63	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/esm.c	Sat Oct  5 01:30:28 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: esm.c,v 1.63 2019/06/08 08:02:38 isaki Exp $  */
+/*  $NetBSD: esm.c,v 1.64 2019/10/05 01:30:28 mrg Exp $  */
 
 /*-
  * Copyright (c) 2002, 2003 Matt Fredette
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.63 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.64 2019/10/05 01:30:28 mrg Exp $");
 
 #include 
 #include 
@@ -1482,6 +1482,7 @@ esm_match(device_t dev, cfdata_t match, 
 		case PCI_PRODUCT_ESSTECH_MAESTRO2E:
 			return 1;
 		}
+		break;
 
 	case PCI_VENDOR_ESSTECH2:
 		switch (PCI_PRODUCT(pa->pa_id)) {



CVS commit: src/sys/kern

2019-10-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Oct  4 23:20:22 UTC 2019

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

Log Message:
Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX

This logic (found in Linux) avoids undefined behavior.

Reported-by: syzbot+8af00519a8688d990...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/sysv_msg.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/sysv_msg.c
diff -u src/sys/kern/sysv_msg.c:1.75 src/sys/kern/sysv_msg.c:1.76
--- src/sys/kern/sysv_msg.c:1.75	Wed Aug  7 00:38:02 2019
+++ src/sys/kern/sysv_msg.c	Fri Oct  4 23:20:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_msg.c,v 1.75 2019/08/07 00:38:02 pgoyette Exp $	*/
+/*	$NetBSD: sysv_msg.c,v 1.76 2019/10/04 23:20:22 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.75 2019/08/07 00:38:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.76 2019/10/04 23:20:22 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -1100,6 +1100,7 @@ restart:
  */
 
 if (msgtyp != msghdr->msg_type &&
+msgtyp != LONG_MIN &&
 msghdr->msg_type > -msgtyp)
 	continue;
 



CVS commit: src/sys/kern

2019-10-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Oct  4 23:20:22 UTC 2019

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

Log Message:
Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX

This logic (found in Linux) avoids undefined behavior.

Reported-by: syzbot+8af00519a8688d990...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/sysv_msg.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2019-10-04 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Oct  4 23:06:19 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
For ZFS on NetBSD there are a number of functions called
zfs_netbsd_{create,mknod,link,etc..} that call functions called
zfs_{create,mknod,link,etc..}.  These later functions may return a
error code along with a *vpp that is NULL.  This situation was not
handled by the zfs_netbsd_* functions and would result in a panic in a
number of cases.  The simplest to trigger it was filling up a dataset
or pool resulting in a over quota condition.  An attempt to create
another file, or directory at that point would panic.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2019-10-04 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Oct  4 23:06:19 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
For ZFS on NetBSD there are a number of functions called
zfs_netbsd_{create,mknod,link,etc..} that call functions called
zfs_{create,mknod,link,etc..}.  These later functions may return a
error code along with a *vpp that is NULL.  This situation was not
handled by the zfs_netbsd_* functions and would result in a panic in a
number of cases.  The simplest to trigger it was filling up a dataset
or pool resulting in a over quota condition.  An attempt to create
another file, or directory at that point would panic.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_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/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.52 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.53
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.52	Sat Aug 24 12:59:05 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Fri Oct  4 23:06:19 2019
@@ -5318,7 +5318,8 @@ zfs_netbsd_create(void *v)
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	if (error == 0)
 		VN_KNOTE(dvp, NOTE_WRITE);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }
@@ -5358,7 +5359,8 @@ zfs_netbsd_mknod(void *v)
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	if (error == 0)
 		VN_KNOTE(dvp, NOTE_WRITE);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }
@@ -5428,7 +5430,8 @@ zfs_netbsd_mkdir(void *v)
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
 	if (error == 0)
 		VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }
@@ -5717,7 +5720,8 @@ zfs_netbsd_symlink(void *v)
 		VN_KNOTE(ap->a_dvp, NOTE_WRITE);
 	KASSERT((error == 0) == (*vpp != NULL));
 	KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);
-	VOP_UNLOCK(*vpp, 0);
+	if (*vpp != NULL)
+		VOP_UNLOCK(*vpp, 0);
 
 	return (error);
 }



CVS commit: src/sys/uvm

2019-10-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Oct  4 22:48:46 UTC 2019

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

Log Message:
Avoid left shift changing the signedness flag

Reviewed by 

Reported-by: syzbot+25ac03024cedf27f3...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/uvm/uvm_mmap.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_mmap.c
diff -u src/sys/uvm/uvm_mmap.c:1.173 src/sys/uvm/uvm_mmap.c:1.174
--- src/sys/uvm/uvm_mmap.c:1.173	Tue Aug  6 08:10:27 2019
+++ src/sys/uvm/uvm_mmap.c	Fri Oct  4 22:48:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_mmap.c,v 1.173 2019/08/06 08:10:27 maxv Exp $	*/
+/*	$NetBSD: uvm_mmap.c,v 1.174 2019/10/04 22:48:45 kamil Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.173 2019/08/06 08:10:27 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.174 2019/10/04 22:48:45 kamil Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_pax.h"
@@ -861,7 +861,7 @@ uvm_mmap(struct vm_map *map, vaddr_t *ad
 	if (align) {
 		if (align >= sizeof(vaddr_t) * NBBY)
 			return EINVAL;
-		align = 1L << align;
+		align = 1UL << align;
 		if (align < PAGE_SIZE)
 			return EINVAL;
 		if (align >= vm_map_max(map))



CVS commit: src/sys/uvm

2019-10-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Oct  4 22:48:46 UTC 2019

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

Log Message:
Avoid left shift changing the signedness flag

Reviewed by 

Reported-by: syzbot+25ac03024cedf27f3...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/uvm/uvm_mmap.c

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



CVS commit: src/share/man/man9

2019-10-04 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Fri Oct  4 21:55:00 UTC 2019

Modified Files:
src/share/man/man9: panic.9

Log Message:
panic.9: add xrefs to printf(3) and printf(9)

printf(3) fmt strings are referenced in the body, and there might as
well be a cross-reference to other kernel message output functions.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/share/man/man9/panic.9

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



CVS commit: src/share/man/man9

2019-10-04 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Fri Oct  4 21:55:00 UTC 2019

Modified Files:
src/share/man/man9: panic.9

Log Message:
panic.9: add xrefs to printf(3) and printf(9)

printf(3) fmt strings are referenced in the body, and there might as
well be a cross-reference to other kernel message output functions.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/share/man/man9/panic.9

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

Modified files:

Index: src/share/man/man9/panic.9
diff -u src/share/man/man9/panic.9:1.22 src/share/man/man9/panic.9:1.23
--- src/share/man/man9/panic.9:1.22	Sun Jul 15 05:16:41 2018
+++ src/share/man/man9/panic.9	Fri Oct  4 21:55:00 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: panic.9,v 1.22 2018/07/15 05:16:41 maxv Exp $
+.\" $NetBSD: panic.9,v 1.23 2019/10/04 21:55:00 gutteridge Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 14, 2018
+.Dd October 4, 2019
 .Dt PANIC 9
 .Os
 .Sh NAME
@@ -104,9 +104,11 @@ The
 .Fn panic
 function never returns.
 .Sh SEE ALSO
+.Xr printf 3 ,
 .Xr sysctl 3 ,
 .Xr ddb 4 ,
 .Xr options 4 ,
 .Xr savecore 8 ,
 .Xr swapctl 8 ,
-.Xr sysctl 8
+.Xr sysctl 8 ,
+.Xr printf 9



CVS commit: src/usr.sbin/sysinst

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 21:36:02 UTC 2019

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
add a size_t len to get_iso9660_volname() so it can properly do
bounds checking.

ok martin@


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/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/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.33 src/usr.sbin/sysinst/util.c:1.34
--- src/usr.sbin/sysinst/util.c:1.33	Wed Oct  2 11:16:04 2019
+++ src/usr.sbin/sysinst/util.c	Fri Oct  4 21:36:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.33 2019/10/02 11:16:04 maya Exp $	*/
+/*	$NetBSD: util.c,v 1.34 2019/10/04 21:36:02 mrg Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -171,7 +171,8 @@ int have_raid, have_vnd, have_cgd, have_
  */
 
 static int check_for(unsigned int mode, const char *pathname);
-static int get_iso9660_volname(int dev, int sess, char *volname);
+static int get_iso9660_volname(int dev, int sess, char *volname,
+		size_t volnamelen);
 static int get_available_cds(void);
 static int binary_available(const char *prog);
 
@@ -377,7 +378,7 @@ get_via_floppy(void)
  * Get the volume name of a ISO9660 file system
  */
 static int
-get_iso9660_volname(int dev, int sess, char *volname)
+get_iso9660_volname(int dev, int sess, char *volname, size_t volnamelen)
 {
 	int blkno, error, last;
 	char buf[ISO_BLKSIZE];
@@ -394,8 +395,9 @@ get_iso9660_volname(int dev, int sess, c
 		if (isonum_711((const unsigned char *)>type)
 		 == ISO_VD_PRIMARY) {
 			pd = (struct iso_primary_descriptor*)buf;
-			strncpy(volname, pd->volume_id, sizeof pd->volume_id);
-			last = sizeof pd->volume_id-1;
+			strncpy(volname, pd->volume_id, volnamelen - 1);
+			volname[volnamelen - 1] = '\0';
+			last = volnamelen - 1;
 			while (last >= 0
 			&& (volname[last] == ' ' || volname[last] == 0))
 last--;
@@ -456,7 +458,8 @@ get_available_cds_helper(void *arg, cons
 			dev = open(dname, O_RDONLY, 0);
 			if (dev == -1)
 continue;
-			error = get_iso9660_volname(dev, sess, volname);
+			error = get_iso9660_volname(dev, sess, volname,
+			sizeof volname);
 			close(dev);
 			if (error)
 continue;



CVS commit: src/usr.sbin/sysinst

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 21:36:02 UTC 2019

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
add a size_t len to get_iso9660_volname() so it can properly do
bounds checking.

ok martin@


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/util.c

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



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

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 21:33:58 UTC 2019

Modified Files:
src/usr.sbin/sup/source: scan.c supcmain.c supcmisc.c supcname.c
supcparse.c supfilesrv.c supscan.c

Log Message:
convert most sprintf() to snprintf().


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sup/source/scan.c
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sup/source/supcmain.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sup/source/supcmisc.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sup/source/supcname.c
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sup/source/supcparse.c
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/sup/source/supfilesrv.c
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sup/source/supscan.c

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



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

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 21:33:58 UTC 2019

Modified Files:
src/usr.sbin/sup/source: scan.c supcmain.c supcmisc.c supcname.c
supcparse.c supfilesrv.c supscan.c

Log Message:
convert most sprintf() to snprintf().


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sup/source/scan.c
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sup/source/supcmain.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sup/source/supcmisc.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sup/source/supcname.c
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sup/source/supcparse.c
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/sup/source/supfilesrv.c
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sup/source/supscan.c

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

Modified files:

Index: src/usr.sbin/sup/source/scan.c
diff -u src/usr.sbin/sup/source/scan.c:1.32 src/usr.sbin/sup/source/scan.c:1.33
--- src/usr.sbin/sup/source/scan.c:1.32	Sat Mar 12 02:26:40 2016
+++ src/usr.sbin/sup/source/scan.c	Fri Oct  4 21:33:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: scan.c,v 1.32 2016/03/12 02:26:40 dholland Exp $	*/
+/*	$NetBSD: scan.c,v 1.33 2019/10/04 21:33:57 mrg Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -279,7 +279,7 @@ getrelease(char *release)
 		frelease = release = estrdup(DEFRELEASE);
 	listTL = NULL;
 
-	(void) sprintf(buf, FILERELEASES, collname);
+	snprintf(buf, sizeof buf, FILERELEASES, collname);
 	f = fopen(buf, "r");
 	if (f != NULL) {
 		rewound = TRUE;
@@ -350,7 +350,7 @@ makescanlists(void)
 	char *saveprefix = prefix;
 	int count = 0;
 
-	(void) sprintf(buf, FILERELEASES, collname);
+	snprintf(buf, sizeof buf, FILERELEASES, collname);
 	f = fopen(buf, "r");
 	if (f != NULL) {
 		while ((p = fgets(buf, sizeof(buf), f)) != NULL) {
@@ -451,7 +451,7 @@ doscan(char *listfile)
 	rsymT = NULL;
 	if (listfile == NULL)
 		listfile = FILELISTDEF;
-	(void) sprintf(buf, FILELIST, collname, listfile);
+	snprintf(buf, sizeof buf, FILELIST, collname, listfile);
 	readlistfile(buf);	/* get contents of list file */
 	(void) Tprocess(upgT, listone, NULL);	/* build list of files
 		 * specified */
@@ -577,7 +577,7 @@ expTinsert(char *p, TREE ** t, int flags
 		newt = Tinsert(t, speclist[i], TRUE);
 		newt->Tflags |= flags;
 		if (exec) {
-			(void) sprintf(buf, exec, speclist[i]);
+			snprintf(buf, sizeof buf, exec, speclist[i]);
 			(void) Tinsert(>Texec, buf, FALSE);
 		}
 		free(speclist[i]);
@@ -724,7 +724,7 @@ listdir(char *name, int always)
 		if (strcmp(dentry->d_name, "..") == 0)
 			continue;
 		if (*newname) {
-			(void)snprintf(filename, sizeof(filename), "%s/%s",
+			snprintf(filename, sizeof(filename), "%s/%s",
 			newname, dentry->d_name);
 		} else {
 			(void)strncpy(filename, dentry->d_name,
@@ -829,7 +829,7 @@ getscanfile(char *scanfile)
 
 	if (scanfile == NULL)
 		scanfile = FILESCANDEF;
-	(void) sprintf(buf, FILESCAN, collname, scanfile);
+	snprintf(buf, sizeof buf, FILESCAN, collname, scanfile);
 	if (stat(buf, ) < 0)
 		return (FALSE);
 	if ((f = fopen(buf, "r")) == NULL)
@@ -930,8 +930,8 @@ chkscanfile(char *scanfile)
 
 	if (scanfile == NULL)
 		scanfile = FILESCANDEF;
-	(void) sprintf(fname, FILESCAN, collname, scanfile);
-	(void) sprintf(tname, "%s.temp", fname);
+	snprintf(fname, sizeof fname, FILESCAN, collname, scanfile);
+	snprintf(tname, sizeof tname,  "%s.temp", fname);
 	if (NULL == (f = fopen(tname, "w")))
 		goaway("Can't test scan file temp %s for %s", tname, collname);
 	else {
@@ -949,8 +949,8 @@ makescanfile(char *scanfile)
 
 	if (scanfile == NULL)
 		scanfile = FILESCANDEF;
-	(void) sprintf(fname, FILESCAN, collname, scanfile);
-	(void) sprintf(tname, "%s.temp", fname);
+	snprintf(fname, sizeof fname, FILESCAN, collname, scanfile);
+	snprintf(tname, sizeof tname, "%s.temp", fname);
 	scanF = fopen(tname, "w");
 	if (scanF == NULL)
 		goto out;

Index: src/usr.sbin/sup/source/supcmain.c
diff -u src/usr.sbin/sup/source/supcmain.c:1.34 src/usr.sbin/sup/source/supcmain.c:1.35
--- src/usr.sbin/sup/source/supcmain.c:1.34	Thu May  4 16:26:10 2017
+++ src/usr.sbin/sup/source/supcmain.c	Fri Oct  4 21:33:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: supcmain.c,v 1.34 2017/05/04 16:26:10 sevan Exp $	*/
+/*	$NetBSD: supcmain.c,v 1.35 2019/10/04 21:33:57 mrg Exp $	*/
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -718,7 +718,7 @@ init(int argc, char **argv)
 c->Cnotify = estrdup(username);
 		}
 		if (c->Cbase == NULL) {
-			(void) sprintf(buf, FILEBASEDEFAULT, c->Cname);
+			snprintf(buf, sizeof buf, FILEBASEDEFAULT, c->Cname);
 			c->Cbase = estrdup(buf);
 		}
 	}
@@ -737,7 +737,7 @@ init(int argc, char **argv)
 	else if (sysflag)
 		p = "system software";
 	else
-		(void) sprintf(p = buf, "file %s", supfname);
+		snprintf(p = buf, sizeof buf, "file %s", supfname);
 	if (!silent)
 		loginfo("SUP %d.%d (%s) for %s at %s", PROTOVERSION, PGMVERSION,
 		scmversion, p, 

CVS commit: src/usr.bin/flock

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 16:27:00 UTC 2019

Modified Files:
src/usr.bin/flock: flock.c

Log Message:
fix a bug gcc 8 picked up: use ~LOCK_NB to look for LOCK_UN,
like the rest of the code does.

from uwe@.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/flock/flock.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/flock/flock.c
diff -u src/usr.bin/flock/flock.c:1.11 src/usr.bin/flock/flock.c:1.12
--- src/usr.bin/flock/flock.c:1.11	Mon Aug 18 09:16:35 2014
+++ src/usr.bin/flock/flock.c	Fri Oct  4 16:27:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: flock.c,v 1.11 2014/08/18 09:16:35 christos Exp $	*/
+/*	$NetBSD: flock.c,v 1.12 2019/10/04 16:27:00 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: flock.c,v 1.11 2014/08/18 09:16:35 christos Exp $");
+__RCSID("$NetBSD: flock.c,v 1.12 2019/10/04 16:27:00 mrg Exp $");
 
 #include 
 #include 
@@ -231,7 +231,7 @@ main(int argc, char *argv[])
 		break;
 
 	default:
-		if ((lock & LOCK_NB) == LOCK_UN)
+		if ((lock & ~LOCK_NB) == LOCK_UN)
 			usage("Unlock is only valid for descriptors");
 		if (strcmp(argv[1], "-c") == 0 ||
 		strcmp(argv[1], "--command") == 0) {



CVS commit: src/usr.bin/flock

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 16:27:00 UTC 2019

Modified Files:
src/usr.bin/flock: flock.c

Log Message:
fix a bug gcc 8 picked up: use ~LOCK_NB to look for LOCK_UN,
like the rest of the code does.

from uwe@.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/flock/flock.c

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



CVS commit: src/usr.bin/flock

2019-10-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct  4 16:14:05 UTC 2019

Modified Files:
src/usr.bin/flock: flock.1

Log Message:
Undo the confusion.  Use separate synopsis lines for -c command with
single argument (sh -c) and command [args ...] forms.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/flock/flock.1

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/flock/flock.1
diff -u src/usr.bin/flock/flock.1:1.12 src/usr.bin/flock/flock.1:1.13
--- src/usr.bin/flock/flock.1:1.12	Fri Oct  4 15:30:16 2019
+++ src/usr.bin/flock/flock.1	Fri Oct  4 16:14:05 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: flock.1,v 1.12 2019/10/04 15:30:16 uwe Exp $
+.\"	$NetBSD: flock.1,v 1.13 2019/10/04 16:14:05 uwe Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,33 +28,48 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd August 18, 2014
+.Dd October 4, 2019
 .Dt FLOCK 1
 .Os
 .Sh NAME
 .Nm flock
 .Nd Provide locking API for shell scripts
 .Sh SYNOPSIS
+.\"
+.Nm
+.Op Fl dnosvx
+.Op Fl w Ar timeout
+.Ar file Ns \^|\^ Ns Ar directory
+.Ar command
+.Op Ar args No ...
+.\"
 .Nm
 .Op Fl dnosvx
 .Op Fl w Ar timeout
-.Ar lockfile|lockdir
-.Oo Fl c Oc Ar command ...
+.Ar file Ns \^|\^ Ns Ar directory
+.Fl c Ar command
+.\"
 .Nm
 .Op Fl dnsuvx
 .Op Fl w Ar timeout
-.Ar lockfd
+.Ar number
 .Sh DESCRIPTION
 The
 .Nm
 utility provides
 .Xr flock 2
 access to the command line or scripts.
-The first form locks a file or directory while the command provided is executed.
-If the file or directory does not exist, then a file is created.
+The first two forms lock the specified
+.Ar file
+or
+.Ar directory
+while the provided command is executed.
+If the path does not exist, then a file of that name is created with
+mode 0600.
 .Pp
-The second form can use an arbitrary file descriptor that is provided from a
-shell script for example:
+The third form can use an arbitrary file descriptor
+.Ar number
+that is provided from a shell script for example:
 .Bd -literal -offset indent
 (
 	flock -s 100



CVS commit: src/usr.bin/flock

2019-10-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct  4 16:14:05 UTC 2019

Modified Files:
src/usr.bin/flock: flock.1

Log Message:
Undo the confusion.  Use separate synopsis lines for -c command with
single argument (sh -c) and command [args ...] forms.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/flock/flock.1

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



CVS commit: src/usr.bin/flock

2019-10-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct  4 15:30:16 UTC 2019

Modified Files:
src/usr.bin/flock: flock.1

Log Message:
The command is not optional.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/flock/flock.1

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



CVS commit: src/usr.bin/flock

2019-10-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct  4 15:30:16 UTC 2019

Modified Files:
src/usr.bin/flock: flock.1

Log Message:
The command is not optional.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/flock/flock.1

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/flock/flock.1
diff -u src/usr.bin/flock/flock.1:1.11 src/usr.bin/flock/flock.1:1.12
--- src/usr.bin/flock/flock.1:1.11	Fri Oct  4 11:49:48 2019
+++ src/usr.bin/flock/flock.1	Fri Oct  4 15:30:16 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: flock.1,v 1.11 2019/10/04 11:49:48 uwe Exp $
+.\"	$NetBSD: flock.1,v 1.12 2019/10/04 15:30:16 uwe Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -39,7 +39,7 @@
 .Op Fl dnosvx
 .Op Fl w Ar timeout
 .Ar lockfile|lockdir
-.Op Oo Fl c Oc Ar command ...
+.Oo Fl c Oc Ar command ...
 .Nm
 .Op Fl dnsuvx
 .Op Fl w Ar timeout



CVS commit: src/sys/arch/i386/i386

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 15:28:00 UTC 2019

Modified Files:
src/sys/arch/i386/i386: i386_trap.S locore.S spl.S

Log Message:
Misc reordering, to clarify and reduce the diff against amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/i386/spl.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/i386/i386

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 15:28:00 UTC 2019

Modified Files:
src/sys/arch/i386/i386: i386_trap.S locore.S spl.S

Log Message:
Misc reordering, to clarify and reduce the diff against amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/i386/spl.S

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

Modified files:

Index: src/sys/arch/i386/i386/i386_trap.S
diff -u src/sys/arch/i386/i386/i386_trap.S:1.18 src/sys/arch/i386/i386/i386_trap.S:1.19
--- src/sys/arch/i386/i386/i386_trap.S:1.18	Mon Feb 11 17:28:52 2019
+++ src/sys/arch/i386/i386/i386_trap.S	Fri Oct  4 15:28:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap.S,v 1.18 2019/02/11 17:28:52 cherry Exp $	*/
+/*	$NetBSD: i386_trap.S,v 1.19 2019/10/04 15:28:00 maxv Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.18 2019/02/11 17:28:52 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.19 2019/10/04 15:28:00 maxv Exp $");
 #endif
 
 /*
@@ -220,7 +220,7 @@ IDTVEC(trap07)
 	pushl	%esp
 	call	_C_LABEL(fpudna)
 	addl	$4,%esp
-	jmp	_C_LABEL(trapreturn)
+	jmp	.Lalltraps_checkusr
 IDTVEC_END(trap07)
 
 IDTVEC(trap08)
@@ -282,7 +282,7 @@ IDTVEC(trap0f)
 #ifdef DIAGNOSTIC
 	movl	CPUVAR(ILEVEL),%ebx
 #endif
-	jmp	_C_LABEL(trapreturn)
+	jmp	.Lalltraps_checkusr
 IDTVEC_END(trap0f)
 IDTVEC_END(intrspurious)
 
@@ -302,7 +302,7 @@ IDTVEC(trap10)
 	adcl	$0,CPUVAR(NTRAP)+4
 	call	_C_LABEL(fputrap)
 	addl	$4,%esp
-	jmp	_C_LABEL(trapreturn)
+	jmp	.Lalltraps_checkusr
 IDTVEC_END(trap10)
 
 IDTVEC(trap11)
@@ -394,13 +394,14 @@ IDTVEC_END(tss_trap08)
 	.type	_C_LABEL(trap_return_fault_return),@function
 LABEL(trap_return_fault_return)
 	mov	4(%esp),%esp	/* frame for user return */
-	jmp	_C_LABEL(trapreturn)
+	jmp	.Lalltraps_checkusr
 END(trap_return_fault_return)
 
 /* LINTSTUB: Ignore */
 ENTRY(alltraps)
 	INTRENTRY
 	STI(%eax)
+
 calltrap:
 #ifdef DIAGNOSTIC
 	movl	CPUVAR(ILEVEL),%ebx
@@ -410,16 +411,18 @@ calltrap:
 	pushl	%esp
 	call	_C_LABEL(trap)
 	addl	$4,%esp
-_C_LABEL(trapreturn):	.globl	trapreturn
+
+.Lalltraps_checkusr:
 	testb	$CHK_UPL,TF_CS(%esp)
 	jnz	.Lalltraps_checkast
 	jmp	6f
+
 .Lalltraps_checkast:
 	/* Check for ASTs on exit to user mode. */
 	CLI(%eax)
 	CHECK_ASTPENDING(%eax)
 	jz	3f
-5:	CLEAR_ASTPENDING(%eax)
+	CLEAR_ASTPENDING(%eax)
 	STI(%eax)
 	movl	$T_ASTFLT,TF_TRAPNO(%esp)
 	addl	$1,CPUVAR(NTRAP)	/* statistical info */
@@ -430,6 +433,7 @@ _C_LABEL(trapreturn):	.globl	trapreturn
 	jmp	.Lalltraps_checkast	/* re-check ASTs */
 3:	CHECK_DEFERRED_SWITCH
 	jnz	9f
+
 #ifdef XEN
 	STIC(%eax)
 	jz	6f
@@ -450,15 +454,23 @@ _C_LABEL(trapreturn):	.globl	trapreturn
 	movl	CPUVAR(XSOURCES)(,%eax,4),%eax
 	jmp	*IS_RESUME(%eax)
 7:	movl	%ebx,CPUVAR(ILEVEL)	/* restore cpl */
-	jmp	_C_LABEL(trapreturn)
-#endif /* XEN */
-#ifndef DIAGNOSTIC
-6:	INTRFASTEXIT
-#else
-6:	cmpl	CPUVAR(ILEVEL),%ebx
-	jne	3f
+	jmp	.Lalltraps_checkusr
+#endif
+
+6:
+#ifdef DIAGNOSTIC
+	cmpl	CPUVAR(ILEVEL),%ebx
+	jne	.Lspl_error
+#endif
 	INTRFASTEXIT
-3:	STI(%eax)
+
+9:	STI(%eax)
+	call	_C_LABEL(pmap_load)
+	jmp	.Lalltraps_checkast	/* re-check ASTs */
+
+#ifdef DIAGNOSTIC
+.Lspl_error:
+	STI(%eax)
 	pushl	$4f
 	call	_C_LABEL(panic)
 	addl	$4,%esp
@@ -467,8 +479,5 @@ _C_LABEL(trapreturn):	.globl	trapreturn
 	addl	$4,%esp
 	jmp	.Lalltraps_checkast	/* re-check ASTs */
 4:	.asciz	"SPL NOT LOWERED ON TRAP EXIT\n"
-#endif /* DIAGNOSTIC */
-9:	STI(%eax)
-	call	_C_LABEL(pmap_load)
-	jmp	.Lalltraps_checkast	/* re-check ASTs */
+#endif
 END(alltraps)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.170 src/sys/arch/i386/i386/locore.S:1.171
--- src/sys/arch/i386/i386/locore.S:1.170	Fri Oct  4 11:47:07 2019
+++ src/sys/arch/i386/i386/locore.S	Fri Oct  4 15:28:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.170 2019/10/04 11:47:07 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.171 2019/10/04 15:28:00 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.170 2019/10/04 11:47:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.171 2019/10/04 15:28:00 maxv Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -1264,6 +1264,7 @@ IDTVEC(syscall)
 	pushl	$T_ASTFLT	/* trap # for doing ASTs */
 	INTRENTRY
 	STI(%eax)
+
 #ifdef DIAGNOSTIC
 	movl	CPUVAR(ILEVEL),%ebx
 	testl	%ebx,%ebx
@@ -1276,6 +1277,7 @@ IDTVEC(syscall)
 #endif
 1:
 #endif /* DIAGNOSTIC */
+
 	addl	$1,CPUVAR(NSYSCALL)	/* count it atomically */
 	adcl	$0,CPUVAR(NSYSCALL)+4	/* count it atomically */
 	movl	CPUVAR(CURLWP),%edi
@@ -1290,6 +1292,7 @@ IDTVEC(syscall)
 	movl	L_MD_ASTPENDING(%edi), %eax
 	orl	CPUVAR(WANT_PMAPLOAD), %eax
 	jnz	9f
+
 #ifdef XEN
 	STIC(%eax)
 	jz	14f

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

2019-10-04 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Oct  4 15:25:31 UTC 2019

Modified Files:
src/sys/arch/sh3/include: ptrace.h

Log Message:
Provide PTRACE_ILLEGAL_ASM, using an illegal slot instruction


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/ptrace.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/sh3/include/ptrace.h
diff -u src/sys/arch/sh3/include/ptrace.h:1.15 src/sys/arch/sh3/include/ptrace.h:1.16
--- src/sys/arch/sh3/include/ptrace.h:1.15	Tue Jun 18 21:18:13 2019
+++ src/sys/arch/sh3/include/ptrace.h	Fri Oct  4 15:25:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.15 2019/06/18 21:18:13 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.16 2019/10/04 15:25:30 maya Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -72,6 +72,8 @@
 #define PTRACE_REG_SP(r)	r->r_r15
 #define PTRACE_REG_INTV(r)	r->r_r0
 
+#define PTRACE_ILLEGAL_ASM	__asm __volatile ("0: bra 0b; bra 0b" : : : "memory")
+
 #define PTRACE_BREAKPOINT_TRAP	0xc3
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xc3, 0xc3 })
 #define PTRACE_BREAKPOINT_ASM	__asm __volatile("trapa %0" :: "i"(PTRACE_BREAKPOINT_TRAP))



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

2019-10-04 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Oct  4 15:25:31 UTC 2019

Modified Files:
src/sys/arch/sh3/include: ptrace.h

Log Message:
Provide PTRACE_ILLEGAL_ASM, using an illegal slot instruction


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/ptrace.h

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-10-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Oct  4 14:17:08 UTC 2019

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

Log Message:
Avoid signed integer overflow in ts2timo() for ts->tv_nsec

The condition would be rechecked later again after subtracting start time
and most invalid inputs rejected. In corner cases the current code can
accept certain invalid inputs that will pass checks later and behave like
valid ones (due to signed integer overflow).

Reported-by: syzbot+3a4a07b62558bbbd3...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_time.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_time.c
diff -u src/sys/kern/subr_time.c:1.20 src/sys/kern/subr_time.c:1.21
--- src/sys/kern/subr_time.c:1.20	Fri Dec  8 01:19:29 2017
+++ src/sys/kern/subr_time.c	Fri Oct  4 14:17:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_time.c,v 1.20 2017/12/08 01:19:29 christos Exp $	*/
+/*	$NetBSD: subr_time.c,v 1.21 2019/10/04 14:17:07 kamil Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.20 2017/12/08 01:19:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.21 2019/10/04 14:17:07 kamil Exp $");
 
 #include 
 #include 
@@ -329,6 +329,9 @@ ts2timo(clockid_t clock_id, int flags, s
 	int error;
 	struct timespec tsd;
 
+	if (ts->tv_nsec < 0 || ts->tv_nsec >= 10L)
+		return EINVAL;
+
 	flags &= TIMER_ABSTIME;
 	if (start == NULL)
 		start = 



CVS commit: src/sys/kern

2019-10-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Oct  4 14:17:08 UTC 2019

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

Log Message:
Avoid signed integer overflow in ts2timo() for ts->tv_nsec

The condition would be rechecked later again after subtracting start time
and most invalid inputs rejected. In corner cases the current code can
accept certain invalid inputs that will pass checks later and behave like
valid ones (due to signed integer overflow).

Reported-by: syzbot+3a4a07b62558bbbd3...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_time.c

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



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

2019-10-04 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Oct  4 12:46:43 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/gcc: ira-color.c

Log Message:
We might've switched modes, re-init the move cost table again if necessary.

Fixes unlikely segfault on VAX.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc/dist/gcc/ira-color.c

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



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

2019-10-04 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Oct  4 12:46:43 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/gcc: ira-color.c

Log Message:
We might've switched modes, re-init the move cost table again if necessary.

Fixes unlikely segfault on VAX.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc/dist/gcc/ira-color.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/ira-color.c
diff -u src/external/gpl3/gcc/dist/gcc/ira-color.c:1.6 src/external/gpl3/gcc/dist/gcc/ira-color.c:1.7
--- src/external/gpl3/gcc/dist/gcc/ira-color.c:1.6	Tue Oct  1 10:38:16 2019
+++ src/external/gpl3/gcc/dist/gcc/ira-color.c	Fri Oct  4 12:46:43 2019
@@ -1377,6 +1377,7 @@ update_costs_from_allocno (ira_allocno_t
 	 e.g. DImode for AREG on x86.  For such cases the
 	 register move cost will be maximal.  */
 	  mode = narrower_subreg_mode (mode, ALLOCNO_MODE (cp->second));
+	  ira_init_register_move_cost_if_necessary (mode);
 	  
 	  cost = (cp->second == allocno
 		  ? ira_register_move_cost[mode][rclass][aclass]



CVS commit: src/sys/fs/tmpfs

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:34:40 UTC 2019

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

Log Message:
remove an always false check and its' "This can never happen?" comment.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/tmpfs/tmpfs_vfsops.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_vfsops.c
diff -u src/sys/fs/tmpfs/tmpfs_vfsops.c:1.74 src/sys/fs/tmpfs/tmpfs_vfsops.c:1.75
--- src/sys/fs/tmpfs/tmpfs_vfsops.c:1.74	Tue Jan  1 10:06:54 2019
+++ src/sys/fs/tmpfs/tmpfs_vfsops.c	Fri Oct  4 12:34:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vfsops.c,v 1.74 2019/01/01 10:06:54 hannken Exp $	*/
+/*	$NetBSD: tmpfs_vfsops.c,v 1.75 2019/10/04 12:34:40 mrg Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.74 2019/01/01 10:06:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.75 2019/10/04 12:34:40 mrg Exp $");
 
 #include 
 #include 
@@ -132,10 +132,6 @@ tmpfs_mount(struct mount *mp, const char
 	if (args->ta_root_uid == VNOVAL || args->ta_root_gid == VNOVAL)
 		return EINVAL;
 
-	/* This can never happen? */
-	if ((args->ta_root_mode & ALLPERMS) == VNOVAL)
-		return EINVAL;
-
 	/* Get the memory usage limit for this file-system. */
 	if (args->ta_size_max < PAGE_SIZE) {
 		memlimit = UINT64_MAX;



CVS commit: src/sys/fs/tmpfs

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:34:40 UTC 2019

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

Log Message:
remove an always false check and its' "This can never happen?" comment.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/tmpfs/tmpfs_vfsops.c

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/dist/drm/radeon

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:29:05 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_evergreen.c

Log Message:
add missing break.  upstream already has it in 5.1.2.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c:1.2	Sat Aug 17 15:49:13 2019
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c	Fri Oct  4 12:29:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_evergreen.c,v 1.2 2019/08/17 15:49:13 msaitoh Exp $	*/
+/*	$NetBSD: radeon_evergreen.c,v 1.3 2019/10/04 12:29:05 mrg Exp $	*/
 
 /*
  * Copyright 2010 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  * Authors: Alex Deucher
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_evergreen.c,v 1.2 2019/08/17 15:49:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_evergreen.c,v 1.3 2019/10/04 12:29:05 mrg Exp $");
 
 #include 
 #include 
@@ -5468,6 +5468,7 @@ restart_ih:
 DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data);
 break;
 			}
+			break;
 		case 96:
 			DRM_ERROR("SRBM_READ_ERROR: 0x%x\n", RREG32(SRBM_READ_ERROR));
 			WREG32(SRBM_INT_ACK, 0x1);



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

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:29:05 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_evergreen.c

Log Message:
add missing break.  upstream already has it in 5.1.2.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c

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



CVS commit: src/sys/dev/ata

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:24:32 UTC 2019

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

Log Message:
use memmove() not memcpy() for overlapping regions.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ata/ata_raid_intel.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_raid_intel.c
diff -u src/sys/dev/ata/ata_raid_intel.c:1.9 src/sys/dev/ata/ata_raid_intel.c:1.10
--- src/sys/dev/ata/ata_raid_intel.c:1.9	Mon Oct 22 19:38:06 2018
+++ src/sys/dev/ata/ata_raid_intel.c	Fri Oct  4 12:24:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid_intel.c,v 1.9 2018/10/22 19:38:06 jdolecek Exp $	*/
+/*	$NetBSD: ata_raid_intel.c,v 1.10 2019/10/04 12:24:32 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2000-2008 Søren Schmidt 
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.9 2018/10/22 19:38:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.10 2019/10/04 12:24:32 mrg Exp $");
 
 #include 
 #include 
@@ -176,7 +176,7 @@ ata_raid_read_config_intel(struct wd_sof
 
 	tmp = (char *)info;
 	(void)memcpy(tmp + 1024, tmp, 512);
-	(void)memcpy(tmp, tmp + 512, 1024);
+	(void)memmove(tmp, tmp + 512, 1024);
 	(void)memset(tmp + 1024, 0, 512);
 
 	/* Check if this is a Intel RAID struct */



CVS commit: src/sys/compat/sunos

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:24:12 UTC 2019

Modified Files:
src/sys/compat/sunos: sunos_misc.c

Log Message:
replace memcpy() with src bounds overflow with single char write.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/compat/sunos/sunos_misc.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/compat/sunos/sunos_misc.c
diff -u src/sys/compat/sunos/sunos_misc.c:1.174 src/sys/compat/sunos/sunos_misc.c:1.175
--- src/sys/compat/sunos/sunos_misc.c:1.174	Mon Sep 23 21:07:50 2019
+++ src/sys/compat/sunos/sunos_misc.c	Fri Oct  4 12:24:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunos_misc.c,v 1.174 2019/09/23 21:07:50 christos Exp $	*/
+/*	$NetBSD: sunos_misc.c,v 1.175 2019/10/04 12:24:12 mrg Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.174 2019/09/23 21:07:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.175 2019/10/04 12:24:12 mrg Exp $");
 
 #include 
 #include 
@@ -657,7 +657,7 @@ sunos_sys_uname(struct lwp *l, const str
 	memcpy(sut.nodename, hostname, sizeof(sut.nodename));
 	sut.nodename[sizeof(sut.nodename)-1] = '\0';
 	memcpy(sut.release, osrelease, sizeof(sut.release) - 1);
-	memcpy(sut.version, "1", sizeof(sut.version) - 1);
+	sut.version[0] = '1';
 	memcpy(sut.machine, machine, sizeof(sut.machine) - 1);
 
 	return copyout((void *), (void *)SCARG(uap, name),



CVS commit: src/sys/compat/sunos

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:24:12 UTC 2019

Modified Files:
src/sys/compat/sunos: sunos_misc.c

Log Message:
replace memcpy() with src bounds overflow with single char write.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/compat/sunos/sunos_misc.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/x86/pci

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:23:37 UTC 2019

Modified Files:
src/sys/arch/x86/pci: pcib.c

Log Message:
add missing break.

surely it is not intended to treat viatech devices with
non VT82C686A's device id as maybe cyrix pci bridges.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pcib.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/x86/pci

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:23:37 UTC 2019

Modified Files:
src/sys/arch/x86/pci: pcib.c

Log Message:
add missing break.

surely it is not intended to treat viatech devices with
non VT82C686A's device id as maybe cyrix pci bridges.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/pci/pcib.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/pci/pcib.c
diff -u src/sys/arch/x86/pci/pcib.c:1.18 src/sys/arch/x86/pci/pcib.c:1.19
--- src/sys/arch/x86/pci/pcib.c:1.18	Mon Jun 17 06:38:29 2019
+++ src/sys/arch/x86/pci/pcib.c	Fri Oct  4 12:23:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcib.c,v 1.18 2019/06/17 06:38:29 msaitoh Exp $	*/
+/*	$NetBSD: pcib.c,v 1.19 2019/10/04 12:23:37 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.18 2019/06/17 06:38:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.19 2019/10/04 12:23:37 mrg Exp $");
 
 #include 
 #include 
@@ -150,6 +150,7 @@ pcibmatch(device_t parent, cfdata_t matc
 			 */
 			return (0);
 		}
+		break;
 	/*
 	 * The Cyrix cs5530 PCI host bridge does not have a broken
 	 * latch on the i8254 clock core, unlike its predecessors



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

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 12:17:05 UTC 2019

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

Log Message:
Switch to the new PTE naming.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c

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



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

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 12:17:05 UTC 2019

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

Log Message:
Switch to the new PTE naming.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c

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

Modified files:

Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.48 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.49
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.48	Fri Oct  4 12:15:21 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Fri Oct  4 12:17:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.48 2019/10/04 12:15:21 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.49 2019/10/04 12:17:05 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.48 2019/10/04 12:15:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.49 2019/10/04 12:17:05 maxv Exp $");
 
 #include 
 #include 
@@ -2131,7 +2131,7 @@ svm_tlb_flush(struct pmap *pm)
 	atomic_inc_64(>mach_htlb_gen);
 
 	/* Generates IPIs, which cause #VMEXITs. */
-	pmap_tlb_shootdown(pmap_kernel(), -1, PG_G, TLBSHOOT_UPDATE);
+	pmap_tlb_shootdown(pmap_kernel(), -1, PTE_G, TLBSHOOT_UPDATE);
 }
 
 static void

Index: src/sys/dev/nvmm/x86/nvmm_x86_vmx.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.37 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.38
--- src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.37	Fri Sep 13 14:19:13 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Fri Oct  4 12:17:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_vmx.c,v 1.37 2019/09/13 14:19:13 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.38 2019/10/04 12:17:05 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.37 2019/09/13 14:19:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.38 2019/10/04 12:17:05 maxv Exp $");
 
 #include 
 #include 
@@ -2749,7 +2749,7 @@ vmx_tlb_flush(struct pmap *pm)
 	atomic_inc_64(>mach_htlb_gen);
 
 	/* Generates IPIs, which cause #VMEXITs. */
-	pmap_tlb_shootdown(pmap_kernel(), -1, PG_G, TLBSHOOT_UPDATE);
+	pmap_tlb_shootdown(pmap_kernel(), -1, PTE_G, TLBSHOOT_UPDATE);
 }
 
 static void



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

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 12:15:21 UTC 2019

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

Log Message:
Fix definition for MWAIT. It should be bit 11, not 12; 12 is the armed
version.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/nvmm/x86/nvmm_x86_svm.c

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



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

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:12:47 UTC 2019

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
workaround a GCC 8 warning:

- code that will be unreachable on platforms with
  sizeof(double) != sizeof(unsigned long) triggered an valid out
  of bounds warning.  avoid the error by using sizeof ul.
- also assert that the sizes are the same if entering here.

both from kamil@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/misc/ubsan.c

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



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

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:12:47 UTC 2019

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
workaround a GCC 8 warning:

- code that will be unreachable on platforms with
  sizeof(double) != sizeof(unsigned long) triggered an valid out
  of bounds warning.  avoid the error by using sizeof ul.
- also assert that the sizes are the same if entering here.

both from kamil@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/misc/ubsan.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/misc/ubsan.c
diff -u src/common/lib/libc/misc/ubsan.c:1.6 src/common/lib/libc/misc/ubsan.c:1.7
--- src/common/lib/libc/misc/ubsan.c:1.6	Mon Jun 17 18:55:37 2019
+++ src/common/lib/libc/misc/ubsan.c	Fri Oct  4 12:12:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $	*/
+/*	$NetBSD: ubsan.c,v 1.7 2019/10/04 12:12:47 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,9 +38,9 @@
 
 #include 
 #if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.7 2019/10/04 12:12:47 mrg Exp $");
 #else
-__RCSID("$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.7 2019/10/04 12:12:47 mrg Exp $");
 #endif
 
 #if defined(_KERNEL)
@@ -1403,7 +1403,8 @@ DeserializeFloatInlined(char *pBuffer, s
 
 	switch (zDeserializeTypeWidth(pType)) {
 	case WIDTH_64:
-		memcpy(, , sizeof(double));
+		ASSERT(sizeof(D) == sizeof(ulNumber));
+		memcpy(, , sizeof(ulNumber));
 		snprintf(pBuffer, zBUfferLength, "%g", D);
 		break;
 	case WIDTH_32:



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

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 12:11:38 UTC 2019

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

Log Message:
Add definitions for RDPRU, MCOMMIT, GMET and VTE.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/nvmm/x86/nvmm_x86_svm.c

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

Modified files:

Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.46 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.47
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.46	Sat May 11 07:31:56 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Fri Oct  4 12:11:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.46 2019/05/11 07:31:56 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.47 2019/10/04 12:11:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.46 2019/05/11 07:31:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.47 2019/10/04 12:11:38 maxv Exp $");
 
 #include 
 #include 
@@ -202,6 +202,7 @@ int svm_vmrun(paddr_t, uint64_t *);
 #define VMCB_EXITCODE_MWAIT		0x008B
 #define VMCB_EXITCODE_MWAIT_CONDITIONAL	0x008C
 #define VMCB_EXITCODE_XSETBV		0x008D
+#define VMCB_EXITCODE_RDPRU		0x008E
 #define VMCB_EXITCODE_EFER_WRITE_TRAP	0x008F
 #define VMCB_EXITCODE_CR0_WRITE_TRAP	0x0090
 #define VMCB_EXITCODE_CR1_WRITE_TRAP	0x0091
@@ -219,6 +220,7 @@ int svm_vmrun(paddr_t, uint64_t *);
 #define VMCB_EXITCODE_CR13_WRITE_TRAP	0x009D
 #define VMCB_EXITCODE_CR14_WRITE_TRAP	0x009E
 #define VMCB_EXITCODE_CR15_WRITE_TRAP	0x009F
+#define VMCB_EXITCODE_MCOMMIT		0x00A3
 #define VMCB_EXITCODE_NPF		0x0400
 #define VMCB_EXITCODE_AVIC_INCOMP_IPI	0x0401
 #define VMCB_EXITCODE_AVIC_NOACCEL	0x0402
@@ -287,10 +289,14 @@ struct vmcb_ctrl {
 #define VMCB_CTRL_INTERCEPT_MONITOR	__BIT(10)
 #define VMCB_CTRL_INTERCEPT_MWAIT	__BIT(12)
 #define VMCB_CTRL_INTERCEPT_XSETBV	__BIT(13)
+#define VMCB_CTRL_INTERCEPT_RDPRU	__BIT(14)
 #define VMCB_CTRL_INTERCEPT_EFER_SPEC	__BIT(15)
 #define VMCB_CTRL_INTERCEPT_WCR_SPEC(x)	__BIT(16 + x)
 
-	uint8_t  rsvd1[40];
+	uint32_t intercept_misc3;
+#define VMCB_CTRL_INTERCEPT_MCOMMIT	__BIT(3)
+
+	uint8_t  rsvd1[36];
 	uint16_t pause_filt_thresh;
 	uint16_t pause_filt_cnt;
 	uint64_t iopm_base_pa;
@@ -332,6 +338,8 @@ struct vmcb_ctrl {
 #define VMCB_CTRL_ENABLE_NP		__BIT(0)
 #define VMCB_CTRL_ENABLE_SEV		__BIT(1)
 #define VMCB_CTRL_ENABLE_ES_SEV		__BIT(2)
+#define VMCB_CTRL_ENABLE_GMET		__BIT(3)
+#define VMCB_CTRL_ENABLE_VTE		__BIT(5)
 
 	uint64_t avic;
 #define VMCB_CTRL_AVIC_APIC_BAR		__BITS(51,0)



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

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 12:11:38 UTC 2019

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

Log Message:
Add definitions for RDPRU, MCOMMIT, GMET and VTE.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/nvmm/x86/nvmm_x86_svm.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/acorn32/acorn32

2019-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 12:08:33 UTC 2019

Modified Files:
src/sys/arch/acorn32/acorn32: rpc_machdep.c

Log Message:
undo previous, requested by uwe


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/acorn32/acorn32/rpc_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/acorn32/acorn32/rpc_machdep.c
diff -u src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.95 src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.96
--- src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.95	Thu Oct  3 21:53:58 2019
+++ src/sys/arch/acorn32/acorn32/rpc_machdep.c	Fri Oct  4 08:08:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_machdep.c,v 1.95 2019/10/04 01:53:58 christos Exp $	*/
+/*	$NetBSD: rpc_machdep.c,v 1.96 2019/10/04 12:08:33 christos Exp $	*/
 
 /*
  * Copyright (c) 2000-2002 Reinoud Zandijk.
@@ -55,7 +55,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.95 2019/10/04 01:53:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.96 2019/10/04 12:08:33 christos Exp $");
 
 #include 
 #include 
@@ -518,7 +518,7 @@ initarm(void *cookie)
 #endif
 	for (loop = 0, physmem = 0; loop < bootconfig.dramblocks; ++loop) {
 #ifdef VERBOSE_INIT_ARM
-		printf("%#x + %#0x, type = %#08x\n", bootconfig.dram[loop].address,
+		printf("0x%x + 0x%0x, type = 0x%08x\n", bootconfig.dram[loop].address,
  bootconfig.dram[loop].pages * PAGE_SIZE,
  bootconfig.dram[loop].flags);
 #endif
@@ -626,13 +626,13 @@ initarm(void *cookie)
 
 #ifdef VERBOSE_INIT_ARM
 	printf("Setting up stacks :\n");
-	printf("IRQ stack: p%#08lx v%#08lx\n",
+	printf("IRQ stack: p0x%08lx v0x%08lx\n",
 	irqstack.pv_pa, irqstack.pv_va); 
-	printf("ABT stack: p%#08lx v%#08lx\n",
+	printf("ABT stack: p0x%08lx v0x%08lx\n",
 	abtstack.pv_pa, abtstack.pv_va); 
-	printf("UND stack: p%#08lx v%#08lx\n",
+	printf("UND stack: p0x%08lx v0x%08lx\n",
 	undstack.pv_pa, undstack.pv_va); 
-	printf("SVC stack: p%#08lx v%#08lx\n",
+	printf("SVC stack: p0x%08lx v0x%08lx\n",
 	kernelstack.pv_pa, kernelstack.pv_va); 
 	printf("\n");
 #endif
@@ -656,7 +656,7 @@ initarm(void *cookie)
 	 */
 
 #ifdef VERBOSE_INIT_ARM
-	printf("Creating L1 page table p@%#08x\n", (uint32_t)kernel_l1pt.pv_pa);
+	printf("Creating L1 page table p@0x%08x\n", (uint32_t)kernel_l1pt.pv_pa);
 #endif
 
 	/*



CVS commit: src/sys/arch/acorn32/acorn32

2019-10-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 12:08:33 UTC 2019

Modified Files:
src/sys/arch/acorn32/acorn32: rpc_machdep.c

Log Message:
undo previous, requested by uwe


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/acorn32/acorn32/rpc_machdep.c

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



CVS commit: src/usr.bin/flock

2019-10-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct  4 11:49:48 UTC 2019

Modified Files:
src/usr.bin/flock: flock.1

Log Message:
Tweak formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/flock/flock.1

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



CVS commit: src/usr.bin/flock

2019-10-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct  4 11:49:48 UTC 2019

Modified Files:
src/usr.bin/flock: flock.1

Log Message:
Tweak formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/flock/flock.1

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/flock/flock.1
diff -u src/usr.bin/flock/flock.1:1.10 src/usr.bin/flock/flock.1:1.11
--- src/usr.bin/flock/flock.1:1.10	Mon Aug 18 09:45:52 2014
+++ src/usr.bin/flock/flock.1	Fri Oct  4 11:49:48 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: flock.1,v 1.10 2014/08/18 09:45:52 christos Exp $
+.\"	$NetBSD: flock.1,v 1.11 2019/10/04 11:49:48 uwe Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -39,9 +39,7 @@
 .Op Fl dnosvx
 .Op Fl w Ar timeout
 .Ar lockfile|lockdir
-.Op Fl c Ar command
-|
-.Op Ar command ...
+.Op Oo Fl c Oc Ar command ...
 .Nm
 .Op Fl dnsuvx
 .Op Fl w Ar timeout
@@ -57,7 +55,7 @@ If the file or directory does not exist,
 .Pp
 The second form can use an arbitrary file descriptor that is provided from a
 shell script for example:
-.Bd -literal
+.Bd -literal -offset indent
 (
 	flock -s 100
 	# commands to be executed under the lock
@@ -65,7 +63,7 @@ shell script for example:
 .Ed
 .Pp
 The following options are available:
-.Bl -tag -width "X"
+.Bl -tag -width Fl
 .It Fl c Ar command
 Pass a command to a the shell.
 .It Fl d , Fl Fl debug



CVS commit: src/sys/arch

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 11:47:08 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S
src/sys/arch/x86/include: fpu.h
src/sys/arch/x86/x86: fpu.c

Log Message:
Rename fpu_eagerswitch to fpu_switch, and add fpu_xstate_reload to
simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/x86/fpu.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.187 src/sys/arch/amd64/amd64/locore.S:1.188
--- src/sys/arch/amd64/amd64/locore.S:1.187	Thu Oct  3 05:06:29 2019
+++ src/sys/arch/amd64/amd64/locore.S	Fri Oct  4 11:47:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.187 2019/10/03 05:06:29 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.188 2019/10/04 11:47:07 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1150,7 +1150,7 @@ ENTRY(cpu_switchto)
 	/* Switch the FPU. */
 	movq	%r13,%rdi
 	movq	%r12,%rsi
-	callq	_C_LABEL(fpu_eagerswitch)
+	callq	_C_LABEL(fpu_switch)
 
 	/* Don't bother with the rest if switching to a system process. */
 	testl	$LW_SYSTEM,L_FLAG(%r12)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.169 src/sys/arch/i386/i386/locore.S:1.170
--- src/sys/arch/i386/i386/locore.S:1.169	Thu Oct  3 05:06:29 2019
+++ src/sys/arch/i386/i386/locore.S	Fri Oct  4 11:47:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.169 2019/10/03 05:06:29 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.170 2019/10/04 11:47:07 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.169 2019/10/03 05:06:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.170 2019/10/04 11:47:07 maxv Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -1141,7 +1141,7 @@ skip_save:
 	pushl	%edx
 	pushl	%edi
 	pushl	%esi
-	call	_C_LABEL(fpu_eagerswitch)
+	call	_C_LABEL(fpu_switch)
 	addl	$8,%esp
 	popl	%edx
 

Index: src/sys/arch/x86/include/fpu.h
diff -u src/sys/arch/x86/include/fpu.h:1.17 src/sys/arch/x86/include/fpu.h:1.18
--- src/sys/arch/x86/include/fpu.h:1.17	Wed Jun 26 12:30:13 2019
+++ src/sys/arch/x86/include/fpu.h	Fri Oct  4 11:47:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.17 2019/06/26 12:30:13 mgorny Exp $	*/
+/*	$NetBSD: fpu.h,v 1.18 2019/10/04 11:47:08 maxv Exp $	*/
 
 #ifndef	_X86_FPU_H_
 #define	_X86_FPU_H_
@@ -20,8 +20,6 @@ void fpu_area_restore(void *, uint64_t);
 void fpusave_lwp(struct lwp *, bool);
 void fpusave_cpu(bool);
 
-void fpu_eagerswitch(struct lwp *, struct lwp *);
-
 void fpu_set_default_cw(struct lwp *, unsigned int);
 
 void fputrap(struct trapframe *);

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.56 src/sys/arch/x86/x86/fpu.c:1.57
--- src/sys/arch/x86/x86/fpu.c:1.56	Thu Oct  3 05:06:29 2019
+++ src/sys/arch/x86/x86/fpu.c	Fri Oct  4 11:47:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.56 2019/10/03 05:06:29 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.57 2019/10/04 11:47:08 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.56 2019/10/03 05:06:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.57 2019/10/04 11:47:08 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -267,8 +267,10 @@ fpu_lwp_install(struct lwp *l)
 	fpu_area_restore(>pcb_savefpu, x86_xsave_features);
 }
 
+void fpu_switch(struct lwp *, struct lwp *);
+
 void
-fpu_eagerswitch(struct lwp *oldlwp, struct lwp *newlwp)
+fpu_switch(struct lwp *oldlwp, struct lwp *newlwp)
 {
 	int s;
 
@@ -536,6 +538,17 @@ fpusave_lwp(struct lwp *l, bool save)
 	}
 }
 
+static inline void
+fpu_xstate_reload(union savefpu *fpu_save, uint64_t xstate)
+{
+	/*
+	 * Force a reload of the given xstate during the next XRSTOR.
+	 */
+	if (x86_fpu_save >= FPU_SAVE_XSAVE) {
+		fpu_save->sv_xsave_hdr.xsh_xstate_bv |= xstate;
+	}
+}
+
 void
 fpu_set_default_cw(struct lwp *l, unsigned int x87_cw)
 {
@@ -544,13 +557,8 @@ fpu_set_default_cw(struct lwp *l, unsign
 
 	if (i386_use_fxsave) {
 		fpu_save->sv_xmm.fx_cw = x87_cw;
-
-		/* Force a reload of CW */
-		if ((x87_cw != __INITIAL_NPXCW__) &&
-		(x86_fpu_save == FPU_SAVE_XSAVE ||
-		x86_fpu_save == FPU_SAVE_XSAVEOPT)) {
-			fpu_save->sv_xsave_hdr.xsh_xstate_bv |=
-			XCR0_X87;
+		if (x87_cw != __INITIAL_NPXCW__) {
+			fpu_xstate_reload(fpu_save, XCR0_X87);
 		}
 	} else {
 		fpu_save->sv_87.s87_cw = x87_cw;
@@ -594,14 +602,8 @@ fpu_clear(struct lwp *l, unsigned int x8
 		fpu_save->sv_xmm.fx_mxcsr = __INITIAL_MXCSR__;
 		fpu_save->sv_xmm.fx_mxcsr_mask = x86_fpu_mxcsr_mask;
 		fpu_save->sv_xmm.fx_cw = x87_cw;

CVS commit: src/sys/arch

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 11:47:08 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S
src/sys/arch/x86/include: fpu.h
src/sys/arch/x86/x86: fpu.c

Log Message:
Rename fpu_eagerswitch to fpu_switch, and add fpu_xstate_reload to
simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/x86/fpu.c

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



CVS commit: src/usr.bin/who

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 11:43:07 UTC 2019

Modified Files:
src/usr.bin/who: utmpentry.c

Log Message:
revert previous; i meant to test first and if you read the comment
immediately above, you can see it is done safely and on purpose.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/who/utmpentry.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/who/utmpentry.c
diff -u src/usr.bin/who/utmpentry.c:1.19 src/usr.bin/who/utmpentry.c:1.20
--- src/usr.bin/who/utmpentry.c:1.19	Fri Oct  4 11:40:43 2019
+++ src/usr.bin/who/utmpentry.c	Fri Oct  4 11:43:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: utmpentry.c,v 1.19 2019/10/04 11:40:43 mrg Exp $	*/
+/*	$NetBSD: utmpentry.c,v 1.20 2019/10/04 11:43:07 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: utmpentry.c,v 1.19 2019/10/04 11:40:43 mrg Exp $");
+__RCSID("$NetBSD: utmpentry.c,v 1.20 2019/10/04 11:43:07 mrg Exp $");
 #endif
 
 #include 
@@ -283,9 +283,9 @@ getentry(struct utmpentry *e, struct utm
 	 * reason we use the size of the _source_ as the length
 	 * argument.
 	 */
-	(void)strncpy(e->name, up->ut_name, sizeof(e->name));
-	(void)strncpy(e->line, up->ut_line, sizeof(e->line));
-	(void)strncpy(e->host, up->ut_host, sizeof(e->host));
+	(void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
+	(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
+	(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
 
 	e->tv.tv_sec = up->ut_time;
 	e->tv.tv_usec = 0;
@@ -314,9 +314,9 @@ getentryx(struct utmpentry *e, struct ut
 	 * reason we use the size of the _source_ as the length
 	 * argument.
 	 */
-	(void)strncpy(e->name, up->ut_name, sizeof(e->name));
-	(void)strncpy(e->line, up->ut_line, sizeof(e->line));
-	(void)strncpy(e->host, up->ut_host, sizeof(e->host));
+	(void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
+	(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
+	(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
 
 	e->tv = up->ut_tv;
 	e->pid = up->ut_pid;



CVS commit: src/usr.bin/who

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 11:43:07 UTC 2019

Modified Files:
src/usr.bin/who: utmpentry.c

Log Message:
revert previous; i meant to test first and if you read the comment
immediately above, you can see it is done safely and on purpose.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/who/utmpentry.c

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



CVS commit: src/usr.bin/who

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 11:40:43 UTC 2019

Modified Files:
src/usr.bin/who: utmpentry.c

Log Message:
use destination buffer size not source buffer size for strncpy len.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/who/utmpentry.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/who/utmpentry.c
diff -u src/usr.bin/who/utmpentry.c:1.18 src/usr.bin/who/utmpentry.c:1.19
--- src/usr.bin/who/utmpentry.c:1.18	Sat Nov 21 15:01:43 2015
+++ src/usr.bin/who/utmpentry.c	Fri Oct  4 11:40:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: utmpentry.c,v 1.18 2015/11/21 15:01:43 christos Exp $	*/
+/*	$NetBSD: utmpentry.c,v 1.19 2019/10/04 11:40:43 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: utmpentry.c,v 1.18 2015/11/21 15:01:43 christos Exp $");
+__RCSID("$NetBSD: utmpentry.c,v 1.19 2019/10/04 11:40:43 mrg Exp $");
 #endif
 
 #include 
@@ -283,9 +283,9 @@ getentry(struct utmpentry *e, struct utm
 	 * reason we use the size of the _source_ as the length
 	 * argument.
 	 */
-	(void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
-	(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
-	(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
+	(void)strncpy(e->name, up->ut_name, sizeof(e->name));
+	(void)strncpy(e->line, up->ut_line, sizeof(e->line));
+	(void)strncpy(e->host, up->ut_host, sizeof(e->host));
 
 	e->tv.tv_sec = up->ut_time;
 	e->tv.tv_usec = 0;
@@ -314,9 +314,9 @@ getentryx(struct utmpentry *e, struct ut
 	 * reason we use the size of the _source_ as the length
 	 * argument.
 	 */
-	(void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
-	(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
-	(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
+	(void)strncpy(e->name, up->ut_name, sizeof(e->name));
+	(void)strncpy(e->line, up->ut_line, sizeof(e->line));
+	(void)strncpy(e->host, up->ut_host, sizeof(e->host));
 
 	e->tv = up->ut_tv;
 	e->pid = up->ut_pid;



CVS commit: src/usr.bin/who

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 11:40:43 UTC 2019

Modified Files:
src/usr.bin/who: utmpentry.c

Log Message:
use destination buffer size not source buffer size for strncpy len.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/who/utmpentry.c

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



CVS commit: src/usr.bin/telnet

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 11:39:44 UTC 2019

Modified Files:
src/usr.bin/telnet: commands.c

Log Message:
use memmove() instead of strncpy() for overlapping strings.
ensure nul termination.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/telnet/commands.c

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



CVS commit: src/usr.bin/telnet

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 11:39:44 UTC 2019

Modified Files:
src/usr.bin/telnet: commands.c

Log Message:
use memmove() instead of strncpy() for overlapping strings.
ensure nul termination.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/telnet/commands.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/telnet/commands.c
diff -u src/usr.bin/telnet/commands.c:1.76 src/usr.bin/telnet/commands.c:1.77
--- src/usr.bin/telnet/commands.c:1.76	Sat Jan  5 08:55:58 2019
+++ src/usr.bin/telnet/commands.c	Fri Oct  4 11:39:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: commands.c,v 1.76 2019/01/05 08:55:58 maya Exp $	*/
+/*	$NetBSD: commands.c,v 1.77 2019/10/04 11:39:44 mrg Exp $	*/
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)commands.c	8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: commands.c,v 1.76 2019/01/05 08:55:58 maya Exp $");
+__RCSID("$NetBSD: commands.c,v 1.77 2019/10/04 11:39:44 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -2503,13 +2503,14 @@ cmdrc(const char *m1, const char *m2)
 	if (isspace((unsigned char)line[0]))
 		continue;
 	if (strncasecmp(line, m1, l1) == 0)
-		strncpy(line, [l1], sizeof(line) - l1);
+		memmove(line, [l1], sizeof(line) - l1 - 1);
 	else if (strncasecmp(line, m2, l2) == 0)
-		strncpy(line, [l2], sizeof(line) - l2);
+		memmove(line, [l2], sizeof(line) - l2 - 1);
 	else if (strncasecmp(line, "DEFAULT", 7) == 0)
-		strncpy(line, [7], sizeof(line) - 7);
+		memmove(line, [7], sizeof(line) - 7 - 1);
 	else
 		continue;
+	line[sizeof(line) - 1] = '\0';
 	if (line[0] != ' ' && line[0] != '\t' && line[0] != '\n')
 		continue;
 	gotmachine = 1;



CVS commit: [netbsd-8] src/doc

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:35:44 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Tickets #1398 - #1400


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.47 -r1.1.2.48 src/doc/CHANGES-8.2

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

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.47 src/doc/CHANGES-8.2:1.1.2.48
--- src/doc/CHANGES-8.2:1.1.2.47	Mon Sep 30 15:50:49 2019
+++ src/doc/CHANGES-8.2	Fri Oct  4 11:35:44 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.47 2019/09/30 15:50:49 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.48 2019/10/04 11:35:44 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1233,3 +1233,24 @@ sys/netinet6/nd6_nbr.c1.174
 	Initialize DAD components properly during boot.
 	[ozaki-r, ticket #1396]
 
+sys/net/route.c	1.222
+
+	Reduce kernel stack usage by passing a const pointer instead of a
+	huge structure by value.
+	[rin, ticket #1398]
+
+sys/external/bsd/ipf/netinet/fil.c		1.31
+sys/external/bsd/ipf/netinet/ip_fil_netbsd.c	1.32,1.33
+
+	- pfil_run_hooks() can be called recursively, so we have to
+	  #define FASTROUTE_RECURSION in fil.c
+	- ip6_if_output()/nd6_output() will free the mbuf on error, to make sure
+	  to set *mpp to NULL so the caller won't try to free it again.
+	[bouyer, ticket #1399]
+
+sys/arch/i386/stand/pxeboot/Makefile		1.28
+sys/arch/i386/stand/pxeboot/start_pxe.S		1.7
+
+	Incrase pxeboot code size limit from 64k to 128k.
+	[manu, ticket #1400]
+



CVS commit: [netbsd-8] src/doc

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:35:44 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Tickets #1398 - #1400


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.47 -r1.1.2.48 src/doc/CHANGES-8.2

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



CVS commit: [netbsd-8] src/sys/arch/i386/stand/pxeboot

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:34:18 UTC 2019

Modified Files:
src/sys/arch/i386/stand/pxeboot [netbsd-8]: Makefile start_pxe.S

Log Message:
Pull up following revision(s) (requested by manu in ticket #1400):

sys/arch/i386/stand/pxeboot/start_pxe.S: revision 1.7
sys/arch/i386/stand/pxeboot/Makefile: revision 1.28

Incrase pxeboot code size limit from 64k to 128k.  Fixes PR kern/54560.
The start_pxe.S part was suggested by mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.24.10.1 -r1.24.10.2 src/sys/arch/i386/stand/pxeboot/Makefile
cvs rdiff -u -r1.6 -r1.6.48.1 src/sys/arch/i386/stand/pxeboot/start_pxe.S

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



CVS commit: [netbsd-8] src/sys/arch/i386/stand/pxeboot

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:34:18 UTC 2019

Modified Files:
src/sys/arch/i386/stand/pxeboot [netbsd-8]: Makefile start_pxe.S

Log Message:
Pull up following revision(s) (requested by manu in ticket #1400):

sys/arch/i386/stand/pxeboot/start_pxe.S: revision 1.7
sys/arch/i386/stand/pxeboot/Makefile: revision 1.28

Incrase pxeboot code size limit from 64k to 128k.  Fixes PR kern/54560.
The start_pxe.S part was suggested by mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.24.10.1 -r1.24.10.2 src/sys/arch/i386/stand/pxeboot/Makefile
cvs rdiff -u -r1.6 -r1.6.48.1 src/sys/arch/i386/stand/pxeboot/start_pxe.S

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

Modified files:

Index: src/sys/arch/i386/stand/pxeboot/Makefile
diff -u src/sys/arch/i386/stand/pxeboot/Makefile:1.24.10.1 src/sys/arch/i386/stand/pxeboot/Makefile:1.24.10.2
--- src/sys/arch/i386/stand/pxeboot/Makefile:1.24.10.1	Wed Sep 18 17:30:06 2019
+++ src/sys/arch/i386/stand/pxeboot/Makefile	Fri Oct  4 11:34:18 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.24.10.1 2019/09/18 17:30:06 martin Exp $
+#	$NetBSD: Makefile,v 1.24.10.2 2019/10/04 11:34:18 martin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -71,7 +71,7 @@ CPPFLAGS+= -DBOOTPARAM_DEFFLAGS=0x0c
 #CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
 
-SAMISCCPPFLAGS+= -DHEAP_START=0x1 -DHEAP_LIMIT=0x3
+SAMISCCPPFLAGS+= -DHEAP_START=0x2 -DHEAP_LIMIT=0x4
 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes	# Read compressed kernels
 
 CPPFLAGS+= -DPASS_BIOSGEOM

Index: src/sys/arch/i386/stand/pxeboot/start_pxe.S
diff -u src/sys/arch/i386/stand/pxeboot/start_pxe.S:1.6 src/sys/arch/i386/stand/pxeboot/start_pxe.S:1.6.48.1
--- src/sys/arch/i386/stand/pxeboot/start_pxe.S:1.6	Fri Mar 18 17:46:26 2011
+++ src/sys/arch/i386/stand/pxeboot/start_pxe.S	Fri Oct  4 11:34:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: start_pxe.S,v 1.6 2011/03/18 17:46:26 jakllsch Exp $	*/
+/*	$NetBSD: start_pxe.S,v 1.6.48.1 2019/10/04 11:34:18 martin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@ _C_LABEL(boot_params):
 	# set up %ss and %sp
 	movl	$_end, %eax		/* top of bss */
 	shrl	$4, %eax		/* as a segment */
-	addw	$0x1001, %ax		/* and + 64k */
+	addw	$0x2001, %ax		/* and + 128k */
 	movw	%ax, %ss		/* for stack */
 	movw	$0xfffc, %sp		/* %sp at top of it */
 



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

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:28:49 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1399):

sys/external/bsd/ipf/netinet/fil.c: revision 1.31
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.32
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.33

Fix 2 bugs, reported by Edgar Fuss on tech-net@
- pfil_run_hooks() can be called recursively, so we have to
  #define FASTROUTE_RECURSION in fil.c
- ip6_if_output()/nd6_output() will free the mbuf on error, to make sure
  to set *mpp to NULL so the caller won't try to free it again.

fix double space in comment


To generate a diff of this commit:
cvs rdiff -u -r1.20.4.3 -r1.20.4.4 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.23.2.1 -r1.23.2.2 \
src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c

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



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

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:28:49 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1399):

sys/external/bsd/ipf/netinet/fil.c: revision 1.31
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.32
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.33

Fix 2 bugs, reported by Edgar Fuss on tech-net@
- pfil_run_hooks() can be called recursively, so we have to
  #define FASTROUTE_RECURSION in fil.c
- ip6_if_output()/nd6_output() will free the mbuf on error, to make sure
  to set *mpp to NULL so the caller won't try to free it again.

fix double space in comment


To generate a diff of this commit:
cvs rdiff -u -r1.20.4.3 -r1.20.4.4 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.23.2.1 -r1.23.2.2 \
src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c

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

Modified files:

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.20.4.3 src/sys/external/bsd/ipf/netinet/fil.c:1.20.4.4
--- src/sys/external/bsd/ipf/netinet/fil.c:1.20.4.3	Fri Aug  9 19:21:04 2019
+++ src/sys/external/bsd/ipf/netinet/fil.c	Fri Oct  4 11:28:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.20.4.3 2019/08/09 19:21:04 martin Exp $	*/
+/*	$NetBSD: fil.c,v 1.20.4.4 2019/10/04 11:28:49 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.20.4.3 2019/08/09 19:21:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.20.4.4 2019/10/04 11:28:49 martin Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -152,6 +152,8 @@ extern	int	opts;
 extern	int	blockreason;
 #endif /* _KERNEL */
 
+#define FASTROUTE_RECURSION
+
 #define	LBUMP(x)	softc->x++
 #define	LBUMPD(x, y)	do { softc->x.y++; DT(y); } while (0)
 

Index: src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.23.2.1 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.23.2.2
--- src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.23.2.1	Mon Aug 14 23:51:14 2017
+++ src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c	Fri Oct  4 11:28:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_netbsd.c,v 1.23.2.1 2017/08/14 23:51:14 snj Exp $	*/
+/*	$NetBSD: ip_fil_netbsd.c,v 1.23.2.2 2019/10/04 11:28:49 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.23.2.1 2017/08/14 23:51:14 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.23.2.2 2019/10/04 11:28:49 martin Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -1490,6 +1490,8 @@ ipf_fastroute6(struct mbuf *m0, struct m
 # else
 			error = nd6_output(ifp, ifp, m0, dst6, rt);
 # endif
+			if (error)
+*mpp = NULL; /* m0 has been freed */
 		} else {
 			error = EMSGSIZE;
 		}



CVS commit: [netbsd-8] src/sys/net

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:26:35 UTC 2019

Modified Files:
src/sys/net [netbsd-8]: route.c

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

sys/net/route.c: revision 1.222

Stop passing a large const structure by value, in order to avoid
possible kernel stack overflow; const pointer is suffice here.

Pointed out by the lgtm bot and kamil.
OK ozaki-r

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.194.6.14 -r1.194.6.15 src/sys/net/route.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/net/route.c
diff -u src/sys/net/route.c:1.194.6.14 src/sys/net/route.c:1.194.6.15
--- src/sys/net/route.c:1.194.6.14	Tue Sep 24 18:27:09 2019
+++ src/sys/net/route.c	Fri Oct  4 11:26:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.194.6.14 2019/09/24 18:27:09 martin Exp $	*/
+/*	$NetBSD: route.c,v 1.194.6.15 2019/10/04 11:26:35 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.194.6.14 2019/09/24 18:27:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.194.6.15 2019/10/04 11:26:35 martin Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -1387,47 +1387,48 @@ rt_setgate(struct rtentry *rt, const str
 }
 
 static struct ifaddr *
-rt_update_get_ifa(const struct rt_addrinfo info, const struct rtentry *rt,
+rt_update_get_ifa(const struct rt_addrinfo *info, const struct rtentry *rt,
 struct ifnet **ifp, struct psref *psref_ifp, struct psref *psref)
 {
 	struct ifaddr *ifa = NULL;
 
 	*ifp = NULL;
-	if (info.rti_info[RTAX_IFP] != NULL) {
-		ifa = ifa_ifwithnet_psref(info.rti_info[RTAX_IFP], psref);
+	if (info->rti_info[RTAX_IFP] != NULL) {
+		ifa = ifa_ifwithnet_psref(info->rti_info[RTAX_IFP], psref);
 		if (ifa == NULL)
 			goto next;
 		*ifp = ifa->ifa_ifp;
 		if_acquire(*ifp, psref_ifp);
-		if (info.rti_info[RTAX_IFA] == NULL &&
-		info.rti_info[RTAX_GATEWAY] == NULL)
+		if (info->rti_info[RTAX_IFA] == NULL &&
+		info->rti_info[RTAX_GATEWAY] == NULL)
 			goto next;
 		ifa_release(ifa, psref);
-		if (info.rti_info[RTAX_IFA] == NULL) {
+		if (info->rti_info[RTAX_IFA] == NULL) {
 			/* route change   -ifp  */
-			ifa = ifaof_ifpforaddr_psref(info.rti_info[RTAX_GATEWAY],
-			*ifp, psref);
+			ifa = ifaof_ifpforaddr_psref(
+			info->rti_info[RTAX_GATEWAY], *ifp, psref);
 		} else {
 			/* route change  -ifp  -ifa  */
-			ifa = ifa_ifwithaddr_psref(info.rti_info[RTAX_IFA], psref);
+			ifa = ifa_ifwithaddr_psref(info->rti_info[RTAX_IFA],
+			psref);
 			if (ifa != NULL)
 goto out;
-			ifa = ifaof_ifpforaddr_psref(info.rti_info[RTAX_IFA],
+			ifa = ifaof_ifpforaddr_psref(info->rti_info[RTAX_IFA],
 			*ifp, psref);
 		}
 		goto out;
 	}
 next:
-	if (info.rti_info[RTAX_IFA] != NULL) {
+	if (info->rti_info[RTAX_IFA] != NULL) {
 		/* route change   -ifa  */
-		ifa = ifa_ifwithaddr_psref(info.rti_info[RTAX_IFA], psref);
+		ifa = ifa_ifwithaddr_psref(info->rti_info[RTAX_IFA], psref);
 		if (ifa != NULL)
 			goto out;
 	}
-	if (info.rti_info[RTAX_GATEWAY] != NULL) {
+	if (info->rti_info[RTAX_GATEWAY] != NULL) {
 		/* route change   */
 		ifa = ifa_ifwithroute_psref(rt->rt_flags, rt_getkey(rt),
-		info.rti_info[RTAX_GATEWAY], psref);
+		info->rti_info[RTAX_GATEWAY], psref);
 	}
 out:
 	if (ifa != NULL && *ifp == NULL) {
@@ -1487,7 +1488,7 @@ rt_update(struct rtentry *rt, struct rt_
 	 * flags may also be different; ifp may be specified
 	 * by ll sockaddr when protocol address is ambiguous
 	 */
-	new_ifa = rt_update_get_ifa(*info, rt, _ifp, _new_ifp,
+	new_ifa = rt_update_get_ifa(info, rt, _ifp, _new_ifp,
 	_new_ifa);
 	if (new_ifa != NULL) {
 		ifa_release(ifa, _ifa);



CVS commit: [netbsd-8] src/sys/net

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 11:26:35 UTC 2019

Modified Files:
src/sys/net [netbsd-8]: route.c

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

sys/net/route.c: revision 1.222

Stop passing a large const structure by value, in order to avoid
possible kernel stack overflow; const pointer is suffice here.

Pointed out by the lgtm bot and kamil.
OK ozaki-r

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.194.6.14 -r1.194.6.15 src/sys/net/route.c

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



CVS commit: src/usr.bin/stat

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 11:12:16 UTC 2019

Modified Files:
src/usr.bin/stat: stat.c

Log Message:
adjust fallthru comment.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/stat/stat.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/stat/stat.c
diff -u src/usr.bin/stat/stat.c:1.44 src/usr.bin/stat/stat.c:1.45
--- src/usr.bin/stat/stat.c:1.44	Mon Feb  4 08:07:33 2019
+++ src/usr.bin/stat/stat.c	Fri Oct  4 11:12:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: stat.c,v 1.44 2019/02/04 08:07:33 mrg Exp $ */
+/*	$NetBSD: stat.c,v 1.45 2019/10/04 11:12:16 mrg Exp $ */
 
 /*
  * Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: stat.c,v 1.44 2019/02/04 08:07:33 mrg Exp $");
+__RCSID("$NetBSD: stat.c,v 1.45 2019/10/04 11:12:16 mrg Exp $");
 #endif
 
 #if ! HAVE_NBTOOL_CONFIG_H
@@ -806,8 +806,8 @@ format1(const struct stat *st,
 			nsecs = st->st_ctimensec;
 #endif
 		}
-		/* FALLTHROUGH */
 #if HAVE_STRUCT_STAT_ST_BIRTHTIME
+		/* FALLTHROUGH */
 	case SHOW_st_btime:
 		if (!gottime) {
 			gottime = 1;



CVS commit: src

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:47:28 UTC 2019

Modified Files:
src/external/bsd/file/lib: Makefile
src/external/bsd/llvm/lib/libLLVMCodeGen: Makefile
src/external/bsd/ntp/bin/ntp-keygen: Makefile
src/external/bsd/ntp/bin/ntpd: Makefile
src/external/bsd/pkg_install/lib: Makefile
src/external/mit/xorg/lib/libXext: Makefile
src/usr.bin/tftp: Makefile
src/usr.sbin/sysinst: Makefile.inc

Log Message:
turn off various warnings for various things:

- file has looks bogus maybe-uninitialized
- llvm triggers an attribute violation:
  ScheduleDAGInstrs.cpp:1430:14: error: declaration of
'llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const 
llvm::ILPValue&)'
with attribute 'noinline' follows inline declaration [-Werror=attributes]
- ntp and pkg_install have obvious restrict violations, should be
  fixed but i'm avoiding patching upstream code in this pass
- tftp has an array bounds that doesn't seem real issue
- sysinst's partman.c has major problem with passing the same
  string as source and dest in snprintf, as a way to strcat
  with formatting which trip restrict violations.  non trivial
  to fix so for now the warning is elided.
- Xext's XEVI.c has similar issue as partman.c

everyone and GCC 8 gets these warnings turned off for now:

-Wno-format-truncation
-Wno-stringop-overflow
-Wno-stringop-truncation
-Wno-cast-function-type

as they trip a large amount of code.  most of them should be
investigated, but the few i looked at were not finding actually
real bugs, vs instances of poor coding, so skipping for now.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/file/lib/Makefile
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/llvm/lib/libLLVMCodeGen/Makefile
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ntp/bin/ntp-keygen/Makefile
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/ntp/bin/ntpd/Makefile
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/pkg_install/lib/Makefile
cvs rdiff -u -r1.8 -r1.9 src/external/mit/xorg/lib/libXext/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/tftp/Makefile
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/Makefile.inc

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



CVS commit: src

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:47:28 UTC 2019

Modified Files:
src/external/bsd/file/lib: Makefile
src/external/bsd/llvm/lib/libLLVMCodeGen: Makefile
src/external/bsd/ntp/bin/ntp-keygen: Makefile
src/external/bsd/ntp/bin/ntpd: Makefile
src/external/bsd/pkg_install/lib: Makefile
src/external/mit/xorg/lib/libXext: Makefile
src/usr.bin/tftp: Makefile
src/usr.sbin/sysinst: Makefile.inc

Log Message:
turn off various warnings for various things:

- file has looks bogus maybe-uninitialized
- llvm triggers an attribute violation:
  ScheduleDAGInstrs.cpp:1430:14: error: declaration of
'llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const 
llvm::ILPValue&)'
with attribute 'noinline' follows inline declaration [-Werror=attributes]
- ntp and pkg_install have obvious restrict violations, should be
  fixed but i'm avoiding patching upstream code in this pass
- tftp has an array bounds that doesn't seem real issue
- sysinst's partman.c has major problem with passing the same
  string as source and dest in snprintf, as a way to strcat
  with formatting which trip restrict violations.  non trivial
  to fix so for now the warning is elided.
- Xext's XEVI.c has similar issue as partman.c

everyone and GCC 8 gets these warnings turned off for now:

-Wno-format-truncation
-Wno-stringop-overflow
-Wno-stringop-truncation
-Wno-cast-function-type

as they trip a large amount of code.  most of them should be
investigated, but the few i looked at were not finding actually
real bugs, vs instances of poor coding, so skipping for now.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/file/lib/Makefile
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/llvm/lib/libLLVMCodeGen/Makefile
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ntp/bin/ntp-keygen/Makefile
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/ntp/bin/ntpd/Makefile
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/pkg_install/lib/Makefile
cvs rdiff -u -r1.8 -r1.9 src/external/mit/xorg/lib/libXext/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/tftp/Makefile
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/Makefile.inc

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

Modified files:

Index: src/external/bsd/file/lib/Makefile
diff -u src/external/bsd/file/lib/Makefile:1.11 src/external/bsd/file/lib/Makefile:1.12
--- src/external/bsd/file/lib/Makefile:1.11	Wed Dec 12 06:36:13 2018
+++ src/external/bsd/file/lib/Makefile	Fri Oct  4 09:47:27 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2018/12/12 06:36:13 msaitoh Exp $
+#	$NetBSD: Makefile,v 1.12 2019/10/04 09:47:27 mrg Exp $
 #
 
 USE_FORT?= yes	# data driven bugs?
@@ -41,4 +41,6 @@ magic.h:magic.h.in
 	${TOOL_SED} -e "s/X.YY/${VERSION:S/.//g}/" < ${.ALLSRC} > ${.TARGET}
 CLEANFILES+=	magic.h
 
+CFLAGS+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-maybe-uninitialized :}
+
 .include 

Index: src/external/bsd/llvm/lib/libLLVMCodeGen/Makefile
diff -u src/external/bsd/llvm/lib/libLLVMCodeGen/Makefile:1.34 src/external/bsd/llvm/lib/libLLVMCodeGen/Makefile:1.35
--- src/external/bsd/llvm/lib/libLLVMCodeGen/Makefile:1.34	Tue Jul 17 18:55:27 2018
+++ src/external/bsd/llvm/lib/libLLVMCodeGen/Makefile	Fri Oct  4 09:47:27 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2018/07/17 18:55:27 joerg Exp $
+#	$NetBSD: Makefile,v 1.35 2019/10/04 09:47:27 mrg Exp $
 
 LIB=	LLVMCodeGen
 
@@ -169,6 +169,10 @@ SRCS+=	AggressiveAntiDepBreaker.cpp \
 	WinEHPrepare.cpp \
 	XRayInstrumentation.cpp
 
+.if !defined(HOSTLIB)
+COPTS.ScheduleDAGInstrs.cpp+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-attributes :}
+.endif
+
 .if defined(HOSTLIB)
 .include 
 # Crashes some versions of GCC

Index: src/external/bsd/ntp/bin/ntp-keygen/Makefile
diff -u src/external/bsd/ntp/bin/ntp-keygen/Makefile:1.5 src/external/bsd/ntp/bin/ntp-keygen/Makefile:1.6
--- src/external/bsd/ntp/bin/ntp-keygen/Makefile:1.5	Sat Dec 28 03:19:43 2013
+++ src/external/bsd/ntp/bin/ntp-keygen/Makefile	Fri Oct  4 09:47:28 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2013/12/28 03:19:43 christos Exp $
+#	$NetBSD: Makefile,v 1.6 2019/10/04 09:47:28 mrg Exp $
 
 .include 
 
@@ -20,4 +20,6 @@ CPPFLAGS+=-I${IDIST}/include -I${IDIST}/
 
 .PATH: ${DIST}
 
+COPTS.ntp-keygen.c+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=restrict :}
+
 .include 

Index: src/external/bsd/ntp/bin/ntpd/Makefile
diff -u src/external/bsd/ntp/bin/ntpd/Makefile:1.22 src/external/bsd/ntp/bin/ntpd/Makefile:1.23
--- src/external/bsd/ntp/bin/ntpd/Makefile:1.22	Fri Feb  2 01:02:39 2018
+++ src/external/bsd/ntp/bin/ntpd/Makefile	Fri Oct  4 09:47:27 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.22 2018/02/02 01:02:39 mrg Exp $
+#	$NetBSD: Makefile,v 1.23 2019/10/04 09:47:27 mrg Exp $
 
 .include 
 
@@ -92,4 +92,6 @@ YHEADER=1
 COPTS.ntp_control.c+=  

Re: CVS commit: src/sys/arch/acorn32/acorn32

2019-10-04 Thread Valery Ushakov
On Fri, Oct 04, 2019 at 04:57:51 +0200, Kamil Rytarowski wrote:

> At least in certain domains of engineering 0 is a special case as it
> does not need unit (km, lumen, kg, ...) neither base (hex, dec, ..).
> 
> It is natural (correct, expected) to print %#x for 0 as 0, without 0x.

I'm happy for them and that there's %#x that they can use.  What does
it have to do with with anything?


> On 04.10.2019 04:09, Christos Zoulas wrote:
> > Thanks, and zero is special for 0#. Should I revert it?
> > 
> > christos
> > 
> >> On Oct 3, 2019, at 10:06 PM, Valery Ushakov  wrote:
> >>
> >>
> >>> Modified Files:
> >>>   src/sys/arch/acorn32/acorn32: rpc_machdep.c
> >>>
> >>> Log Message:
> >>> change 0x% -> %x
> >>
> >> This should read %#x.
> >> And this is wrong.
> >>
> >> 1) With # the 0x is part of the width, so 
> >>
> >> 0x%08x -> 0x0001
> >> %#08x  -> 0x01
> >>
> >> 0x 0x0001
> >>  0x01
> >>
> >> 2) # doesn't add prefix for zero, so 
> >>
> >> 0x%08x -> 0x
> >> %#08x  ->  
> >>
> >> -uwe
> > 
> 
> 




-uwe


CVS commit: src/external/bsd/atf/dist/atf-sh

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:19:19 UTC 2019

Modified Files:
src/external/bsd/atf/dist/atf-sh: atf-check.cpp

Log Message:
give a catch() a variable.  gcc 8 is picky:

atf-check.cpp:221:23: error: catching polymorphic type 'class 
std::runtime_error' by value [-Werror=catch-value=]


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/atf/dist/atf-sh/atf-check.cpp

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/atf/dist/atf-sh/atf-check.cpp
diff -u src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.10 src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.11
--- src/external/bsd/atf/dist/atf-sh/atf-check.cpp:1.10	Fri Dec  4 01:43:58 2015
+++ src/external/bsd/atf/dist/atf-sh/atf-check.cpp	Fri Oct  4 09:19:18 2019
@@ -218,7 +218,7 @@ parse_signal(const std::string& str)
 if (signo == INT_MIN) {
 try {
 return atf::text::to_type< int >(str);
-} catch (std::runtime_error) {
+} catch (std::runtime_error ) {
 throw atf::application::usage_error("Invalid signal name or number "
 "in -s option");
 }



CVS commit: src/external/bsd/atf/dist/atf-sh

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:19:19 UTC 2019

Modified Files:
src/external/bsd/atf/dist/atf-sh: atf-check.cpp

Log Message:
give a catch() a variable.  gcc 8 is picky:

atf-check.cpp:221:23: error: catching polymorphic type 'class 
std::runtime_error' by value [-Werror=catch-value=]


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/atf/dist/atf-sh/atf-check.cpp

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



CVS commit: src

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:16:39 UTC 2019

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: bignum.c
src/sbin/nvmectl: bignum.c

Log Message:
avoid access uninitialised memory, found by gcc8, patch by agc@.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/nvmectl/bignum.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c:1.4 src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c:1.5
--- src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c:1.4	Mon Apr 17 19:50:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c	Fri Oct  4 09:16:38 2019
@@ -2308,7 +2308,7 @@ fast_col_array_multiply(mp_int * a, mp_i
 		tmpc = c->dp;
 		for (ix = 0; ix < pa+1; ix++) {
 			/* now extract the previous digit [below the carry] */
-			*tmpc++ = W[ix];
+			*tmpc++ = (ix < pa) ? W[ix] : 0;
 		}
 
 		/* clear unused digits [that existed in the old copy of c] */

Index: src/sbin/nvmectl/bignum.c
diff -u src/sbin/nvmectl/bignum.c:1.2 src/sbin/nvmectl/bignum.c:1.3
--- src/sbin/nvmectl/bignum.c:1.2	Thu Feb  8 09:05:17 2018
+++ src/sbin/nvmectl/bignum.c	Fri Oct  4 09:16:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bignum.c,v 1.2 2018/02/08 09:05:17 dholland Exp $	*/
+/*	$NetBSD: bignum.c,v 1.3 2019/10/04 09:16:38 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2012 Alistair Crooks 
@@ -2304,7 +2304,7 @@ fast_col_array_multiply(mp_int * a, mp_i
 		tmpc = c->dp;
 		for (ix = 0; ix < pa+1; ix++) {
 			/* now extract the previous digit [below the carry] */
-			*tmpc++ = W[ix];
+			*tmpc++ = (ix < pa) ? W[ix] : 0;
 		}
 
 		/* clear unused digits [that existed in the old copy of c] */



CVS commit: src

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:16:39 UTC 2019

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: bignum.c
src/sbin/nvmectl: bignum.c

Log Message:
avoid access uninitialised memory, found by gcc8, patch by agc@.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/bignum.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/nvmectl/bignum.c

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



CVS commit: src

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:02:00 UTC 2019

Modified Files:
src/external/bsd/am-utils/dist/amd: info_ldap.c
src/external/bsd/nvi/dist/common: options.c
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c
src/tests/lib/librumphijack: h_client.c
src/usr.bin/rlogin: rlogin.c

Log Message:
msg:
avoid passing the same pointer in multiple arguments for restrict
marked arguments:
- sigaction() wants separate in/out
- use memmove() not memcpy() for overlapping regions (this may fix
  a real bug in nvi -- but it seems unlikely)
- select() wants separate read/write/except
- sigprocmask() wants separate set/oset


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/am-utils/dist/amd/info_ldap.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/nvi/dist/common/options.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/librumphijack/h_client.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/rlogin/rlogin.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/am-utils/dist/amd/info_ldap.c
diff -u src/external/bsd/am-utils/dist/amd/info_ldap.c:1.2 src/external/bsd/am-utils/dist/amd/info_ldap.c:1.3
--- src/external/bsd/am-utils/dist/amd/info_ldap.c:1.2	Fri Aug 28 11:38:57 2015
+++ src/external/bsd/am-utils/dist/amd/info_ldap.c	Fri Oct  4 09:01:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: info_ldap.c,v 1.2 2015/08/28 11:38:57 joerg Exp $	*/
+/*	$NetBSD: info_ldap.c,v 1.3 2019/10/04 09:01:59 mrg Exp $	*/
 
 /*
  * Copyright (c) 1997-2014 Erez Zadok
@@ -197,7 +197,7 @@ amu_ldap_unbind(LDAP *ld)
 {
   int e;
 #ifdef HAVE_SIGACTION
-  struct sigaction sa;
+  struct sigaction sa, osa;
 #else /* not HAVE_SIGACTION */
   void (*handler)(int);
 #endif /* not HAVE_SIGACTION */
@@ -209,7 +209,7 @@ amu_ldap_unbind(LDAP *ld)
   sa.sa_flags = 0;
   sigemptyset(&(sa.sa_mask));
   sigaddset(&(sa.sa_mask), SIGPIPE);
-  sigaction(SIGPIPE, , );	/* set IGNORE, and get old action */
+  sigaction(SIGPIPE, , );	/* set IGNORE, and get old action */
 #else /* not HAVE_SIGACTION */
   handler = signal(SIGPIPE, SIG_IGN);
 #endif /* not HAVE_SIGACTION */
@@ -217,9 +217,9 @@ amu_ldap_unbind(LDAP *ld)
   e = ldap_unbind(ld);
 
 #ifdef HAVE_SIGACTION
-  sigemptyset(&(sa.sa_mask));
-  sigaddset(&(sa.sa_mask), SIGPIPE);
-  sigaction(SIGPIPE, , NULL);
+  sigemptyset(&(osa.sa_mask));
+  sigaddset(&(osa.sa_mask), SIGPIPE);
+  sigaction(SIGPIPE, , NULL);
 #else /* not HAVE_SIGACTION */
   (void) signal(SIGPIPE, handler);
 #endif /* not HAVE_SIGACTION */

Index: src/external/bsd/nvi/dist/common/options.c
diff -u src/external/bsd/nvi/dist/common/options.c:1.6 src/external/bsd/nvi/dist/common/options.c:1.7
--- src/external/bsd/nvi/dist/common/options.c:1.6	Tue Aug  7 08:05:47 2018
+++ src/external/bsd/nvi/dist/common/options.c	Fri Oct  4 09:01:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.6 2018/08/07 08:05:47 rin Exp $ */
+/*	$NetBSD: options.c,v 1.7 2019/10/04 09:01:59 mrg Exp $ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: options.c,v 10.65 2002/01/18 22:34:43 skimo Exp  (Berkeley) Date: 2002/01/18 22:34:43 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: options.c,v 1.6 2018/08/07 08:05:47 rin Exp $");
+__RCSID("$NetBSD: options.c,v 1.7 2019/10/04 09:01:59 mrg Exp $");
 #endif
 
 #include 
@@ -356,7 +356,7 @@ opts_init(SCR *sp, int *oargs)
 #define	OI(indx, str) {			\
 	a.len = STRLEN(str);		\
 	if ((const CHAR_T*)str != b2)/* GCC puts strings in text-space. */\
-		(void)MEMCPY(b2, str, a.len+1);\
+		(void)MEMMOVE(b2, str, a.len+1);			\
 	if (opts_set(sp, argv, NULL)) {	\
 		 optindx = indx;	\
 		goto err;		\

Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.5 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.6
--- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.5	Sun Jul  8 21:01:21 2018
+++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c	Fri Oct  4 09:01:59 2019
@@ -1045,11 +1045,12 @@ output(int unit, u_char *p, int len)
 void
 wait_input(struct timeval *timo)
 {
-fd_set ready;
+fd_set ready, eready;
 int n;
 
 ready = in_fds;
-n = select(max_in_fd + 1, , NULL, , timo);
+eready = in_fds;
+n = select(max_in_fd + 1, , NULL, , timo);
 if (n < 0 && errno != EINTR)
 	fatal("%s: select: %m", __func__);
 }

Index: src/tests/lib/librumphijack/h_client.c
diff -u src/tests/lib/librumphijack/h_client.c:1.8 src/tests/lib/librumphijack/h_client.c:1.9
--- src/tests/lib/librumphijack/h_client.c:1.8	Fri Apr 20 05:15:11 2012
+++ src/tests/lib/librumphijack/h_client.c	Fri Oct  4 09:02:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_client.c,v 1.8 2012/04/20 05:15:11 jruoho Exp $	*/
+/*	$NetBSD: h_client.c,v 1.9 

CVS commit: src

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 09:02:00 UTC 2019

Modified Files:
src/external/bsd/am-utils/dist/amd: info_ldap.c
src/external/bsd/nvi/dist/common: options.c
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c
src/tests/lib/librumphijack: h_client.c
src/usr.bin/rlogin: rlogin.c

Log Message:
msg:
avoid passing the same pointer in multiple arguments for restrict
marked arguments:
- sigaction() wants separate in/out
- use memmove() not memcpy() for overlapping regions (this may fix
  a real bug in nvi -- but it seems unlikely)
- select() wants separate read/write/except
- sigprocmask() wants separate set/oset


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/am-utils/dist/amd/info_ldap.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/nvi/dist/common/options.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/librumphijack/h_client.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/rlogin/rlogin.c

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



CVS commit: src/bin/dd

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 08:57:38 UTC 2019

Modified Files:
src/bin/dd: Makefile dd.c extern.h
Added Files:
src/bin/dd: dd_swab.c

Log Message:
copy libc's swab.c into dd as dd_swab(), and remove the restrict.

our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it.  oh well.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/dd/Makefile
cvs rdiff -u -r1.52 -r1.53 src/bin/dd/dd.c
cvs rdiff -u -r0 -r1.1 src/bin/dd/dd_swab.c
cvs rdiff -u -r1.23 -r1.24 src/bin/dd/extern.h

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



CVS commit: src/bin/dd

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 08:57:38 UTC 2019

Modified Files:
src/bin/dd: Makefile dd.c extern.h
Added Files:
src/bin/dd: dd_swab.c

Log Message:
copy libc's swab.c into dd as dd_swab(), and remove the restrict.

our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it.  oh well.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/dd/Makefile
cvs rdiff -u -r1.52 -r1.53 src/bin/dd/dd.c
cvs rdiff -u -r0 -r1.1 src/bin/dd/dd_swab.c
cvs rdiff -u -r1.23 -r1.24 src/bin/dd/extern.h

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

Modified files:

Index: src/bin/dd/Makefile
diff -u src/bin/dd/Makefile:1.19 src/bin/dd/Makefile:1.20
--- src/bin/dd/Makefile:1.19	Sun Sep 15 23:58:31 2019
+++ src/bin/dd/Makefile	Fri Oct  4 08:57:37 2019
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.19 2019/09/15 23:58:31 kamil Exp $
+#	$NetBSD: Makefile,v 1.20 2019/10/04 08:57:37 mrg Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 .include 
 
 RUMPPRG=dd
-SRCS=	args.c conv.c dd.c misc.c position.c
+SRCS=	args.c conv.c dd.c dd_swab.c misc.c position.c
 
 DPADD+=	${LIBUTIL}
 LDADD+=	-lutil

Index: src/bin/dd/dd.c
diff -u src/bin/dd/dd.c:1.52 src/bin/dd/dd.c:1.53
--- src/bin/dd/dd.c:1.52	Sat Mar 23 09:33:16 2019
+++ src/bin/dd/dd.c	Fri Oct  4 08:57:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dd.c,v 1.52 2019/03/23 09:33:16 mlelstv Exp $	*/
+/*	$NetBSD: dd.c,v 1.53 2019/10/04 08:57:37 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)dd.c	8.5 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: dd.c,v 1.52 2019/03/23 09:33:16 mlelstv Exp $");
+__RCSID("$NetBSD: dd.c,v 1.53 2019/10/04 08:57:37 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -456,7 +456,7 @@ dd_in(void)
 ++st.swab;
 --n;
 			}
-			swab(in.dbp, in.dbp, n);
+			dd_swab(in.dbp, in.dbp, n);
 		}
 
 		in.dbp += in.dbrcnt;

Index: src/bin/dd/extern.h
diff -u src/bin/dd/extern.h:1.23 src/bin/dd/extern.h:1.24
--- src/bin/dd/extern.h:1.23	Wed Mar 18 13:23:49 2015
+++ src/bin/dd/extern.h	Fri Oct  4 08:57:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.23 2015/03/18 13:23:49 manu Exp $	*/
+/*	$NetBSD: extern.h,v 1.24 2019/10/04 08:57:38 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -84,3 +84,5 @@ extern const u_char	e2a_32V[], e2a_POSIX
 extern const u_char	a2ibm_32V[], a2ibm_POSIX[];
 extern u_char		casetab[];
 extern const char	*msgfmt;
+
+void dd_swab(const void *, void *, ssize_t len);

Added files:

Index: src/bin/dd/dd_swab.c
diff -u /dev/null src/bin/dd/dd_swab.c:1.1
--- /dev/null	Fri Oct  4 08:57:38 2019
+++ src/bin/dd/dd_swab.c	Fri Oct  4 08:57:38 2019
@@ -0,0 +1,83 @@
+/*	$NetBSD: dd_swab.c,v 1.1 2019/10/04 08:57:38 mrg Exp $	*/
+
+/*
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jeffrey Mogul.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * from: NetBSD: swab.c,v 1.18 2011/01/04 17:14:07 martin Exp
+ */
+
+/* This copy has no restrict on it, that dd wants */
+
+#include 
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)swab.c	8.1 (Berkeley) 6/4/93";
+#else

CVS commit: src/external/gpl3/gcc

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 08:51:33 UTC 2019

Modified Files:
src/external/gpl3/gcc: README.gcc8
src/external/gpl3/gcc/dist/gcc/config/aarch64: aarch64-netbsd.h
src/external/gpl3/gcc/dist/libsanitizer/lsan: lsan_allocator.cc
lsan_allocator.h
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_platform_limits_netbsd.h
sanitizer_stoptheworld_linux_libcdep.cc
src/external/gpl3/gcc/dist/libsanitizer/ubsan: ubsan_handlers_cxx.cc
src/external/gpl3/gcc/lib/libsupc++: Makefile.common
src/external/gpl3/gcc/lib/libubsan: Makefile
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64: configargs.h

Log Message:
- update README.gcc8 to include current status
- netbsd/arm64 uses 64 byte malloc alignment
- make lsan compile on sparc*, mips*, ppc and arm64 again
- add missing sparc, alpha and i386 abi compat for struct __sanitizer_addrinfo
- avoid linux includes on arm64
- avoid multiply defined __ubsan_handle_cfi_bad_type when UBSAN_CAN_USE_CXXABI
  isn't defined, and, undefine it
- bad_array_length.cc and bad_array_new.cc lose special build rules
- regen arm64 mknative


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/gpl3/gcc/README.gcc8
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-netbsd.h
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_allocator.cc
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_allocator.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_netbsd.h
cvs rdiff -u -r1.9 -r1.10 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_handlers_cxx.cc
cvs rdiff -u -r1.14 -r1.15 \
src/external/gpl3/gcc/lib/libsupc++/Makefile.common
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc/lib/libubsan/Makefile
cvs rdiff -u -r1.11 -r1.12 \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64/configargs.h

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

Modified files:

Index: src/external/gpl3/gcc/README.gcc8
diff -u src/external/gpl3/gcc/README.gcc8:1.1 src/external/gpl3/gcc/README.gcc8:1.2
--- src/external/gpl3/gcc/README.gcc8:1.1	Wed Oct  2 04:23:58 2019
+++ src/external/gpl3/gcc/README.gcc8	Fri Oct  4 08:51:32 2019
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc8,v 1.1 2019/10/02 04:23:58 mrg Exp $
+$NetBSD: README.gcc8,v 1.2 2019/10/04 08:51:32 mrg Exp $
 
 new stuff:
 	cc1objcplus
@@ -21,43 +21,43 @@ switched:	has port switched?  y (yes), n
 
 architecture	tools	kernels	libgcc	native-gcc	make release	runs	atf	switched
 	-	---	--	--			---	
-aarch64		?	?	?	?		?		?	?	?
-alpha		?	?	?	?		?		?	?	?
-arm		?	?	?	?		?		?	?	?
-armeb		?	?	?	?		?		?	?	?
-earmv4		?	?	?	?		?		?	?	?
-earmv4eb	?	?	?	?		?		?	?	?
-earm		?	?	?	?		?		?	?	?
-earmeb		?	?	?	?		?		?	?	?
-earmhf		?	?	?	?		?		?	?	?
-earmhfeb	?	?	?	?		?		?	?	?
-earmv6		?	?	?	?		?		?	?	?
-earmv6eb	?	?	?	?		?		?	?	?
-earmv6hf	?	?	?	?		?		?	?	?
-earmv6hfeb	?	?	?	?		?		?	?	?
-earmv7		?	?	?	?		?		?	?	?
-earmv7eb	?	?	?	?		?		?	?	?
-earmv7hf	?	?	?	?		?		?	?	?
-earmv7hfeb	?	?	?	?		?		?	?	?
-hppa		?	?	?	?		?		?	?	?
-i386		?	?	?	?		?		?	?	?
-ia64		?	?	?	?		?		?	?	?
-m68000		?	?	?	?		?		?	?	?
-m68k		?	?	?	?		?		?	?	?
-mipseb		?	?	?	?		?		?	?	?
-mipsel		?	?	?	?		?		?	?	?
-mips64eb	?	?	?	?		?		?	?	?
-mips64el	?	?	?	?		?		?	?	?
-powerpc		?	?	?	?		?		?	?	?
-powerpc64	?	?	?	?		?		?	?	?
-sh3eb		?	?	?	?		?		?	?	?
-sh3el		?	?	?	?		?		?	?	?
-sparc		?	?	?	?		?		?	?	?
-sparc64		?	?	?	?		?		?	?	?
-vax		?	?	?	?		?		?	?	?
-x86_64		?	?	?	?		?		?	?	?
-riscv32		?	?	?	?		?		?	?	?	
-riscv64		?	?	?	?		?		?	?	?
+aarch64		y	y	y	y		?		?	?	?
+alpha		y	?	?	y		?		?	?	?
+arm		y	?	?	y		?		?	?	?
+armeb		y	?	?	y		?		?	?	?
+earmv4		y	?	?	y		?		?	?	?
+earmv4eb	y	?	?	y		?		?	?	?
+earm		y	?	?	y		?		?	?	?
+earmeb		y	?	?	y		?		?	?	?
+earmhf		y	?	?	y		?		?	?	?
+earmhfeb	y	?	?	y		?		?	?	?
+earmv6		y	?	?	y		?		?	?	?
+earmv6eb	y	?	?	y		?		?	?	?
+earmv6hf	y	?	?	y		?		?	?	?
+earmv6hfeb	y	?	?	y		?		?	?	?
+earmv7		y	?	?	y		?		?	?	?
+earmv7eb	y	?	?	y		?		?	?	?
+earmv7hf	y	?	?	y		?		?	?	?
+earmv7hfeb	y	?	?	y		?		?	?	?
+hppa		y	?	?	y		?		?	?	?
+i386		y	?	?	y		?		?	?	?
+ia64		y	?	?	y		?		?	?	?
+m68000		y	?	?	y		?		?	?	?
+m68k		y	?	?	y		?		?	?	?
+mipseb		y	?	?	y		?		?	?	?
+mipsel		y	?	?	y		?		?	?	?
+mips64eb	y	?	?	y		?		?	?	?
+mips64el	y	?	?	y		?		?	?	?
+powerpc		y	?	?	y		?		?	?	?
+powerpc64	y	?	?	y		?		?	?	?
+sh3eb		y	?	?	y		?		?	?	?
+sh3el		y	?	?	y		?		?	?	?
+sparc		y	y	y	y		y		y	?	?
+sparc64		y	?	?	y		?		?	?	?
+vax		y	?	?	y		?		?	?	?
+x86_64		y	y	y	y		y		y	?	?
+riscv32		y	?	?	y		?		?	?	?	
+riscv64		y	?	?	y		?		?	?	?
 --
 coldfire	?	N/A	?	?	

CVS commit: src/external/gpl3/gcc

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 08:51:33 UTC 2019

Modified Files:
src/external/gpl3/gcc: README.gcc8
src/external/gpl3/gcc/dist/gcc/config/aarch64: aarch64-netbsd.h
src/external/gpl3/gcc/dist/libsanitizer/lsan: lsan_allocator.cc
lsan_allocator.h
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_platform_limits_netbsd.h
sanitizer_stoptheworld_linux_libcdep.cc
src/external/gpl3/gcc/dist/libsanitizer/ubsan: ubsan_handlers_cxx.cc
src/external/gpl3/gcc/lib/libsupc++: Makefile.common
src/external/gpl3/gcc/lib/libubsan: Makefile
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64: configargs.h

Log Message:
- update README.gcc8 to include current status
- netbsd/arm64 uses 64 byte malloc alignment
- make lsan compile on sparc*, mips*, ppc and arm64 again
- add missing sparc, alpha and i386 abi compat for struct __sanitizer_addrinfo
- avoid linux includes on arm64
- avoid multiply defined __ubsan_handle_cfi_bad_type when UBSAN_CAN_USE_CXXABI
  isn't defined, and, undefine it
- bad_array_length.cc and bad_array_new.cc lose special build rules
- regen arm64 mknative


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/gpl3/gcc/README.gcc8
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-netbsd.h
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_allocator.cc
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/lsan/lsan_allocator.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_netbsd.h
cvs rdiff -u -r1.9 -r1.10 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/external/gpl3/gcc/dist/libsanitizer/ubsan/ubsan_handlers_cxx.cc
cvs rdiff -u -r1.14 -r1.15 \
src/external/gpl3/gcc/lib/libsupc++/Makefile.common
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc/lib/libubsan/Makefile
cvs rdiff -u -r1.11 -r1.12 \
src/external/gpl3/gcc/usr.bin/gcc/arch/aarch64/configargs.h

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



CVS commit: [netbsd-9] src/doc

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 08:09:49 UTC 2019

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

Log Message:
Tickets #282 and #283


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.69 -r1.1.2.70 src/doc/CHANGES-9.0

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.69 src/doc/CHANGES-9.0:1.1.2.70
--- src/doc/CHANGES-9.0:1.1.2.69	Thu Oct  3 17:35:13 2019
+++ src/doc/CHANGES-9.0	Fri Oct  4 08:09:49 2019
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-9.0,v 1.1.2.69 2019/10/03 17:35:13 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.70 2019/10/04 08:09:49 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -4270,3 +4270,31 @@ external/gpl3/gdb/dist/gdb/arm-nbsd-nat.
 	Validate register number before fetching/storing it.
 	[christos, ticket #281]
 
+lib/libnpf/libnpf.31.11
+lib/libnpf/npf.c1.48
+lib/libnpf/npf.h1.38
+sys/net/npf/npf_conn.c1.30
+sys/net/npf/npf_ctl.c1.59
+sys/net/npf/npf_if.c1.11,1.12
+sys/net/npf/npf_impl.h1.80
+sys/net/npf/npf_ruleset.c			1.49
+usr.sbin/npf/npfctl/npf.conf.5			1.89,1.90
+usr.sbin/npf/npfctl/npf_build.c			1.52,1.53
+usr.sbin/npf/npfctl/npf_parse.y			1.50
+usr.sbin/npf/npfctl/npf_scan.l			1.30
+usr.sbin/npf/npfctl/npfctl.8			1.22-1.24
+usr.sbin/npf/npfctl/npfctl.c			1.62,1.63
+usr.sbin/npf/npfctl/npfctl.h			1.50,1.51
+usr.sbin/npf/npftest/npftest.conf		1.8
+
+	npfctl: implement table replace subcommand.
+	NPF ifmap: rework and fix a few small bugs.
+	libnpf/npfctl: support dynamic NAT rulesets using a name prefix.
+	npf_ifmap_copylogname: be more defensive.
+	[rmind, ticket #282]
+
+sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts	1.4
+
+	Increase voltage for frequencies above 1GHz.
+	[jmcneill, ticket #283]
+



CVS commit: [netbsd-9] src/doc

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 08:09:49 UTC 2019

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

Log Message:
Tickets #282 and #283


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.69 -r1.1.2.70 src/doc/CHANGES-9.0

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



CVS commit: [netbsd-9] src/sys/arch/arm/dts

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 08:08:53 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-h5-nanopi-neo-plus2.dts

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #283):

sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts: revision 1.4

Increase voltage for frequencies above 1GHz


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 \
src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts

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/dts/sun50i-h5-nanopi-neo-plus2.dts
diff -u src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.3 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.3.4.1
--- src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.3	Mon Jul  2 17:13:15 2018
+++ src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts	Fri Oct  4 08:08:53 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-h5-nanopi-neo-plus2.dts,v 1.3 2018/07/02 17:13:15 jakllsch Exp $ */
+/* $NetBSD: sun50i-h5-nanopi-neo-plus2.dts,v 1.3.4.1 2019/10/04 08:08:53 martin Exp $ */
 
 #include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts"
 #include "sun50i-h5.dtsi"
@@ -9,9 +9,9 @@
 			cpu-supply = <_cpux>;
 			operating-points = <
 /* kHz	  uV */
-1152000	110
-1104000	110
-1008000	110
+1152000	130
+1104000	130
+1008000	130
 816000	110
 624000	110
 >;



CVS commit: [netbsd-9] src/sys/arch/arm/dts

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 08:08:53 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-h5-nanopi-neo-plus2.dts

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #283):

sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts: revision 1.4

Increase voltage for frequencies above 1GHz


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 \
src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts

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



CVS commit: [netbsd-9] src

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 08:06:35 UTC 2019

Modified Files:
src/lib/libnpf [netbsd-9]: libnpf.3 npf.c npf.h
src/sys/net/npf [netbsd-9]: npf_conn.c npf_ctl.c npf_if.c npf_impl.h
npf_ruleset.c
src/usr.sbin/npf/npfctl [netbsd-9]: npf.conf.5 npf_build.c npf_parse.y
npf_scan.l npfctl.8 npfctl.c npfctl.h
src/usr.sbin/npf/npftest [netbsd-9]: npftest.conf

Log Message:
Pull up following revision(s) (requested by rmind in ticket #282):

usr.sbin/npf/npfctl/npf_build.c: revision 1.53
lib/libnpf/npf.c: revision 1.48
usr.sbin/npf/npfctl/npfctl.h: revision 1.50
sys/net/npf/npf_impl.h: revision 1.80
usr.sbin/npf/npfctl/npfctl.h: revision 1.51
sys/net/npf/npf_ruleset.c: revision 1.49
usr.sbin/npf/npfctl/npf.conf.5: revision 1.90
sys/net/npf/npf_ctl.c: revision 1.59
lib/libnpf/libnpf.3: revision 1.11
usr.sbin/npf/npfctl/npf_parse.y: revision 1.50
usr.sbin/npf/npftest/npftest.conf: revision 1.8
usr.sbin/npf/npfctl/npfctl.c: revision 1.62
usr.sbin/npf/npfctl/npfctl.c: revision 1.63
usr.sbin/npf/npfctl/npf_scan.l: revision 1.30
usr.sbin/npf/npfctl/npfctl.8: revision 1.22
lib/libnpf/npf.h: revision 1.38
usr.sbin/npf/npfctl/npfctl.8: revision 1.23
usr.sbin/npf/npfctl/npfctl.8: revision 1.24
sys/net/npf/npf_if.c: revision 1.11
sys/net/npf/npf_if.c: revision 1.12
usr.sbin/npf/npfctl/npf.conf.5: revision 1.89
sys/net/npf/npf_conn.c: revision 1.30
usr.sbin/npf/npfctl/npf_build.c: revision 1.52

npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.

NPF ifmap: rework and fix a few small bugs.

npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.
(missed a file in previous commit; cvs is so helpful..)

libnpf/npfctl: support dynamic NAT rulesets using a name prefix.

Use -width Pa for FILES.

Fix pasto in table replace -t type

Use -width Pa for FILES.

npf_ifmap_copylogname: be more defensive.


To generate a diff of this commit:
cvs rdiff -u -r1.9.2.1 -r1.9.2.2 src/lib/libnpf/libnpf.3
cvs rdiff -u -r1.46.2.1 -r1.46.2.2 src/lib/libnpf/npf.c
cvs rdiff -u -r1.36.2.1 -r1.36.2.2 src/lib/libnpf/npf.h
cvs rdiff -u -r1.27.2.1 -r1.27.2.2 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.54.2.3 -r1.54.2.4 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/sys/net/npf/npf_if.c
cvs rdiff -u -r1.75.2.3 -r1.75.2.4 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/net/npf/npf_ruleset.c
cvs rdiff -u -r1.88 -r1.88.2.1 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.50.2.1 -r1.50.2.2 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.49 -r1.49.2.1 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.29 -r1.29.2.1 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.21 -r1.21.2.1 src/usr.sbin/npf/npfctl/npfctl.8
cvs rdiff -u -r1.60.2.1 -r1.60.2.2 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.48.2.1 -r1.48.2.2 src/usr.sbin/npf/npfctl/npfctl.h
cvs rdiff -u -r1.7 -r1.7.2.1 src/usr.sbin/npf/npftest/npftest.conf

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

Modified files:

Index: src/lib/libnpf/libnpf.3
diff -u src/lib/libnpf/libnpf.3:1.9.2.1 src/lib/libnpf/libnpf.3:1.9.2.2
--- src/lib/libnpf/libnpf.3:1.9.2.1	Sun Sep  1 13:13:13 2019
+++ src/lib/libnpf/libnpf.3	Fri Oct  4 08:06:35 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: libnpf.3,v 1.9.2.1 2019/09/01 13:13:13 martin Exp $
+.\"	$NetBSD: libnpf.3,v 1.9.2.2 2019/10/04 08:06:35 martin Exp $
 .\"
 .\" Copyright (c) 2011-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 21, 2019
+.Dd August 25, 2019
 .Dt LIBNPF 3
 .Os
 .Sh NAME
@@ -108,6 +108,15 @@
 .Fn npf_table_replace "int fd" "nl_table_t *tl" "npf_error_t *errinfo"
 .Ft void
 .Fn npf_table_destroy "nl_table_t *tl"
+.\" ---
+.Ft int
+.Fn npf_ruleset_add "int fd" "const char *name" "nl_rule_t *rl" "uint64_t *id"
+.Ft int
+.Fn npf_ruleset_remove "int fd" "const char *name" "uint64_t id"
+.Ft int
+.Fn npf_ruleset_remkey "int fd" "const char *name" "const void *key" "size_t len"
+.Ft int
+.Fn npf_ruleset_flush "int fd" "const char *name"
 .\" -
 .Sh DESCRIPTION
 The
@@ -352,7 +361,9 @@ Additionally,
 may be specified to indicate the translation network;
 otherwise, it should be set to
 .Dv NPF_NO_NETMASK .
-In such case, a custom algorithm may need to be specified using the
+.Pp
+In order to use the translation network, a custom algorithm may need to
+be specified using the
 .Fn npf_nat_setalgo
 function.
 .\" ---
@@ -368,6 +379,9 @@ Currently, the following algorithms are 
 Hash of the source and destination addresses.
 .It Dv NPF_ALGO_RR
 Round-robin for the translation 

CVS commit: [netbsd-9] src

2019-10-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  4 08:06:35 UTC 2019

Modified Files:
src/lib/libnpf [netbsd-9]: libnpf.3 npf.c npf.h
src/sys/net/npf [netbsd-9]: npf_conn.c npf_ctl.c npf_if.c npf_impl.h
npf_ruleset.c
src/usr.sbin/npf/npfctl [netbsd-9]: npf.conf.5 npf_build.c npf_parse.y
npf_scan.l npfctl.8 npfctl.c npfctl.h
src/usr.sbin/npf/npftest [netbsd-9]: npftest.conf

Log Message:
Pull up following revision(s) (requested by rmind in ticket #282):

usr.sbin/npf/npfctl/npf_build.c: revision 1.53
lib/libnpf/npf.c: revision 1.48
usr.sbin/npf/npfctl/npfctl.h: revision 1.50
sys/net/npf/npf_impl.h: revision 1.80
usr.sbin/npf/npfctl/npfctl.h: revision 1.51
sys/net/npf/npf_ruleset.c: revision 1.49
usr.sbin/npf/npfctl/npf.conf.5: revision 1.90
sys/net/npf/npf_ctl.c: revision 1.59
lib/libnpf/libnpf.3: revision 1.11
usr.sbin/npf/npfctl/npf_parse.y: revision 1.50
usr.sbin/npf/npftest/npftest.conf: revision 1.8
usr.sbin/npf/npfctl/npfctl.c: revision 1.62
usr.sbin/npf/npfctl/npfctl.c: revision 1.63
usr.sbin/npf/npfctl/npf_scan.l: revision 1.30
usr.sbin/npf/npfctl/npfctl.8: revision 1.22
lib/libnpf/npf.h: revision 1.38
usr.sbin/npf/npfctl/npfctl.8: revision 1.23
usr.sbin/npf/npfctl/npfctl.8: revision 1.24
sys/net/npf/npf_if.c: revision 1.11
sys/net/npf/npf_if.c: revision 1.12
usr.sbin/npf/npfctl/npf.conf.5: revision 1.89
sys/net/npf/npf_conn.c: revision 1.30
usr.sbin/npf/npfctl/npf_build.c: revision 1.52

npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.

NPF ifmap: rework and fix a few small bugs.

npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.
(missed a file in previous commit; cvs is so helpful..)

libnpf/npfctl: support dynamic NAT rulesets using a name prefix.

Use -width Pa for FILES.

Fix pasto in table replace -t type

Use -width Pa for FILES.

npf_ifmap_copylogname: be more defensive.


To generate a diff of this commit:
cvs rdiff -u -r1.9.2.1 -r1.9.2.2 src/lib/libnpf/libnpf.3
cvs rdiff -u -r1.46.2.1 -r1.46.2.2 src/lib/libnpf/npf.c
cvs rdiff -u -r1.36.2.1 -r1.36.2.2 src/lib/libnpf/npf.h
cvs rdiff -u -r1.27.2.1 -r1.27.2.2 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.54.2.3 -r1.54.2.4 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/sys/net/npf/npf_if.c
cvs rdiff -u -r1.75.2.3 -r1.75.2.4 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/net/npf/npf_ruleset.c
cvs rdiff -u -r1.88 -r1.88.2.1 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.50.2.1 -r1.50.2.2 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.49 -r1.49.2.1 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.29 -r1.29.2.1 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.21 -r1.21.2.1 src/usr.sbin/npf/npfctl/npfctl.8
cvs rdiff -u -r1.60.2.1 -r1.60.2.2 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.48.2.1 -r1.48.2.2 src/usr.sbin/npf/npfctl/npfctl.h
cvs rdiff -u -r1.7 -r1.7.2.1 src/usr.sbin/npf/npftest/npftest.conf

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



CVS commit: src/sys/arch/arm/imx/fdt

2019-10-04 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Oct  4 06:49:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_ahcisata.c

Log Message:
Remove FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_ahcisata.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/imx/fdt/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.2 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.2	Mon Aug 19 03:45:51 2019
+++ src/sys/arch/arm/imx/fdt/imx6_ahcisata.c	Fri Oct  4 06:49:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.3 2019/10/04 06:49:40 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.3 2019/10/04 06:49:40 hkenken Exp $");
 
 #include 
 #include 
@@ -116,6 +116,8 @@ imx6_ahcisata_attach(device_t parent, de
 		sc->sc_rx_eq = 3000;
 	if (of_getprop_bool(phandle, "fsl,no-spread-spectrum") == false)
 		sc->sc_ss = 1;
+	else
+		sc->sc_ss = 0;
 
 	sc->sc_clk_sata = fdtbus_clock_get(phandle, "sata");
 	if (sc->sc_clk_sata == NULL) {
@@ -181,8 +183,8 @@ imx6_ahcisata_attach(device_t parent, de
 		return;
 	}
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO,
-	FDT_INTR_MPSAFE, ahci_intr, >sc);
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0,
+	ahci_intr, >sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
 		intrstr);
@@ -412,10 +414,10 @@ imx6_ahcisata_init(struct imx6_ahcisata_
 			val = gpr13_sata_phy_settings[i].def_val;
 		v |= __SHIFTIN(val, gpr13_sata_phy_settings[i].mask);
 	}
-	v |= __SHIFTIN(sc->sc_ss, IOMUX_GPR13_SATA_PHY_5);
 	v |= __SHIFTIN(0x12, IOMUX_GPR13_SATA_PHY_7);	/* Rx SATA2m */
 	v |= __SHIFTIN(3, IOMUX_GPR13_SATA_PHY_6);	/* Rx DPLL mode */
 	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_SPEED);	/* 3.0GHz */
+	v |= __SHIFTIN(sc->sc_ss, IOMUX_GPR13_SATA_PHY_5);
 	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_PHY_1);	/* PLL clock enable */
 	bus_space_write_4(sc->sc_iot, sc->sc_gpr_ioh, IOMUX_GPR13, v);
 



CVS commit: src/sys/arch/arm/imx/fdt

2019-10-04 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Oct  4 06:49:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_ahcisata.c

Log Message:
Remove FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_ahcisata.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-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 06:27:42 UTC 2019

Modified Files:
src/sys/arch/amd64/include: types.h
src/sys/arch/x86/include: bus_defs.h
src/sys/arch/x86/x86: bus_dma.c
src/sys/kern: subr_asan.c
src/sys/sys: asan.h

Log Message:
Add DMA instrumentation in KASAN. We note the original buffer and length in
the map, and check the buffer on each bus_dmamap_sync. This allows us to
find DMA buffer overflows and UAFs, which couldn't be found before because
the device accesses to memory are outside of KASAN's control.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/bus_defs.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/x86/x86/bus_dma.c
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_asan.c
cvs rdiff -u -r1.10 -r1.11 src/sys/sys/asan.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/types.h
diff -u src/sys/arch/amd64/include/types.h:1.62 src/sys/arch/amd64/include/types.h:1.63
--- src/sys/arch/amd64/include/types.h:1.62	Mon Sep 23 23:06:26 2019
+++ src/sys/arch/amd64/include/types.h	Fri Oct  4 06:27:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.62 2019/09/23 23:06:26 kamil Exp $	*/
+/*	$NetBSD: types.h,v 1.63 2019/10/04 06:27:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -108,6 +108,7 @@ typedef	unsigned char		__cpu_simple_lock
 #include "opt_kasan.h"
 #ifdef KASAN
 #define __HAVE_KASAN_INSTR_BUS
+#define __HAVE_KASAN_INSTR_DMA
 #endif
 #if defined(__x86_64__) && !defined(XENPV)
 #if !defined(KASAN)

Index: src/sys/arch/x86/include/bus_defs.h
diff -u src/sys/arch/x86/include/bus_defs.h:1.3 src/sys/arch/x86/include/bus_defs.h:1.4
--- src/sys/arch/x86/include/bus_defs.h:1.3	Mon Sep 23 16:17:58 2019
+++ src/sys/arch/x86/include/bus_defs.h	Fri Oct  4 06:27:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.3 2019/09/23 16:17:58 skrll Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.4 2019/10/04 06:27:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -64,6 +64,10 @@
 #ifndef _X86_BUS_H_
 #define _X86_BUS_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_kasan.h"
+#endif
+
 #include 
 
 #ifdef BUS_SPACE_DEBUG 
@@ -141,6 +145,11 @@ struct x86_bus_dmamap {
 	/*
 	 * PUBLIC MEMBERS: these are used by machine-independent code.
 	 */
+#if defined(KASAN)
+	void		*dm_buf;
+	bus_size_t	dm_buflen;
+	int		dm_buftype;
+#endif
 	bus_size_t	dm_maxsegsz;	/* largest possible segment */
 	bus_size_t	dm_mapsize;	/* size of the mapping */
 	int		dm_nsegs;	/* # valid segments in mapping */

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.79 src/sys/arch/x86/x86/bus_dma.c:1.80
--- src/sys/arch/x86/x86/bus_dma.c:1.79	Fri Jun 14 03:35:31 2019
+++ src/sys/arch/x86/x86/bus_dma.c	Fri Oct  4 06:27:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.79 2019/06/14 03:35:31 mrg Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.80 2019/10/04 06:27:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.79 2019/06/14 03:35:31 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.80 2019/10/04 06:27:42 maxv Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -95,6 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1327,6 +1328,8 @@ bus_dmamap_sync(bus_dma_tag_t t, bus_dma
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_sync(p, o, l, ops);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_SYNC) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1386,6 +1389,8 @@ bus_dmamap_load(bus_dma_tag_t t, bus_dma
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, buf, buflen, KASAN_DMA_LINEAR);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1404,6 +1409,8 @@ bus_dmamap_load_mbuf(bus_dma_tag_t t, bu
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, chain, 0, KASAN_DMA_MBUF);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD_MBUF) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1422,6 +1429,8 @@ bus_dmamap_load_uio(bus_dma_tag_t t, bus
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, uio, 0, KASAN_DMA_UIO);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD_UIO) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1441,6 +1450,8 @@ bus_dmamap_load_raw(bus_dma_tag_t t, bus
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, NULL, 0, KASAN_DMA_RAW);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD_RAW) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {


CVS commit: src/sys

2019-10-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 06:27:42 UTC 2019

Modified Files:
src/sys/arch/amd64/include: types.h
src/sys/arch/x86/include: bus_defs.h
src/sys/arch/x86/x86: bus_dma.c
src/sys/kern: subr_asan.c
src/sys/sys: asan.h

Log Message:
Add DMA instrumentation in KASAN. We note the original buffer and length in
the map, and check the buffer on each bus_dmamap_sync. This allows us to
find DMA buffer overflows and UAFs, which couldn't be found before because
the device accesses to memory are outside of KASAN's control.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/bus_defs.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/x86/x86/bus_dma.c
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_asan.c
cvs rdiff -u -r1.10 -r1.11 src/sys/sys/asan.h

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