CVS commit: src/sys/dev/mii

2019-02-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 25 07:36:16 UTC 2019

Modified Files:
src/sys/dev/mii: mii.h rgephy.c

Log Message:
 MMDACR_FN_{DATANPI,DATAPIRW,DATAPIW} are little hard to identify and might be
misread, so rename them to MMDACR_FN_{DATA,DATA_INC_RW,DATA_INC_W}.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/mii/mii.h
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/mii/rgephy.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/mii/mii.h
diff -u src/sys/dev/mii/mii.h:1.25 src/sys/dev/mii/mii.h:1.26
--- src/sys/dev/mii/mii.h:1.25	Wed Jan 16 08:32:24 2019
+++ src/sys/dev/mii/mii.h	Mon Feb 25 07:36:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii.h,v 1.25 2019/01/16 08:32:24 msaitoh Exp $	*/
+/*	$NetBSD: mii.h,v 1.26 2019/02/25 07:36:16 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
@@ -292,9 +292,9 @@
 #define	MMDACR_FUNCMASK	0xc000	/* function */
 #define	MMDACR_DADDRMASK 0x001f	/* device address */
 #define	MMDACR_FN_ADDRESS	(0 << 14) /* address */
-#define	MMDACR_FN_DATANPI	(1 << 14) /* data, no post increment */
-#define	MMDACR_FN_DATAPIRW	(2 << 14) /* data, post increment on r/w */
-#define	MMDACR_FN_DATAPIW	(3 << 14) /* data, post increment on wr only */
+#define	MMDACR_FN_DATA		(1 << 14) /* data, no post increment */
+#define	MMDACR_FN_DATA_INC_RW	(2 << 14) /* data, post increment on r/w */
+#define	MMDACR_FN_DATA_INC_W	(3 << 14) /* data, post increment on wr only */
 
 #define	MII_MMDAADR	0x0e	/* MMD access address data register */
 

Index: src/sys/dev/mii/rgephy.c
diff -u src/sys/dev/mii/rgephy.c:1.49 src/sys/dev/mii/rgephy.c:1.50
--- src/sys/dev/mii/rgephy.c:1.49	Mon Feb 25 06:59:37 2019
+++ src/sys/dev/mii/rgephy.c	Mon Feb 25 07:36:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephy.c,v 1.49 2019/02/25 06:59:37 msaitoh Exp $	*/
+/*	$NetBSD: rgephy.c,v 1.50 2019/02/25 07:36:16 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.49 2019/02/25 06:59:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.50 2019/02/25 07:36:16 msaitoh Exp $");
 
 
 /*
@@ -702,7 +702,7 @@ rgephy_reset(struct mii_softc *sc)
 		/* disable EEE */
 		PHY_WRITE(sc, MII_MMDACR, MMDACR_FN_ADDRESS | MDIO_MMD_AN);
 		PHY_WRITE(sc, MII_MMDAADR, MDIO_AN_EEEADVERT);
-		PHY_WRITE(sc, MII_MMDACR, MMDACR_FN_DATANPI | MDIO_MMD_AN);
+		PHY_WRITE(sc, MII_MMDACR, MMDACR_FN_DATA | MDIO_MMD_AN);
 		PHY_WRITE(sc, MII_MMDAADR, 0x);
 	}
 }



CVS commit: src/sys/netinet6

2019-02-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 25 07:31:32 UTC 2019

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

Log Message:
Fix the order in udp6_attach: soreserve should be called before
in6_pcballoc, otherwise if it fails there is still a PCB attached, and
we hit a KASSERT in socreate. In !DIAGNOSTIC this would have caused a
memory leak.

By the way I find the splsoftnet highly suspicious, in6_pcballoc already
does that.

Triggered by SyzKaller.

Reported-by: syzbot+7bace612ca3cc3e12...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/netinet6/udp6_usrreq.c

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

Modified files:

