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

2018-05-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 05:04:39 UTC 2018

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

Log Message:
 Add SSBD bit for Intel.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/x86/procfs_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/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.22 src/sys/arch/x86/x86/procfs_machdep.c:1.23
--- src/sys/arch/x86/x86/procfs_machdep.c:1.22	Mon Mar  5 04:21:36 2018
+++ src/sys/arch/x86/x86/procfs_machdep.c	Wed May 23 05:04:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.22 2018/03/05 04:21:36 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.23 2018/05/23 05:04:39 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.22 2018/03/05 04:21:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.23 2018/05/23 05:04:39 msaitoh Exp $");
 
 #include 
 #include 
@@ -190,7 +190,7 @@ static const char * const x86_features[]
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, NULL},
+	NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, "ssbd"},
 };
 
 static int	procfs_getonecpu(int, struct cpu_info *, char *, size_t *);



CVS commit: src/sys/dev/pci/ixgbe

2018-05-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 04:45:24 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Don't check IFF_RUNNING in ixgbe_rxeof(). Doing break and leaving a deacriptor
with DD bit is worse than just processing the entry. And it's also racy to
check IFF_RUNNING in rxeof(). If you'd like to strictly obey IFF_RUNNING,
it would be better to do it in the upper layer.

 Same as DragonFly (a part of 79251f5ebe4cf9dd2f3e6aed590e09d756d39922).


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ix_txrx.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.45 src/sys/dev/pci/ixgbe/ix_txrx.c:1.46
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.45	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed May 23 04:45:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.45 2018/05/18 10:09:02 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.46 2018/05/23 04:45:24 msaitoh Exp $ */
 
 /**
 
@@ -1833,8 +1833,6 @@ ixgbe_rxeof(struct ix_queue *que)
 
 		if ((staterr & IXGBE_RXD_STAT_DD) == 0)
 			break;
-		if ((ifp->if_flags & IFF_RUNNING) == 0)
-			break;
 
 		count--;
 		sendmp = NULL;



CVS commit: src/sys/dev/pci/ixgbe

2018-05-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 23 04:37:13 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 Add rxd_nxck (Receive Descriptor next to check) read only sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.153 src/sys/dev/pci/ixgbe/ixgbe.c:1.154
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.153	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed May 23 04:37:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.153 2018/05/18 10:09:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.154 2018/05/23 04:37:13 msaitoh Exp $ */
 
 /**
 
@@ -236,6 +236,7 @@ static int	ixgbe_sysctl_phy_overtemp_occ
 static int	ixgbe_sysctl_power_state(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO);
 #endif
+static int  ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
 static int  ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int  ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int  ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -1817,6 +1818,14 @@ ixgbe_add_hw_stats(struct adapter *adapt
 		if (sysctl_createv(log, 0, , ,
 		CTLFLAG_READONLY,
 		CTLTYPE_INT,
+		"rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"),
+			ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
+		CTL_CREATE, CTL_EOL) != 0)
+			break;
+
+		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY,
+		CTLTYPE_INT,
 		"rxd_head", SYSCTL_DESCR("Receive Descriptor Head"),
 		ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
 		CTL_CREATE, CTL_EOL) != 0)
@@ -2179,6 +2188,27 @@ ixgbe_sysctl_tdt_handler(SYSCTLFN_ARGS)
 } /* ixgbe_sysctl_tdt_handler */
 
 /
+ * ixgbe_sysctl_next_to_check_handler - Receive Descriptor next to check
+ * handler function
+ *
+ *   Retrieves the next_to_check value
+ /
+static int 
+ixgbe_sysctl_next_to_check_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+	uint32_t val;
+
+	if (!rxr)
+		return (0);
+
+	val = rxr->next_to_check;
+	node.sysctl_data = 
+	return sysctl_lookup(SYSCTLFN_CALL());
+} /* ixgbe_sysctl_next_to_check_handler */
+
+/
  * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function
  *
  *   Retrieves the RDH value from the hardware

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.98 src/sys/dev/pci/ixgbe/ixv.c:1.99
--- src/sys/dev/pci/ixgbe/ixv.c:1.98	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed May 23 04:37:13 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.98 2018/05/18 10:09:02 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.99 2018/05/23 04:37:13 msaitoh Exp $*/
 
 /**
 
@@ -136,6 +136,7 @@ static void	ixv_add_stats_sysctls(struct
 static void	ixv_set_sysctl_value(struct adapter *, const char *,
 		const char *, int *, int);
 static int  ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
+static int  ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
 static int  ixv_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int  ixv_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int  ixv_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -1878,6 +1879,27 @@ ixv_sysctl_tdt_handler(SYSCTLFN_ARGS)
 } /* ixv_sysctl_tdt_handler */
 
 /
+ * ixv_sysctl_next_to_check_handler - Receive Descriptor next to check
+ * handler function
+ *
+ *   Retrieves the next_to_check value
+ /
+static int 
+ixv_sysctl_next_to_check_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+	uint32_t val;
+
+	if (!rxr)
+		return (0);
+
+	val = rxr->next_to_check;
+	node.sysctl_data = 
+	return sysctl_lookup(SYSCTLFN_CALL());
+} /* ixv_sysctl_next_to_check_handler */
+
+/
  * ixv_sysctl_rdh_handler - Receive Descriptor Head handler function
  *
  *   Retrieves the RDH value from the hardware
@@ -2450,6 +2472,14 @@ ixv_add_stats_sysctls(struct adapter *ad
 		if (sysctl_createv(log, 0, , ,
 		CTLFLAG_READONLY,
 		CTLTYPE_INT,
+		"rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"),
+			ixv_sysctl_next_to_check_handler, 0, (void *)rxr, 

CVS commit: src/lib/libc

2018-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 23 02:08:40 UTC 2018

Modified Files:
src/lib/libc/hash: hmac.3
src/lib/libc/md: mdX.3

Log Message:
Add cross references to the openssl man pages.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/hash/hmac.3
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/md/mdX.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/hash/hmac.3
diff -u src/lib/libc/hash/hmac.3:1.5 src/lib/libc/hash/hmac.3:1.6
--- src/lib/libc/hash/hmac.3:1.5	Sat Jul  2 12:04:47 2016
+++ src/lib/libc/hash/hmac.3	Tue May 22 22:08:40 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: hmac.3,v 1.5 2016/07/02 16:04:47 wiz Exp $
+.\" $NetBSD: hmac.3,v 1.6 2018/05/23 02:08:40 christos Exp $
 .\"
 .\" Copyright (c) 2016 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 1, 2016
+.Dd May 22, 2018
 .Dt HMAC 3
 .Os
 .Sh NAME
@@ -69,6 +69,10 @@ This length depends on the hashing funct
 .Xr md2 3 ,
 .Xr md4 3 ,
 .Xr md5 3 ,
+.Xr openssl_HMAC 3 ,
+.Xr openssl_MD2 3 ,
+.Xr openssl_MD4 3 ,
+.Xr openssl_MD5 3 ,
 .Xr rmd160 3 ,
 .Xr sha1 3 ,
 .Xr sha2 3

Index: src/lib/libc/md/mdX.3
diff -u src/lib/libc/md/mdX.3:1.10 src/lib/libc/md/mdX.3:1.11
--- src/lib/libc/md/mdX.3:1.10	Thu Jun 12 21:28:41 2003
+++ src/lib/libc/md/mdX.3	Tue May 22 22:08:40 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mdX.3,v 1.10 2003/06/13 01:28:41 lukem Exp $
+.\"	$NetBSD: mdX.3,v 1.11 2018/05/23 02:08:40 christos Exp $
 .\"
 .\" 
 .\" "THE BEER-WARE LICENSE" (Revision 42):
@@ -9,7 +9,7 @@
 .\"
 .\"	from FreeBSD Id: mdX.3,v 1.7 1996/10/22 16:28:56 phk Exp
 .\"
-.Dd June 13, 2003
+.Dd May 22, 2018
 .Dt MDX 3
 .Os
 .Sh NAME
@@ -105,7 +105,10 @@ argument is non-null it must point to at
 .Sh SEE ALSO
 .Xr md2 3 ,
 .Xr md4 3 ,
-.Xr md5 3
+.Xr md5 3 ,
+.Xr openssl_MD2 3 ,
+.Xr openssl_MD4 3 ,
+.Xr openssl_MD5 3 ,
 .Rs
 .%A B. Kaliski
 .%T The MD2 Message-Digest Algorithm



CVS commit: src/distrib/sets/lists/comp

2018-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 23 02:06:04 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
rename {HMAC,MD5} to openssl_{HMAC,MD5}; add openssl_MD{2,4}


To generate a diff of this commit:
cvs rdiff -u -r1.2193 -r1.2194 src/distrib/sets/lists/comp/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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2193 src/distrib/sets/lists/comp/mi:1.2194
--- src/distrib/sets/lists/comp/mi:1.2193	Sat May 12 10:49:34 2018
+++ src/distrib/sets/lists/comp/mi	Tue May 22 22:06:03 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2193 2018/05/12 14:49:34 jdolecek Exp $
+#	$NetBSD: mi,v 1.2194 2018/05/23 02:06:03 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -4699,7 +4699,7 @@
 ./usr/share/man/cat3/GCQ_INIT.0			comp-sys-catman		.cat
 ./usr/share/man/cat3/GCQ_INIT_HEAD.0		comp-sys-catman		.cat
 ./usr/share/man/cat3/GCQ_ITEM.0			comp-sys-catman		.cat
-./usr/share/man/cat3/HMAC.0			comp-c-catman		.cat,openssl=11
+./usr/share/man/cat3/HMAC.0			comp-openssl		openssl
 ./usr/share/man/cat3/IFTODT.0			comp-c-catman		.cat
 ./usr/share/man/cat3/LIST.0			comp-c-catman		.cat
 ./usr/share/man/cat3/LIST_EMPTY.0		comp-c-catman		.cat
@@ -4731,7 +4731,7 @@
 ./usr/share/man/cat3/MD4Final.0			comp-c-catman		.cat
 ./usr/share/man/cat3/MD4Init.0			comp-c-catman		.cat
 ./usr/share/man/cat3/MD4Update.0		comp-c-catman		.cat
-./usr/share/man/cat3/MD5.0			comp-c-catman		.cat,openssl=11
+./usr/share/man/cat3/MD5.0			comp-obsolete		obsolete
 ./usr/share/man/cat3/MD5Data.0			comp-c-catman		.cat
 ./usr/share/man/cat3/MD5End.0			comp-c-catman		.cat
 ./usr/share/man/cat3/MD5File.0			comp-c-catman		.cat
@@ -8413,6 +8413,10 @@
 ./usr/share/man/cat3/openpam_ttyconv.0		comp-c-catman		.cat,pam
 ./usr/share/man/cat3/openpgpsdk.0		comp-obsolete		obsolete
 ./usr/share/man/cat3/openpty.0			comp-c-catman		.cat
+./usr/share/man/cat3/openssl_HMAC.0		comp-c-catman		.cat,openssl=11
+./usr/share/man/cat3/openssl_MD2.0		comp-c-catman		.cat,openssl=11
+./usr/share/man/cat3/openssl_MD4.0		comp-c-catman		.cat,openssl=11
+./usr/share/man/cat3/openssl_MD5.0		comp-c-catman		.cat,openssl=11
 ./usr/share/man/cat3/openssl_bio.0		comp-c-catman		.cat
 ./usr/share/man/cat3/openssl_blowfish.0	comp-c-catman	.cat,openssl=10
 ./usr/share/man/cat3/openssl_bn.0	comp-c-catman	.cat,openssl=10
@@ -12516,7 +12520,7 @@
 ./usr/share/man/html3/GCQ_INIT.html		comp-sys-htmlman	html
 ./usr/share/man/html3/GCQ_INIT_HEAD.html	comp-sys-htmlman	html
 ./usr/share/man/html3/GCQ_ITEM.html		comp-sys-htmlman	html
-./usr/share/man/html3/HMAC.html	comp-c-htmlman	html,openssl=11
+./usr/share/man/html3/HMAC.html			comp-obsolete		obsolete
 ./usr/share/man/html3/IFTODT.html		comp-c-htmlman		html
 ./usr/share/man/html3/LIST.html			comp-c-htmlman		html
 ./usr/share/man/html3/LIST_EMPTY.html		comp-c-htmlman		html
@@ -12548,7 +12552,7 @@
 ./usr/share/man/html3/MD4Final.html		comp-c-htmlman		html
 ./usr/share/man/html3/MD4Init.html		comp-c-htmlman		html
 ./usr/share/man/html3/MD4Update.html		comp-c-htmlman		html
-./usr/share/man/html3/MD5.html	comp-c-htmlman	html,openssl=11
+./usr/share/man/html3/MD5.html			comp-obsolete		obsolete
 ./usr/share/man/html3/MD5Data.html		comp-c-htmlman		html
 ./usr/share/man/html3/MD5End.html		comp-c-htmlman		html
 ./usr/share/man/html3/MD5File.html		comp-c-htmlman		html
@@ -16154,6 +16158,10 @@
 ./usr/share/man/html3/openpam_ttyconv.html	comp-c-htmlman		html,pam
 ./usr/share/man/html3/openpgpsdk.html		comp-obsolete		obsolete
 ./usr/share/man/html3/openpty.html		comp-c-htmlman		html
+./usr/share/man/html3/openssl_HMAC.html		comp-c-htmlman		html,openssl=11
+./usr/share/man/html3/openssl_MD2.html		comp-c-htmlman		html,openssl=11
+./usr/share/man/html3/openssl_MD4.html		comp-c-htmlman		html,openssl=11
+./usr/share/man/html3/openssl_MD5.html		comp-c-htmlman		html,openssl=11
 ./usr/share/man/html3/openssl_bio.html		comp-c-htmlman		html
 ./usr/share/man/html3/openssl_blowfish.html	comp-c-htmlman	html,openssl=10
 ./usr/share/man/html3/openssl_blowfish.html	comp-obsolete	openssl=11,obsolete
@@ -20173,7 +20181,7 @@
 ./usr/share/man/man3/GCQ_INIT.3			comp-sys-man		.man
 ./usr/share/man/man3/GCQ_INIT_HEAD.3		comp-sys-man		.man
 ./usr/share/man/man3/GCQ_ITEM.3			comp-sys-man		.man
-./usr/share/man/man3/HMAC.3	comp-c-man	.man,openssl=11
+./usr/share/man/man3/HMAC.3			comp-obsolete		obsolete
 ./usr/share/man/man3/IFTODT.3			comp-c-man		.man
 ./usr/share/man/man3/LIST.3			comp-c-man		.man
 ./usr/share/man/man3/LIST_EMPTY.3		comp-c-man		.man
@@ -20205,7 +20213,7 @@
 ./usr/share/man/man3/MD4Final.3			comp-c-man		.man
 ./usr/share/man/man3/MD4Init.3			comp-c-man		.man
 ./usr/share/man/man3/MD4Update.3		comp-c-man		.man
-./usr/share/man/man3/MD5.3	comp-c-man	.man,openssl=11
+./usr/share/man/man3/MD5.3			

CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto

2018-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 23 01:58:40 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto: man.inc
src/crypto/external/bsd/openssl/lib/libcrypto/man: Makefile
Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/man: openssl_HMAC.3
openssl_MD5.3
Removed Files:
src/crypto/external/bsd/openssl/lib/libcrypto/man: HMAC.3 MD5.3

Log Message:
rename {MD5,HMAC} to openssl_{MD5,HMAC}. Also add man pages for openssl_MD2
and openssl_MD4 to avoid conflicts with case-preserving but case-insensitive
filesystems and the corresponding libc lower case man pages.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/lib/libcrypto/man.inc
cvs rdiff -u -r1.1 -r0 \
src/crypto/external/bsd/openssl/lib/libcrypto/man/HMAC.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/man/MD5.3
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/lib/libcrypto/man/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_HMAC.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_MD5.3

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/openssl/lib/libcrypto/man.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/man.inc:1.8 src/crypto/external/bsd/openssl/lib/libcrypto/man.inc:1.9
--- src/crypto/external/bsd/openssl/lib/libcrypto/man.inc:1.8	Wed Mar  7 17:40:26 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/man.inc	Tue May 22 21:58:40 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: man.inc,v 1.8 2018/03/07 22:40:26 christos Exp $
+#	$NetBSD: man.inc,v 1.9 2018/05/23 01:58:40 christos Exp $
 
 .PATH:	${.CURDIR}/man
 
@@ -160,8 +160,8 @@ EVP_PKEY_verify_recover.3 \
 EVP_SealInit.3 \
 EVP_SignInit.3 \
 EVP_VerifyInit.3 \
-HMAC.3 \
-MD5.3 \
+openssl_HMAC.3 \
+openssl_MD5.3 \
 MDC2_Init.3 \
 OBJ_nid2obj.3 \
 OCSP_REQUEST_new.3 \
@@ -452,3 +452,7 @@ openssl_x509.1 \
 openssl_x509.3 \
 openssl_x509v3_config.1 \
 ssl.3
+
+MLINKS += \
+openssl_MD5.3 openssl_MD2.3 \
+openssl_MD5.3 openssl_MD4.3

Index: src/crypto/external/bsd/openssl/lib/libcrypto/man/Makefile
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/man/Makefile:1.4 src/crypto/external/bsd/openssl/lib/libcrypto/man/Makefile:1.5
--- src/crypto/external/bsd/openssl/lib/libcrypto/man/Makefile:1.4	Thu Feb  8 16:57:26 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/man/Makefile	Tue May 22 21:58:40 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2018/02/08 21:57:26 christos Exp $
+#	$NetBSD: Makefile,v 1.5 2018/05/23 01:58:40 christos Exp $
 
 # the makefile is not, and should not be visited during normal build process.
 # try to use latest pod2man, which comes with the latest perl.
@@ -47,10 +47,11 @@ make-manpages:
 			perl libcrypto.pl >`basename $$i .pod`.$$sec; \
 		fi \
 	done
-	for i in bio evp x509; do \
+	for i in bio evp x509 MD5 HMAC; do \
 		mv $$i.3 openssl_$$i.3; \
 	done
 
+
 clean:
 	-/bin/rm -f *.[0-9]
 

Added files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_HMAC.3
diff -u /dev/null src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_HMAC.3:1.1
--- /dev/null	Tue May 22 21:58:41 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_HMAC.3	Tue May 22 21:58:40 2018
@@ -0,0 +1,284 @@
+.\"	$NetBSD: openssl_HMAC.3,v 1.1 2018/05/23 01:58:40 christos Exp $
+.\"
+.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32)
+.\"
+.\" Standard preamble:
+.\" 
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.ds -- \(*W-
+.ds PI pi
+.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.ds L" ""
+.ds R" ""
+.ds C` ""
+.ds C' ""
+'br\}
+.el\{\
+.ds -- \|\(em\|
+.ds PI \(*p
+.ds L" ``
+.ds R" ''
+.ds C`
+.ds C'
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el   .ds Aq '
+.\"
+.\" If the F register is >0, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), 

CVS commit: src/tests/lib/libc/sys

2018-05-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed May 23 01:29:43 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Refactor the attach[1-8] and race1 ATF t_ptrace_wait* tests

Share code in: attach1, attach2 and race1 in the same function body.
Rename thsee tests to more verbose names:
 - tracer_sees_terminaton_before_the_parent
 - tracer_sysctl_lookup_without_duplicates
 - unrelated_tracer_sees_terminaton_before_the_parent

Rename attach3 to parent_attach_to_its_child.

Rename attach4 to child_attach_to_its_parent.

Share code in attach5, attach6 and attach7 in the same function body and
reanem the tests to:
 - tracee_sees_its_original_parent_getppid
 - tracee_sees_its_original_parent_sysctl_kinfo_proc2
 - tracee_sees_its_original_parent_procfs_status

Reduce the code by around 50%.

No functional change intended. All tests pass.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.50 src/tests/lib/libc/sys/t_ptrace_wait.c:1.51
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.50	Tue May 22 10:48:06 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Wed May 23 01:29:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.50 2018/05/22 10:48:06 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.51 2018/05/23 01:29:43 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.50 2018/05/22 10:48:06 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.51 2018/05/23 01:29:43 kamil Exp $");
 
 #include 
 #include 
@@ -852,16 +852,14 @@ ATF_TC_BODY(traceme_vfork_exec, tc)
 /// 
 
 #if defined(TWAIT_HAVE_PID)
-ATF_TC(attach1);
-ATF_TC_HEAD(attach1, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	"Assert that tracer sees process termination before the parent");
-}
-
 static void
-attach1_raw(bool raw)
+tracer_sees_terminaton_before_the_parent_raw(bool notimeout, bool unrelated)
 {
+	/*
+	 * notimeout - disable timeout in await zombie function
+	 * unrelated - attach from unrelated tracer reparented to initproc
+	 */
+
 	struct msg_fds parent_tracee, parent_tracer;
 	const int exitval_tracee = 5;
 	const int exitval_tracer = 10;
@@ -884,6 +882,13 @@ attach1_raw(bool raw)
 	SYSCALL_REQUIRE(msg_open(_tracer) == 0);
 	tracer = atf_utils_fork();
 	if (tracer == 0) {
+		if(unrelated) {
+			/* Fork again and drop parent to reattach to PID 1 */
+			tracer = atf_utils_fork();
+			if (tracer != 0)
+_exit(exitval_tracer);
+		}
+
 		DPRINTF("Before calling PT_ATTACH from tracee %d\n", getpid());
 		FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1);
 
@@ -910,7 +915,21 @@ attach1_raw(bool raw)
 		DPRINTF("Tracee %d exited with %d\n", tracee, exitval_tracee);
 
 		DPRINTF("Before exiting of the tracer process\n");
-		_exit(exitval_tracer);
+		_exit(unrelated ? 0 /* collect by initproc */ : exitval_tracer);
+	}
+
+	if (unrelated) {
+		DPRINTF("Wait for the tracer process (direct child) to exit "
+		"calling %s()\n", TWAIT_FNAME);
+		TWAIT_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracer, , 0), tracer);
+
+		validate_status_exited(status, exitval_tracer);
+
+		DPRINTF("Wait for the non-exited tracee process with %s()\n",
+		TWAIT_FNAME);
+		TWAIT_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, NULL, WNOHANG), 0);
 	}
 
 	DPRINTF("Wait for the tracer to attach to the tracee\n");