Index: src/sys/netinet6/udp6_usrreq.c
diff -u src/sys/netinet6/udp6_usrreq.c:1.146 src/sys/netinet6/udp6_usrreq.c:1.147
--- src/sys/netinet6/udp6_usrreq.c:1.146	Mon Jan 28 12:53:01 2019
+++ src/sys/netinet6/udp6_usrreq.c	Mon Feb 25 07:31:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: udp6_usrreq.c,v 1.146 2019/01/28 12:53:01 martin Exp $ */
+/* $NetBSD: udp6_usrreq.c,v 1.147 2019/02/25 07:31:32 maxv Exp $ */
 /* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */
 /* $KAME: udp6_output.c,v 1.43 2001/10/15 09:19:52 itojun Exp $ */
 
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.146 2019/01/28 12:53:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.147 2019/02/25 07:31:32 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1045,6 +1045,11 @@ udp6_attach(struct socket *so, int proto
 	KASSERT(sotoin6pcb(so) == NULL);
 	sosetlock(so);
 
+	error = soreserve(so, udp6_sendspace, udp6_recvspace);
+	if (error) {
+		return error;
+	}
+
 	/*
 	 * MAPPED_ADDR implementation spec:
 	 *  Always attach for IPv6, and only when necessary for IPv4.
@@ -1055,10 +1060,7 @@ udp6_attach(struct socket *so, int proto
 	if (error) {
 		return error;
 	}
-	error = soreserve(so, udp6_sendspace, udp6_recvspace);
-	if (error) {
-		return error;
-	}
+
 	in6p = sotoin6pcb(so);
 	in6p->in6p_cksum = -1;	/* just to be sure */
 



CVS commit: src/sys/dev/mii

2019-02-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 25 06:59:37 UTC 2019

Modified Files:
src/sys/dev/mii: rgephy.c rgephyreg.h

Log Message:
 It seems EEE support is not only on 8211F but on 8211D and newer.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/mii/rgephy.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/mii/rgephyreg.h

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

Modified files:

Index: src/sys/dev/mii/rgephy.c
diff -u src/sys/dev/mii/rgephy.c:1.48 src/sys/dev/mii/rgephy.c:1.49
--- src/sys/dev/mii/rgephy.c:1.48	Sun Feb 24 17:22:21 2019
+++ src/sys/dev/mii/rgephy.c	Mon Feb 25 06:59:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephy.c,v 1.48 2019/02/24 17:22:21 christos Exp $	*/
+/*	$NetBSD: rgephy.c,v 1.49 2019/02/25 06:59:37 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.48 2019/02/24 17:22:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.49 2019/02/25 06:59:37 msaitoh Exp $");
 
 
 /*
@@ -696,7 +696,7 @@ rgephy_reset(struct mii_softc *sc)
 	/* NWay enable and Restart NWay */
 	PHY_WRITE(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG);
 
-	if (sc->mii_mpd_rev == RGEPHY_8211F) {
+	if (sc->mii_mpd_rev >= RGEPHY_8211D) {
 		/* RTL8211F */
 		delay(1);
 		/* disable EEE */

Index: src/sys/dev/mii/rgephyreg.h
diff -u src/sys/dev/mii/rgephyreg.h:1.11 src/sys/dev/mii/rgephyreg.h:1.12
--- src/sys/dev/mii/rgephyreg.h:1.11	Wed Jun 27 07:51:36 2018
+++ src/sys/dev/mii/rgephyreg.h	Mon Feb 25 06:59:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephyreg.h,v 1.11 2018/06/27 07:51:36 msaitoh Exp $	*/
+/*	$NetBSD: rgephyreg.h,v 1.12 2019/02/25 06:59:37 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -39,6 +39,7 @@
 
 #define	RGEPHY_8211B		2
 #define	RGEPHY_8211C		3
+#define	RGEPHY_8211D		4
 #define	RGEPHY_8211E		5
 #define	RGEPHY_8211F		6
 



CVS commit: src/sys

2019-02-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 25 06:49:44 UTC 2019

Modified Files:
src/sys/netcan: can_pcb.c
src/sys/netinet: sctp_usrreq.c
src/sys/netinet6: raw_ip6.c sctp6_usrreq.c

Log Message:
RIP6, CAN, SCTP and SCTP6 lack a length check in their _send() functions.
Fix RIP6 and CAN, add a big XXX in the SCTP ones.

Found by KASAN, triggered by SyzKaller.

Reported-by: syzbot+0b9692ae0f49f93b7...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/netcan/can_pcb.c
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/sctp_usrreq.c
cvs rdiff -u -r1.174 -r1.175 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.18 -r1.19 src/sys/netinet6/sctp6_usrreq.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/netcan/can_pcb.c
diff -u src/sys/netcan/can_pcb.c:1.6 src/sys/netcan/can_pcb.c:1.7
--- src/sys/netcan/can_pcb.c:1.6	Fri Jun  9 08:21:41 2017
+++ src/sys/netcan/can_pcb.c	Mon Feb 25 06:49:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: can_pcb.c,v 1.6 2017/06/09 08:21:41 bouyer Exp $	*/
+/*	$NetBSD: can_pcb.c,v 1.7 2019/02/25 06:49:44 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: can_pcb.c,v 1.6 2017/06/09 08:21:41 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: can_pcb.c,v 1.7 2019/02/25 06:49:44 maxv Exp $");
 
 #include 
 #include 
@@ -124,6 +124,8 @@ can_pcbbind(void *v, struct sockaddr_can
 
 	if (scan->can_family != AF_CAN)
 		return (EAFNOSUPPORT);
+	if (scan->can_len != sizeof(*scan))
+		return EINVAL;
 	mutex_enter(>canp_mtx);
 	if (scan->can_ifindex != 0) {
 		canp->canp_ifp = if_byindex(scan->can_ifindex);
@@ -157,6 +159,8 @@ can_pcbconnect(void *v, struct sockaddr_
 
 	if (scan->can_family != AF_CAN)
 		return (EAFNOSUPPORT);
+	if (scan->can_len != sizeof(*scan))
+		return EINVAL;
 #if 0
 	mutex_enter(>canp_mtx);
 	memcpy(>canp_dst, scan, sizeof(struct sockaddr_can));

Index: src/sys/netinet/sctp_usrreq.c
diff -u src/sys/netinet/sctp_usrreq.c:1.17 src/sys/netinet/sctp_usrreq.c:1.18
--- src/sys/netinet/sctp_usrreq.c:1.17	Sun Feb 24 07:20:33 2019
+++ src/sys/netinet/sctp_usrreq.c	Mon Feb 25 06:49:44 2019
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $	*/
-/*	$NetBSD: sctp_usrreq.c,v 1.17 2019/02/24 07:20:33 maxv Exp $	*/
+/*	$NetBSD: sctp_usrreq.c,v 1.18 2019/02/25 06:49:44 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.17 2019/02/24 07:20:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.18 2019/02/25 06:49:44 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -638,6 +638,11 @@ sctp_send(struct socket *so, struct mbuf
 		return EINVAL;
 	}
 #endif /* INET6 */
+
+	/*
+	 * XXX XXX XXX Check addr->sa_len?
+	 */
+
  connected_type:
 	/* now what about control */
 	if (control) {

Index: src/sys/netinet6/raw_ip6.c
diff -u src/sys/netinet6/raw_ip6.c:1.174 src/sys/netinet6/raw_ip6.c:1.175
--- src/sys/netinet6/raw_ip6.c:1.174	Sun Feb 24 07:20:33 2019
+++ src/sys/netinet6/raw_ip6.c	Mon Feb 25 06:49:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip6.c,v 1.174 2019/02/24 07:20:33 maxv Exp $	*/
+/*	$NetBSD: raw_ip6.c,v 1.175 2019/02/25 06:49:44 maxv Exp $	*/
 /*	$KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.174 2019/02/24 07:20:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.175 2019/02/25 06:49:44 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -891,6 +891,10 @@ rip6_send(struct socket *so, struct mbuf
 			error = EAFNOSUPPORT;
 			goto release;
 		}
+		if (dst->sin6_len != sizeof(*dst)) {
+			error = EINVAL;
+			goto release;
+		}
 	}
 	error = rip6_output(m, so, dst, control);
 	m = NULL;

Index: src/sys/netinet6/sctp6_usrreq.c
diff -u src/sys/netinet6/sctp6_usrreq.c:1.18 src/sys/netinet6/sctp6_usrreq.c:1.19
--- src/sys/netinet6/sctp6_usrreq.c:1.18	Sun Feb 24 07:20:33 2019
+++ src/sys/netinet6/sctp6_usrreq.c	Mon Feb 25 06:49:44 2019
@@ -1,5 +1,5 @@
 /* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */
-/* $NetBSD: sctp6_usrreq.c,v 1.18 2019/02/24 07:20:33 maxv Exp $ */
+/* $NetBSD: sctp6_usrreq.c,v 1.19 2019/02/25 06:49:44 maxv Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp6_usrreq.c,v 1.18 2019/02/24 07:20:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp6_usrreq.c,v 1.19 2019/02/25 06:49:44 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -833,6 +833,9 @@ sctp6_send(struct socket *so, struct mbu
 
 #ifdef INET
 	sin6 = (struct sockaddr_in6 *)nam;
+	/*
+	 * XXX XXX XXX Check sin6->sin6_len?
+	 */
 	if (inp6->in6p_flags 

CVS commit: src/sys/dev/mii

2019-02-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 25 06:23:53 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.140 src/sys/dev/mii/miidevs.h:1.141
--- src/sys/dev/mii/miidevs.h:1.140	Wed Feb 13 08:40:14 2019
+++ src/sys/dev/mii/miidevs.h	Mon Feb 25 06:23:53 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.140 2019/02/13 08:40:14 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.141 2019/02/25 06:23:53 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.140 2019/02/13 08:39:55 msaitoh Exp
+ *	NetBSD: miidevs,v 1.142 2019/02/25 06:23:33 msaitoh Exp
  */
 
 /*-
@@ -141,6 +141,20 @@
 #define	MII_MODEL_xxASIX_AX88X9X	0x0031
 #define	MII_STR_xxASIX_AX88X9X	"Ax88x9x internal PHY"
 
+/* Altima Communications PHYs */
+/* Don't know the model for ACXXX */
+#define	MII_MODEL_ALTIMA_ACXXX	0x0001
+#define	MII_STR_ALTIMA_ACXXX	"ACXXX 10/100 media interface"
+#define	MII_MODEL_ALTIMA_AC101L	0x0012
+#define	MII_STR_ALTIMA_AC101L	"AC101L 10/100 media interface"
+#define	MII_MODEL_ALTIMA_AC101	0x0021
+#define	MII_STR_ALTIMA_AC101	"AC101 10/100 media interface"
+/* AMD Am79C87[45] have ALTIMA OUI */
+#define	MII_MODEL_ALTIMA_Am79C875	0x0014
+#define	MII_STR_ALTIMA_Am79C875	"Am79C875 10/100 media interface"
+#define	MII_MODEL_ALTIMA_Am79C874	0x0021
+#define	MII_STR_ALTIMA_Am79C874	"Am79C874 10/100 media interface"
+
 /* Atheros PHYs */
 #define	MII_MODEL_ATHEROS_F1	0x0001
 #define	MII_STR_ATHEROS_F1	"F1 10/100/1000 PHY"
@@ -157,20 +171,6 @@
 #define	MII_MODEL_ATTANSIC_AR8035	0x0007
 #define	MII_STR_ATTANSIC_AR8035	"Atheros AR8035 10/100/1000 PHY"
 
-/* Altima Communications PHYs */
-/* Don't know the model for ACXXX */
-#define	MII_MODEL_ALTIMA_ACXXX	0x0001
-#define	MII_STR_ALTIMA_ACXXX	"ACXXX 10/100 media interface"
-#define	MII_MODEL_ALTIMA_AC101L	0x0012
-#define	MII_STR_ALTIMA_AC101L	"AC101L 10/100 media interface"
-#define	MII_MODEL_ALTIMA_AC101	0x0021
-#define	MII_STR_ALTIMA_AC101	"AC101 10/100 media interface"
-/* AMD Am79C87[45] have ALTIMA OUI */
-#define	MII_MODEL_ALTIMA_Am79C875	0x0014
-#define	MII_STR_ALTIMA_Am79C875	"Am79C875 10/100 media interface"
-#define	MII_MODEL_ALTIMA_Am79C874	0x0021
-#define	MII_STR_ALTIMA_Am79C874	"Am79C874 10/100 media interface"
-
 /* Advanced Micro Devices PHYs */
 /* see Davicom DM9101 for Am79C873 */
 #define	MII_MODEL_yyAMD_79C972_10T	0x0001
@@ -312,6 +312,8 @@
 
 /* Davicom Semiconductor PHYs */
 /* AMD Am79C873 seems to be a relabeled DM9101 */
+#define	MII_MODEL_DAVICOM_DM9101	0x
+#define	MII_STR_DAVICOM_DM9101	"DM9101 (AMD Am79C873) 10/100 media interface"
 #define	MII_MODEL_xxDAVICOM_DM9101	0x
 #define	MII_STR_xxDAVICOM_DM9101	"DM9101 (AMD Am79C873) 10/100 media interface"
 #define	MII_MODEL_xxDAVICOM_DM9102	0x0004

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.128 src/sys/dev/mii/miidevs_data.h:1.129
--- src/sys/dev/mii/miidevs_data.h:1.128	Wed Feb 13 08:40:14 2019
+++ src/sys/dev/mii/miidevs_data.h	Mon Feb 25 06:23:53 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.128 2019/02/13 08:40:14 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.129 2019/02/25 06:23:53 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.140 2019/02/13 08:39:55 msaitoh Exp
+ *	NetBSD: miidevs,v 1.142 2019/02/25 06:23:33 msaitoh Exp
  */
 
 /*-
@@ -39,17 +39,17 @@
 struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_AGERE, MII_MODEL_AGERE_ET1011, MII_STR_AGERE_ET1011 },
  { MII_OUI_xxASIX, MII_MODEL_xxASIX_AX88X9X, MII_STR_xxASIX_AX88X9X },
+ { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_ACXXX, MII_STR_ALTIMA_ACXXX },
+ { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_AC101L, MII_STR_ALTIMA_AC101L },
+ { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_AC101, MII_STR_ALTIMA_AC101 },
+ { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_Am79C875, MII_STR_ALTIMA_Am79C875 },
+ { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_Am79C874, MII_STR_ALTIMA_Am79C874 },
  { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_F1, MII_STR_ATHEROS_F1 },
  { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_F2, MII_STR_ATHEROS_F2 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_L1, MII_STR_ATTANSIC_L1 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_L2, MII_STR_ATTANSIC_L2 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_AR8021, MII_STR_ATTANSIC_AR8021 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_AR8035, MII_STR_ATTANSIC_AR8035 },
- { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_ACXXX, MII_STR_ALTIMA_ACXXX },
- { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_AC101L, MII_STR_ALTIMA_AC101L },
- { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_AC101, MII_STR_ALTIMA_AC101 },
- { 

CVS commit: src/sys/dev/mii

2019-02-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 25 06:23:33 UTC 2019

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Add non-xx'ed DAVICOM DM9101.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.141 src/sys/dev/mii/miidevs:1.142
--- src/sys/dev/mii/miidevs:1.141	Thu Feb 14 04:34:37 2019
+++ src/sys/dev/mii/miidevs	Mon Feb 25 06:23:33 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.141 2019/02/14 04:34:37 msaitoh Exp $
+$NetBSD: miidevs,v 1.142 2019/02/25 06:23:33 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -226,6 +226,7 @@ model xxCICADA CS8201B		0x0021 Cicada CS
 
 /* Davicom Semiconductor PHYs */
 /* AMD Am79C873 seems to be a relabeled DM9101 */
+model DAVICOM DM9101		0x DM9101 (AMD Am79C873) 10/100 media interface
 model xxDAVICOM DM9101		0x DM9101 (AMD Am79C873) 10/100 media interface
 model xxDAVICOM DM9102		0x0004 DM9102 10/100 media interface
 



CVS commit: src/sys/ufs/ufs

2019-02-24 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Feb 25 06:00:40 UTC 2019

Modified Files:
src/sys/ufs/ufs: ufs_vnops.c

Log Message:
Revert -r1.244-245 of ufs_vnops.c; they are wrong.
Fix the mistake in -r1.243 that made them look like reasonable changes.

(this does not affect whether the -r1.243 change works with the union
mount path in libc, but fixes an immediate hazard)


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/sys/ufs/ufs/ufs_vnops.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.245 src/sys/ufs/ufs/ufs_vnops.c:1.246
--- src/sys/ufs/ufs/ufs_vnops.c:1.245	Mon Feb 25 00:51:24 2019
+++ src/sys/ufs/ufs/ufs_vnops.c	Mon Feb 25 06:00:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1246,7 +1246,7 @@ ufs_readdir(void *v)
 	size_t		numcookies, maxcookies;
 	/* disk buffer */
 	off_t		physstart, physend;
-	size_t		skipstart;
+	size_t		skipstart, dropend;
 	char		*rawbuf;
 	size_t		rawbufmax, rawbytes;
 	struct uio	rawuio;
@@ -1277,11 +1277,13 @@ ufs_readdir(void *v)
 	}
 
 	skipstart = startoffset - physstart;
+	dropend = endoffset - physend;
 
 	/* how much to actually read */
 	rawbufmax = callerbytes + skipstart;
 	if (rawbufmax < callerbytes)
 		return EINVAL;
+	rawbufmax -= dropend;
 
 	if (rawbufmax < _DIRENT_MINSIZE(rawdp)) {
 		/* no room for even one struct direct */



CVS commit: src/sys/ufs/ufs

2019-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 25 00:51:24 UTC 2019

Modified Files:
src/sys/ufs/ufs: ufs_vnops.c

Log Message:
drop unused


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/ufs/ufs/ufs_vnops.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.244 src/sys/ufs/ufs/ufs_vnops.c:1.245
--- src/sys/ufs/ufs/ufs_vnops.c:1.244	Sun Feb 24 19:11:13 2019
+++ src/sys/ufs/ufs/ufs_vnops.c	Sun Feb 24 19:51:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.244 2019/02/25 00:11:13 christos Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.244 2019/02/25 00:11:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1246,7 +1246,7 @@ ufs_readdir(void *v)
 	size_t		numcookies, maxcookies;
 	/* disk buffer */
 	off_t		physstart, physend;
-	size_t		skipstart, dropend;
+	size_t		skipstart;
 	char		*rawbuf;
 	size_t		rawbufmax, rawbytes;
 	struct uio	rawuio;
@@ -1277,7 +1277,6 @@ ufs_readdir(void *v)
 	}
 
 	skipstart = startoffset - physstart;
-	dropend = endoffset - physend;
 
 	/* how much to actually read */
 	rawbufmax = callerbytes + skipstart;



CVS commit: src/sys/dev/mii

2019-02-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 25 04:26:22 UTC 2019

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
 Remove xxMARVELL E1000 and duplicated xxMARVELL E1000S to make functionality
the same as rev. 1.54.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/mii/makphy.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/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.55 src/sys/dev/mii/makphy.c:1.56
--- src/sys/dev/mii/makphy.c:1.55	Sun Feb 24 17:22:21 2019
+++ src/sys/dev/mii/makphy.c	Mon Feb 25 04:26:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.55 2019/02/24 17:22:21 christos Exp $	*/
+/*	$NetBSD: makphy.c,v 1.56 2019/02/25 04:26:22 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.55 2019/02/24 17:22:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.56 2019/02/25 04:26:22 msaitoh Exp $");
 
 #include 
 #include 
@@ -96,8 +96,6 @@ static const struct mii_phydesc makphys[
 	MII_PHY_DESC(MARVELL, E1000_3),
 	MII_PHY_DESC(MARVELL, E1000_5),
 	MII_PHY_DESC(MARVELL, E1000_6),
-	MII_PHY_DESC(xxMARVELL, E1000),
-	MII_PHY_DESC(xxMARVELL, E1000S),
 	MII_PHY_DESC(xxMARVELL, E1000_3),
 	MII_PHY_DESC(xxMARVELL, E1000_5),
 	MII_PHY_DESC(xxMARVELL, E1000S),



CVS commit: src/sys/dev/gpib

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 20:54:13 UTC 2019

Modified Files:
src/sys/dev/gpib: mt.c

Log Message:
Add missing FALLTHROUGH in gpib/mt.c

Requested by GCC in NetBSD/i386 kUBSan KCOV build.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/gpib/mt.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/gpib/mt.c
diff -u src/sys/dev/gpib/mt.c:1.31 src/sys/dev/gpib/mt.c:1.32
--- src/sys/dev/gpib/mt.c:1.31	Sat Oct 28 04:53:56 2017
+++ src/sys/dev/gpib/mt.c	Sun Feb 24 20:54:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mt.c,v 1.31 2017/10/28 04:53:56 riastradh Exp $ */
+/*	$NetBSD: mt.c,v 1.32 2019/02/24 20:54:13 kamil Exp $ */
 
 /*-
  * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.31 2017/10/28 04:53:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.32 2019/02/24 20:54:13 kamil Exp $");
 
 #include 
 #include 
@@ -628,6 +628,7 @@ mtstart(struct mt_softc *sc)
 sc->sc_flags &= ~MTF_REW;
 break;
 			}
+			/* FALLTHROUGH */
 		case -2:
 			/*
 			 * -2 means "timeout" reading DSJ, which is probably
@@ -639,6 +640,7 @@ mtstart(struct mt_softc *sc)
 mtstart_callout, sc);
 return;
 			}
+			/* FALLTHROUGH */
 		case 2:
 			if (bp->b_cmd != MTNOP || !(bp->b_flags & B_CMD)) {
 bp->b_error = EBUSY;



CVS commit: src/sys/netinet

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 21:07:59 UTC 2019

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

Log Message:
Add missing FALLTHROUGH in sctp_input.c

Requested by GCC NetBSD/i386 kUBSan KCOC build.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/netinet/sctp_input.c

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

Modified files:

Index: src/sys/netinet/sctp_input.c
diff -u src/sys/netinet/sctp_input.c:1.12 src/sys/netinet/sctp_input.c:1.13
--- src/sys/netinet/sctp_input.c:1.12	Tue Feb 12 14:40:38 2019
+++ src/sys/netinet/sctp_input.c	Sun Feb 24 21:07:59 2019
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_input.c,v 1.28 2005/04/21 18:36:21 nishida Exp $	*/
-/*	$NetBSD: sctp_input.c,v 1.12 2019/02/12 14:40:38 rjs Exp $	*/
+/*	$NetBSD: sctp_input.c,v 1.13 2019/02/24 21:07:59 kamil Exp $	*/
 
 /*
  * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_input.c,v 1.12 2019/02/12 14:40:38 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_input.c,v 1.13 2019/02/24 21:07:59 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -682,6 +682,7 @@ sctp_process_unrecog_chunk(struct sctp_t
 			printf("Strange peer, snds ASCONF but does not recongnize asconf-ack?\n");
 		}
 #endif
+		/* FALLTHROUGH */
 	case SCTP_ASCONF:
 #ifdef SCTP_DEBUG
 		if (sctp_debug_on & SCTP_DEBUG_INPUT2) {



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

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 20:56:28 UTC 2019

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
Enable kUBSan and KCOV in NetBSD/i386 kernel=ALL


To generate a diff of this commit:
cvs rdiff -u -r1.463 -r1.464 src/sys/arch/i386/conf/ALL

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/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.463 src/sys/arch/i386/conf/ALL:1.464
--- src/sys/arch/i386/conf/ALL:1.463	Wed Feb  6 11:58:31 2019
+++ src/sys/arch/i386/conf/ALL	Sun Feb 24 20:56:27 2019
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.463 2019/02/06 11:58:31 rin Exp $
+# $NetBSD: ALL,v 1.464 2019/02/24 20:56:27 kamil Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.463 $"
+#ident		"ALL-$Revision: 1.464 $"
 
 maxusers	64		# estimated number of users
 
@@ -110,6 +110,7 @@ options 	BUFQ_PRIOCSCAN
 # Diagnostic/debugging support options
 options 	DIAGNOSTIC	# inexpensive kernel consistency checks
 options 	DEBUG		# expensive debugging checks/support
+options		KUBSAN		# Kernel Undefined Behavior Sanitizer (kUBSan)
 options 	LOCKDEBUG	# expensive locking checks/support
 options 	DDB		# in-kernel debugger
 options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'
@@ -118,6 +119,7 @@ options 	DDB_VERBOSE_HELP
 options 	KGDB		# remote debugger
 options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
 makeoptions	DEBUG="-g"	# compile full symbol table
+options		KUBSAN		# Kernel Undefined Behavior Sanitizer (kUBSan)
 options 	SYSCALL_STATS	# per syscall counts
 options 	SYSCALL_TIMES	# per syscall times
 options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)
@@ -125,6 +127,10 @@ options 	KDTRACE_HOOKS	# kernel DTrace h
 options 	UVMHIST		# kernhist for uvm subsystem
 options 	BIOHIST		# kernhist for buff I/O
 
+# Kernel Code Coverage Driver.
+makeoptions	KCOV=1
+options		KCOV
+
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI



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

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 20:58:55 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
Enable kUBSan kASan and KCOV in NetBSD/amd64 kernel=ALL

Add disabled KLEAK as it conflicts right now with KCOV, using the same
compiler instrumentation.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/amd64/conf/ALL

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.115 src/sys/arch/amd64/conf/ALL:1.116
--- src/sys/arch/amd64/conf/ALL:1.115	Wed Feb  6 11:58:30 2019
+++ src/sys/arch/amd64/conf/ALL	Sun Feb 24 20:58:55 2019
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.115 2019/02/06 11:58:30 rin Exp $
+# $NetBSD: ALL,v 1.116 2019/02/24 20:58:55 kamil Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.115 $"
+#ident		"ALL-$Revision: 1.116 $"
 
 maxusers	64		# estimated number of users
 
@@ -120,6 +120,7 @@ options 	KGDB		# remote debugger
 options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
 makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
 makeoptions	DEBUG="-g"	# compile full symbol table
+options		KUBSAN		# Kernel Undefined Behavior Sanitizer (kUBSan)
 options 	SYSCALL_STATS	# per syscall counts
 options 	SYSCALL_TIMES	# per syscall times
 options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)
@@ -127,6 +128,19 @@ options 	KDTRACE_HOOKS	# kernel DTrace h
 options 	UVMHIST		# kernhist for uvm subsystem
 options 	BIOHIST		# kernhist for buff I/O
 
+# Kernel Address Sanitizer (kASan). You need to disable SVS to use it.
+makeoptions	KASAN=1		# Kernel Address Sanitizer
+options		KASAN
+#no options SVS
+
+# Kernel Info Leak Detector.
+#makeoptions	KLEAK=1
+#options		KLEAK
+
+# Kernel Code Coverage Driver.
+makeoptions	KCOV=1
+options		KCOV
+
 # Compatibility options
 options 	EXEC_AOUT	# required by binaries from before 1.5
 options 	COMPAT_386BSD_MBRPART # recognize old partition ID



CVS commit: src

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 21:14:43 UTC 2019

Modified Files:
src/sys/sys: kcov.h
src/tests/modules: t_kcov.c

Log Message:
Add KCOV_LOAD() and KCOV_STORE() - new helper macros

New macros prefer 64-bit atomic operations whenever accessible.

As a fallback they use volatile move operations that are not known
to have negative effect in KCOV even if interrupted in the middle of
operation.

Enable kcov_basic and kcov_thread tests on targets without
__HAVE_ATOMIC64_OPS.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/sys/kcov.h
cvs rdiff -u -r1.2 -r1.3 src/tests/modules/t_kcov.c

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

Modified files:

Index: src/sys/sys/kcov.h
diff -u src/sys/sys/kcov.h:1.1 src/sys/sys/kcov.h:1.2
--- src/sys/sys/kcov.h:1.1	Sat Feb 23 03:10:06 2019
+++ src/sys/sys/kcov.h	Sun Feb 24 21:14:43 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: kcov.h,v 1.1 2019/02/23 03:10:06 kamil Exp $*/
+/*  $NetBSD: kcov.h,v 1.2 2019/02/24 21:14:43 kamil Exp $*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -32,6 +32,10 @@
 #ifndef _SYS_KCOV_H_
 #define _SYS_KCOV_H_
 
+#include 
+#include 
+#include 
+
 #define KCOV_IOC_SETBUFSIZE	_IOW('K', 1, uint64_t)
 #define KCOV_IOC_ENABLE		_IO('K', 2)
 #define KCOV_IOC_DISABLE	_IO('K', 3)
@@ -39,4 +43,19 @@
 typedef volatile uint64_t kcov_int_t;
 #define KCOV_ENTRY_SIZE sizeof(kcov_int_t)
 
+/*
+ * Always prefer 64-bit atomic operations whenever accessible.
+ *
+ * As a fallback keep regular volatile move operation that it's not known
+ * to have negative effect in KCOV even if interrupted in the middle of
+ * operation.
+ */
+#ifdef __HAVE_ATOMIC64_OPS
+#define KCOV_STORE(x,v)	__atomic_store_n(&(x), (v), __ATOMIC_RELAXED)
+#define KCOV_LOAD(x)	__atomic_load_n(&(x), __ATOMIC_RELAXED)
+#else
+#define KCOV_STORE(x,v)	(x) = (y)
+#define KCOV_LOAD(x)	(x)
+#endif
+
 #endif /* !_SYS_KCOV_H_ */

Index: src/tests/modules/t_kcov.c
diff -u src/tests/modules/t_kcov.c:1.2 src/tests/modules/t_kcov.c:1.3
--- src/tests/modules/t_kcov.c:1.2	Sat Feb 23 08:03:24 2019
+++ src/tests/modules/t_kcov.c	Sun Feb 24 21:14:43 2019
@@ -254,10 +254,10 @@ ATF_TC_BODY(kcov_basic, tc)
 	ATF_REQUIRE_MSG(ioctl(fd, KCOV_IOC_ENABLE) == 0,
 	"Unable to enable kcov ");
 
-	__atomic_store_n([0], 0 , __ATOMIC_RELAXED);
+	KCOV_STORE([0], 0);
 
 	sleep(0);
-	ATF_REQUIRE_MSG(__atomic_load_n([0], __ATOMIC_RELAXED) != 0, "No records found");
+	ATF_REQUIRE_MSG(KCOV_LOAD([0]) != 0, "No records found");
 
 	ATF_REQUIRE_MSG(ioctl(fd, KCOV_IOC_DISABLE) == 0,
 	"Unable to disable kcov");
@@ -270,9 +270,9 @@ thread_test_helper(void *ptr)
 {
 	kcov_int_t *buf = ptr;
 
-	__atomic_store_n([0], 0, __ATOMIC_RELAXED);
+	KCOV_STORE([0], 0);
 	sleep(0);
-	ATF_REQUIRE_MSG(__atomic_load_n([0], __ATOMIC_RELAXED) == 0,
+	ATF_REQUIRE_MSG(KCOV_LOAD([0]) == 0,
 	"Records changed in blocked thread");
 
 	return NULL;
@@ -311,9 +311,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, kcov_enable_no_disable);
 	ATF_TP_ADD_TC(tp, kcov_enable_no_disable_no_close);
 	ATF_TP_ADD_TC(tp, kcov_mmap_enable_thread_close);
-#ifdef __HAVE_ATOMIC64_OPS
 	ATF_TP_ADD_TC(tp, kcov_basic);
 	ATF_TP_ADD_TC(tp, kcov_thread);
-#endif
 	return atf_no_error();
 }



CVS commit: src/sys/dev/mii

2019-02-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 25 04:24:22 UTC 2019

Modified Files:
src/sys/dev/mii: dmphy.c

Log Message:
 Fix previos to not to duplicate DM9101 entry. One is DAVICOM and another
is xxDAVICOM.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/mii/dmphy.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/mii/dmphy.c
diff -u src/sys/dev/mii/dmphy.c:1.39 src/sys/dev/mii/dmphy.c:1.40
--- src/sys/dev/mii/dmphy.c:1.39	Sun Feb 24 17:22:21 2019
+++ src/sys/dev/mii/dmphy.c	Mon Feb 25 04:24:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmphy.c,v 1.39 2019/02/24 17:22:21 christos Exp $	*/
+/*	$NetBSD: dmphy.c,v 1.40 2019/02/25 04:24:22 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dmphy.c,v 1.39 2019/02/24 17:22:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dmphy.c,v 1.40 2019/02/25 04:24:22 msaitoh Exp $");
 
 #include 
 #include 
@@ -94,7 +94,7 @@ static const struct mii_phy_funcs dmphy_
 static const struct mii_phydesc dmphys[] = {
 	MII_PHY_DESC(xxDAVICOM, DM9101),
 	MII_PHY_DESC(xxDAVICOM, DM9102),
-	MII_PHY_DESC(xxDAVICOM, DM9101),
+	MII_PHY_DESC(DAVICOM, DM9101),
 	MII_PHY_END,
 };
 



CVS commit: src/sys/dev/mii

2019-02-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 25 04:56:30 UTC 2019

Modified Files:
src/sys/dev/mii: brgphy.c

Log Message:
- Add Broadcom BCM540[24], BCM5424 and BCM5466.
- Sort lines.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/mii/brgphy.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/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.81 src/sys/dev/mii/brgphy.c:1.82
--- src/sys/dev/mii/brgphy.c:1.81	Sun Feb 24 17:22:21 2019
+++ src/sys/dev/mii/brgphy.c	Mon Feb 25 04:56:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.81 2019/02/24 17:22:21 christos Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.82 2019/02/25 04:56:30 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.81 2019/02/24 17:22:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.82 2019/02/25 04:56:30 msaitoh Exp $");
 
 #include 
 #include 
@@ -140,12 +140,16 @@ static const struct mii_phy_funcs brgphy
 static const struct mii_phydesc brgphys[] = {
 	MII_PHY_DESC(BROADCOM, BCM5400),
 	MII_PHY_DESC(BROADCOM, BCM5401),
+	MII_PHY_DESC(BROADCOM, BCM5402),
+	MII_PHY_DESC(BROADCOM, BCM5404),
 	MII_PHY_DESC(BROADCOM, BCM5411),
 	MII_PHY_DESC(BROADCOM, BCM5421),
-	MII_PHY_DESC(BROADCOM, BCM5462),
+	MII_PHY_DESC(BROADCOM, BCM5424),
 	MII_PHY_DESC(BROADCOM, BCM5461),
-	MII_PHY_DESC(BROADCOM, BCM54K2),
+	MII_PHY_DESC(BROADCOM, BCM5462),
 	MII_PHY_DESC(BROADCOM, BCM5464),
+	MII_PHY_DESC(BROADCOM, BCM5466),
+	MII_PHY_DESC(BROADCOM, BCM54K2),
 	MII_PHY_DESC(BROADCOM, BCM5701),
 	MII_PHY_DESC(BROADCOM, BCM5703),
 	MII_PHY_DESC(BROADCOM, BCM5704),



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

2019-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 25 02:31:58 UTC 2019

Modified Files:
src/external/mpl/dhcp/dist/omapip: result.c

Log Message:
Catch up with bind


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/mpl/dhcp/dist/omapip/result.c

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

Modified files:

Index: src/external/mpl/dhcp/dist/omapip/result.c
diff -u src/external/mpl/dhcp/dist/omapip/result.c:1.2 src/external/mpl/dhcp/dist/omapip/result.c:1.3
--- src/external/mpl/dhcp/dist/omapip/result.c:1.2	Sat Apr  7 18:37:30 2018
+++ src/external/mpl/dhcp/dist/omapip/result.c	Sun Feb 24 21:31:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: result.c,v 1.2 2018/04/07 22:37:30 christos Exp $	*/
+/*	$NetBSD: result.c,v 1.3 2019/02/25 02:31:57 christos Exp $	*/
 
 /* result.c
  */
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: result.c,v 1.2 2018/04/07 22:37:30 christos Exp $");
+__RCSID("$NetBSD: result.c,v 1.3 2019/02/25 02:31:57 christos Exp $");
 
 #include "dhcpd.h"
 
@@ -77,15 +77,12 @@ static const char *text[DHCP_R_NRESULTS]
 #define DHCP_RESULT_RESULTSET		2
 #define DHCP_RESULT_UNAVAILABLESET	3
 
-// This is a placeholder as we don't allow for external message catalogs yet
-isc_msgcat_t * dhcp_msgcat = NULL;
-
 isc_result_t
 dhcp_result_register(void) {
 	isc_result_t result;
 
 	result = isc_result_register(ISC_RESULTCLASS_DHCP, DHCP_R_NRESULTS,
- text, dhcp_msgcat, DHCP_RESULT_RESULTSET);
+ text, DHCP_RESULT_RESULTSET);
 
 	return(result);
 }



CVS commit: src/sys/ufs/ufs

2019-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 25 00:11:13 UTC 2019

Modified Files:
src/sys/ufs/ufs: ufs_vnops.c

Log Message:
remove junk assignment.


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/ufs/ufs/ufs_vnops.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.243 src/sys/ufs/ufs/ufs_vnops.c:1.244
--- src/sys/ufs/ufs/ufs_vnops.c:1.243	Sun Feb 24 14:06:40 2019
+++ src/sys/ufs/ufs/ufs_vnops.c	Sun Feb 24 19:11:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.243 2019/02/24 19:06:40 mlelstv Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.244 2019/02/25 00:11:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.243 2019/02/24 19:06:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.244 2019/02/25 00:11:13 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1283,7 +1283,6 @@ ufs_readdir(void *v)
 	rawbufmax = callerbytes + skipstart;
 	if (rawbufmax < callerbytes)
 		return EINVAL;
-	rawbuf -= dropend;
 
 	if (rawbufmax < _DIRENT_MINSIZE(rawdp)) {
 		/* no room for even one struct direct */



CVS commit: src/sys/dev/isa

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 20:50:03 UTC 2019

Modified Files:
src/sys/dev/isa: mcd.c

Log Message:
Add missing FALLTHROUGH in isa/mcd.c

Requested by GCC in NetBSD/i386 kUBSan KCOV build.

Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/isa/mcd.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/isa/mcd.c
diff -u src/sys/dev/isa/mcd.c:1.117 src/sys/dev/isa/mcd.c:1.118
--- src/sys/dev/isa/mcd.c:1.117	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/isa/mcd.c	Sun Feb 24 20:50:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcd.c,v 1.117 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: mcd.c,v 1.118 2019/02/24 20:50:03 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.  All rights reserved.
@@ -56,7 +56,7 @@
 /*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.117 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.118 2019/02/24 20:50:03 kamil Exp $");
 
 #include 
 #include 
@@ -1192,6 +1192,7 @@ mcdintr(void *arg)
 		mbx->count = RDELAY_WAITMODE;
 		mbx->state = MCD_S_WAITMODE;
 
+		/* FALLTHROUGH */
 	case MCD_S_WAITMODE:
 		callout_stop(>sc_pintr_ch);
 		for (i = 20; i; i--) {
@@ -1230,6 +1231,7 @@ mcdintr(void *arg)
 		mbx->count = RDELAY_WAITREAD;
 		mbx->state = MCD_S_WAITREAD;
 
+		/* FALLTHROUGH */
 	case MCD_S_WAITREAD:
 		callout_stop(>sc_pintr_ch);
 	nextblock:



CVS commit: src/distrib/sets/lists

2019-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 24 20:06:43 UTC 2019

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

Log Message:
update for new bind


To generate a diff of this commit:
cvs rdiff -u -r1.856 -r1.857 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.216 -r1.217 src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.856 src/distrib/sets/lists/base/shl.mi:1.857
--- src/distrib/sets/lists/base/shl.mi:1.856	Thu Feb 14 15:42:40 2019
+++ src/distrib/sets/lists/base/shl.mi	Sun Feb 24 15:06:43 2019
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.856 2019/02/14 20:42:40 christos Exp $
+# $NetBSD: shl.mi,v 1.857 2019/02/24 20:06:43 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -202,8 +202,8 @@
 ./usr/lib/libbfd.so.16base-sys-shlib		compatfile,binutils=231
 ./usr/lib/libbfd.so.16.0			base-sys-shlib		compatfile,binutils=231
 ./usr/lib/libbind9.sobase-bind-shlib		compatfile
-./usr/lib/libbind9.so.10base-bind-shlib		compatfile
-./usr/lib/libbind9.so.10.0			base-bind-shlib		compatfile
+./usr/lib/libbind9.so.11base-bind-shlib		compatfile
+./usr/lib/libbind9.so.11.0			base-bind-shlib		compatfile
 ./usr/lib/libblacklist.so			base-sys-shlib		compatfile
 ./usr/lib/libblacklist.so.0			base-sys-shlib		compatfile
 ./usr/lib/libblacklist.so.0.0			base-sys-shlib		compatfile
@@ -259,8 +259,8 @@
 ./usr/lib/libdm.so.0base-sys-shlib		compatfile
 ./usr/lib/libdm.so.0.0base-sys-shlib		compatfile
 ./usr/lib/libdns.sobase-bind-shlib		compatfile
-./usr/lib/libdns.so.10base-bind-shlib		compatfile
-./usr/lib/libdns.so.10.0			base-bind-shlib		compatfile
+./usr/lib/libdns.so.11base-bind-shlib		compatfile
+./usr/lib/libdns.so.11.0			base-bind-shlib		compatfile
 ./usr/lib/libdns_sd.sobase-mdns-shlib		compatfile,mdns
 ./usr/lib/libdns_sd.so.0			base-mdns-shlib		compatfile,mdns
 ./usr/lib/libdns_sd.so.0.0			base-mdns-shlib		compatfile,mdns
@@ -335,17 +335,17 @@
 ./usr/lib/libipsec.so.3base-net-shlib		compatfile
 ./usr/lib/libipsec.so.3.0			base-net-shlib		compatfile
 ./usr/lib/libirs.sobase-bind-shlib		compatfile
-./usr/lib/libirs.so.10base-bind-shlib		compatfile
-./usr/lib/libirs.so.10.0			base-bind-shlib		compatfile
+./usr/lib/libirs.so.11base-bind-shlib		compatfile
+./usr/lib/libirs.so.11.0			base-bind-shlib		compatfile
 ./usr/lib/libisc.sobase-bind-shlib		compatfile
-./usr/lib/libisc.so.10base-bind-shlib		compatfile
-./usr/lib/libisc.so.10.0			base-bind-shlib		compatfile
+./usr/lib/libisc.so.11base-bind-shlib		compatfile
+./usr/lib/libisc.so.11.0			base-bind-shlib		compatfile
 ./usr/lib/libisccc.sobase-bind-shlib		compatfile
-./usr/lib/libisccc.so.10			base-bind-shlib		compatfile
-./usr/lib/libisccc.so.10.0			base-bind-shlib		compatfile
+./usr/lib/libisccc.so.11			base-bind-shlib		compatfile
+./usr/lib/libisccc.so.11.0			base-bind-shlib		compatfile
 ./usr/lib/libisccfg.sobase-bind-shlib		compatfile
-./usr/lib/libisccfg.so.10			base-bind-shlib		compatfile
-./usr/lib/libisccfg.so.10.0			base-bind-shlib		compatfile
+./usr/lib/libisccfg.so.11			base-bind-shlib		compatfile
+./usr/lib/libisccfg.so.11.0			base-bind-shlib		compatfile
 ./usr/lib/libiscsi.sobase-iscsi-shlib	iscsi,compatfile
 ./usr/lib/libiscsi.so.2base-iscsi-shlib	iscsi,compatfile
 ./usr/lib/libiscsi.so.2.0			base-iscsi-shlib	iscsi,compatfile
@@ -427,8 +427,8 @@
 ./usr/lib/libnpf.so.0base-npf-shlib		npf,compatfile
 ./usr/lib/libnpf.so.0.1base-npf-shlib		npf,compatfile
 ./usr/lib/libns.sobase-bind-shlib		compatfile
-./usr/lib/libns.so.10base-bind-shlib		compatfile
-./usr/lib/libns.so.10.0base-bind-shlib		compatfile
+./usr/lib/libns.so.11base-bind-shlib		compatfile
+./usr/lib/libns.so.11.0base-bind-shlib		compatfile
 ./usr/lib/libnvpair.sobase-zfs-shlib		compatfile,zfs
 ./usr/lib/libnvpair.so.0			base-zfs-shlib		compatfile,zfs
 ./usr/lib/libnvpair.so.0.0			base-zfs-shlib		compatfile,zfs

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.216 src/distrib/sets/lists/debug/shl.mi:1.217
--- src/distrib/sets/lists/debug/shl.mi:1.216	Thu Feb 14 15:42:41 2019
+++ src/distrib/sets/lists/debug/shl.mi	Sun Feb 24 15:06:43 2019
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.216 2019/02/14 20:42:41 christos Exp $
+# $NetBSD: shl.mi,v 1.217 2019/02/24 20:06:43 christos Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
@@ -64,7 +64,7 @@
 ./usr/libdata/debug/usr/lib/libatf-c.so.0.0.debug		comp-atf-debug	

CVS commit: src/doc

2019-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 24 20:04:01 UTC 2019

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new bind


To generate a diff of this commit:
cvs rdiff -u -r1.1598 -r1.1599 src/doc/3RDPARTY
cvs rdiff -u -r1.2503 -r1.2504 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1598 src/doc/3RDPARTY:1.1599
--- src/doc/3RDPARTY:1.1598	Tue Feb 12 11:13:23 2019
+++ src/doc/3RDPARTY	Sun Feb 24 15:04:01 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1598 2019/02/12 16:13:23 prlw1 Exp $
+#	$NetBSD: 3RDPARTY,v 1.1599 2019/02/24 20:04:01 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -120,8 +120,8 @@ Notes:
 bc includes dc, both of which are in the NetBSD tree.
 
 Package:	bind [named and utils]
-Version:	9.10.7/BSD	9.13.5-W1/MPL
-Current Vers:			9.13.5-W1/MPL
+Version:	9.10.8-P1/BSD	9.13.7/MPL
+Current Vers:			9.13.7/MPL
 Maintainer:	ISC
 Archive Site:	ftp://ftp.isc.org/isc/bind9/
 Home Page:	http://www.isc.org/software/bind/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2503 src/doc/CHANGES:1.2504
--- src/doc/CHANGES:1.2503	Wed Feb 20 12:08:06 2019
+++ src/doc/CHANGES	Sun Feb 24 15:04:01 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2503 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2504 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -332,3 +332,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 		currently intended for netbooting via TFTP. [sevan 20190219]
 	bge(4): Add support for BCM5762, BCM5725, BCM5727, BCM57764, BCM57767
 		and BCM57787 [msaitoh 20190220]
+	bind: Import version 9.13.7. [christos 20190224]



CVS commit: src/lib/libcurses

2019-02-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Feb 24 20:20:18 UTC 2019

Modified Files:
src/lib/libcurses: get_wstr.c getstr.c in_wchstr.c inchstr.c instr.c
inwstr.c

Log Message:
Fix warn macro usage.

Thanks to rofl0r.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libcurses/get_wstr.c \
src/lib/libcurses/in_wchstr.c src/lib/libcurses/inwstr.c
cvs rdiff -u -r1.24 -r1.25 src/lib/libcurses/getstr.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libcurses/inchstr.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcurses/instr.c

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

Modified files:

Index: src/lib/libcurses/get_wstr.c
diff -u src/lib/libcurses/get_wstr.c:1.5 src/lib/libcurses/get_wstr.c:1.6
--- src/lib/libcurses/get_wstr.c:1.5	Thu Nov 22 22:16:45 2018
+++ src/lib/libcurses/get_wstr.c	Sun Feb 24 20:20:18 2019
@@ -1,4 +1,4 @@
-/*   $NetBSD: get_wstr.c,v 1.5 2018/11/22 22:16:45 uwe Exp $ */
+/*   $NetBSD: get_wstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: get_wstr.c,v 1.5 2018/11/22 22:16:45 uwe Exp $");
+__RCSID("$NetBSD: get_wstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $");
 #endif		  /* not lint */
 
 #include "curses.h"
@@ -61,7 +61,7 @@ getn_wstr(wchar_t *wstr, int n)
  *	Get a string from stdscr starting at (cury, curx).
  */
 __warn_references(get_wstr,
-	"warning: this program uses get_wstr(), which is unsafe.")
+	"warning: this program uses get_wstr(), which is unsafe.");
 int
 get_wstr(wchar_t *wstr)
 {
@@ -83,7 +83,7 @@ mvgetn_wstr(int y, int x, wchar_t *wstr,
  *	  Get a string from stdscr starting at (y, x).
  */
 __warn_references(mvget_wstr,
-	"warning: this program uses mvget_wstr(), which is unsafe.")
+	"warning: this program uses mvget_wstr(), which is unsafe.");
 int
 mvget_wstr(int y, int x, wchar_t *wstr)
 {
@@ -109,7 +109,7 @@ mvwgetn_wstr(WINDOW *win, int y, int x, 
  *	  Get a string from the given window starting at (y, x).
  */
 __warn_references(mvget_wstr,
-	"warning: this program uses mvget_wstr(), which is unsafe.")
+	"warning: this program uses mvget_wstr(), which is unsafe.");
 int
 mvwget_wstr(WINDOW *win, int y, int x, wchar_t *wstr)
 {
@@ -124,7 +124,7 @@ mvwget_wstr(WINDOW *win, int y, int x, w
  *	Get a string starting at (cury, curx).
  */
 __warn_references(wget_wstr,
-	"warning: this program uses wget_wstr(), which is unsafe.")
+	"warning: this program uses wget_wstr(), which is unsafe.");
 int
 wget_wstr(WINDOW *win, wchar_t *wstr)
 {
Index: src/lib/libcurses/in_wchstr.c
diff -u src/lib/libcurses/in_wchstr.c:1.5 src/lib/libcurses/in_wchstr.c:1.6
--- src/lib/libcurses/in_wchstr.c:1.5	Thu Nov 22 22:16:45 2018
+++ src/lib/libcurses/in_wchstr.c	Sun Feb 24 20:20:18 2019
@@ -1,4 +1,4 @@
-/*   $NetBSD: in_wchstr.c,v 1.5 2018/11/22 22:16:45 uwe Exp $ */
+/*   $NetBSD: in_wchstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: in_wchstr.c,v 1.5 2018/11/22 22:16:45 uwe Exp $");
+__RCSID("$NetBSD: in_wchstr.c,v 1.6 2019/02/24 20:20:18 roy Exp $");
 #endif		  /* not lint */
 
 #include "curses.h"
@@ -47,7 +47,7 @@ __RCSID("$NetBSD: in_wchstr.c,v 1.5 2018
  *	Return an array of wide characters at cursor position from stdscr.
  */
 __warn_references(in_wchstr,
-	"warning: this program uses in_wchstr(), which is unsafe.")
+	"warning: this program uses in_wchstr(), which is unsafe.");
 int
 in_wchstr(cchar_t *wchstr)
 {
@@ -65,7 +65,7 @@ in_wchnstr(cchar_t *wchstr, int n)
  *  Return an array of wide characters at position (y, x) from stdscr.
  */
 __warn_references(mvin_wchstr,
-	"warning: this program uses mvin_wchstr(), which is unsafe.")
+	"warning: this program uses mvin_wchstr(), which is unsafe.");
 int
 mvin_wchstr(int y, int x, cchar_t *wchstr)
 {
@@ -83,7 +83,7 @@ mvin_wchnstr(int y, int x, cchar_t *wchs
  *  Return an array wide characters at position (y, x) from the given window.
  */
 __warn_references(mvwin_wchstr,
-	"warning: this program uses mvwin_wchstr(), which is unsafe.")
+	"warning: this program uses mvwin_wchstr(), which is unsafe.");
 int
 mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wchstr)
 {
@@ -107,7 +107,7 @@ mvwin_wchnstr(WINDOW *win, int y, int x,
  *	Return an array of characters at cursor position.
  */
 __warn_references(win_wchstr,
-	"warning: this program uses win_wchstr(), which is unsafe.")
+	"warning: this program uses win_wchstr(), which is unsafe.");
 int
 win_wchstr(WINDOW *win, cchar_t *wchstr)
 {
Index: src/lib/libcurses/inwstr.c
diff -u src/lib/libcurses/inwstr.c:1.5 src/lib/libcurses/inwstr.c:1.6
--- src/lib/libcurses/inwstr.c:1.5	Thu Nov 22 22:16:45 2018
+++ src/lib/libcurses/inwstr.c	Sun Feb 24 20:20:18 2019
@@ -1,4 +1,4 @@
-/*   $NetBSD: inwstr.c,v 1.5 2018/11/22 22:16:45 uwe Exp $ */
+/*   

CVS commit: src/sys/arch/amiga/dev

2019-02-24 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sun Feb 24 19:25:35 UTC 2019

Modified Files:
src/sys/arch/amiga/dev: kbd.c

Log Message:
fix comment


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amiga/dev/kbd.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/amiga/dev/kbd.c
diff -u src/sys/arch/amiga/dev/kbd.c:1.57 src/sys/arch/amiga/dev/kbd.c:1.58
--- src/sys/arch/amiga/dev/kbd.c:1.57	Fri Jul 25 08:10:31 2014
+++ src/sys/arch/amiga/dev/kbd.c	Sun Feb 24 19:25:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.57 2014/07/25 08:10:31 dholland Exp $ */
+/*	$NetBSD: kbd.c,v 1.58 2019/02/24 19:25:35 jandberg Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.57 2014/07/25 08:10:31 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.58 2019/02/24 19:25:35 jandberg Exp $");
 
 #include 
 #include 
@@ -144,7 +144,7 @@ struct kbd_softc {
 	int k_console;		/* true if used as console keyboard */
 #if NWSKBD>0
 	device_t k_wskbddev; /* pointer to wskbd for sending strokes */
-	int k_pollingmode; /* polling mode on? whatever it isss... */
+	int k_pollingmode; /* Polling mode on? Otherwise send events. */
 #endif
 };
 struct kbd_softc kbd_softc;



CVS commit: src/sys/arch/amiga/amiga

2019-02-24 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sun Feb 24 19:24:21 UTC 2019

Modified Files:
src/sys/arch/amiga/amiga: machdep.c

Log Message:
cnpollc needs to be called before cngetc


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/sys/arch/amiga/amiga/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/amiga/amiga/machdep.c
diff -u src/sys/arch/amiga/amiga/machdep.c:1.250 src/sys/arch/amiga/amiga/machdep.c:1.251
--- src/sys/arch/amiga/amiga/machdep.c:1.250	Wed Dec  5 09:34:46 2018
+++ src/sys/arch/amiga/amiga/machdep.c	Sun Feb 24 19:24:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.250 2018/12/05 09:34:46 mlelstv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.251 2019/02/24 19:24:20 jandberg Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,7 +50,7 @@
 #include "empm.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.250 2018/12/05 09:34:46 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.251 2019/02/24 19:24:20 jandberg Exp $");
 
 #include 
 #include 
@@ -440,7 +440,9 @@ cpu_reboot(register int howto, char *boo
 		printf("\n");
 		printf("The operating system has halted.\n");
 		printf("Please press any key to reboot.\n\n");
+		cnpollc(1);
 		cngetc();
+		cnpollc(0);
 	}
 
 	printf("rebooting...\n");



CVS commit: src/sys/ufs/ufs

2019-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb 24 19:06:40 UTC 2019

Modified Files:
src/sys/ufs/ufs: ufs_vnops.c

Log Message:
Reading a directory may trigger a panic when the buffer is too small.
Adjust necessary checks.

While here, also check for arithmetic overflow.

Reported-by: syzbot+88ecace8bff241690...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/sys/ufs/ufs/ufs_vnops.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.242 src/sys/ufs/ufs/ufs_vnops.c:1.243
--- src/sys/ufs/ufs/ufs_vnops.c:1.242	Tue Jan  1 10:06:55 2019
+++ src/sys/ufs/ufs/ufs_vnops.c	Sun Feb 24 19:06:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.242 2019/01/01 10:06:55 hannken Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.243 2019/02/24 19:06:40 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.242 2019/01/01 10:06:55 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.243 2019/02/24 19:06:40 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1268,19 +1268,28 @@ ufs_readdir(void *v)
 	}
 
 	/* round start and end down to block boundaries */
-	physstart = startoffset & ~(off_t)(ump->um_dirblksiz - 1);
-	physend = endoffset & ~(off_t)(ump->um_dirblksiz - 1);
+	physstart = rounddown2(startoffset, ump->um_dirblksiz);
+	physend = rounddown2(endoffset, ump->um_dirblksiz);
+
+	if (physstart >= physend) {
+		/* Need at least one block */
+		return EINVAL;
+	}
+
 	skipstart = startoffset - physstart;
 	dropend = endoffset - physend;
 
-	if (callerbytes - dropend < _DIRENT_MINSIZE(rawdp)) {
+	/* how much to actually read */
+	rawbufmax = callerbytes + skipstart;
+	if (rawbufmax < callerbytes)
+		return EINVAL;
+	rawbuf -= dropend;
+
+	if (rawbufmax < _DIRENT_MINSIZE(rawdp)) {
 		/* no room for even one struct direct */
 		return EINVAL;
 	}
 
-	/* how much to actually read */
-	rawbufmax = callerbytes + skipstart - dropend;
-
 	/* read it */
 	rawbuf = kmem_alloc(rawbufmax, KM_SLEEP);
 	rawiov.iov_base = rawbuf;



CVS commit: src/sys/dev/mii

2019-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 24 17:22:21 UTC 2019

Modified Files:
src/sys/dev/mii: acphy.c amhphy.c atphy.c bmtphy.c brgphy.c ciphy.c
dmphy.c etphy.c glxtphy.c gphyter.c icsphy.c igphy.c ihphy.c
ikphy.c inphy.c iophy.c lxtphy.c makphy.c micphy.c miivar.h mvphy.c
nsphy.c nsphyter.c pnaphy.c qsphy.c rdcphy.c rgephy.c rlphy.c
sqphy.c tlphy.c tqphy.c

Log Message:
use a macro to tidy up the phydesc array initialization, from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/mii/acphy.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/mii/amhphy.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/mii/bmtphy.c src/sys/dev/mii/rlphy.c
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/mii/dmphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/etphy.c src/sys/dev/mii/rdcphy.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/mii/glxtphy.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/mii/gphyter.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/mii/icsphy.c src/sys/dev/mii/sqphy.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/mii/ikphy.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/mii/inphy.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/mii/iophy.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/mii/lxtphy.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/mii/micphy.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/mii/mvphy.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/mii/nsphy.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/mii/nsphyter.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/mii/pnaphy.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/mii/qsphy.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/mii/rgephy.c
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/mii/tlphy.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/mii/tqphy.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/mii/acphy.c
diff -u src/sys/dev/mii/acphy.c:1.26 src/sys/dev/mii/acphy.c:1.27
--- src/sys/dev/mii/acphy.c:1.26	Mon Jan 21 22:42:27 2019
+++ src/sys/dev/mii/acphy.c	Sun Feb 24 12:22:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acphy.c,v 1.26 2019/01/22 03:42:27 msaitoh Exp $	*/
+/*	$NetBSD: acphy.c,v 1.27 2019/02/24 17:22:21 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.26 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.27 2019/02/24 17:22:21 christos Exp $");
 
 #include 
 #include 
@@ -72,21 +72,13 @@ static const struct mii_phy_funcs acphy_
 };
 
 static const struct mii_phydesc acphys[] = {
-	{ MII_OUI_ALTIMA,		MII_MODEL_ALTIMA_AC101,
-	  MII_STR_ALTIMA_AC101 },
-	{ MII_OUI_ALTIMA,		MII_MODEL_ALTIMA_AC101L,
-	  MII_STR_ALTIMA_AC101L },
-	{ MII_OUI_ALTIMA,		MII_MODEL_ALTIMA_Am79C874,
-	  MII_STR_ALTIMA_Am79C874 },
-	{ MII_OUI_ALTIMA,		MII_MODEL_ALTIMA_Am79C875,
-	  MII_STR_ALTIMA_Am79C875 },
-
+	MII_PHY_DESC(ALTIMA, AC101),
+	MII_PHY_DESC(ALTIMA, AC101L),
+	MII_PHY_DESC(ALTIMA, Am79C874),
+	MII_PHY_DESC(ALTIMA, Am79C875),
 	/* XXX This is reported to work, but it's not from any data sheet. */
-	{ MII_OUI_ALTIMA,		MII_MODEL_ALTIMA_ACXXX,
-	  MII_STR_ALTIMA_ACXXX },
-
-	{ 0,0,
-	  NULL },
+	MII_PHY_DESC(ALTIMA, ACXXX),
+	MII_PHY_END,
 };
 
 static int

Index: src/sys/dev/mii/amhphy.c
diff -u src/sys/dev/mii/amhphy.c:1.21 src/sys/dev/mii/amhphy.c:1.22
--- src/sys/dev/mii/amhphy.c:1.21	Mon Jan 21 22:42:27 2019
+++ src/sys/dev/mii/amhphy.c	Sun Feb 24 12:22:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: amhphy.c,v 1.21 2019/01/22 03:42:27 msaitoh Exp $	*/
+/*	$NetBSD: amhphy.c,v 1.22 2019/02/24 17:22:21 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.21 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.22 2019/02/24 17:22:21 christos Exp $");
 
 #include 
 #include 
@@ -72,11 +72,8 @@ static const struct mii_phy_funcs amhphy
 };
 
 static const struct mii_phydesc amhphys[] = {
-	{ MII_OUI_yyAMD,		MII_MODEL_yyAMD_79c901,
-	  MII_STR_yyAMD_79c901 },
-
-	{ 0,0,
-	  NULL },
+	MII_PHY_DESC(yyAMD, 79c901),
+	MII_PHY_END,
 };
 
 static int

Index: src/sys/dev/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.19 src/sys/dev/mii/atphy.c:1.20
--- src/sys/dev/mii/atphy.c:1.19	Mon Jan 21 22:42:27 2019
+++ src/sys/dev/mii/atphy.c	Sun Feb 24 12:22:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.19 2019/01/22 03:42:27 msaitoh Exp $ */
+/*	$NetBSD: atphy.c,v 1.20 2019/02/24 17:22:21 christos Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 

CVS commit: src/sys/netinet

2019-02-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Feb 24 17:01:52 UTC 2019

Modified Files:
src/sys/netinet: sctp_asconf.h

Log Message:
Appease GCC7 in sctp_asconf.h

Do not declare types inside function parameter list.
Add decklarations of types before these function prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_asconf.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/netinet/sctp_asconf.h
diff -u src/sys/netinet/sctp_asconf.h:1.1 src/sys/netinet/sctp_asconf.h:1.2
--- src/sys/netinet/sctp_asconf.h:1.1	Tue Oct 13 21:28:35 2015
+++ src/sys/netinet/sctp_asconf.h	Sun Feb 24 17:01:52 2019
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_asconf.h,v 1.8 2005/03/06 16:04:16 itojun Exp $	*/
-/*	$NetBSD: sctp_asconf.h,v 1.1 2015/10/13 21:28:35 rjs Exp $ */
+/*	$NetBSD: sctp_asconf.h,v 1.2 2019/02/24 17:01:52 kamil Exp $ */
 
 #ifndef _NETINET_SCTP_ASCONF_H_
 #define _NETINET_SCTP_ASCONF_H_
@@ -36,6 +36,13 @@
 
 #if defined(_KERNEL)
 
+struct sctp_tcb;
+struct sctp_nets;
+struct sctp_asconf_chunk;
+struct sockaddr;
+struct sctp_inpcb;
+struct sctp_asconf_ack_chunk;
+
 extern void sctp_asconf_cleanup(struct sctp_tcb *, struct sctp_nets *);
 
 extern struct mbuf *sctp_compose_asconf(struct sctp_tcb *);



CVS commit: src/sys/kern

2019-02-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Feb 24 16:11:24 UTC 2019

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

Log Message:
Clear per-lwp entries whose mount is gone before the first return
from fstrans_done().

No longer leaks "struct mount" forever.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/vfs_trans.c

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

Modified files:

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.55 src/sys/kern/vfs_trans.c:1.56
--- src/sys/kern/vfs_trans.c:1.55	Thu Feb 21 08:52:53 2019
+++ src/sys/kern/vfs_trans.c	Sun Feb 24 16:11:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.55 2019/02/21 08:52:53 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.56 2019/02/24 16:11:24 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.55 2019/02/21 08:52:53 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.56 2019/02/24 16:11:24 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -543,6 +543,9 @@ fstrans_done(struct mount *mp)
 		return;
 	}
 
+	if (__predict_false(fstrans_gone_count > 0))
+		fstrans_clear_lwp_info();
+
 	s = pserialize_read_enter();
 	if (__predict_true(fmi->fmi_state == FSTRANS_NORMAL)) {
 		fli->fli_trans_cnt = 0;
@@ -552,9 +555,6 @@ fstrans_done(struct mount *mp)
 	}
 	pserialize_read_exit(s);
 
-	if (__predict_false(fstrans_gone_count > 0))
-		fstrans_clear_lwp_info();
-
 	mutex_enter(_lock);
 	fli->fli_trans_cnt = 0;
 	cv_signal(_count_cv);



CVS commit: src/games/fortune/datfiles

2019-02-24 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Feb 24 12:34:00 UTC 2019

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
Shorter than a season - The Soul Of A New Machine


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.78 src/games/fortune/datfiles/fortunes:1.79
--- src/games/fortune/datfiles/fortunes:1.78	Mon Jan 21 16:58:47 2019
+++ src/games/fortune/datfiles/fortunes	Sun Feb 24 12:34:00 2019
@@ -16257,3 +16257,7 @@ But I can tell you, anyhow,		I'll ki
 Civilization advances by extending the number of important operations which we
 can perform without thinking about them.
 		-- Alfred North Whitehead, An Introduction to Mathematics (1911)
+%
+I'm going to a commune in Vermont and will deal with no unit of time shorter
+than a season.
+		-- Josh Rosen



CVS commit: src/sys/dev/dtv

2019-02-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb 24 12:05:49 UTC 2019

Modified Files:
src/sys/dev/dtv: dtv_demux.c

Log Message:
Pass 0xff instead of true to memset when setting "all PIDs" mode in the PID 
filter


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dtv/dtv_demux.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/dtv/dtv_demux.c
diff -u src/sys/dev/dtv/dtv_demux.c:1.9 src/sys/dev/dtv/dtv_demux.c:1.10
--- src/sys/dev/dtv/dtv_demux.c:1.9	Mon Sep  3 16:29:30 2018
+++ src/sys/dev/dtv/dtv_demux.c	Sun Feb 24 12:05:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_demux.c,v 1.9 2018/09/03 16:29:30 riastradh Exp $ */
+/* $NetBSD: dtv_demux.c,v 1.10 2019/02/24 12:05:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -52,7 +52,7 @@
  */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dtv_demux.c,v 1.9 2018/09/03 16:29:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_demux.c,v 1.10 2019/02/24 12:05:49 jmcneill Exp $");
 
 #include 
 #include 
@@ -279,7 +279,7 @@ dtv_demux_set_pidfilter(struct dtv_demux
 	 * PID.
 	 */
 	if (pid == 0x2000) {
-		memset(sc->sc_ts.ts_pidfilter, onoff,
+		memset(sc->sc_ts.ts_pidfilter, onoff ? 0xff : 0,
 		sizeof(sc->sc_ts.ts_pidfilter));
 	} else {
 		sc->sc_ts.ts_pidfilter[pid] = onoff;



CVS commit: src/lib/libc/time

2019-02-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Feb 24 11:51:05 UTC 2019

Modified Files:
src/lib/libc/time: strptime.3

Log Message:
fix typo. From Evil_Bob.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/time/strptime.3

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

Modified files:

Index: src/lib/libc/time/strptime.3
diff -u src/lib/libc/time/strptime.3:1.36 src/lib/libc/time/strptime.3:1.37
--- src/lib/libc/time/strptime.3:1.36	Fri Oct 27 04:05:21 2017
+++ src/lib/libc/time/strptime.3	Sun Feb 24 11:51:05 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.36 2017/10/27 04:05:21 kre Exp $
+.\"	$NetBSD: strptime.3,v 1.37 2019/02/24 11:51:05 maya Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April  6, 2015
+.Dd Februrary  24, 2019
 .Dt STRPTIME 3
 .Os
 .Sh NAME
@@ -310,7 +310,7 @@ through
 .Pq non-nautical local time zone
 .El
 .It
-An arbirtrary timezone name that can be loaded from the database.
+An arbitrary timezone name that can be loaded from the database.
 .El
 .Po
 A



CVS commit: [netbsd-7-1] src/doc

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:54:59 UTC 2019

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1196


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.42 -r1.1.2.43 src/doc/CHANGES-7.1.3

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-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.42 src/doc/CHANGES-7.1.3:1.1.2.43
--- src/doc/CHANGES-7.1.3:1.1.2.42	Sat Feb 23 07:17:03 2019
+++ src/doc/CHANGES-7.1.3	Sun Feb 24 10:54:59 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.42 2019/02/23 07:17:03 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.43 2019/02/24 10:54:59 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -448,4 +448,9 @@ sys/net/rtsock.c		(patch)
 	Fix locking for sysctl_rtable.
 	[sborrill, ticket #1680]
 
+sys/kern/kern_time.c1.196
+
+	Avoid panic from setitimer(2) for CLOCK_MONOTONIC.
+	[mlelstv, ticket #1196]
+
 



CVS commit: [netbsd-7-0] src/doc

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:55:50 UTC 2019

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1196


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.135 -r1.1.2.136 src/doc/CHANGES-7.0.3

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-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.135 src/doc/CHANGES-7.0.3:1.1.2.136
--- src/doc/CHANGES-7.0.3:1.1.2.135	Sat Feb 23 07:16:06 2019
+++ src/doc/CHANGES-7.0.3	Sun Feb 24 10:55:50 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.135 2019/02/23 07:16:06 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.136 2019/02/24 10:55:50 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5756,4 +5756,9 @@ sys/net/rtsock.c		(patch)
 	Fix locking for sysctl_rtable.
 	[sborrill, ticket #1680]
 
+sys/kern/kern_time.c1.196
+
+	Avoid panic from setitimer(2) for CLOCK_MONOTONIC.
+	[mlelstv, ticket #1196]
+
 



CVS commit: [netbsd-7-0] src/sys/kern

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:55:24 UTC 2019

Modified Files:
src/sys/kern [netbsd-7-0]: kern_time.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1196):

sys/kern/kern_time.c: revision 1.196

The callout is used by any nonvirtual timer including CLOCK_MONOTONIC
and needs to be initialized.

Detected by [syzkaller].


To generate a diff of this commit:
cvs rdiff -u -r1.179.12.5 -r1.179.12.6 src/sys/kern/kern_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/kern_time.c
diff -u src/sys/kern/kern_time.c:1.179.12.5 src/sys/kern/kern_time.c:1.179.12.6
--- src/sys/kern/kern_time.c:1.179.12.5	Fri Feb  1 11:12:03 2019
+++ src/sys/kern/kern_time.c	Sun Feb 24 10:55:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.179.12.5 2019/02/01 11:12:03 martin Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.179.12.6 2019/02/24 10:55:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.12.5 2019/02/01 11:12:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.12.6 2019/02/24 10:55:24 martin Exp $");
 
 #include 
 #include 
@@ -1141,7 +1141,7 @@ dosetitimer(struct proc *p, int which, s
 		pt->pt_type = which;
 		pt->pt_entry = which;
 		pt->pt_queued = false;
-		if (pt->pt_type == CLOCK_REALTIME)
+		if (!CLOCK_VIRTUAL_P(which))
 			callout_init(>pt_ch, CALLOUT_MPSAFE);
 		else
 			pt->pt_active = 0;



CVS commit: [netbsd-7-1] src/sys/kern

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:54:36 UTC 2019

Modified Files:
src/sys/kern [netbsd-7-1]: kern_time.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1196):

sys/kern/kern_time.c: revision 1.196

The callout is used by any nonvirtual timer including CLOCK_MONOTONIC
and needs to be initialized.

Detected by [syzkaller].


To generate a diff of this commit:
cvs rdiff -u -r1.179.8.1.4.4 -r1.179.8.1.4.5 src/sys/kern/kern_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/kern_time.c
diff -u src/sys/kern/kern_time.c:1.179.8.1.4.4 src/sys/kern/kern_time.c:1.179.8.1.4.5
--- src/sys/kern/kern_time.c:1.179.8.1.4.4	Fri Feb  1 11:08:56 2019
+++ src/sys/kern/kern_time.c	Sun Feb 24 10:54:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.179.8.1.4.4 2019/02/01 11:08:56 martin Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.179.8.1.4.5 2019/02/24 10:54:36 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.8.1.4.4 2019/02/01 11:08:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.8.1.4.5 2019/02/24 10:54:36 martin Exp $");
 
 #include 
 #include 
@@ -1141,7 +1141,7 @@ dosetitimer(struct proc *p, int which, s
 		pt->pt_type = which;
 		pt->pt_entry = which;
 		pt->pt_queued = false;
-		if (pt->pt_type == CLOCK_REALTIME)
+		if (!CLOCK_VIRTUAL_P(which))
 			callout_init(>pt_ch, CALLOUT_MPSAFE);
 		else
 			pt->pt_active = 0;



CVS commit: [netbsd-7] src/doc

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:54:02 UTC 2019

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1196


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-7.3

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-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.40 src/doc/CHANGES-7.3:1.1.2.41
--- src/doc/CHANGES-7.3:1.1.2.40	Sat Feb 23 07:18:00 2019
+++ src/doc/CHANGES-7.3	Sun Feb 24 10:54:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.40 2019/02/23 07:18:00 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.41 2019/02/24 10:54:02 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -467,4 +467,8 @@ sys/net/rtsock.c		(patch)
 	Fix locking for sysctl_rtable.
 	[sborrill, ticket #1680]
 
+sys/kern/kern_time.c1.196
+
+	Avoid panic from setitimer(2) for CLOCK_MONOTONIC.
+	[mlelstv, ticket #1196]
 



CVS commit: [netbsd-7] src/sys/kern

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:53:32 UTC 2019

Modified Files:
src/sys/kern [netbsd-7]: kern_time.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1196):

sys/kern/kern_time.c: revision 1.196

The callout is used by any nonvirtual timer including CLOCK_MONOTONIC
and needs to be initialized.

Detected by [syzkaller].


To generate a diff of this commit:
cvs rdiff -u -r1.179.8.5 -r1.179.8.6 src/sys/kern/kern_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/kern_time.c
diff -u src/sys/kern/kern_time.c:1.179.8.5 src/sys/kern/kern_time.c:1.179.8.6
--- src/sys/kern/kern_time.c:1.179.8.5	Fri Feb  1 11:06:20 2019
+++ src/sys/kern/kern_time.c	Sun Feb 24 10:53:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.179.8.5 2019/02/01 11:06:20 martin Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.179.8.6 2019/02/24 10:53:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.8.5 2019/02/01 11:06:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.8.6 2019/02/24 10:53:32 martin Exp $");
 
 #include 
 #include 
@@ -1141,7 +1141,7 @@ dosetitimer(struct proc *p, int which, s
 		pt->pt_type = which;
 		pt->pt_entry = which;
 		pt->pt_queued = false;
-		if (pt->pt_type == CLOCK_REALTIME)
+		if (!CLOCK_VIRTUAL_P(which))
 			callout_init(>pt_ch, CALLOUT_MPSAFE);
 		else
 			pt->pt_active = 0;



CVS commit: [netbsd-8] src/doc

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:50:50 UTC 2019

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

Log Message:
Ticket #1196


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.110 -r1.1.2.111 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.110 src/doc/CHANGES-8.1:1.1.2.111
--- src/doc/CHANGES-8.1:1.1.2.110	Sat Feb 23 06:59:28 2019
+++ src/doc/CHANGES-8.1	Sun Feb 24 10:50:49 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.110 2019/02/23 06:59:28 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.111 2019/02/24 10:50:49 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2525,3 +2525,8 @@ sys/kern/sysv_shm.c1.133
 	and linux32 compatibility calls.
 	[mrg, ticket #1195]
 
+sys/kern/kern_time.c1.196
+
+	Avoid panic from setitimer(2) for CLOCK_MONOTONIC.
+	[mlelstv, ticket #1196]
+



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

2019-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 24 10:49:53 UTC 2019

Modified Files:
src/sys/kern [netbsd-8]: kern_time.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1196):

sys/kern/kern_time.c: revision 1.196

The callout is used by any nonvirtual timer including CLOCK_MONOTONIC
and needs to be initialized.

Detected by [syzkaller].


To generate a diff of this commit:
cvs rdiff -u -r1.189.8.4 -r1.189.8.5 src/sys/kern/kern_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/kern_time.c
diff -u src/sys/kern/kern_time.c:1.189.8.4 src/sys/kern/kern_time.c:1.189.8.5
--- src/sys/kern/kern_time.c:1.189.8.4	Fri Feb  1 11:21:30 2019
+++ src/sys/kern/kern_time.c	Sun Feb 24 10:49:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.189.8.4 2019/02/01 11:21:30 martin Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.189.8.5 2019/02/24 10:49:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.189.8.4 2019/02/01 11:21:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.189.8.5 2019/02/24 10:49:53 martin Exp $");
 
 #include 
 #include 
@@ -1179,7 +1179,7 @@ dosetitimer(struct proc *p, int which, s
 		pt->pt_type = which;
 		pt->pt_entry = which;
 		pt->pt_queued = false;
-		if (pt->pt_type == CLOCK_REALTIME)
+		if (!CLOCK_VIRTUAL_P(which))
 			callout_init(>pt_ch, CALLOUT_MPSAFE);
 		else
 			pt->pt_active = 0;



CVS commit: src/sys/kern

2019-02-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Feb 24 10:44:41 UTC 2019

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

Log Message:
Improve the KASAN output, provide an error code, to help distinguish
classes of bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_asan.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_asan.c
diff -u src/sys/kern/subr_asan.c:1.4 src/sys/kern/subr_asan.c:1.5
--- src/sys/kern/subr_asan.c:1.4	Sun Feb 24 08:02:45 2019
+++ src/sys/kern/subr_asan.c	Sun Feb 24 10:44:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_asan.c,v 1.4 2019/02/24 08:02:45 maxv Exp $	*/
+/*	$NetBSD: subr_asan.c,v 1.5 2019/02/24 10:44:41 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.4 2019/02/24 08:02:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.5 2019/02/24 10:44:41 maxv Exp $");
 
 #include 
 #include 
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_asan.c,
 #include 
 
 /* Our redzone values. */
-#define KASAN_GLOBAL_REDZONE	0xFA
+#define KASAN_MEMORY_FREED	0xFA
 #define KASAN_MEMORY_REDZONE	0xFB
 
 /* Stack redzone values. Part of the compiler ABI. */
@@ -163,12 +163,37 @@ kasan_init(void)
 	kasan_ctors();
 }
 
+static inline const char *
+kasan_code_name(uint8_t code)
+{
+	switch (code) {
+	case KASAN_MEMORY_FREED:
+		return "UseAfterFree";
+	case KASAN_MEMORY_REDZONE:
+		return "RedZone";
+	case 1 ... 7:
+		return "RedZonePartial";
+	case KASAN_STACK_LEFT:
+		return "StackLeft";
+	case KASAN_STACK_RIGHT:
+		return "StackRight";
+	case KASAN_STACK_PARTIAL:
+		return "StackPartial";
+	case KASAN_USE_AFTER_SCOPE:
+		return "UseAfterScope";
+	default:
+		return "Unknown";
+	}
+}
+
 static void
-kasan_report(unsigned long addr, size_t size, bool write, unsigned long pc)
+kasan_report(unsigned long addr, size_t size, bool write, unsigned long pc,
+uint8_t code)
 {
-	printf("ASan: Unauthorized Access In %p: Addr %p [%zu byte%s, %s]\n",
+	printf("ASan: Unauthorized Access In %p: Addr %p [%zu byte%s, %s,"
+	" %s]\n",
 	(void *)pc, (void *)addr, size, (size > 1 ? "s" : ""),
-	(write ? "write" : "read"));
+	(write ? "write" : "read"), kasan_code_name(code));
 	kasan_md_unwind();
 }
 
@@ -259,69 +284,85 @@ kasan_mark(const void *addr, size_t size
 	((addr + size - 1) >> KASAN_SHADOW_SCALE_SHIFT)
 
 static __always_inline bool
-kasan_shadow_1byte_isvalid(unsigned long addr)
+kasan_shadow_1byte_isvalid(unsigned long addr, uint8_t *code)
 {
 	int8_t *byte = kasan_md_addr_to_shad((void *)addr);
 	int8_t last = (addr & KASAN_SHADOW_MASK) + 1;
 
-	return __predict_true(*byte == 0 || last <= *byte);
+	if (__predict_true(*byte == 0 || last <= *byte)) {
+		return true;
+	}
+	*code = *byte;
+	return false;
 }
 
 static __always_inline bool
-kasan_shadow_2byte_isvalid(unsigned long addr)
+kasan_shadow_2byte_isvalid(unsigned long addr, uint8_t *code)
 {
 	int8_t *byte, last;
 
 	if (ADDR_CROSSES_SCALE_BOUNDARY(addr, 2)) {
-		return (kasan_shadow_1byte_isvalid(addr) &&
-		kasan_shadow_1byte_isvalid(addr+1));
+		return (kasan_shadow_1byte_isvalid(addr, code) &&
+		kasan_shadow_1byte_isvalid(addr+1, code));
 	}
 
 	byte = kasan_md_addr_to_shad((void *)addr);
 	last = ((addr + 1) & KASAN_SHADOW_MASK) + 1;
 
-	return __predict_true(*byte == 0 || last <= *byte);
+	if (__predict_true(*byte == 0 || last <= *byte)) {
+		return true;
+	}
+	*code = *byte;
+	return false;
 }
 
 static __always_inline bool
-kasan_shadow_4byte_isvalid(unsigned long addr)
+kasan_shadow_4byte_isvalid(unsigned long addr, uint8_t *code)
 {
 	int8_t *byte, last;
 
 	if (ADDR_CROSSES_SCALE_BOUNDARY(addr, 4)) {
-		return (kasan_shadow_2byte_isvalid(addr) &&
-		kasan_shadow_2byte_isvalid(addr+2));
+		return (kasan_shadow_2byte_isvalid(addr, code) &&
+		kasan_shadow_2byte_isvalid(addr+2, code));
 	}
 
 	byte = kasan_md_addr_to_shad((void *)addr);
 	last = ((addr + 3) & KASAN_SHADOW_MASK) + 1;
 
-	return __predict_true(*byte == 0 || last <= *byte);
+	if (__predict_true(*byte == 0 || last <= *byte)) {
+		return true;
+	}
+	*code = *byte;
+	return false;
 }
 
 static __always_inline bool
-kasan_shadow_8byte_isvalid(unsigned long addr)
+kasan_shadow_8byte_isvalid(unsigned long addr, uint8_t *code)
 {
 	int8_t *byte, last;
 
 	if (ADDR_CROSSES_SCALE_BOUNDARY(addr, 8)) {
-		return (kasan_shadow_4byte_isvalid(addr) &&
-		kasan_shadow_4byte_isvalid(addr+4));
+		return (kasan_shadow_4byte_isvalid(addr, code) &&
+		kasan_shadow_4byte_isvalid(addr+4, code));
 	}
 
 	byte = kasan_md_addr_to_shad((void *)addr);
 	last = ((addr + 7) & KASAN_SHADOW_MASK) + 1;
 
-	return __predict_true(*byte == 0 || last <= *byte);
+	if (__predict_true(*byte == 0 || last <= *byte)) {
+		return true;
+	}
+	*code = *byte;
+	return false;
 }
 
 static __always_inline bool

CVS commit: src/sys

2019-02-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Feb 24 08:02:45 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64
src/sys/kern: subr_asan.c

Log Message:
Add support for use-after-scope detection in KASAN. It is available since
GCC7, and we have GCC7 by default now.

Slightly reorder the code, and remove a duplicated KASSERT too.

Tested on amd64-KASAN. Not yet enabled on aarch64-KASAN, but it should
work as-is.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/amd64/conf/Makefile.amd64
cvs rdiff -u -r1.3 -r1.4 src/sys/kern/subr_asan.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/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.75 src/sys/arch/amd64/conf/Makefile.amd64:1.76
--- src/sys/arch/amd64/conf/Makefile.amd64:1.75	Wed Oct 31 06:26:25 2018
+++ src/sys/arch/amd64/conf/Makefile.amd64	Sun Feb 24 08:02:45 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.75 2018/10/31 06:26:25 maxv Exp $
+#	$NetBSD: Makefile.amd64,v 1.76 2019/02/24 08:02:45 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -52,6 +52,7 @@ CFLAGS+=  -mindirect-branch-register
 .if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0
 KASANFLAGS=	-fsanitize=kernel-address \
 		--param asan-globals=1 --param asan-stack=1 \
+		-fsanitize-address-use-after-scope \
 		-fasan-shadow-offset=0xDFFF9000
 .for f in subr_asan.c
 KASANFLAGS.${f}=	# empty

Index: src/sys/kern/subr_asan.c
diff -u src/sys/kern/subr_asan.c:1.3 src/sys/kern/subr_asan.c:1.4
--- src/sys/kern/subr_asan.c:1.3	Wed Feb 13 14:55:29 2019
+++ src/sys/kern/subr_asan.c	Sun Feb 24 08:02:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_asan.c,v 1.3 2019/02/13 14:55:29 kamil Exp $	*/
+/*	$NetBSD: subr_asan.c,v 1.4 2019/02/24 08:02:45 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.3 2019/02/13 14:55:29 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_asan.c,v 1.4 2019/02/24 08:02:45 maxv Exp $");
 
 #include 
 #include 
@@ -182,6 +182,16 @@ kasan_shadow_1byte_markvalid(unsigned lo
 }
 
 static __always_inline void
+kasan_shadow_Nbyte_markvalid(const void *addr, size_t size)
+{
+	size_t i;
+
+	for (i = 0; i < size; i++) {
+		kasan_shadow_1byte_markvalid((unsigned long)addr+i);
+	}
+}
+
+static __always_inline void
 kasan_shadow_Nbyte_fill(const void *addr, size_t size, uint8_t val)
 {
 	void *shad;
@@ -210,16 +220,10 @@ kasan_add_redzone(size_t *size)
 static void
 kasan_markmem(const void *addr, size_t size, bool valid)
 {
-	size_t i;
-
 	KASSERT((vaddr_t)addr % KASAN_SHADOW_SCALE_SIZE == 0);
-
 	if (valid) {
-		for (i = 0; i < size; i++) {
-			kasan_shadow_1byte_markvalid((unsigned long)addr+i);
-		}
+		kasan_shadow_Nbyte_markvalid(addr, size);
 	} else {
-		KASSERT(size % KASAN_SHADOW_SCALE_SIZE == 0);
 		kasan_shadow_Nbyte_fill(addr, size, KASAN_MEMORY_REDZONE);
 	}
 }
@@ -537,3 +541,17 @@ ASAN_SET_SHADOW(f2);
 ASAN_SET_SHADOW(f3);
 ASAN_SET_SHADOW(f5);
 ASAN_SET_SHADOW(f8);
+
+void __asan_poison_stack_memory(const void *, size_t);
+void __asan_unpoison_stack_memory(const void *, size_t);
+
+void __asan_poison_stack_memory(const void *addr, size_t size)
+{
+	size = roundup(size, KASAN_SHADOW_SCALE_SIZE);
+	kasan_shadow_Nbyte_fill(addr, size, KASAN_USE_AFTER_SCOPE);
+}
+
+void __asan_unpoison_stack_memory(const void *addr, size_t size)
+{
+	kasan_shadow_Nbyte_markvalid(addr, size);
+}