@@ -920,7 +939,7 @@ attach1_raw(bool raw)
 	PARENT_TO_CHILD("exit tracee", parent_tracee,  msg);
 
 	DPRINTF("Detect that tracee is zombie\n");
-	if (raw)
+	if (notimeout)
 		await_zombie_raw(tracee, 0);
 	else
 		await_zombie(tracee);
@@ -931,21 +950,26 @@ attach1_raw(bool raw)
 	TWAIT_REQUIRE_SUCCESS(
 	wpid = TWAIT_GENERIC(tracee, , WNOHANG), 0);
 
-	DPRINTF("Tell the tracer child should have exited\n");
-	PARENT_TO_CHILD("wait for tracee exit", parent_tracer,  msg);
-	DPRINTF("Wait for tracer to finish its job and exit - calling %s()\n",
-	TWAIT_FNAME);
-
-	DPRINTF("Wait from tracer child to complete waiting for tracee\n");
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, , 0),
-	tracer);
+	if (unrelated) {
+		DPRINTF("Resume the tracer and let it detect exited tracee\n");
+		PARENT_TO_CHILD("Message 2", parent_tracer, msg);
+	} else {
+		DPRINTF("Tell the tracer child should have exited\n");
+		PARENT_TO_CHILD("wait for tracee exit", parent_tracer,  msg);
+		DPRINTF("Wait for tracer to finish its job and exit - calling "
+		"%s()\n", TWAIT_FNAME);
+
+		DPRINTF("Wait from tracer child to complete waiting for "
+		"tracee\n");
+		TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, , 0),
+		tracer);
 
-	

CVS commit: src/distrib/sets/lists

2018-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 23 01:05:47 UTC 2018

Modified Files:
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/man: mi

Log Message:
remove Mail


To generate a diff of this commit:
cvs rdiff -u -r1.1174 -r1.1175 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.1588 -r1.1589 src/distrib/sets/lists/man/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/mi
diff -u src/distrib/sets/lists/base/mi:1.1174 src/distrib/sets/lists/base/mi:1.1175
--- src/distrib/sets/lists/base/mi:1.1174	Fri May 11 03:43:42 2018
+++ src/distrib/sets/lists/base/mi	Tue May 22 21:05:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1174 2018/05/11 07:43:42 maya Exp $
+# $NetBSD: mi,v 1.1175 2018/05/23 01:05:47 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -628,7 +628,7 @@
 ./tmp		base-sys-root
 ./usr		base-sys-root
 ./usr/bin	base-sys-usr
-./usr/bin/Mail	base-mail-bin
+./usr/bin/Mail	base-obsolete		obsolete
 ./usr/bin/agrep	base-util-bin
 ./usr/bin/apply	base-util-bin
 ./usr/bin/aproposbase-man-bin

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1588 src/distrib/sets/lists/man/mi:1.1589
--- src/distrib/sets/lists/man/mi:1.1588	Sun May 20 10:08:32 2018
+++ src/distrib/sets/lists/man/mi	Tue May 22 21:05:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1588 2018/05/20 14:08:32 thorpej Exp $
+# $NetBSD: mi,v 1.1589 2018/05/23 01:05:47 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -38,7 +38,7 @@
 ./usr/share/info/texinfo.info			man-texinfo-info	info
 ./usr/share/info/uucp.info			man-obsolete		obsolete
 ./usr/share/info/vi.info			man-sys-info		doc,info
-./usr/share/man/cat1/Mail.0			man-mail-catman		.cat
+./usr/share/man/cat1/Mail.0			man-obsolete		obsolete
 ./usr/share/man/cat1/[.0			man-util-catman		.cat
 ./usr/share/man/cat1/agrep.0			man-util-catman		.cat
 ./usr/share/man/cat1/alias.0			man-util-catman		.cat
@@ -3263,7 +3263,7 @@
 ./usr/share/man/cat9lua/intro.0			man-sys-catman		.cat
 ./usr/share/man/cat9lua/pmf.0			man-sys-catman		.cat
 ./usr/share/man/cat9lua/systm.0			man-sys-catman		.cat
-./usr/share/man/html1/Mail.html			man-mail-htmlman	html
+./usr/share/man/html1/Mail.html			man-obsolete		obsolete
 ./usr/share/man/html1/[.html			man-util-htmlman	html
 ./usr/share/man/html1/agrep.html		man-util-htmlman	html
 ./usr/share/man/html1/alias.html		man-util-htmlman	html
@@ -6096,7 +6096,7 @@
 ./usr/share/man/html9lua/intro.html		man-sys-htmlman		html
 ./usr/share/man/html9lua/pmf.html		man-sys-htmlman		html
 ./usr/share/man/html9lua/systm.html		man-sys-htmlman		html
-./usr/share/man/man1/Mail.1			man-mail-man		.man
+./usr/share/man/man1/Mail.1			man-obsolete		obsolete
 ./usr/share/man/man1/[.1			man-util-man		.man
 ./usr/share/man/man1/agrep.1			man-util-man		.man
 ./usr/share/man/man1/alias.1			man-util-man		.man



CVS commit: src/usr.bin/mail

2018-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 23 01:03:46 UTC 2018

Modified Files:
src/usr.bin/mail: Makefile mail.1

Log Message:
Remove Mail


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/mail/Makefile
cvs rdiff -u -r1.63 -r1.64 src/usr.bin/mail/mail.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/mail/Makefile
diff -u src/usr.bin/mail/Makefile:1.36 src/usr.bin/mail/Makefile:1.37
--- src/usr.bin/mail/Makefile:1.36	Sat Jul  5 15:22:04 2014
+++ src/usr.bin/mail/Makefile	Tue May 22 21:03:46 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.36 2014/07/05 19:22:04 dholland Exp $
+#	$NetBSD: Makefile,v 1.37 2018/05/23 01:03:46 christos Exp $
 #	@(#)Makefile	8.3 (Berkeley) 4/20/95
 
 .include 
@@ -26,8 +26,8 @@ SRCS=	version.c support.c cmd1.c cmd2.c 
 	dotlock.c edit.c fio.c format.c getname.c head.c v7.local.c lex.c \
 	list.c main.c names.c popen.c quit.c send.c sig.c strings.c temp.c \
 	tty.c vars.c
-LINKS=	${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx
-MLINKS=	mail.1 Mail.1 mail.1 mailx.1
+LINKS=	${BINDIR}/mail ${BINDIR}/mailx
+MLINKS=	mail.1 mailx.1
 
 LDADD+=		-lutil
 DPADD+=		${LIBUTIL}

Index: src/usr.bin/mail/mail.1
diff -u src/usr.bin/mail/mail.1:1.63 src/usr.bin/mail/mail.1:1.64
--- src/usr.bin/mail/mail.1:1.63	Mon Jul  3 17:34:20 2017
+++ src/usr.bin/mail/mail.1	Tue May 22 21:03:46 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mail.1,v 1.63 2017/07/03 21:34:20 wiz Exp $
+.\"	$NetBSD: mail.1,v 1.64 2018/05/23 01:03:46 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,13 +29,12 @@
 .\"
 .\"	@(#)mail.1	8.8 (Berkeley) 4/28/95
 .\"
-.Dd December 15, 2014
+.Dd May 22, 2018
 .Dt MAIL 1
 .Os
 .Sh NAME
 .Nm mail ,
-.Nm mailx ,
-.Nm Mail
+.Nm mailx
 .Nd send and receive mail
 .Sh SYNOPSIS
 .Nm
@@ -2299,11 +2298,14 @@ originally written by Kurt Shoens.
 There are some flags and commands that are not documented here.
 Most are not useful to the general user.
 .Pp
-Usually,
+Historically,
 .Nm
-is just a link to
+was just a link to
 .Nm Mail ,
-which can be confusing.
+which was confusing.
+.Nm Mail
+has been removed in
+.Nx 9 .
 .Pp
 The name of the
 .Ic alternates



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

2018-05-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 22 21:03:09 UTC 2018

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

Log Message:
Define PTRACE_BREAKPOINT_ASM for i386 in the MD part of 

x86 uses int3 for software breakpoint on i386 and amd64.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/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/i386/include/ptrace.h
diff -u src/sys/arch/i386/include/ptrace.h:1.19 src/sys/arch/i386/include/ptrace.h:1.20
--- src/sys/arch/i386/include/ptrace.h:1.19	Sat Apr  8 02:02:30 2017
+++ src/sys/arch/i386/include/ptrace.h	Tue May 22 21:03:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.19 2017/04/08 02:02:30 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.20 2018/05/22 21:03:09 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -112,6 +112,7 @@
 #define PTRACE_REG_INTRV(r)	(r)->r_eax
 
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xcc })
+#define PTRACE_BREAKPOINT_ASM	__asm __volatile ("int3" : : : "memory")
 #define PTRACE_BREAKPOINT_SIZE	1
 #define PTRACE_BREAKPOINT_ADJ	sizeof(PTRACE_BREAKPOINT)
 



CVS commit: [netbsd-8] src/doc

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:51:55 UTC 2018

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

Log Message:
Tickets #830, #831 and #833


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.200 -r1.1.2.201 src/doc/CHANGES-8.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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.200 src/doc/CHANGES-8.0:1.1.2.201
--- src/doc/CHANGES-8.0:1.1.2.200	Thu May 17 14:08:18 2018
+++ src/doc/CHANGES-8.0	Tue May 22 17:51:55 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.200 2018/05/17 14:08:18 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.201 2018/05/22 17:51:55 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13479,3 +13479,20 @@ sys/netipsec/ipsecif.c1.8
 	are created.
 	[knakahara, ticket #829]
 
+sys/netinet6/nd6_rtr.c1.142
+
+	Add missing m_put_rcvif_psref.
+	[maxv, ticket #830]
+
+sys/arch/i386/stand/efiboot/eficons.c		1.6
+
+	Avoid an invisible timer countdown on some UEFI implementations.
+	[jakllsch, ticket #831]
+
+sys/kern/uipc_mbuf.c1.214
+
+	Revert ticket #770:
+	remove the M_READONLY check. The initial code was correct.
+	[maxv, ticket #833]
+
+



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:50:27 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #833):

sys/kern/uipc_mbuf.c: revision 1.214

Revert my rev1.190, remove the M_READONLY check. The initial code was
correct: what is read-only is the mbuf storage, not the mbuf itself. The
storage contains the packet payload, and never has anything related to
mbufs. So it is fine to remove M_PKTHDR on mbufs that have a read-only
storage.

In fact it was kind of obvious, since several places already manually
remove M_PKTHDR without taking care of the external storage.


To generate a diff of this commit:
cvs rdiff -u -r1.172.6.4 -r1.172.6.5 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.172.6.4 src/sys/kern/uipc_mbuf.c:1.172.6.5
--- src/sys/kern/uipc_mbuf.c:1.172.6.4	Sun May  6 09:20:43 2018
+++ src/sys/kern/uipc_mbuf.c	Tue May 22 17:50:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.172.6.4 2018/05/06 09:20:43 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.172.6.5 2018/05/22 17:50:27 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.4 2018/05/06 09:20:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.5 2018/05/22 17:50:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -460,11 +460,6 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
-	if (M_READONLY(m)) {
-		/* Nothing we can do. */
-		return;
-	}
-
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:43:21 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficons.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #831):

sys/arch/i386/stand/efiboot/eficons.c: revision 1.6

During awaitkey(), move the cursor back to the beginning of the
countdown with '\b' only after waiting.

Some UEFI implementations have a destructive/erasing backspace,
and will not show the countdown if we move the cursor back before the
wait.

My ThinkPad T430 w/ Lenovo's UEFI exhibited this whiteout-backspace,
while my Gigabyte Brix GB-BXBT-2807 did not.

Should fix PR #53292.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.1 src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.2
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.1	Mon Apr  2 08:50:33 2018
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Tue May 22 17:43:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.4.2.1 2018/04/02 08:50:33 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4.2.2 2018/05/22 17:43:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -328,10 +328,10 @@ awaitkey(int timeout, int tell)
 	char c = 0;
 
 	for (;;) {
-		if (tell && timeout) {
-			char numbuf[32];
-			int len;
+		char numbuf[32];
+		int len;
 
+		if (tell && timeout) {
 			len = snprintf(numbuf, sizeof(numbuf), "%d seconds. ",
 			timeout);
 			if (len > 0 && len < sizeof(numbuf)) {
@@ -340,7 +340,6 @@ awaitkey(int timeout, int tell)
 printf("%s", numbuf);
 while (*p)
 	*p++ = '\b';
-printf("%s", numbuf);
 			}
 		}
 		if (iskey(1)) {
@@ -355,6 +354,8 @@ awaitkey(int timeout, int tell)
 			internal_waitforinputevent(1000);
 		else
 			break;
+		if (tell)
+			printf("%s", numbuf);
 	}
 
 out:



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:41:12 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-8]: nd6_rtr.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #830):

sys/netinet6/nd6_rtr.c: revision 1.142

Add missing m_put_rcvif_psref.


To generate a diff of this commit:
cvs rdiff -u -r1.135.6.2 -r1.135.6.3 src/sys/netinet6/nd6_rtr.c

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

Modified files:

Index: src/sys/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.135.6.2 src/sys/netinet6/nd6_rtr.c:1.135.6.3
--- src/sys/netinet6/nd6_rtr.c:1.135.6.2	Mon Feb  5 14:55:15 2018
+++ src/sys/netinet6/nd6_rtr.c	Tue May 22 17:41:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_rtr.c,v 1.135.6.2 2018/02/05 14:55:15 martin Exp $	*/
+/*	$NetBSD: nd6_rtr.c,v 1.135.6.3 2018/05/22 17:41:12 martin Exp $	*/
 /*	$KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.135.6.2 2018/02/05 14:55:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.135.6.3 2018/05/22 17:41:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -179,6 +179,7 @@ nd6_rs_input(struct mbuf *m, int off, in
 	IP6_EXTHDR_GET(nd_rs, struct nd_router_solicit *, m, off, icmp6len);
 	if (nd_rs == NULL) {
 		ICMP6_STATINC(ICMP6_STAT_TOOSHORT);
+		m_put_rcvif_psref(ifp, );
 		return;
 	}
 



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:38:48 UTC 2018

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

Log Message:
Ticket #1606


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.104 -r1.1.2.105 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.104 src/doc/CHANGES-7.0.3:1.1.2.105
--- src/doc/CHANGES-7.0.3:1.1.2.104	Mon May 14 16:20:55 2018
+++ src/doc/CHANGES-7.0.3	Tue May 22 17:38:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.104 2018/05/14 16:20:55 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.105 2018/05/22 17:38:48 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5436,3 +5436,9 @@ sys/net/npf/npf_inet.c1.45
 	Fix use-after-free.
 	[maxv, ticket #1605]
 
+sys/kern/uipc_mbuf.c1.214
+
+	Revert ticket #1598:
+	remove the M_READONLY check. The initial code was correct.
+	[maxv, ticket #1606]
+



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:38:05 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1606):

sys/kern/uipc_mbuf.c: revision 1.214

Revert my rev1.190, remove the M_READONLY check. The initial code was
correct: what is read-only is the mbuf storage, not the mbuf itself. The
storage contains the packet payload, and never has anything related to
mbufs. So it is fine to remove M_PKTHDR on mbufs that have a read-only
storage.

In fact it was kind of obvious, since several places already manually
remove M_PKTHDR without taking care of the external storage.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.2.3 -r1.158.4.1.2.4 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158.4.1.2.3 src/sys/kern/uipc_mbuf.c:1.158.4.1.2.4
--- src/sys/kern/uipc_mbuf.c:1.158.4.1.2.3	Tue May 15 04:48:16 2018
+++ src/sys/kern/uipc_mbuf.c	Tue May 22 17:38:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.3 2018/05/15 04:48:16 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.4 2018/05/22 17:38:05 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.3 2018/05/15 04:48:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.4 2018/05/22 17:38:05 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -458,11 +458,6 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
-	if (M_READONLY(m)) {
-		/* Nothing we can do. */
-		return;
-	}
-
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:37:15 UTC 2018

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

Log Message:
Ticket #1606


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 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.11 src/doc/CHANGES-7.1.3:1.1.2.12
--- src/doc/CHANGES-7.1.3:1.1.2.11	Mon May 14 16:21:13 2018
+++ src/doc/CHANGES-7.1.3	Tue May 22 17:37:15 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.11 2018/05/14 16:21:13 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.12 2018/05/22 17:37:15 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -128,3 +128,9 @@ sys/net/npf/npf_inet.c1.45
 	Fix use-after-free.
 	[maxv, ticket #1605]
 
+sys/kern/uipc_mbuf.c1.214
+
+	Revert ticket #1598:
+	remove the M_READONLY check. The initial code was correct.
+	[maxv, ticket #1606]
+



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:36:45 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1606):

sys/kern/uipc_mbuf.c: revision 1.214

Revert my rev1.190, remove the M_READONLY check. The initial code was
correct: what is read-only is the mbuf storage, not the mbuf itself. The
storage contains the packet payload, and never has anything related to
mbufs. So it is fine to remove M_PKTHDR on mbufs that have a read-only
storage.

In fact it was kind of obvious, since several places already manually
remove M_PKTHDR without taking care of the external storage.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.6.3 -r1.158.4.1.6.4 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158.4.1.6.3 src/sys/kern/uipc_mbuf.c:1.158.4.1.6.4
--- src/sys/kern/uipc_mbuf.c:1.158.4.1.6.3	Thu May  3 15:14:48 2018
+++ src/sys/kern/uipc_mbuf.c	Tue May 22 17:36:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.3 2018/05/03 15:14:48 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.4 2018/05/22 17:36:45 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.3 2018/05/03 15:14:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.4 2018/05/22 17:36:45 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -458,11 +458,6 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
-	if (M_READONLY(m)) {
-		/* Nothing we can do. */
-		return;
-	}
-
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



CVS commit: [netbsd-7] src/doc

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:36:10 UTC 2018

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

Log Message:
Ticket #1606


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.89 -r1.1.2.90 src/doc/CHANGES-7.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-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.89 src/doc/CHANGES-7.2:1.1.2.90
--- src/doc/CHANGES-7.2:1.1.2.89	Mon May 14 16:21:48 2018
+++ src/doc/CHANGES-7.2	Tue May 22 17:36:10 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.89 2018/05/14 16:21:48 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.90 2018/05/22 17:36:10 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5481,3 +5481,9 @@ sys/net/npf/npf_inet.c1.45
 	Fix use-after-free.
 	[maxv, ticket #1605]
 
+sys/kern/uipc_mbuf.c1.214
+
+	Revert ticket #1598:
+	remove the M_READONLY check. The initial code was correct.
+	[maxv, ticket #1606]
+



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:35:38 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1606):

sys/kern/uipc_mbuf.c: revision 1.214

Revert my rev1.190, remove the M_READONLY check. The initial code was
correct: what is read-only is the mbuf storage, not the mbuf itself. The
storage contains the packet payload, and never has anything related to
mbufs. So it is fine to remove M_PKTHDR on mbufs that have a read-only
storage.

In fact it was kind of obvious, since several places already manually
remove M_PKTHDR without taking care of the external storage.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.4 -r1.158.4.5 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158.4.4 src/sys/kern/uipc_mbuf.c:1.158.4.5
--- src/sys/kern/uipc_mbuf.c:1.158.4.4	Thu May  3 15:13:36 2018
+++ src/sys/kern/uipc_mbuf.c	Tue May 22 17:35:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.4 2018/05/03 15:13:36 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.5 2018/05/22 17:35:38 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.4 2018/05/03 15:13:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.5 2018/05/22 17:35:38 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -458,11 +458,6 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
-	if (M_READONLY(m)) {
-		/* Nothing we can do. */
-		return;
-	}
-
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



CVS commit: src/sys/arch/x86

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 17:14:47 UTC 2018

Modified Files:
src/sys/arch/x86/include: specialreg.h
src/sys/arch/x86/x86: spectre.c

Log Message:
Extend the AMD NONARCH method to family 17h. The AMD spec states that for
17h care must be taken when handling sibling threads.

The concern is that if we have a protected two-thread process running on
two siblings, and context switch one thread to another unprotected thread,
disabling the SSB protection on one logical core will disable SSB on its
sibling too (which is still running the protected thread).

All of that doesn't matter to us, because the SSB value we set is
system-wide, not per-process.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/x86/spectre.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/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.123 src/sys/arch/x86/include/specialreg.h:1.124
--- src/sys/arch/x86/include/specialreg.h:1.123	Tue May 22 10:20:04 2018
+++ src/sys/arch/x86/include/specialreg.h	Tue May 22 17:14:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.123 2018/05/22 10:20:04 maxv Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.124 2018/05/22 17:14:46 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -860,6 +860,7 @@
 #define 	LS_CFG_DIS_LS2_SQUISH	0x0200
 #define 	LS_CFG_DIS_SSB_F15H	0x0040ULL
 #define 	LS_CFG_DIS_SSB_F16H	0x0002ULL
+#define 	LS_CFG_DIS_SSB_F17H	0x0400ULL
 
 #define MSR_IC_CFG	0xc0011021
 #define 	IC_CFG_DIS_SEQ_PREFETCH	0x0800

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.17 src/sys/arch/x86/x86/spectre.c:1.18
--- src/sys/arch/x86/x86/spectre.c:1.17	Tue May 22 16:44:42 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 17:14:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.17 2018/05/22 16:44:42 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.18 2018/05/22 17:14:46 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.17 2018/05/22 16:44:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.18 2018/05/22 17:14:46 maxv Exp $");
 
 #include "opt_spectre.h"
 
@@ -62,7 +62,8 @@ enum v4_mitigation {
 	V4_MITIGATION_INTEL_SSBD,
 	V4_MITIGATION_INTEL_SSB_NO,
 	V4_MITIGATION_AMD_NONARCH_F15H,
-	V4_MITIGATION_AMD_NONARCH_F16H
+	V4_MITIGATION_AMD_NONARCH_F16H,
+	V4_MITIGATION_AMD_NONARCH_F17H
 };
 
 static enum v2_mitigation v2_mitigation_method = V2_MITIGATION_NONE;
@@ -381,6 +382,7 @@ v4_set_name(void)
 			break;
 		case V4_MITIGATION_AMD_NONARCH_F15H:
 		case V4_MITIGATION_AMD_NONARCH_F16H:
+		case V4_MITIGATION_AMD_NONARCH_F17H:
 			strlcat(name, "[AMD NONARCH]", sizeof(name));
 			break;
 		}
@@ -426,6 +428,9 @@ v4_detect_method(void)
 		case 0x16:
 			v4_mitigation_method = V4_MITIGATION_AMD_NONARCH_F16H;
 			return;
+		case 0x17:
+			v4_mitigation_method = V4_MITIGATION_AMD_NONARCH_F17H;
+			return;
 		default:
 			break;
 		}
@@ -437,40 +442,37 @@ v4_detect_method(void)
 static void
 mitigation_v4_apply_cpu(bool enabled)
 {
-	uint64_t msr;
+	uint64_t msr, msrval = 0, msrbit = 0;
 
 	switch (v4_mitigation_method) {
 	case V4_MITIGATION_NONE:
 	case V4_MITIGATION_INTEL_SSB_NO:
 		panic("impossible");
 	case V4_MITIGATION_INTEL_SSBD:
-		msr = rdmsr(MSR_IA32_SPEC_CTRL);
-		if (enabled) {
-			msr |= IA32_SPEC_CTRL_SSBD;
-		} else {
-			msr &= ~IA32_SPEC_CTRL_SSBD;
-		}
-		wrmsr(MSR_IA32_SPEC_CTRL, msr);
+		msrval = MSR_IA32_SPEC_CTRL;
+		msrbit = IA32_SPEC_CTRL_SSBD;
 		break;
 	case V4_MITIGATION_AMD_NONARCH_F15H:
-		msr = rdmsr(MSR_LS_CFG);
-		if (enabled) {
-			msr |= LS_CFG_DIS_SSB_F15H;
-		} else {
-			msr &= ~LS_CFG_DIS_SSB_F15H;
-		}
-		wrmsr(MSR_LS_CFG, msr);
+		msrval = MSR_LS_CFG;
+		msrbit = LS_CFG_DIS_SSB_F15H;
 		break;
 	case V4_MITIGATION_AMD_NONARCH_F16H:
-		msr = rdmsr(MSR_LS_CFG);
-		if (enabled) {
-			msr |= LS_CFG_DIS_SSB_F16H;
-		} else {
-			msr &= ~LS_CFG_DIS_SSB_F16H;
-		}
-		wrmsr(MSR_LS_CFG, msr);
+		msrval = MSR_LS_CFG;
+		msrbit = LS_CFG_DIS_SSB_F16H;
+		break;
+	case V4_MITIGATION_AMD_NONARCH_F17H:
+		msrval = MSR_LS_CFG;
+		msrbit = LS_CFG_DIS_SSB_F17H;
 		break;
 	}
+
+	msr = rdmsr(msrval);
+	if (enabled) {
+		msr |= msrbit;
+	} else {
+		msr &= ~msrbit;
+	}
+	wrmsr(msrval, msr);
 }
 
 static void
@@ -512,6 +514,7 @@ static int mitigation_v4_change(bool ena
 	case V4_MITIGATION_INTEL_SSBD:
 	case V4_MITIGATION_AMD_NONARCH_F15H:
 	case V4_MITIGATION_AMD_NONARCH_F16H:
+	case V4_MITIGATION_AMD_NONARCH_F17H:
 		printf("[+] %s SpectreV4 Mitigation...",
 		enabled ? "Enabling" : "Disabling");
 		xc = xc_broadcast(0, mitigation_v4_change_cpu,



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

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 16:44:43 UTC 2018

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

Log Message:
Simplify the sysctl handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/spectre.c

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

Modified files:

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.16 src/sys/arch/x86/x86/spectre.c:1.17
--- src/sys/arch/x86/x86/spectre.c:1.16	Tue May 22 16:36:19 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 16:44:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.16 2018/05/22 16:36:19 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.17 2018/05/22 16:44:42 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.16 2018/05/22 16:36:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.17 2018/05/22 16:44:42 maxv Exp $");
 
 #include "opt_spectre.h"
 
@@ -355,19 +355,9 @@ sysctl_machdep_spectreV2_mitigated(SYSCT
 	if (error != 0 || newp == NULL)
 		return error;
 
-	if (val == 0) {
-		if (!v2_mitigation_enabled)
-			error = 0;
-		else
-			error = mitigation_v2_change(false);
-	} else {
-		if (v2_mitigation_enabled)
-			error = 0;
-		else
-			error = mitigation_v2_change(true);
-	}
-
-	return error;
+	if (val == v2_mitigation_enabled)
+		return 0;
+	return mitigation_v2_change(val);
 }
 
 /* -- */
@@ -557,19 +547,9 @@ sysctl_machdep_spectreV4_mitigated(SYSCT
 	if (error != 0 || newp == NULL)
 		return error;
 
-	if (val == 0) {
-		if (!v4_mitigation_enabled)
-			error = 0;
-		else
-			error = mitigation_v4_change(false);
-	} else {
-		if (v4_mitigation_enabled)
-			error = 0;
-		else
-			error = mitigation_v4_change(true);
-	}
-
-	return error;
+	if (val == v4_mitigation_enabled)
+		return 0;
+	return mitigation_v4_change(val);
 }
 
 /* -- */



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

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 16:36:19 UTC 2018

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

Log Message:
Forgot switch cases for AMD.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/spectre.c

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

Modified files:

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.15 src/sys/arch/x86/x86/spectre.c:1.16
--- src/sys/arch/x86/x86/spectre.c:1.15	Tue May 22 10:20:04 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 16:36:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.15 2018/05/22 10:20:04 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.16 2018/05/22 16:36:19 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.15 2018/05/22 10:20:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.16 2018/05/22 16:36:19 maxv Exp $");
 
 #include "opt_spectre.h"
 
@@ -520,6 +520,8 @@ static int mitigation_v4_change(bool ena
 		mutex_exit(_lock);
 		return EOPNOTSUPP;
 	case V4_MITIGATION_INTEL_SSBD:
+	case V4_MITIGATION_AMD_NONARCH_F15H:
+	case V4_MITIGATION_AMD_NONARCH_F16H:
 		printf("[+] %s SpectreV4 Mitigation...",
 		enabled ? "Enabling" : "Disabling");
 		xc = xc_broadcast(0, mitigation_v4_change_cpu,



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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 14:50:06 UTC 2018

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
Ticket #1500


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.144 -r1.1.2.145 src/doc/CHANGES-6.0.7

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-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.144 src/doc/CHANGES-6.0.7:1.1.2.145
--- src/doc/CHANGES-6.0.7:1.1.2.144	Thu May  3 15:04:51 2018
+++ src/doc/CHANGES-6.0.7	Tue May 22 14:50:06 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.144 2018/05/03 15:04:51 martin Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.145 2018/05/22 14:50:06 martin Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -15472,3 +15472,25 @@ sys/kern/uipc_mbuf.c1.211 (patch)
 	the chain.
 	[maxv, ticket #1547]
 
+sys/kern/kern_exec.c	(patch)
+sys/arch/amiga/conf/DRACO(patch)
+sys/arch/amiga/conf/GENERIC(patch)
+sys/arch/amiga/conf/GENERIC.in(patch)
+sys/arch/hp300/conf/GENERIC(patch)
+sys/arch/i386/conf/GENERIC(patch)
+sys/arch/i386/conf/XEN3_DOM0(patch)
+sys/arch/i386/conf/XEN3_DOMU(patch)
+sys/arch/sparc/conf/BILL-THE-CAT			(patch)
+sys/arch/sparc/conf/GENERIC(patch)
+sys/arch/sparc/conf/KRUPS(patch)
+sys/arch/sparc/conf/MRCOFFEE(patch)
+sys/arch/sparc/conf/TADPOLE3GX(patch)
+sys/arch/sparc64/conf/GENERIC(patch)
+sys/arch/sparc64/conf/NONPLUS64(patch)
+
+	Disable compat_svr4 and compat_svr4_32 everywhere.
+	Disable compat_ibcs2 everywhere but on Vax.
+	Disable autoload of modules for svr4/svr4_32/ibcs2/freebsd.
+	[maxv, ticket #1500]
+
+



CVS commit: [netbsd-6-0] src/sys

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 14:49:02 UTC 2018

Modified Files:
src/sys/arch/amiga/conf [netbsd-6-0]: DRACO GENERIC GENERIC.in
src/sys/arch/hp300/conf [netbsd-6-0]: GENERIC
src/sys/arch/i386/conf [netbsd-6-0]: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/sparc/conf [netbsd-6-0]: BILL-THE-CAT GENERIC KRUPS
MRCOFFEE TADPOLE3GX
src/sys/arch/sparc64/conf [netbsd-6-0]: GENERIC NONPLUS64
src/sys/kern [netbsd-6-0]: kern_exec.c

Log Message:
Apply patch requested by maxv in ticket #1500:

 * disable compat_svr4 and compat_svr4_32 everywhere
 * disable compat_ibcs2 everywhere but on Vax
 * remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.154.6.1 src/sys/arch/amiga/conf/DRACO
cvs rdiff -u -r1.284 -r1.284.6.1 src/sys/arch/amiga/conf/GENERIC
cvs rdiff -u -r1.96 -r1.96.6.1 src/sys/arch/amiga/conf/GENERIC.in
cvs rdiff -u -r1.169 -r1.169.6.1 src/sys/arch/hp300/conf/GENERIC
cvs rdiff -u -r1.1066.2.7.4.1 -r1.1066.2.7.4.2 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.60.2.5 -r1.60.2.5.4.1 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.41.2.2 -r1.41.2.2.4.1 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.51 -r1.51.8.1 src/sys/arch/sparc/conf/BILL-THE-CAT
cvs rdiff -u -r1.230 -r1.230.6.1 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.56.4.1 -r1.56.4.1.4.1 src/sys/arch/sparc/conf/KRUPS
cvs rdiff -u -r1.34 -r1.34.8.1 src/sys/arch/sparc/conf/MRCOFFEE
cvs rdiff -u -r1.54.4.1 -r1.54.4.1.4.1 src/sys/arch/sparc/conf/TADPOLE3GX
cvs rdiff -u -r1.148.2.2 -r1.148.2.2.4.1 src/sys/arch/sparc64/conf/GENERIC
cvs rdiff -u -r1.34 -r1.34.8.1 src/sys/arch/sparc64/conf/NONPLUS64
cvs rdiff -u -r1.339.2.5.4.4 -r1.339.2.5.4.5 src/sys/kern/kern_exec.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/conf/DRACO
diff -u src/sys/arch/amiga/conf/DRACO:1.154 src/sys/arch/amiga/conf/DRACO:1.154.6.1
--- src/sys/arch/amiga/conf/DRACO:1.154	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/DRACO	Tue May 22 14:49:01 2018
@@ -1,4 +1,4 @@
-# $NetBSD: DRACO,v 1.154 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: DRACO,v 1.154.6.1 2018/05/22 14:49:01 martin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.154 $"
+#ident 		"GENERIC-$Revision: 1.154.6.1 $"
 
 
 maxusers	8
@@ -143,7 +143,7 @@ options 	COMPAT_30	# NetBSD 3.0 compatib
 options 	COMPAT_40	# NetBSD 4.0 compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
 options 	COMPAT_SUNOS	# Support to run Sun (m68k) executables
-options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
+#options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
 options 	COMPAT_NOMID	# allow nonvalid machine id executables
 #options 	COMPAT_LINUX	# Support to run Linux/m68k executables
 

Index: src/sys/arch/amiga/conf/GENERIC
diff -u src/sys/arch/amiga/conf/GENERIC:1.284 src/sys/arch/amiga/conf/GENERIC:1.284.6.1
--- src/sys/arch/amiga/conf/GENERIC:1.284	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/GENERIC	Tue May 22 14:49:01 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.284 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: GENERIC,v 1.284.6.1 2018/05/22 14:49:01 martin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.284 $"
+#ident 		"GENERIC-$Revision: 1.284.6.1 $"
 
 
 maxusers	8
@@ -155,7 +155,7 @@ options 	COMPAT_30	# NetBSD 3.0 compatib
 options 	COMPAT_40	# NetBSD 4.0 compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
 options 	COMPAT_SUNOS	# Support to run Sun (m68k) executables
-options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
+#options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
 options 	COMPAT_NOMID	# allow nonvalid machine id executables
 #options 	COMPAT_LINUX	# Support to run Linux/m68k executables
 

Index: src/sys/arch/amiga/conf/GENERIC.in
diff -u src/sys/arch/amiga/conf/GENERIC.in:1.96 src/sys/arch/amiga/conf/GENERIC.in:1.96.6.1
--- src/sys/arch/amiga/conf/GENERIC.in:1.96	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/GENERIC.in	Tue May 22 14:49:01 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.96 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.96.6.1 2018/05/22 14:49:01 martin Exp $
 #
 ##
 # GENERIC machine description file
@@ -52,7 +52,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.96 $"
+#ident 		"GENERIC-$Revision: 

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

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 14:45:21 UTC 2018

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
Ticket #1500


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.142 -r1.1.2.143 src/doc/CHANGES-6.1.6

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-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.142 src/doc/CHANGES-6.1.6:1.1.2.143
--- src/doc/CHANGES-6.1.6:1.1.2.142	Thu May 17 13:51:22 2018
+++ src/doc/CHANGES-6.1.6	Tue May 22 14:45:21 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.142 2018/05/17 13:51:22 martin Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.143 2018/05/22 14:45:21 martin Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -15147,3 +15147,24 @@ sys/net/npf/npf_inet.c1.45 (patch)
 	Fix use-after-free.
 	[maxv, ticket #1549]
 
+sys/kern/kern_exec.c	(patch)
+sys/arch/amiga/conf/DRACO(patch)
+sys/arch/amiga/conf/GENERIC(patch)
+sys/arch/amiga/conf/GENERIC.in(patch)
+sys/arch/hp300/conf/GENERIC(patch)
+sys/arch/i386/conf/GENERIC(patch)
+sys/arch/i386/conf/XEN3_DOM0(patch)
+sys/arch/i386/conf/XEN3_DOMU(patch)
+sys/arch/sparc/conf/BILL-THE-CAT			(patch)
+sys/arch/sparc/conf/GENERIC(patch)
+sys/arch/sparc/conf/KRUPS(patch)
+sys/arch/sparc/conf/MRCOFFEE(patch)
+sys/arch/sparc/conf/TADPOLE3GX(patch)
+sys/arch/sparc64/conf/GENERIC(patch)
+sys/arch/sparc64/conf/NONPLUS64(patch)
+
+	Disable compat_svr4 and compat_svr4_32 everywhere.
+	Disable compat_ibcs2 everywhere but on Vax.
+	Disable autoload of modules for svr4/svr4_32/ibcs2/freebsd.
+	[maxv, ticket #1500]
+



CVS commit: [netbsd-6-1] src/sys

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 14:44:31 UTC 2018

Modified Files:
src/sys/arch/amiga/conf [netbsd-6-1]: DRACO GENERIC GENERIC.in
src/sys/arch/hp300/conf [netbsd-6-1]: GENERIC
src/sys/arch/i386/conf [netbsd-6-1]: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/sparc/conf [netbsd-6-1]: BILL-THE-CAT GENERIC KRUPS
MRCOFFEE TADPOLE3GX
src/sys/arch/sparc64/conf [netbsd-6-1]: GENERIC NONPLUS64
src/sys/kern [netbsd-6-1]: kern_exec.c

Log Message:
Apply patch requested by maxv in ticket #1500:

 * disable compat_svr4 and compat_svr4_32 everywhere
 * disable compat_ibcs2 everywhere but on Vax
 * remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.154.8.1 src/sys/arch/amiga/conf/DRACO
cvs rdiff -u -r1.284 -r1.284.8.1 src/sys/arch/amiga/conf/GENERIC
cvs rdiff -u -r1.96 -r1.96.8.1 src/sys/arch/amiga/conf/GENERIC.in
cvs rdiff -u -r1.169 -r1.169.8.1 src/sys/arch/hp300/conf/GENERIC
cvs rdiff -u -r1.1066.2.7.6.1 -r1.1066.2.7.6.2 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.60.2.7 -r1.60.2.7.2.1 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.41.2.2 -r1.41.2.2.6.1 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.51 -r1.51.10.1 src/sys/arch/sparc/conf/BILL-THE-CAT
cvs rdiff -u -r1.230 -r1.230.8.1 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.56.4.1 -r1.56.4.1.6.1 src/sys/arch/sparc/conf/KRUPS
cvs rdiff -u -r1.34 -r1.34.10.1 src/sys/arch/sparc/conf/MRCOFFEE
cvs rdiff -u -r1.54.4.1 -r1.54.4.1.6.1 src/sys/arch/sparc/conf/TADPOLE3GX
cvs rdiff -u -r1.148.2.2 -r1.148.2.2.6.1 src/sys/arch/sparc64/conf/GENERIC
cvs rdiff -u -r1.34 -r1.34.10.1 src/sys/arch/sparc64/conf/NONPLUS64
cvs rdiff -u -r1.339.2.6.2.3 -r1.339.2.6.2.4 src/sys/kern/kern_exec.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/conf/DRACO
diff -u src/sys/arch/amiga/conf/DRACO:1.154 src/sys/arch/amiga/conf/DRACO:1.154.8.1
--- src/sys/arch/amiga/conf/DRACO:1.154	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/DRACO	Tue May 22 14:44:30 2018
@@ -1,4 +1,4 @@
-# $NetBSD: DRACO,v 1.154 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: DRACO,v 1.154.8.1 2018/05/22 14:44:30 martin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.154 $"
+#ident 		"GENERIC-$Revision: 1.154.8.1 $"
 
 
 maxusers	8
@@ -143,7 +143,7 @@ options 	COMPAT_30	# NetBSD 3.0 compatib
 options 	COMPAT_40	# NetBSD 4.0 compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
 options 	COMPAT_SUNOS	# Support to run Sun (m68k) executables
-options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
+#options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
 options 	COMPAT_NOMID	# allow nonvalid machine id executables
 #options 	COMPAT_LINUX	# Support to run Linux/m68k executables
 

Index: src/sys/arch/amiga/conf/GENERIC
diff -u src/sys/arch/amiga/conf/GENERIC:1.284 src/sys/arch/amiga/conf/GENERIC:1.284.8.1
--- src/sys/arch/amiga/conf/GENERIC:1.284	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/GENERIC	Tue May 22 14:44:30 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.284 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: GENERIC,v 1.284.8.1 2018/05/22 14:44:30 martin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.284 $"
+#ident 		"GENERIC-$Revision: 1.284.8.1 $"
 
 
 maxusers	8
@@ -155,7 +155,7 @@ options 	COMPAT_30	# NetBSD 3.0 compatib
 options 	COMPAT_40	# NetBSD 4.0 compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
 options 	COMPAT_SUNOS	# Support to run Sun (m68k) executables
-options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
+#options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
 options 	COMPAT_NOMID	# allow nonvalid machine id executables
 #options 	COMPAT_LINUX	# Support to run Linux/m68k executables
 

Index: src/sys/arch/amiga/conf/GENERIC.in
diff -u src/sys/arch/amiga/conf/GENERIC.in:1.96 src/sys/arch/amiga/conf/GENERIC.in:1.96.8.1
--- src/sys/arch/amiga/conf/GENERIC.in:1.96	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/GENERIC.in	Tue May 22 14:44:30 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.96 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.96.8.1 2018/05/22 14:44:30 martin Exp $
 #
 ##
 # GENERIC machine description file
@@ -52,7 +52,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.96 $"
+#ident 		"GENERIC-$Revision: 

CVS commit: [netbsd-6] src/doc

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 14:40:58 UTC 2018

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1500


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.339 -r1.1.2.340 src/doc/CHANGES-6.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-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.339 src/doc/CHANGES-6.2:1.1.2.340
--- src/doc/CHANGES-6.2:1.1.2.339	Thu May 17 13:46:08 2018
+++ src/doc/CHANGES-6.2	Tue May 22 14:40:58 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.339 2018/05/17 13:46:08 martin Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.340 2018/05/22 14:40:58 martin Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -21257,3 +21257,25 @@ sys/net/npf/npf_inet.c1.45 (patch)
 	Fix use-after-free.
 	[maxv, ticket #1549]
 
+sys/kern/kern_exec.c	(patch)
+sys/arch/amiga/conf/DRACO(patch)
+sys/arch/amiga/conf/GENERIC(patch)
+sys/arch/amiga/conf/GENERIC.in(patch)
+sys/arch/hp300/conf/GENERIC(patch)
+sys/arch/i386/conf/GENERIC(patch)
+sys/arch/i386/conf/XEN3_DOM0(patch)
+sys/arch/i386/conf/XEN3_DOMU(patch)
+sys/arch/sparc/conf/BILL-THE-CAT			(patch)
+sys/arch/sparc/conf/GENERIC(patch)
+sys/arch/sparc/conf/KRUPS(patch)
+sys/arch/sparc/conf/MRCOFFEE(patch)
+sys/arch/sparc/conf/TADPOLE3GX(patch)
+sys/arch/sparc64/conf/GENERIC(patch)
+sys/arch/sparc64/conf/NONPLUS64(patch)
+
+	Disable compat_svr4 and compat_svr4_32 everywhere.
+	Disable compat_ibcs2 everywhere but on Vax.
+	Disable autoload of modules for svr4/svr4_32/ibcs2/freebsd.
+	[maxv, ticket #1500]
+
+



CVS commit: [netbsd-6] src/sys

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 14:38:20 UTC 2018

Modified Files:
src/sys/arch/amiga/conf [netbsd-6]: DRACO GENERIC GENERIC.in
src/sys/arch/hp300/conf [netbsd-6]: GENERIC
src/sys/arch/i386/conf [netbsd-6]: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/sparc/conf [netbsd-6]: BILL-THE-CAT GENERIC KRUPS MRCOFFEE
TADPOLE3GX
src/sys/arch/sparc64/conf [netbsd-6]: GENERIC NONPLUS64
src/sys/kern [netbsd-6]: kern_exec.c

Log Message:
Apply patch requested by maxv in ticket #1500:

 * disable compat_svr4 and compat_svr4_32 everywhere
 * disable compat_ibcs2 everywhere but on Vax
 * remove the svr4/svr4_32/ibcs2/freebsd entries from the autoload list


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/arch/amiga/conf/DRACO
cvs rdiff -u -r1.284 -r1.284.2.1 src/sys/arch/amiga/conf/GENERIC
cvs rdiff -u -r1.96 -r1.96.2.1 src/sys/arch/amiga/conf/GENERIC.in
cvs rdiff -u -r1.169.2.1 -r1.169.2.2 src/sys/arch/hp300/conf/GENERIC
cvs rdiff -u -r1.1066.2.8 -r1.1066.2.9 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.60.2.7 -r1.60.2.8 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.51 -r1.51.4.1 src/sys/arch/sparc/conf/BILL-THE-CAT
cvs rdiff -u -r1.230 -r1.230.2.1 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.56.4.1 -r1.56.4.2 src/sys/arch/sparc/conf/KRUPS
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/arch/sparc/conf/MRCOFFEE
cvs rdiff -u -r1.54.4.1 -r1.54.4.2 src/sys/arch/sparc/conf/TADPOLE3GX
cvs rdiff -u -r1.148.2.2 -r1.148.2.3 src/sys/arch/sparc64/conf/GENERIC
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/arch/sparc64/conf/NONPLUS64
cvs rdiff -u -r1.339.2.10 -r1.339.2.11 src/sys/kern/kern_exec.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/conf/DRACO
diff -u src/sys/arch/amiga/conf/DRACO:1.154 src/sys/arch/amiga/conf/DRACO:1.154.2.1
--- src/sys/arch/amiga/conf/DRACO:1.154	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/DRACO	Tue May 22 14:38:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: DRACO,v 1.154 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: DRACO,v 1.154.2.1 2018/05/22 14:38:20 martin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.154 $"
+#ident 		"GENERIC-$Revision: 1.154.2.1 $"
 
 
 maxusers	8
@@ -143,7 +143,7 @@ options 	COMPAT_30	# NetBSD 3.0 compatib
 options 	COMPAT_40	# NetBSD 4.0 compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
 options 	COMPAT_SUNOS	# Support to run Sun (m68k) executables
-options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
+#options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
 options 	COMPAT_NOMID	# allow nonvalid machine id executables
 #options 	COMPAT_LINUX	# Support to run Linux/m68k executables
 

Index: src/sys/arch/amiga/conf/GENERIC
diff -u src/sys/arch/amiga/conf/GENERIC:1.284 src/sys/arch/amiga/conf/GENERIC:1.284.2.1
--- src/sys/arch/amiga/conf/GENERIC:1.284	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/GENERIC	Tue May 22 14:38:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.284 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: GENERIC,v 1.284.2.1 2018/05/22 14:38:20 martin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.284 $"
+#ident 		"GENERIC-$Revision: 1.284.2.1 $"
 
 
 maxusers	8
@@ -155,7 +155,7 @@ options 	COMPAT_30	# NetBSD 3.0 compatib
 options 	COMPAT_40	# NetBSD 4.0 compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
 options 	COMPAT_SUNOS	# Support to run Sun (m68k) executables
-options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
+#options 	COMPAT_SVR4	# Support to run SVR4 (m68k) executables
 options 	COMPAT_NOMID	# allow nonvalid machine id executables
 #options 	COMPAT_LINUX	# Support to run Linux/m68k executables
 

Index: src/sys/arch/amiga/conf/GENERIC.in
diff -u src/sys/arch/amiga/conf/GENERIC.in:1.96 src/sys/arch/amiga/conf/GENERIC.in:1.96.2.1
--- src/sys/arch/amiga/conf/GENERIC.in:1.96	Tue Jan 24 00:19:39 2012
+++ src/sys/arch/amiga/conf/GENERIC.in	Tue May 22 14:38:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.96 2012/01/24 00:19:39 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.96.2.1 2018/05/22 14:38:20 martin Exp $
 #
 ##
 # GENERIC machine description file
@@ -52,7 +52,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.96 $"
+#ident 		"GENERIC-$Revision: 1.96.2.1 $"
 
 m4_ifdef(`INSTALL_CONFIGURATION', 

CVS commit: src/sys/arch/usermode/target

2018-05-22 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue May 22 14:38:10 UTC 2018

Modified Files:
src/sys/arch/usermode/target/i386: cpu_i386.c
src/sys/arch/usermode/target/x86_64: cpu_x86_64.c

Log Message:
Include  now its available


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/target/i386/cpu_i386.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/target/x86_64/cpu_x86_64.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/usermode/target/i386/cpu_i386.c
diff -u src/sys/arch/usermode/target/i386/cpu_i386.c:1.5 src/sys/arch/usermode/target/i386/cpu_i386.c:1.6
--- src/sys/arch/usermode/target/i386/cpu_i386.c:1.5	Fri May 18 20:21:14 2018
+++ src/sys/arch/usermode/target/i386/cpu_i386.c	Tue May 22 14:38:10 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_i386.c,v 1.5 2018/05/18 20:21:14 reinoud Exp $ */
+/* $NetBSD: cpu_i386.c,v 1.6 2018/05/22 14:38:10 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk 
@@ -29,7 +29,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_i386.c,v 1.5 2018/05/18 20:21:14 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_i386.c,v 1.6 2018/05/22 14:38:10 reinoud Exp $");
 
 #include 
 #include 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_i386.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include "opt_exec.h"
 
@@ -89,11 +90,6 @@ struct sigframe_siginfo {
 /*
  * mcontext extensions to handle signal delivery.
  */
-#define _UC_SETSTACK	0x0001
-#define _UC_CLRSTACK	0x0002
-#define _UC_VM		0x0004
-#define	_UC_TLSBASE	0x0008
-
 
 void
 sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)

Index: src/sys/arch/usermode/target/x86_64/cpu_x86_64.c
diff -u src/sys/arch/usermode/target/x86_64/cpu_x86_64.c:1.4 src/sys/arch/usermode/target/x86_64/cpu_x86_64.c:1.5
--- src/sys/arch/usermode/target/x86_64/cpu_x86_64.c:1.4	Fri May 18 21:05:10 2018
+++ src/sys/arch/usermode/target/x86_64/cpu_x86_64.c	Tue May 22 14:38:10 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_x86_64.c,v 1.4 2018/05/18 21:05:10 reinoud Exp $ */
+/* $NetBSD: cpu_x86_64.c,v 1.5 2018/05/22 14:38:10 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk 
@@ -29,7 +29,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_x86_64.c,v 1.4 2018/05/18 21:05:10 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_x86_64.c,v 1.5 2018/05/22 14:38:10 reinoud Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_x86_64.c
 #include 
 #include 
 #include 
-
+#include 
 
 #if 0
 static void dump_regs(register_t *reg);;
@@ -84,16 +84,9 @@ struct sigframe_siginfo {
 };
 
 
-/* should be the same as i386 */
 /*
  * mcontext extensions to handle signal delivery.
  */
-#define _UC_SETSTACK	0x0001
-#define _UC_CLRSTACK	0x0002
-#define _UC_VM		0x0004
-#define	_UC_TLSBASE	0x0008
-
-
 void
 sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
 {



CVS commit: src/sys/arch

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 11:09:57 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/i386/conf: files.i386
src/sys/arch/x86/conf: files.x86

Log Message:
Mmh, don't compile spectre.c on Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.392 -r1.393 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/x86/conf/files.x86

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/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.102 src/sys/arch/amd64/conf/files.amd64:1.103
--- src/sys/arch/amd64/conf/files.amd64:1.102	Sat Apr  7 19:38:06 2018
+++ src/sys/arch/amd64/conf/files.amd64	Tue May 22 11:09:57 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.102 2018/04/07 19:38:06 mrg Exp $
+#	$NetBSD: files.amd64,v 1.103 2018/05/22 11:09:57 maxv Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -57,6 +57,7 @@ file	arch/amd64/amd64/trap.c			machdep
 file	arch/x86/x86/fpu.c			machdep
 file	arch/x86/x86/dbregs.c			machdep
 file	arch/x86/x86/convert_xmm_s87.c		machdep
+file	arch/x86/x86/spectre.c			machdep
 file	arch/amd64/amd64/lock_stubs.S		machdep
 file	dev/cons.cmachdep
 

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.392 src/sys/arch/i386/conf/files.i386:1.393
--- src/sys/arch/i386/conf/files.i386:1.392	Sat Apr  7 19:38:06 2018
+++ src/sys/arch/i386/conf/files.i386	Tue May 22 11:09:57 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.392 2018/04/07 19:38:06 mrg Exp $
+#	$NetBSD: files.i386,v 1.393 2018/05/22 11:09:57 maxv Exp $
 #
 # new style config file for i386 architecture
 #
@@ -78,6 +78,7 @@ file	arch/i386/i386/trap.c
 file	dev/cons.c
 file	arch/x86/x86/fpu.c
 file	arch/x86/x86/dbregs.c
+file	arch/x86/x86/spectre.c
 
 file	arch/i386/i386/mptramp.S	multiprocessor
 

Index: src/sys/arch/x86/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.100 src/sys/arch/x86/conf/files.x86:1.101
--- src/sys/arch/x86/conf/files.x86:1.100	Tue May  1 10:15:27 2018
+++ src/sys/arch/x86/conf/files.x86	Tue May 22 11:09:57 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.100 2018/05/01 10:15:27 pgoyette Exp $
+#	$NetBSD: files.x86,v 1.101 2018/05/22 11:09:57 maxv Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI
@@ -98,7 +98,6 @@ file 	arch/x86/x86/pmap.c		machdep
 file 	arch/x86/x86/x86_tlb.c		machdep
 file 	arch/x86/x86/pmc.c		machdep
 file	arch/x86/x86/procfs_machdep.c	procfs
-file	arch/x86/x86/spectre.c		machdep
 file 	arch/x86/x86/svs.c		machdep & svs
 file	arch/x86/x86/sys_machdep.c	machdep
 file	arch/x86/x86/syscall.c		machdep



CVS commit: src/tests/lib/libc/sys

2018-05-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 22 10:48:06 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Add new ATF ptrace(2) tests: traceme_sendsignal_{masked,ignored}[1-3]

These tests emit signal from a tracer/parent to the child and verify the
behavior in the case of SIG_BLOCK (masked) and SIG_IGN (ignored).

The signal is not reported by the child process.

These tests pass.

While there, rename for consistency with other tests:
 - traceme_sighandler_catch[1-3] -> traceme_sendsignal_handle[1-3]
 - traceme_signal_nohandler[1-5] -> traceme_sendsignal_simple[1-5]

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.49 src/tests/lib/libc/sys/t_ptrace_wait.c:1.50
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.49	Sun May 20 23:47:16 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue May 22 10:48:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.49 2018/05/20 23:47:16 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.50 2018/05/22 10:48:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.49 2018/05/20 23:47:16 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.50 2018/05/22 10:48:06 kamil Exp $");
 
 #include 
 #include 
@@ -177,7 +177,7 @@ TRACEME_RAISE(traceme_raise5, SIGCONT) /
 /// 
 
 static void
-traceme_sighandler_catch(int sigsent, void (*sah)(int arg), int *traceme_caught)
+traceme_sendsignal_handle(int sigsent, void (*sah)(int a), int *traceme_caught)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -242,7 +242,7 @@ traceme_sighandler_catch(int sigsent, vo
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
 }
 
-#define TRACEME_SIGHANDLER_CATCH(test, sig)	\
+#define TRACEME_SENDSIGNAL_HANDLE(test, sig)	\
 ATF_TC(test);	\
 ATF_TC_HEAD(test, tc)\
 {		\
@@ -264,18 +264,185 @@ test##_sighandler(int arg)			\
 ATF_TC_BODY(test, tc)\
 {		\
 		\
-	traceme_sighandler_catch(sig, test##_sighandler, & test##_caught);	\
+	traceme_sendsignal_handle(sig, test##_sighandler, & test##_caught);	\
 }
 
 // A signal handler for SIGKILL and SIGSTOP cannot be registered.
-TRACEME_SIGHANDLER_CATCH(traceme_sighandler_catch1, SIGABRT) /* abort trap */
-TRACEME_SIGHANDLER_CATCH(traceme_sighandler_catch2, SIGHUP)  /* hangup */
-TRACEME_SIGHANDLER_CATCH(traceme_sighandler_catch3, SIGCONT) /* continued? */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle1, SIGABRT) /* abort trap */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle2, SIGHUP)  /* hangup */
+TRACEME_SENDSIGNAL_HANDLE(traceme_sendsignal_handle3, SIGCONT) /* continued? */
 
 /// 
 
 static void
-traceme_signal_nohandler(int sigsent)
+traceme_sendsignal_masked(int sigsent)
+{
+	const int exitval = 5;
+	const int sigval = SIGSTOP;
+	pid_t child, wpid;
+	sigset_t set;
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+
+	struct ptrace_siginfo info;
+	memset(, 0, sizeof(info));
+
+	DPRINTF("Before forking process PID=%d\n", getpid());
+	SYSCALL_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		sigemptyset();
+		sigaddset(, sigsent);
+		FORKEE_ASSERT(sigprocmask(SIG_BLOCK, , NULL) != -1);
+
+		DPRINTF("Before raising %s from child\n", strsignal(sigval));
+		FORKEE_ASSERT(raise(sigval) == 0);
+
+		_exit(exitval);
+	}
+	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigval);
+
+	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+	SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, , sizeof(info))
+	!= -1);
+
+	DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
+
+	DPRINTF("Before resuming the child process where it left off and with "
+	"signal %s to be sent\n", strsignal(sigsent));
+	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = 

CVS commit: src/sys/arch/x86

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 10:20:05 UTC 2018

Modified Files:
src/sys/arch/x86/include: specialreg.h
src/sys/arch/x86/x86: spectre.c

Log Message:
Implement a mitigation for SpectreV4 on AMD families 15h and 16h. We use
a non-architectural MSR. This MSR is also available on 17h, but there SMT
is involved, and it needs more investigation.

Not tested (I have only 10h).


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/spectre.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/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.122 src/sys/arch/x86/include/specialreg.h:1.123
--- src/sys/arch/x86/include/specialreg.h:1.122	Tue May 22 07:24:08 2018
+++ src/sys/arch/x86/include/specialreg.h	Tue May 22 10:20:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.122 2018/05/22 07:24:08 maxv Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.123 2018/05/22 10:20:04 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -858,6 +858,8 @@
 
 #define MSR_LS_CFG	0xc0011020
 #define 	LS_CFG_DIS_LS2_SQUISH	0x0200
+#define 	LS_CFG_DIS_SSB_F15H	0x0040ULL
+#define 	LS_CFG_DIS_SSB_F16H	0x0002ULL
 
 #define MSR_IC_CFG	0xc0011021
 #define 	IC_CFG_DIS_SEQ_PREFETCH	0x0800

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.14 src/sys/arch/x86/x86/spectre.c:1.15
--- src/sys/arch/x86/x86/spectre.c:1.14	Tue May 22 09:25:58 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 10:20:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.14 2018/05/22 09:25:58 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.15 2018/05/22 10:20:04 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.14 2018/05/22 09:25:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.15 2018/05/22 10:20:04 maxv Exp $");
 
 #include "opt_spectre.h"
 
@@ -60,7 +60,9 @@ enum v2_mitigation {
 enum v4_mitigation {
 	V4_MITIGATION_NONE,
 	V4_MITIGATION_INTEL_SSBD,
-	V4_MITIGATION_INTEL_SSB_NO
+	V4_MITIGATION_INTEL_SSB_NO,
+	V4_MITIGATION_AMD_NONARCH_F15H,
+	V4_MITIGATION_AMD_NONARCH_F16H
 };
 
 static enum v2_mitigation v2_mitigation_method = V2_MITIGATION_NONE;
@@ -379,14 +381,18 @@ v4_set_name(void)
 		strlcat(name, "(none)", sizeof(name));
 	} else {
 		switch (v4_mitigation_method) {
+		case V4_MITIGATION_NONE:
+			panic("%s: impossible", __func__);
 		case V4_MITIGATION_INTEL_SSBD:
 			strlcat(name, "[Intel SSBD]", sizeof(name));
 			break;
 		case V4_MITIGATION_INTEL_SSB_NO:
 			strlcat(name, "[Intel SSB_NO]", sizeof(name));
 			break;
-		default:
-			panic("%s: impossible", __func__);
+		case V4_MITIGATION_AMD_NONARCH_F15H:
+		case V4_MITIGATION_AMD_NONARCH_F16H:
+			strlcat(name, "[AMD NONARCH]", sizeof(name));
+			break;
 		}
 	}
 
@@ -397,6 +403,7 @@ v4_set_name(void)
 static void
 v4_detect_method(void)
 {
+	struct cpu_info *ci = curcpu();
 	u_int descs[4];
 	uint64_t msr;
 
@@ -421,6 +428,17 @@ v4_detect_method(void)
 return;
 			}
 		}
+	} else if (cpu_vendor == CPUVENDOR_AMD) {
+		switch (CPUID_TO_FAMILY(ci->ci_signature)) {
+		case 0x15:
+			v4_mitigation_method = V4_MITIGATION_AMD_NONARCH_F15H;
+			return;
+		case 0x16:
+			v4_mitigation_method = V4_MITIGATION_AMD_NONARCH_F16H;
+			return;
+		default:
+			break;
+		}
 	}
 
 	v4_mitigation_method = V4_MITIGATION_NONE;
@@ -431,15 +449,38 @@ mitigation_v4_apply_cpu(bool enabled)
 {
 	uint64_t msr;
 
-	msr = rdmsr(MSR_IA32_SPEC_CTRL);
-
-	if (enabled) {
-		msr |= IA32_SPEC_CTRL_SSBD;
-	} else {
-		msr &= ~IA32_SPEC_CTRL_SSBD;
+	switch (v4_mitigation_method) {
+	case V4_MITIGATION_NONE:
+	case V4_MITIGATION_INTEL_SSB_NO:
+		panic("impossible");
+	case V4_MITIGATION_INTEL_SSBD:
+		msr = rdmsr(MSR_IA32_SPEC_CTRL);
+		if (enabled) {
+			msr |= IA32_SPEC_CTRL_SSBD;
+		} else {
+			msr &= ~IA32_SPEC_CTRL_SSBD;
+		}
+		wrmsr(MSR_IA32_SPEC_CTRL, msr);
+		break;
+	case V4_MITIGATION_AMD_NONARCH_F15H:
+		msr = rdmsr(MSR_LS_CFG);
+		if (enabled) {
+			msr |= LS_CFG_DIS_SSB_F15H;
+		} else {
+			msr &= ~LS_CFG_DIS_SSB_F15H;
+		}
+		wrmsr(MSR_LS_CFG, msr);
+		break;
+	case V4_MITIGATION_AMD_NONARCH_F16H:
+		msr = rdmsr(MSR_LS_CFG);
+		if (enabled) {
+			msr |= LS_CFG_DIS_SSB_F16H;
+		} else {
+			msr &= ~LS_CFG_DIS_SSB_F16H;
+		}
+		wrmsr(MSR_LS_CFG, msr);
+		break;
 	}
-
-	wrmsr(MSR_IA32_SPEC_CTRL, msr);
 }
 
 static void



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

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 09:25:58 UTC 2018

Modified Files:
src/sys/arch/x86/x86: spectre.c x86_machdep.c

Log Message:
Several changes:

 - Move the sysctl initialization code into spectre.c. This way each
   variable is local. Rename the variables, use shorter names.

 - Use mitigation methods for SpectreV4, like SpectreV2. There are
   several available on AMD (that we don't support yet). Add a "method"
   leaf.

 - Make SSB_NO a mitigation method by itself. This way we report as
   "mitigated" a CPU that is not affected by SpectreV4. In this case,
   of course, the user can't enable/disable the mitigation. Drop the
   "affected" sysctl leaf.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/x86/x86/x86_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/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.13 src/sys/arch/x86/x86/spectre.c:1.14
--- src/sys/arch/x86/x86/spectre.c:1.13	Tue May 22 08:15:26 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 09:25:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.13 2018/05/22 08:15:26 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.14 2018/05/22 09:25:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -30,11 +30,11 @@
  */
 
 /*
- * Mitigations for the Spectre V2 CPU flaw.
+ * Mitigations for the SpectreV2 and SpectreV4 CPU flaws.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.13 2018/05/22 08:15:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.14 2018/05/22 09:25:58 maxv Exp $");
 
 #include "opt_spectre.h"
 
@@ -51,18 +51,31 @@ __KERNEL_RCSID(0, "$NetBSD: spectre.c,v 
 
 #include 
 
-enum spec_mitigation {
-	MITIGATION_NONE,
-	MITIGATION_AMD_DIS_IND,
-	MITIGATION_INTEL_IBRS
+enum v2_mitigation {
+	V2_MITIGATION_NONE,
+	V2_MITIGATION_AMD_DIS_IND,
+	V2_MITIGATION_INTEL_IBRS
 };
 
-bool spec_v2_mitigation_enabled __read_mostly = false;
-static enum spec_mitigation mitigation_v2_method = MITIGATION_NONE;
-char spec_v2_mitigation_name[64] = "(none)";
+enum v4_mitigation {
+	V4_MITIGATION_NONE,
+	V4_MITIGATION_INTEL_SSBD,
+	V4_MITIGATION_INTEL_SSB_NO
+};
+
+static enum v2_mitigation v2_mitigation_method = V2_MITIGATION_NONE;
+static enum v4_mitigation v4_mitigation_method = V4_MITIGATION_NONE;
+
+static bool v2_mitigation_enabled __read_mostly = false;
+static bool v4_mitigation_enabled __read_mostly = false;
+
+static char v2_mitigation_name[64] = "(none)";
+static char v4_mitigation_name[64] = "(none)";
+
+/* - */
 
 static void
-spec_v2_set_name(void)
+v2_set_name(void)
 {
 	char name[64] = "";
 	size_t nmitig = 0;
@@ -72,17 +85,17 @@ spec_v2_set_name(void)
 	nmitig++;
 #endif
 
-	if (!spec_v2_mitigation_enabled) {
+	if (!v2_mitigation_enabled) {
 		if (nmitig == 0)
 			strlcat(name, "(none)", sizeof(name));
 	} else {
 		if (nmitig)
 			strlcat(name, " + ", sizeof(name));
-		switch (mitigation_v2_method) {
-		case MITIGATION_AMD_DIS_IND:
+		switch (v2_mitigation_method) {
+		case V2_MITIGATION_AMD_DIS_IND:
 			strlcat(name, "[AMD DIS_IND]", sizeof(name));
 			break;
-		case MITIGATION_INTEL_IBRS:
+		case V2_MITIGATION_INTEL_IBRS:
 			strlcat(name, "[Intel IBRS]", sizeof(name));
 			break;
 		default:
@@ -90,12 +103,12 @@ spec_v2_set_name(void)
 		}
 	}
 
-	strlcpy(spec_v2_mitigation_name, name,
-	sizeof(spec_v2_mitigation_name));
+	strlcpy(v2_mitigation_name, name,
+	sizeof(v2_mitigation_name));
 }
 
 static void
-spec_v2_detect_method(void)
+v2_detect_method(void)
 {
 	struct cpu_info *ci = curcpu();
 	u_int descs[4];
@@ -106,15 +119,15 @@ spec_v2_detect_method(void)
 			if (descs[3] & CPUID_SEF_IBRS) {
 /* descs[3] = %edx */
 #ifdef __x86_64__
-mitigation_v2_method = MITIGATION_INTEL_IBRS;
+v2_mitigation_method = V2_MITIGATION_INTEL_IBRS;
 #else
 /* IBRS not supported on i386. */
-mitigation_v2_method = MITIGATION_NONE;
+v2_mitigation_method = V2_MITIGATION_NONE;
 #endif
 return;
 			}
 		}
-		mitigation_v2_method = MITIGATION_NONE;
+		v2_mitigation_method = V2_MITIGATION_NONE;
 	} else if (cpu_vendor == CPUVENDOR_AMD) {
 		/*
 		 * The AMD Family 10h manual documents the IC_CFG.DIS_IND bit.
@@ -127,14 +140,14 @@ spec_v2_detect_method(void)
 		case 0x10:
 		case 0x12:
 		case 0x16:
-			mitigation_v2_method = MITIGATION_AMD_DIS_IND;
+			v2_mitigation_method = V2_MITIGATION_AMD_DIS_IND;
 			break;
 		default:
-			mitigation_v2_method = MITIGATION_NONE;
+			v2_mitigation_method = V2_MITIGATION_NONE;
 			break;
 		}
 	} else {
-		mitigation_v2_method = MITIGATION_NONE;
+		v2_mitigation_method = V2_MITIGATION_NONE;
 	}
 }
 
@@ -208,10 +221,10 @@ mitigation_v2_apply_cpu(struct cpu_info 
 {
 	uint64_t msr;
 
-	switch (mitigation_v2_method) {
-	case MITIGATION_NONE:
+	

CVS commit: src/sys/arch

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 08:15:26 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC
src/sys/arch/x86/x86: spectre.c x86_machdep.c

Log Message:
Clarify the parameters for the SpectreV2 mitigation.

Add:
machdep.spectre_v2.swmitigated
Rename:
machdep.spectre_v2.mitigated -> machdep.spectre_v2.hwmitigated

Change the method string, to combine both the hardware and software
mitigations. swmitigated is set at compile time, hwmitigated can be
set by the user.

Examples:

spectre_v2.swmitigated = 1
spectre_v2.hwmitigated = 0
spectre_v2.method = [GCC retpoline]

spectre_v2.swmitigated = 0
spectre_v2.hwmitigated = 0
spectre_v2.method = (none)

spectre_v2.swmitigated = 1
spectre_v2.hwmitigated = 1
spectre_v2.method = [GCC retpoline] + [Intel IBRS]


To generate a diff of this commit:
cvs rdiff -u -r1.491 -r1.492 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1178 -r1.1179 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x86/x86/x86_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/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.491 src/sys/arch/amd64/conf/GENERIC:1.492
--- src/sys/arch/amd64/conf/GENERIC:1.491	Tue May 15 01:53:27 2018
+++ src/sys/arch/amd64/conf/GENERIC	Tue May 22 08:15:26 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.491 2018/05/15 01:53:27 thorpej Exp $
+# $NetBSD: GENERIC,v 1.492 2018/05/22 08:15:26 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.491 $"
+#ident		"GENERIC-$Revision: 1.492 $"
 
 maxusers	64		# estimated number of users
 
@@ -78,6 +78,7 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 options 	SVS		# Separate Virtual Space
 makeoptions	SPECTRE_V2_GCC_MITIGATION=1	# GCC Spectre variant 2
 		# migitation
+options 	SPECTRE_V2_GCC_MITIGATION
 
 # CPU features
 acpicpu*	at cpu?		# ACPI CPU (including frequency scaling)

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1178 src/sys/arch/i386/conf/GENERIC:1.1179
--- src/sys/arch/i386/conf/GENERIC:1.1178	Tue May 15 01:53:27 2018
+++ src/sys/arch/i386/conf/GENERIC	Tue May 22 08:15:26 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1178 2018/05/15 01:53:27 thorpej Exp $
+# $NetBSD: GENERIC,v 1.1179 2018/05/22 08:15:26 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1178 $"
+#ident		"GENERIC-$Revision: 1.1179 $"
 
 maxusers	64		# estimated number of users
 
@@ -31,6 +31,7 @@ options 	USER_LDT	# user-settable LDT; u
 #options 	PAE		# PAE mode (36 bits physical addressing)
 makeoptions	SPECTRE_V2_GCC_MITIGATION=1	# GCC Spectre variant 2
 		# migitation
+options 	SPECTRE_V2_GCC_MITIGATION
 
 # CPU features
 acpicpu*	at cpu?		# ACPI CPU (including frequency scaling)

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.12 src/sys/arch/x86/x86/spectre.c:1.13
--- src/sys/arch/x86/x86/spectre.c:1.12	Tue May 22 07:11:53 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 08:15:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.12 2018/05/22 07:11:53 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.13 2018/05/22 08:15:26 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.12 2018/05/22 07:11:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.13 2018/05/22 08:15:26 maxv Exp $");
+
+#include "opt_spectre.h"
 
 #include 
 #include 
@@ -62,22 +64,32 @@ char spec_v2_mitigation_name[64] = "(non
 static void
 spec_v2_set_name(void)
 {
-	const char *name;
+	char name[64] = "";
+	size_t nmitig = 0;
+
+#if defined(SPECTRE_V2_GCC_MITIGATION)
+	strlcat(name, "[GCC retpoline]", sizeof(name));
+	nmitig++;
+#endif
 
 	if (!spec_v2_mitigation_enabled) {
-		name = "(none)";
+		if (nmitig == 0)
+			strlcat(name, "(none)", sizeof(name));
 	} else {
+		if (nmitig)
+			strlcat(name, " + ", sizeof(name));
 		switch (mitigation_v2_method) {
 		case MITIGATION_AMD_DIS_IND:
-			name = "AMD DIS_IND";
+			strlcat(name, "[AMD DIS_IND]", sizeof(name));
 			break;
 		case MITIGATION_INTEL_IBRS:
-			name = "Intel IBRS";
+			strlcat(name, "[Intel IBRS]", sizeof(name));
 			break;
 		default:
 			panic("%s: impossible", __func__);
 		}
 	}
+
 	strlcpy(spec_v2_mitigation_name, name,
 	sizeof(spec_v2_mitigation_name));
 }

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.113 

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

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 07:24:08 UTC 2018

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
Add RSBA. When set, it indicates that the CPU is vulnerable to SpectreV2
via the RSB.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.121 src/sys/arch/x86/include/specialreg.h:1.122
--- src/sys/arch/x86/include/specialreg.h:1.121	Tue May 22 07:11:53 2018
+++ src/sys/arch/x86/include/specialreg.h	Tue May 22 07:24:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.121 2018/05/22 07:11:53 maxv Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.122 2018/05/22 07:24:08 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -661,6 +661,7 @@
 #define MSR_IA32_ARCH_CAPABILITIES 0x10a
 #define 	IA32_ARCH_RDCL_NO	0x01
 #define 	IA32_ARCH_IBRS_ALL	0x02
+#define 	IA32_ARCH_RSBA		0x04
 #define 	IA32_ARCH_SSB_NO	0x10
 #define MSR_BBL_CR_ADDR		0x116	/* PII+ only */
 #define MSR_BBL_CR_DECC		0x118	/* PII+ only */



CVS commit: src/sys/arch/x86

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 07:11:54 UTC 2018

Modified Files:
src/sys/arch/x86/include: specialreg.h
src/sys/arch/x86/x86: spectre.c x86_machdep.c

Log Message:
Mitigation for SpectreV4, based on SSBD. The following sysctl branches
are added:

machdep.spectre_v4.mitigated = {0/1} user-settable
machdep.spectre_v4.affected = {0/1} set by the kernel

The mitigation is not enabled by default yet. It is not tested either,
because no microcode update has been published yet.

On current CPUs a microcode/bios update must be applied for SSBD to be
available. The user can then set mitigated=1. Even with an update applied
the kernel will set affected=1.

On future CPUs, where the problem will presumably be fixed by default,
the CPU will report SSB_NO, and the kernel will set affected=0. In this
case we also have mitigated=0, but the mitigation is not needed.

For now the feature is system-wide. Perhaps we will want a more
fine-grained, per-process approach in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/x86/x86/x86_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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.120 src/sys/arch/x86/include/specialreg.h:1.121
--- src/sys/arch/x86/include/specialreg.h:1.120	Fri Mar 30 19:49:49 2018
+++ src/sys/arch/x86/include/specialreg.h	Tue May 22 07:11:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.120 2018/03/30 19:49:49 maxv Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.121 2018/05/22 07:11:53 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -405,11 +405,11 @@
 #define CPUID_SEF_IBRS		__BIT(26) /* IBRS / IBPB Speculation Control */
 #define CPUID_SEF_STIBP		__BIT(27) /* STIBP Speculation Control */
 #define CPUID_SEF_ARCH_CAP	__BIT(29) /* IA32_ARCH_CAPABILITIES */
+#define CPUID_SEF_SSBD		__BIT(31) /* Speculative Store Bypass Disable */
 
-#define CPUID_SEF_FLAGS2	"\20" \
-"\3" "AVX512_4VNNIW" "\4" "AVX512_4FMAPS" \
-	"\33" "IBRS"	"\34" "STIBP"	\
-			"\36" "ARCH_CAP"
+#define CPUID_SEF_FLAGS2	\
+	"\20" "\3" "AVX512_4VNNIW" "\4" "AVX512_4FMAPS" \
+	"\33" "IBRS" "\34" "STIBP" "\36" "ARCH_CAP" "\38" "SSBD"
 
 /*
  * CPUID Processor extended state Enumeration Fn000d
@@ -643,6 +643,7 @@
 #define MSR_IA32_SPEC_CTRL	0x048
 #define 	IA32_SPEC_CTRL_IBRS	0x01
 #define 	IA32_SPEC_CTRL_STIBP	0x02
+#define 	IA32_SPEC_CTRL_SSBD	0x04
 #define MSR_IA32_PRED_CMD	0x049
 #define 	IA32_PRED_CMD_IBPB	0x01
 #define MSR_BIOS_UPDT_TRIG	0x079
@@ -660,6 +661,7 @@
 #define MSR_IA32_ARCH_CAPABILITIES 0x10a
 #define 	IA32_ARCH_RDCL_NO	0x01
 #define 	IA32_ARCH_IBRS_ALL	0x02
+#define 	IA32_ARCH_SSB_NO	0x10
 #define MSR_BBL_CR_ADDR		0x116	/* PII+ only */
 #define MSR_BBL_CR_DECC		0x118	/* PII+ only */
 #define MSR_BBL_CR_CTL		0x119	/* PII+ only */

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.11 src/sys/arch/x86/x86/spectre.c:1.12
--- src/sys/arch/x86/x86/spectre.c:1.11	Tue May 22 06:31:05 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 07:11:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.11 2018/05/22 06:31:05 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.12 2018/05/22 07:11:53 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.11 2018/05/22 06:31:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.12 2018/05/22 07:11:53 maxv Exp $");
 
 #include 
 #include 
@@ -347,6 +347,140 @@ sysctl_machdep_spectreV2_mitigated(SYSCT
 
 /* -- */
 
+bool spec_v4_mitigation_enabled __read_mostly = false;
+bool spec_v4_affected __read_mostly = true;
+
+int sysctl_machdep_spectreV4_mitigated(SYSCTLFN_ARGS);
+
+static bool ssbd_needed(void)
+{
+	uint64_t msr;
+
+	if (cpu_info_primary.ci_feat_val[7] & CPUID_SEF_ARCH_CAP) {
+		msr = rdmsr(MSR_IA32_ARCH_CAPABILITIES);
+		if (msr & IA32_ARCH_SSB_NO) {
+			/*
+			 * The processor indicates it is not vulnerable to the
+			 * Speculative Store Bypass (SpectreV4) flaw.
+			 */
+			return false;
+		}
+	}
+
+	return true;
+}
+
+static bool ssbd_supported(void)
+{
+	u_int descs[4];
+
+	if (cpu_vendor == CPUVENDOR_INTEL) {
+		if (cpuid_level >= 7) {
+			x86_cpuid(7, descs);
+			if (descs[3] & CPUID_SEF_SSBD) {
+/* descs[3] = %edx */
+return true;
+			}
+		}
+	}
+	return false;
+}
+
+static void
+mitigation_v4_apply_cpu(bool enabled)
+{
+	uint64_t msr;
+
+	msr = rdmsr(MSR_IA32_SPEC_CTRL);
+
+	if (enabled) {
+		msr |= IA32_SPEC_CTRL_SSBD;
+	} else {
+		msr &= ~IA32_SPEC_CTRL_SSBD;
+	}
+
+	wrmsr(MSR_IA32_SPEC_CTRL, msr);
+}
+
+static void

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

2018-05-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue May 22 06:31:05 UTC 2018

Modified Files:
src/sys/arch/x86/x86: spectre.c x86_machdep.c

Log Message:
Reorder and rename, to make the code less SpectreV2-specific.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/x86/x86/x86_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/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.10 src/sys/arch/x86/x86/spectre.c:1.11
--- src/sys/arch/x86/x86/spectre.c:1.10	Thu Apr  5 15:04:29 2018
+++ src/sys/arch/x86/x86/spectre.c	Tue May 22 06:31:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.10 2018/04/05 15:04:29 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.11 2018/05/22 06:31:05 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.10 2018/04/05 15:04:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.11 2018/05/22 06:31:05 maxv Exp $");
 
 #include 
 #include 
@@ -55,44 +55,19 @@ enum spec_mitigation {
 	MITIGATION_INTEL_IBRS
 };
 
-bool spec_mitigation_enabled __read_mostly = false;
-static enum spec_mitigation mitigation_method = MITIGATION_NONE;
-char spec_mitigation_name[64] = "(none)";
-
-void speculation_barrier(struct lwp *, struct lwp *);
-
-void
-speculation_barrier(struct lwp *oldlwp, struct lwp *newlwp)
-{
-	if (!spec_mitigation_enabled)
-		return;
-
-	/*
-	 * From kernel thread to kernel thread, no need for a barrier.
-	 */
-	if ((oldlwp != NULL && (oldlwp->l_flag & LW_SYSTEM)) &&
-	(newlwp->l_flag & LW_SYSTEM))
-		return;
-
-	switch (mitigation_method) {
-	case MITIGATION_INTEL_IBRS:
-		wrmsr(MSR_IA32_PRED_CMD, IA32_PRED_CMD_IBPB);
-		break;
-	default:
-		/* nothing */
-		break;
-	}
-}
+bool spec_v2_mitigation_enabled __read_mostly = false;
+static enum spec_mitigation mitigation_v2_method = MITIGATION_NONE;
+char spec_v2_mitigation_name[64] = "(none)";
 
 static void
-speculation_set_name(void)
+spec_v2_set_name(void)
 {
 	const char *name;
 
-	if (!spec_mitigation_enabled) {
+	if (!spec_v2_mitigation_enabled) {
 		name = "(none)";
 	} else {
-		switch (mitigation_method) {
+		switch (mitigation_v2_method) {
 		case MITIGATION_AMD_DIS_IND:
 			name = "AMD DIS_IND";
 			break;
@@ -103,12 +78,12 @@ speculation_set_name(void)
 			panic("%s: impossible", __func__);
 		}
 	}
-	strlcpy(spec_mitigation_name, name,
-	sizeof(spec_mitigation_name));
+	strlcpy(spec_v2_mitigation_name, name,
+	sizeof(spec_v2_mitigation_name));
 }
 
 static void
-speculation_detect_method(void)
+spec_v2_detect_method(void)
 {
 	struct cpu_info *ci = curcpu();
 	u_int descs[4];
@@ -119,15 +94,15 @@ speculation_detect_method(void)
 			if (descs[3] & CPUID_SEF_IBRS) {
 /* descs[3] = %edx */
 #ifdef __x86_64__
-mitigation_method = MITIGATION_INTEL_IBRS;
+mitigation_v2_method = MITIGATION_INTEL_IBRS;
 #else
 /* IBRS not supported on i386. */
-mitigation_method = MITIGATION_NONE;
+mitigation_v2_method = MITIGATION_NONE;
 #endif
 return;
 			}
 		}
-		mitigation_method = MITIGATION_NONE;
+		mitigation_v2_method = MITIGATION_NONE;
 	} else if (cpu_vendor == CPUVENDOR_AMD) {
 		/*
 		 * The AMD Family 10h manual documents the IC_CFG.DIS_IND bit.
@@ -140,14 +115,14 @@ speculation_detect_method(void)
 		case 0x10:
 		case 0x12:
 		case 0x16:
-			mitigation_method = MITIGATION_AMD_DIS_IND;
+			mitigation_v2_method = MITIGATION_AMD_DIS_IND;
 			break;
 		default:
-			mitigation_method = MITIGATION_NONE;
+			mitigation_v2_method = MITIGATION_NONE;
 			break;
 		}
 	} else {
-		mitigation_method = MITIGATION_NONE;
+		mitigation_v2_method = MITIGATION_NONE;
 	}
 }
 
@@ -217,11 +192,11 @@ ibrs_enable_hotpatch(void)
 /* -- */
 
 static void
-mitigation_apply_cpu(struct cpu_info *ci, bool enabled)
+mitigation_v2_apply_cpu(struct cpu_info *ci, bool enabled)
 {
 	uint64_t msr;
 
-	switch (mitigation_method) {
+	switch (mitigation_v2_method) {
 	case MITIGATION_NONE:
 		panic("impossible");
 	case MITIGATION_INTEL_IBRS:
@@ -253,14 +228,14 @@ mitigation_apply_cpu(struct cpu_info *ci
  * Note: IBRS requires hotpatching, so we need barriers.
  */
 static void
-mitigation_change_cpu(void *arg1, void *arg2)
+mitigation_v2_change_cpu(void *arg1, void *arg2)
 {
 	struct cpu_info *ci = curcpu();
 	bool enabled = (bool)arg1;
 	u_long psl = 0;
 
 	/* Rendez-vous 1 (IBRS only). */
-	if (mitigation_method == MITIGATION_INTEL_IBRS) {
+	if (mitigation_v2_method == MITIGATION_INTEL_IBRS) {
 		psl = x86_read_psl();
 		x86_disable_intr();
 
@@ -270,10 +245,10 @@ mitigation_change_cpu(void *arg1, void *
 		}
 	}
 
-	mitigation_apply_cpu(ci, enabled);
+	mitigation_v2_apply_cpu(ci, enabled);
 
 	/* Rendez-vous 2 (IBRS only). */
-	if 

CVS commit: src/sys/arch/arm/sunxi

2018-05-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 21 22:04:27 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
Workaround bogus GCC warning about an uninitialized variable


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/sunxi/sunxi_mmc.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.23 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.24
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.23	Thu May 17 23:07:47 2018
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Mon May 21 22:04:27 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.23 2018/05/17 23:07:47 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.24 2018/05/21 22:04:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.23 2018/05/17 23:07:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.24 2018/05/21 22:04:27 jmcneill Exp $");
 
 #include 
 #include 
@@ -475,7 +475,7 @@ static int
 sunxi_mmc_set_clock(struct sunxi_mmc_softc *sc, u_int freq, bool ddr)
 {
 	const struct sunxi_mmc_delay *delays;
-	int error, timing;
+	int error, timing = SUNXI_MMC_TIMING_400K;
 
 	if (sc->sc_config->delays) {
 		if (freq <= 400) {



CVS commit: src/share/misc

2018-05-22 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Tue May 22 02:46:19 UTC 2018

Modified Files:
src/share/misc: acronyms

Log Message:
Fix spelling


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/share/misc/acronyms

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.271 src/share/misc/acronyms:1.272
--- src/share/misc/acronyms:1.271	Sun May 13 16:53:04 2018
+++ src/share/misc/acronyms	Tue May 22 02:46:19 2018
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.271 2018/05/13 16:53:04 maya Exp $
+$NetBSD: acronyms,v 1.272 2018/05/22 02:46:19 ginsbach Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -206,7 +206,7 @@ GTSY	{glad,good} to see you
 GWS	get well soon
 H8	hate
 HAND	have a nice day
-HE	how embarrasing
+HE	how embarrassing
 HF	have fun
 HHIS	hanging head in shame
 HHOS	ha ha, only serious
@@ -508,7 +508,7 @@ THNX	thanks
 THX	thanks
 TIA	thanks in advance
 TIAVP	this is a volunteer project
-TIC	tonque in cheek
+TIC	tongue in cheek
 TIL	today I learned
 TINC	there is no cabal
 TINLA	this is not legal advice



CVS commit: src

2018-05-22 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 22 01:35:49 UTC 2018

Modified Files:
src/share/man/man7: audio.7
src/sys/dev: audio.c

Log Message:
Using audioctl without the -p switch defaults to the mix ring.  This allows
setting the hardware gain etc.

Update the audio spec in audio.7 to reflect these changes.

Addresses PR kern/52781.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man7/audio.7
cvs rdiff -u -r1.456 -r1.457 src/sys/dev/audio.c

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

Modified files:

Index: src/share/man/man7/audio.7
diff -u src/share/man/man7/audio.7:1.2 src/share/man/man7/audio.7:1.3
--- src/share/man/man7/audio.7:1.2	Tue May 15 09:30:01 2018
+++ src/share/man/man7/audio.7	Tue May 22 01:35:49 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.7,v 1.2 2018/05/15 09:30:01 wiz Exp $
+.\"	$NetBSD: audio.7,v 1.3 2018/05/22 01:35:49 nat Exp $
 .\"
 .\" Copyright (c) 2016 - 2018  Nathanial Sloss 
 .\" All rights reserved.
@@ -144,7 +144,7 @@ device so to check on buffer usage and s
 .Pp
 As opening an
 .Xr audioctl 4
-device would result in a new vchan being created, these
+device would represent vchan 0 (the mix ring), these
 ioctls allow setting the target vchan and
 .Vt audio_info
 structure to that of an existing vchan.
@@ -188,22 +188,21 @@ are numbered starting at zero (0).
 .Pp
 Not specifying
 .Fl p
-will result in working with a new vchan and this is only
-desired when the next subsequent audio open is to be
-.Pa /dev/sound ,
-i.e.:
+is the same as specifying
+.Fl p
+0 and will result in working with vchan 0 (the mix ring).
+This will display the audio parameters of the mix ring and allow
+setting the hardware gain and balance.
 .Pp
-.Dl audioctl -w play.gain=120
-.Dl open /dev/sound this will have an initial software volume level of 120.
+This is for compatibility with existing applications and shell scrpits
+that are unaware of the
+.Fl p
+switch.
 .Pp
 The parameters for playback and recording only effect the particular vchan
 being operated on (gain, sample rate, channels, encoding etc), except
 .Fl p Ar 0
 (the mix ring).
-Specifying
-.Fl p Ar 0
-will display the audio parameters of the mix ring and allow
-setting the hardware gain and balance.
 .Sh ADDED SYSCTLS
 With the introduction of the audio mixer the following
 .Xr sysctl 7 Ns s

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.456 src/sys/dev/audio.c:1.457
--- src/sys/dev/audio.c:1.456	Thu May 17 11:35:31 2018
+++ src/sys/dev/audio.c	Tue May 22 01:35:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.456 2018/05/17 11:35:31 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.457 2018/05/22 01:35:49 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.456 2018/05/17 11:35:31 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.457 2018/05/22 01:35:49 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -234,6 +234,8 @@ int	audiosetinfo(struct audio_softc *, s
 int	audiogetinfo(struct audio_softc *, struct audio_info *, int,
 		 struct virtual_channel *);
 
+int	audioctl_open(dev_t, struct audio_softc *, int, int, struct lwp *,
+		   struct file **);
 int	audio_open(dev_t, struct audio_softc *, int, int, struct lwp *,
 		   struct file **);
 int	audio_close(struct audio_softc *, int, struct audio_chan *);
@@ -1678,9 +1680,11 @@ audioopen(dev_t dev, int flags, int ifmt
 	switch (AUDIODEV(dev)) {
 	case SOUND_DEVICE:
 	case AUDIO_DEVICE:
-	case AUDIOCTL_DEVICE:
 		error = audio_open(dev, sc, flags, ifmt, l, );
 		break;
+	case AUDIOCTL_DEVICE:
+		error = audioctl_open(dev, sc, flags, ifmt, l, );
+		break;
 	case MIXER_DEVICE:
 		error = mixer_open(dev, sc, flags, ifmt, l, );
 		break;
@@ -1714,9 +1718,11 @@ audioclose(struct file *fp)
 	switch (AUDIODEV(dev)) {
 	case SOUND_DEVICE:
 	case AUDIO_DEVICE:
-	case AUDIOCTL_DEVICE:
 		error = audio_close(sc, fp->f_flag, chan);
 		break;
+	case AUDIOCTL_DEVICE:
+		error = 0;
+		break;
 	case MIXER_DEVICE:
 		error = mixer_close(sc, fp->f_flag, chan);
 		break;
@@ -2144,6 +2150,50 @@ audio_calcwater(struct audio_softc *sc, 
 }
 
 int
+audioctl_open(dev_t dev, struct audio_softc *sc, int flags, int ifmt,
+struct lwp *l, struct file **nfp)
+{
+	struct file *fp;
+	int error, fd;
+	const struct audio_hw_if *hw;
+	struct virtual_channel *vc;
+	struct audio_chan *chan;
+
+	KASSERT(mutex_owned(sc->sc_lock));
+
+	if (sc->sc_usemixer && !sc->sc_ready)
+		return ENXIO;
+
+	hw = sc->hw_if;
+	if (hw == NULL)
+		return ENXIO;
+
+	chan = kmem_zalloc(sizeof(struct audio_chan), KM_SLEEP);
+	if (sc->sc_usemixer)
+		vc = >sc_mixring;
+	else
+		vc = sc->sc_hwvc;
+	chan->vc = vc;
+
+	error = fd_allocfile(, );
+	if (error)
+		goto bad;
+
+	chan->dev = dev;
+	chan->chan = 0;
+	chan->deschan = 0;
+
+	error = fd_clone(fp, fd, flags, 

CVS commit: src/share/man/man7

2018-05-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 22 02:31:57 UTC 2018

Modified Files:
src/share/man/man7: signal.7

Log Message:
Minor update to signal(7)

Note that SIGCHLD is not just a child exit signal.
Note that SIGIOT is PDP-11 specific signal.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/share/man/man7/signal.7

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/man7/signal.7
diff -u src/share/man/man7/signal.7:1.20 src/share/man/man7/signal.7:1.21
--- src/share/man/man7/signal.7:1.20	Tue Jul 12 12:39:04 2016
+++ src/share/man/man7/signal.7	Tue May 22 02:31:57 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: signal.7,v 1.20 2016/07/12 12:39:04 wiz Exp $
+.\"	$NetBSD: signal.7,v 1.21 2018/05/22 02:31:57 kamil Exp $
 .\"
 .\" Copyright (c) 1999, 2016 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 9, 2016
+.Dd May 22, 2018
 .Dt SIGNAL 7
 .Os
 .Sh NAME
@@ -132,7 +132,7 @@ The following signals are defined in
 .It Dv SIGSTOP Ta "Suspended (signal)"
 .It Dv SIGTSTP Ta "Suspended"
 .It Dv SIGCONT Ta "Continued"
-.It Dv SIGCHLD Ta "Child exited"
+.It Dv SIGCHLD Ta "Child exited, stopped or continued"
 .It Dv SIGTTIN Ta "Stopped (tty input)"
 .It Dv SIGTTOU Ta "Stopped (tty output)"
 .It Dv SIGIO Ta "I/O possible"
@@ -221,7 +221,9 @@ The number for
 is 6.
 This number was also formerly used for
 .Dv SIGIOT ,
-which is no longer defined.
+which is no longer defined,
+as it was specific to the PDP-11 instruction
+.Dv iot .
 .\" 
 .It Dv SIGEMT Ta (EMT trap)
 In theory this signal is generated when an instruction needs to be
@@ -389,7 +391,7 @@ The number for
 .Dv SIGCONT
 is 19.
 .\" 
-.It Dv SIGCHLD Ta (Child exited)
+.It Dv SIGCHLD Ta (Child exited, stopped or continued)
 This signal is generated by the kernel when one of a process's
 immediate children exits and can be waited for using one of the
 .Xr wait 2