CVS commit: src/lib/libutil

2018-06-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jun 24 01:53:14 UTC 2018

Modified Files:
src/lib/libutil: passwd.c

Log Message:
Prevent underflow buffer read in trim_whitespace() in libutil/passwd.c

If a string is empty or contains only white characters, the algorithm of
removal of white characters at the end of the passed string will read
buffer at index -1 and keep iterating backward.

Detected with MKSANITIZER/ASan when executing passwd(1).


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libutil/passwd.c

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

Modified files:

Index: src/lib/libutil/passwd.c
diff -u src/lib/libutil/passwd.c:1.52 src/lib/libutil/passwd.c:1.53
--- src/lib/libutil/passwd.c:1.52	Mon Jun 25 22:32:47 2012
+++ src/lib/libutil/passwd.c	Sun Jun 24 01:53:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: passwd.c,v 1.52 2012/06/25 22:32:47 abs Exp $	*/
+/*	$NetBSD: passwd.c,v 1.53 2018/06/24 01:53:14 kamil Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: passwd.c,v 1.52 2012/06/25 22:32:47 abs Exp $");
+__RCSID("$NetBSD: passwd.c,v 1.53 2018/06/24 01:53:14 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -503,13 +503,21 @@ trim_whitespace(char *line)
 
 	_DIAGASSERT(line != NULL);
 
+	/* Handle empty string */
+	if (*line == '\0')
+		return;
+
 	/* Remove leading spaces */
 	p = line;
 	while (isspace((unsigned char) *p))
 		p++;
 	memmove(line, p, strlen(p) + 1);
 
-	/* Remove trailing spaces */
+	/* Handle empty string after removal of whitespace characters */
+	if (*line == '\0')
+		return;
+
+	/* Remove trailing spaces, line must not be empty string here */
 	p = line + strlen(line) - 1;
 	while (isspace((unsigned char) *p))
 		p--;



CVS commit: src/usr.sbin/sysinst

2018-06-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun 23 22:35:29 UTC 2018

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

Log Message:
Enlarge the set_status[] array by a single element

In the get_and_unpack_sets() function there is accessed the
set_status[SET_GROUP_END] element in the array. The array is allocated on
the stack with SET_GROUP_END elements. This means that it is 1 element too
short.

This has been reported with MKSANITIZER=yes with Address Sanitizer.


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

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

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.9 src/usr.sbin/sysinst/util.c:1.10
--- src/usr.sbin/sysinst/util.c:1.9	Thu Jun 21 23:05:28 2018
+++ src/usr.sbin/sysinst/util.c	Sat Jun 23 22:35:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.9 2018/06/21 23:05:28 kamil Exp $	*/
+/*	$NetBSD: util.c,v 1.10 2018/06/23 22:35:29 kamil Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -78,7 +78,7 @@ static const char *msg_yes, *msg_no, *ms
 static const char *msg_cur_distsets_row;
 static int select_menu_width;
 
-static uint8_t set_status[SET_GROUP_END];
+static uint8_t set_status[SET_GROUP_END + 1];
 #define SET_VALID	0x01
 #define SET_SELECTED	0x02
 #define SET_SKIPPED	0x04



CVS commit: src/external/gpl2/gettext/lib/libnlspr

2018-06-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun 23 20:15:23 UTC 2018

Modified Files:
src/external/gpl2/gettext/lib/libnlspr: Makefile

Log Message:
Specify -Wno-format-extra-args for Clang/LLVM in gpl2/gettext

This is needed with Clang v. 7svn (HEAD) 2018-06-23 snapshot.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/gettext/lib/libnlspr/Makefile

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

Modified files:

Index: src/external/gpl2/gettext/lib/libnlspr/Makefile
diff -u src/external/gpl2/gettext/lib/libnlspr/Makefile:1.3 src/external/gpl2/gettext/lib/libnlspr/Makefile:1.4
--- src/external/gpl2/gettext/lib/libnlspr/Makefile:1.3	Fri Jan 15 18:03:32 2016
+++ src/external/gpl2/gettext/lib/libnlspr/Makefile	Sat Jun 23 20:15:23 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2016/01/15 18:03:32 tron Exp $
+#	$NetBSD: Makefile,v 1.4 2018/06/23 20:15:23 kamil Exp $
 
 LIBISPRIVATE=	yes
 
@@ -102,6 +102,7 @@ COPTS.write-tcl.c = -Wno-stack-protector
 COPTS.msgl-fsearch.c = -Wno-variably-modified
 
 CWARNFLAGS.clang+=	-Wno-tautological-compare
+CWARNFLAGS.clang+=	-Wno-format-extra-arg
 
 .include 
 



CVS commit: src/share/misc

2018-06-23 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Jun 23 19:40:59 UTC 2018

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add MDC, MDI, MDI-X, MDIO


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/share/misc/acronyms.comp

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.comp
diff -u src/share/misc/acronyms.comp:1.204 src/share/misc/acronyms.comp:1.205
--- src/share/misc/acronyms.comp:1.204	Sat Jun 23 15:00:22 2018
+++ src/share/misc/acronyms.comp	Sat Jun 23 19:40:59 2018
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.204 2018/06/23 15:00:22 sevan Exp $
+$NetBSD: acronyms.comp,v 1.205 2018/06/23 19:40:59 sevan Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -793,6 +793,10 @@ MD	machine-dependent
 MD-SAL	model-driven service abstraction layer
 MDA	mail delivery agent
 MDA	Monochrome Display Adapter
+MDC	Management Data Clock
+MDI	Medium Dependent Interface
+MDI-X	Medium Dependent Interface Crossover
+MDIO	Management Data Input/Output
 MDMX	MIPS Digital Media eXtension
 MDRAM	multibank dynamic random access memory
 MESI	modified, exclusive, shared, invalid



CVS commit: src/distrib/notes/common

2018-06-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jun 23 17:46:00 UTC 2018

Modified Files:
src/distrib/notes/common: main

Log Message:
remove core list, portmaster list, releng list, and developer list.

...as proposed several times in several places back in 2009/2010.

this info can all be found on the website (where it's more accurate) and
has no place in a document describing the installation of netbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.545 -r1.546 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.545 src/distrib/notes/common/main:1.546
--- src/distrib/notes/common/main:1.545	Fri Jun 22 18:23:59 2018
+++ src/distrib/notes/common/main	Sat Jun 23 17:46:00 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.545 2018/06/22 18:23:59 roy Exp $
+.\"	$NetBSD: main,v 1.546 2018/06/23 17:46:00 snj Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -978,446 +978,6 @@ since its inception in January, 1993.
 If you're one of them, and would like to be mentioned, tell us!)
 .bullet)
 .
-.Ss "We are..."
-.
-.Pp
-(in alphabetical order)
-.Pp
-.
-.
-.Bl -column xxx "Jun-ichiro itojun Hagino" ".Mt sommerf...@netbsd.org" ".Sy playstation2"
-.
-.br_ne 1i
-.It Em "The NetBSD core group:"
-.It Ta Ta
-.It Ta Alistair Crooks Ta Mt a...@netbsd.org
-.It Ta Matthew Green Ta Mt m...@netbsd.org
-.It Ta Martin Husemann Ta Mt mar...@netbsd.org
-.It Ta Chuck Silvers Ta Mt c...@netbsd.org
-.It Ta Matt Thomas Ta Mt m...@netbsd.org
-.It Ta YAMAMOTO Takashi Ta Mt y...@netbsd.org
-.It Ta Christos Zoulas Ta Mt chris...@netbsd.org
-.It Ta Ta
-.
-.br_ne 2i
-.It Em "The portmasters (and their ports):"
-.\"
-.\" Please keep src/doc/RESPONSIBLE in sync with this list.
-.\"
-.\" XXX created by list-portmasters.pl
-.\"
-.It Ta Reinoud ZandijkTa Mt  reinoud Ta Sy acorn32
-.It Ta Matt ThomasTa Mt matt Ta Sy alpha
-.It Ta Ignatios Souvatzis Ta Mt   is Ta Sy amiga
-.It Ta Ignatios Souvatzis Ta Mt   is Ta Sy amigappc
-.It Ta Noriyuki Soda  Ta Mt soda Ta Sy arc
-.It Ta Julian Coleman Ta Mt  jdc Ta Sy atari
-.It Ta Matthias Drochner  Ta Mt drochner Ta Sy cesfic
-.It Ta Erik Berls Ta Mtcyber Ta Sy cobalt
-.It Ta Antti Kantee   Ta Mtpooka Ta Sy emips
-.It Ta Simon BurgeTa Mt   simonb Ta Sy evbmips
-.It Ta Steve Woodford Ta Mt  scw Ta Sy evbppc
-.It Ta Izumi Tsutsui  Ta Mt  tsutsui Ta Sy ews4800mips
-.It Ta Izumi Tsutsui  Ta Mt  tsutsui Ta Sy hp300
-.It Ta Nick HudsonTa Mtskrll Ta Sy hppa
-.It Ta Valeriy E. Ushakov Ta Mt  uwe Ta Sy hpcsh
-.It Ta Matt ThomasTa Mt matt Ta Sy ibmnws
-.It Ta Gavan Fantom   Ta Mtgavan Ta Sy iyonix
-.It Ta Valeriy E. Ushakov Ta Mt  uwe Ta Sy landisk
-.It Ta Izumi Tsutsui  Ta Mt  tsutsui Ta Sy luna68k
-.It Ta Scott Reynolds Ta Mt   scottr Ta Sy mac68k
-.It Ta Michael Lorenz Ta Mt macallan Ta Sy macppc
-.It Ta Steve Woodford Ta Mt  scw Ta Sy mvme68k
-.It Ta Steve Woodford Ta Mt  scw Ta Sy mvmeppc
-.It Ta Matt ThomasTa Mt matt Ta Sy netwinder
-.It Ta Izumi Tsutsui  Ta Mt  tsutsui Ta Sy news68k
-.It Ta Tim Rightnour  Ta Mt  garbled Ta Sy ofppc
-.It Ta Simon BurgeTa Mt   simonb Ta Sy pmax
-.It Ta Tim Rightnour  Ta Mt  garbled Ta Sy prep
-.It Ta Tim Rightnour  Ta Mt  garbled Ta Sy rs6000
-.It Ta Tohru NishimuraTa Mt nisimura Ta Sy sandpoint
-.It Ta Simon BurgeTa Mt   simonb Ta Sy sbmips
-.It Ta S\(/oren J\(/orvangTa Mtsoren Ta Sy sgimips
-.It Ta SAITOH MasanobuTa Mt  msaitoh Ta Sy sh3
-.It Ta Martin HusemannTa Mt   martin Ta Sy sparc64
-.It Ta Anders Magnusson   Ta Mtragge Ta Sy vax
-.It Ta NISHIMURA Takeshi  Ta Mt  nsmrtks Ta Sy x68k
-.It Ta Manuel Bouyer  Ta Mt   bouyer Ta Sy xen
-.It Ta Ta Ta
-.
-.br_ne 1i
-.It Em "The NetBSD \*V Release Engineering team:"
-.It Ta Ta
-.It Ta Stephen 

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

2018-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jun 23 16:09:53 UTC 2018

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

Log Message:
Disable all contemporary mode 1 quirks.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/x86/pci/pci_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/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.81 src/sys/arch/x86/pci/pci_machdep.c:1.82
--- src/sys/arch/x86/pci/pci_machdep.c:1.81	Sat Jun 23 16:05:05 2018
+++ src/sys/arch/x86/pci/pci_machdep.c	Sat Jun 23 16:09:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.81 2018/06/23 16:05:05 jakllsch Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.82 2018/06/23 16:09:53 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.81 2018/06/23 16:05:05 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.82 2018/06/23 16:09:53 jakllsch Exp $");
 
 #include 
 #include 
@@ -204,6 +204,7 @@ const struct {
 	/* XXX Triflex2 not tested */
 	_qe(0, 0, 0, PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX2),
 	_qe(0, 0, 0, PCI_VENDOR_COMPAQ, PCI_PRODUCT_COMPAQ_TRIFLEX4),
+#if 0
 	/* Triton needed for Connectix Virtual PC */
 	_qe(0, 0, 0, PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82437FX),
 	/* Connectix Virtual PC 5 has a 440BX */
@@ -217,6 +218,7 @@ const struct {
 	_qe(0, 0, 0, PCI_VENDOR_SIS, PCI_PRODUCT_SIS_741),
 	/* VIA Technologies VX900 */
 	_qe(0, 0, 0, PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX900_HB)
+#endif
 };
 #undef _tag
 #undef _qe
@@ -730,7 +732,6 @@ pci_mode_detect(void)
 	uint32_t sav, val;
 	int i;
 	pcireg_t idreg;
-	extern char cpu_brand_string[];
 
 	if (pci_mode != -1)
 		return pci_mode;
@@ -761,6 +762,8 @@ pci_mode_detect(void)
 		}
 	}
 
+#if 0
+	extern char cpu_brand_string[];
 	const char *reason, *system_vendor, *system_product;
 	if (memcmp(cpu_brand_string, "QEMU", 4) == 0)
 		/* PR 45671, https://bugs.launchpad.net/qemu/+bug/897771 */
@@ -779,7 +782,7 @@ pci_mode_detect(void)
 #endif
 		return (pci_mode);
 	}
-
+#endif
 	/*
 	 * Strong check for standard compliant mode 1:
 	 * 1. bit 31 ("enable") can be set



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

2018-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jun 23 16:05:05 UTC 2018

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

Log Message:
If mode 1 enable check fails, give mode 1 a second chance by trying to
use it to locate a PCI Host Bridge or device from vendor that produced
a chipset lacking a Host Bridge class device.

Should allow us to remove most all the mode 1 quirks added in the last
two decades.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/x86/pci/pci_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/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.80 src/sys/arch/x86/pci/pci_machdep.c:1.81
--- src/sys/arch/x86/pci/pci_machdep.c:1.80	Wed Apr 11 10:34:19 2018
+++ src/sys/arch/x86/pci/pci_machdep.c	Sat Jun 23 16:05:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.80 2018/04/11 10:34:19 nonaka Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.81 2018/06/23 16:05:05 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.80 2018/04/11 10:34:19 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.81 2018/06/23 16:05:05 jakllsch Exp $");
 
 #include 
 #include 
@@ -433,6 +433,30 @@ pci_conf_select(uint32_t sel)
 	}
 }
 
+static int
+pci_mode_check(void)
+{
+	pcireg_t x;
+	pcitag_t t;
+	int device;
+	const int maxdev = pci_bus_maxdevs(NULL, 0);
+
+	for (device = 0; device < maxdev; device++) {
+		t = pci_make_tag(NULL, 0, device, 0);
+		x = pci_conf_read(NULL, t, PCI_CLASS_REG);
+		if (PCI_CLASS(x) == PCI_CLASS_BRIDGE &&
+		PCI_SUBCLASS(x) == PCI_SUBCLASS_BRIDGE_HOST)
+			return 0;
+		x = pci_conf_read(NULL, t, PCI_ID_REG);
+		switch (PCI_VENDOR(x)) {
+		case PCI_VENDOR_COMPAQ:
+		case PCI_VENDOR_INTEL:
+		case PCI_VENDOR_VIATECH:
+			return 0;
+		}
+	}
+	return -1;
+}
 #ifdef __HAVE_PCI_MSI_MSIX
 static int
 pci_has_msi_quirk(pcireg_t id, int type)
@@ -769,6 +793,13 @@ pci_mode_detect(void)
 #ifdef DEBUG
 		printf("%s: mode 1 enable failed (%x)\n", __func__, val);
 #endif
+		/* Try out mode 1 to see if we can find a host bridge. */
+		if (pci_mode_check() == 0) {
+#ifdef DEBUG
+			printf("%s: mode 1 functional, using\n", __func__);
+#endif
+			return (pci_mode);
+		}
 		goto not1;
 	}
 	outl(PCI_MODE1_ADDRESS_REG, 0);



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

2018-06-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Jun 23 15:53:14 UTC 2018

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

Log Message:
make compile without DDB

PR port-xen/50282


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/x86/xen_ipi.c

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

Modified files:

Index: src/sys/arch/xen/x86/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.23 src/sys/arch/xen/x86/xen_ipi.c:1.24
--- src/sys/arch/xen/x86/xen_ipi.c:1.23	Mon Nov  6 15:27:09 2017
+++ src/sys/arch/xen/x86/xen_ipi.c	Sat Jun 23 15:53:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.23 2017/11/06 15:27:09 cherry Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.24 2018/06/23 15:53:14 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,12 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.23 2017/11/06 15:27:09 cherry Exp $");
+ * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.24 2018/06/23 15:53:14 jdolecek Exp $");
  */
 
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.23 2017/11/06 15:27:09 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.24 2018/06/23 15:53:14 jdolecek Exp $");
+
+#include "opt_ddb.h"
 
 #include 
 
@@ -59,11 +61,13 @@ __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 
 #include 
 #include 
 
+#ifdef DDB
 extern void ddb_ipi(struct trapframe);
+static void xen_ipi_ddb(struct cpu_info *, struct intrframe *);
+#endif
 
 static void xen_ipi_halt(struct cpu_info *, struct intrframe *);
 static void xen_ipi_synch_fpu(struct cpu_info *, struct intrframe *);
-static void xen_ipi_ddb(struct cpu_info *, struct intrframe *);
 static void xen_ipi_xcall(struct cpu_info *, struct intrframe *);
 static void xen_ipi_hvcb(struct cpu_info *, struct intrframe *);
 static void xen_ipi_generic(struct cpu_info *, struct intrframe *);
@@ -72,7 +76,11 @@ static void (*ipifunc[XEN_NIPIS])(struct
 {	/* In order of priority (see: xen/include/intrdefs.h */
 	xen_ipi_halt,
 	xen_ipi_synch_fpu,
+#ifdef DDB
 	xen_ipi_ddb,
+#else
+	NULL,
+#endif
 	xen_ipi_xcall,
 	xen_ipi_hvcb,
 	xen_ipi_generic,
@@ -229,6 +237,7 @@ xen_ipi_synch_fpu(struct cpu_info *ci, s
 	fpusave_cpu(true);
 }
 
+#ifdef DDB
 static void
 xen_ipi_ddb(struct cpu_info *ci, struct intrframe *intrf)
 {
@@ -260,6 +269,7 @@ xen_ipi_ddb(struct cpu_info *ci, struct 
 	ddb_ipi(tf);
 #endif
 }
+#endif /* DDB */
 
 static void
 xen_ipi_xcall(struct cpu_info *ci, struct intrframe *intrf)



CVS commit: src/share/misc

2018-06-23 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Jun 23 15:00:22 UTC 2018

Modified Files:
src/share/misc: acronyms.comp

Log Message:
The s in AST is system.
Add RC and common use of IPL, previous entry was from the world of s/360


To generate a diff of this commit:
cvs rdiff -u -r1.203 -r1.204 src/share/misc/acronyms.comp

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.comp
diff -u src/share/misc/acronyms.comp:1.203 src/share/misc/acronyms.comp:1.204
--- src/share/misc/acronyms.comp:1.203	Thu Jun 21 23:05:44 2018
+++ src/share/misc/acronyms.comp	Sat Jun 23 15:00:22 2018
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.203 2018/06/21 23:05:44 maya Exp $
+$NetBSD: acronyms.comp,v 1.204 2018/06/23 15:00:22 sevan Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -89,7 +89,7 @@ ASPM	active state power management
 ASQ	automated software quality
 ASR	address space register
 AST	abstract syntax tree
-AST	asynchronous trap
+AST	asynchronous system trap
 AT	access time
 AT	advanced technology
 ATA	advanced technology attachment
@@ -649,6 +649,7 @@ IPC	interprocess communication
 IPE	integrated programming environment
 IPI	interprocessor interrupt
 IPL	Initial Program Load
+IPL	Interrupt Priority Level
 IPMB	Intelligent Platform Management Bus
 IPMI	Intelligent Platform Management Interface
 IPNG	Internet Protocol, Next Generation
@@ -1112,6 +1113,7 @@ RBF	radial basis function
 RBT	red-black tree
 RC	release candidate
 RC	remote control
+RC	run commands
 RCS	Revision Control System
 RCS	revision control system
 RCU	read, copy, update



CVS commit: src/sys/kern

2018-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jun 23 14:22:30 UTC 2018

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

Log Message:
add a kobj_error() to a recently added error case


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/kern/subr_kobj.c

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

Modified files:

Index: src/sys/kern/subr_kobj.c
diff -u src/sys/kern/subr_kobj.c:1.65 src/sys/kern/subr_kobj.c:1.66
--- src/sys/kern/subr_kobj.c:1.65	Sat Nov  4 22:17:55 2017
+++ src/sys/kern/subr_kobj.c	Sat Jun 23 14:22:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kobj.c,v 1.65 2017/11/04 22:17:55 christos Exp $	*/
+/*	$NetBSD: subr_kobj.c,v 1.66 2018/06/23 14:22:30 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.65 2017/11/04 22:17:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.66 2018/06/23 14:22:30 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -889,6 +889,7 @@ kobj_sym_lookup(kobj_t ko, uintptr_t sym
 		 * Don't even try to lookup the symbol if the index is
 		 * bogus.
 		 */
+		kobj_error(ko, "symbol index out of range");
 		return EINVAL;
 	}
 



CVS commit: src/usr.sbin/installboot/arch

2018-06-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun 23 14:15:57 UTC 2018

Modified Files:
src/usr.sbin/installboot/arch: i386.c

Log Message:
Fix integer overflow in installboot(8)

Add a sanity check of the disk_buf first three bytes. The original code on
a disk with nul bytes was causing integer overflow and thus calling the
memcmp(3) functin in is_zero() with enormous length.

Verity that the 0th byte is JMP, 1th a signed byte >=9 to prevent overflow
and 2th byte NOP.

Add a comment explaining the check.

Detected with MKSANITIZER and ASan.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/installboot/arch/i386.c

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

Modified files:

Index: src/usr.sbin/installboot/arch/i386.c
diff -u src/usr.sbin/installboot/arch/i386.c:1.40 src/usr.sbin/installboot/arch/i386.c:1.41
--- src/usr.sbin/installboot/arch/i386.c:1.40	Fri Jun 14 03:54:43 2013
+++ src/usr.sbin/installboot/arch/i386.c	Sat Jun 23 14:15:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: i386.c,v 1.40 2013/06/14 03:54:43 msaitoh Exp $ */
+/* $NetBSD: i386.c,v 1.41 2018/06/23 14:15:57 kamil Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if !defined(__lint)
-__RCSID("$NetBSD: i386.c,v 1.40 2013/06/14 03:54:43 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.41 2018/06/23 14:15:57 kamil Exp $");
 #endif /* !__lint */
 
 #include 
@@ -418,8 +418,19 @@ i386_setboot(ib_params *params)
 			return 0;
 		}
 
-		/* Find size of old BPB, and copy into new bootcode */
-		if (!is_zero(disk_buf.b + 3 + 8, disk_buf.b[1] - 1 - 8)) {
+		/*
+		 * Find size of old BPB, and copy into new bootcode
+		 *
+		 * The 2nd byte (b[1]) contains jmp short relative offset.
+		 * If it is zero or some invalid input that is smaller than 9,
+		 * it will cause overflow and call is_zero() with enormous size.
+		 * Add a paranoid check to prevent this scenario.
+		 *
+		 * Verify that b[0] contains JMP (0xeb) and b[2] NOP (0x90).
+		 */
+		if (disk_buf.b[0] == 0xeb && disk_buf.b[1] >= 9 &&
+		disk_buf.b[2] == 0x90 &&
+		!is_zero(disk_buf.b + 3 + 8, disk_buf.b[1] - 1 - 8)) {
 			struct mbr_bpbFAT16 *bpb = (void *)(disk_buf.b + 3 + 8);
 			/* Check enough space before the FAT for the bootcode */
 			u = le16toh(bpb->bpbBytesPerSec)



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

2018-06-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Jun 23 14:14:43 UTC 2018

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

Log Message:
Add acpiecdt* at acpi?.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/arch/amd64/conf/XEN3_DOM0

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/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.152 src/sys/arch/amd64/conf/XEN3_DOM0:1.153
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.152	Fri Jun 22 02:51:17 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat Jun 23 14:14:42 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.152 2018/06/22 02:51:17 darcy Exp $
+# $NetBSD: XEN3_DOM0,v 1.153 2018/06/23 14:14:42 jakllsch Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -10,7 +10,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.152 $"
+#ident		"XEN3_DOM0-$Revision: 1.153 $"
 
 maxusers	32		# estimated number of users
 
@@ -229,7 +229,8 @@ acpiacad*	at acpi?		# ACPI AC Adapter
 acpibat*	at acpi?		# ACPI Battery
 acpibut*	at acpi?		# ACPI Button
 acpidalb*	at acpi?		# ACPI Direct Application Launch Button
-acpiec* 	at acpi?		# ACPI Embedded Controller
+acpiec* 	at acpi?		# ACPI Embedded Controller (late)
+acpiecdt*	at acpi?		# ACPI Embedded Controller (early)
 acpilid*	at acpi?		# ACPI Lid Switch
 acpitz* 	at acpi?		# ACPI Thermal Zone
 aibs*		at acpi?		# ASUSTeK AI Booster hardware monitor



CVS commit: [netbsd-8] src/doc

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 12:14:46 UTC 2018

Modified Files:
src/doc [netbsd-8]: 3RDPARTY

Log Message:
Fix current version of tzcode for ticket #809.


To generate a diff of this commit:
cvs rdiff -u -r1.1444.2.13 -r1.1444.2.14 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1444.2.13 src/doc/3RDPARTY:1.1444.2.14
--- src/doc/3RDPARTY:1.1444.2.13	Sat Jun 23 11:14:23 2018
+++ src/doc/3RDPARTY	Sat Jun 23 12:14:46 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1444.2.13 2018/06/23 11:14:23 martin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1444.2.14 2018/06/23 12:14:46 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1412,7 +1412,7 @@ Added changes from a5 -> a12 manually.
 
 Package:	tz
 Version:	tzcode2017b / tzdata2018e
-Current Vers:	tzcode2018d / tzdata2018e
+Current Vers:	tzcode2018e / tzdata2018e
 Maintainer:	Paul Eggert 
 Archive Site:	ftp://ftp.iana.org/tz/releases/
 Archive Site:	ftp://munnari.oz.au/pub/oldtz/



CVS commit: src/doc

2018-06-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Jun 23 11:54:06 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
remove the xen XSAVE entry, needs more work before it can be enabled


To generate a diff of this commit:
cvs rdiff -u -r1.2402 -r1.2403 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2402 src/doc/CHANGES:1.2403
--- src/doc/CHANGES:1.2402	Thu Jun 21 12:02:15 2018
+++ src/doc/CHANGES	Sat Jun 23 11:54:06 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2402 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2403 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -164,6 +164,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	virtio(4): Add MMIO transport and fdt(4) attachment. [jakllsch 20180606]
 	arm: Add support for QEMU ARM Virtual Machine ("virt"). [jmcneill 20180614]
 	arm: Add support for Rockchip RK3328 SoC. [jmcneill 20180615]
-	xen: Enabled XSAVE and AVX support on hardware with proper XSAVE
-		support, PR kern/50332. [jdolecek 20180619]
 	dhcpcd: Import 7.0.6. [roy 20180621]



CVS commit: [netbsd-8] src/doc

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:41:11 UTC 2018

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

Log Message:
Tickets #891, #892, #893, #894, #895, #896 and #897.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.214 -r1.1.2.215 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.214 src/doc/CHANGES-8.0:1.1.2.215
--- src/doc/CHANGES-8.0:1.1.2.214	Fri Jun 22 18:06:22 2018
+++ src/doc/CHANGES-8.0	Sat Jun 23 11:41:11 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.214 2018/06/22 18:06:22 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.215 2018/06/23 11:41:11 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13979,3 +13979,63 @@ sys/netipsec/xform_ah.c1.90,1.93,1.1
 	Simplify and strengthen the AH parser.
 	[maxv, ticket #889]
 
+crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h	(patch)
+crypto/external/bsd/openssl/dist/crypto/dh/dh.h		(patch)
+crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h	(patch)
+crypto/external/bsd/openssl/dist/crypto/ecdsa/ecdsa.h	(patch)
+crypto/external/bsd/openssl/dist/crypto/evp/evp.h	(patch)
+crypto/external/bsd/openssl/dist/crypto/hmac/hmac.h	(patch)
+crypto/external/bsd/openssl/dist/crypto/rsa/rsa.h	(patch)
+crypto/external/bsd/openssl/dist/crypto/x509v3/x509v3.h	(patch)
+
+	Provide a future proof API if OPENSSL_API_COMPAT is defined
+	to >= 0x1010L.
+	[christos, ticket #891]
+
+
+lib/libc/sys/sched.c1.5
+
+	Return PRI_NONE for sched_get_priority_m{in,ax} and SCHED_OTHER.
+	[maya, ticket #892]
+
+sys/netinet6/icmp6.c1.228,1.230
+
+	Remove the RH0 code from ICMPv6, and fix a length calculation.
+	[maxv, ticket #893]
+
+
+sys/dev/ata/ata_raid.c1.40
+
+	Call config_cfattach_attach() regardless of whether the module is
+	being built as part of a kernel or as a external module.
+	[pgoyette, ticket #894]
+
+usr.sbin/sysinst/util.c1.9
+
+	Fix invalid free(3) in sysinst(8).
+	[kamil, ticket #895]
+
+external/bsd/dhcpcd/dist/src/common.c   up to 1.1.1.5
+external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.14
+external/bsd/dhcpcd/dist/src/dhcpcd.8.inup to 1.1.1.10
+external/bsd/dhcpcd/dist/src/dhcpcd.c   up to 1.13
+external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.10
+external/bsd/dhcpcd/dist/src/duid.c up to 1.1.1.3
+doc/3RDPARTY	(adjusted manually)
+
+	Import dhcpcd-7.0.6.
+	[roy, ticket #896]
+
+sys/arch/amd64/amd64/locore.S		1.166 (patch)
+sys/arch/i386/i386/locore.S		1.157 (patch)
+sys/arch/x86/include/cpu.h		1.92 (patch)
+sys/arch/x86/include/fpu.h		1.9 (patch)
+sys/arch/x86/x86/fpu.c			1.33-1.39 (patch)
+sys/arch/x86/x86/identcpu.c		1.72 (patch)
+sys/arch/x86/x86/vm_machdep.c		1.34 (patch)
+sys/arch/x86/x86/x86_machdep.c		1.116,1.117 (patch)
+
+	Support eager fpu switch, to work around INTEL-SA-00145.
+	Provide a sysctl machdep.fpu_eager, which gets automatically
+	initialized to 1 on affected CPUs.
+	[maxv, ticket #897]



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

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:39:02 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: locore.S
src/sys/arch/i386/i386 [netbsd-8]: locore.S
src/sys/arch/x86/include [netbsd-8]: cpu.h fpu.h
src/sys/arch/x86/x86 [netbsd-8]: fpu.c identcpu.c vm_machdep.c
x86_machdep.c

Log Message:
Pull up the following, via patch, requested by maxv in ticket #897:

sys/arch/amd64/amd64/locore.S   1.166 (patch)
sys/arch/i386/i386/locore.S 1.157 (patch)
sys/arch/x86/include/cpu.h  1.92 (patch)
sys/arch/x86/include/fpu.h  1.9 (patch)
sys/arch/x86/x86/fpu.c  1.33-1.39 (patch)
sys/arch/x86/x86/identcpu.c 1.72 (patch)
sys/arch/x86/x86/vm_machdep.c   1.34 (patch)
sys/arch/x86/x86/x86_machdep.c  1.116,1.117 (patch)

Support eager fpu switch, to work around INTEL-SA-00145.
Provide a sysctl machdep.fpu_eager, which gets automatically
initialized to 1 on affected CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.123.6.6 -r1.123.6.7 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.145.6.3 -r1.145.6.4 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.71.2.6 -r1.71.2.7 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.6 -r1.6.28.1 src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.12.8.1 -r1.12.8.2 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.55.2.3 -r1.55.2.4 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.28.6.3 -r1.28.6.4 src/sys/arch/x86/x86/vm_machdep.c
cvs rdiff -u -r1.91.4.3 -r1.91.4.4 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/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.6 src/sys/arch/amd64/amd64/locore.S:1.123.6.7
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.6	Sat May  5 15:00:29 2018
+++ src/sys/arch/amd64/amd64/locore.S	Sat Jun 23 11:39:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.6 2018/05/05 15:00:29 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.7 2018/06/23 11:39:01 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1094,6 +1094,20 @@ skip_save:
 	popq	%rdx
 #endif
 
+#ifndef XEN
+	/* RDI/RSI got clobbered. */
+	movq	%r13,%rdi
+	movq	%r12,%rsi
+
+	pushq	%rdx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	callq	_C_LABEL(fpu_eagerswitch)
+.Lno_eagerfpu:
+	popq	%rdx
+#endif
+
 	/* Switch to newlwp's stack. */
 	movq	L_PCB(%r12),%r14
 	movq	PCB_RSP(%r14),%rsp

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.145.6.3 src/sys/arch/i386/i386/locore.S:1.145.6.4
--- src/sys/arch/i386/i386/locore.S:1.145.6.3	Tue Mar 13 15:47:44 2018
+++ src/sys/arch/i386/i386/locore.S	Sat Jun 23 11:39:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.145.6.3 2018/03/13 15:47:44 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.3 2018/03/13 15:47:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -1089,6 +1089,19 @@ ENTRY(cpu_switchto)
 	movl	%ebp,PCB_EBP(%eax)
 skip_save:
 
+#ifndef XEN
+	pushl	%edx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	pushl	%edi
+	pushl	%esi
+	call	_C_LABEL(fpu_eagerswitch)
+	addl	$8,%esp
+.Lno_eagerfpu:
+	popl	%edx
+#endif
+
 	/* Switch to newlwp's stack. */
 	movl	L_PCB(%edi),%ebx
 	movl	PCB_EBP(%ebx),%ebp

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.71.2.6 src/sys/arch/x86/include/cpu.h:1.71.2.7
--- src/sys/arch/x86/include/cpu.h:1.71.2.6	Sat Jun  9 15:12:21 2018
+++ src/sys/arch/x86/include/cpu.h	Sat Jun 23 11:39:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.71.2.6 2018/06/09 15:12:21 martin Exp $	*/
+/*	$NetBSD: cpu.h,v 1.71.2.7 2018/06/23 11:39:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -424,6 +424,7 @@ extern int x86_fpu_save;
 #define	FPU_SAVE_XSAVEOPT	3
 extern unsigned int x86_fpu_save_size;
 extern uint64_t x86_xsave_features;
+extern bool x86_fpu_eager;
 
 extern void (*x86_cpu_idle)(void);
 #define	cpu_idle() (*x86_cpu_idle)()

Index: src/sys/arch/x86/include/fpu.h
diff -u src/sys/arch/x86/include/fpu.h:1.6 src/sys/arch/x86/include/fpu.h:1.6.28.1
--- src/sys/arch/x86/include/fpu.h:1.6	Tue Feb 25 22:16:52 2014
+++ src/sys/arch/x86/include/fpu.h	Sat Jun 23 11:39:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.6 2014/02/25 22:16:52 dsl Exp $	*/
+/*	$NetBSD: fpu.h,v 1.6.28.1 2018/06/23 11:39:02 martin Exp $	*/
 
 #ifndef	_X86_FPU_H_
 #define	_X86_FPU_H_
@@ -15,6 +15,8 @@ void fpuinit(struct cpu_info *);
 void fpusave_lwp(struct lwp *, bool);
 void 

CVS commit: [netbsd-8] src/doc

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:14:23 UTC 2018

Modified Files:
src/doc [netbsd-8]: 3RDPARTY

Log Message:
Note import of dhcpcd-7.0.6.


To generate a diff of this commit:
cvs rdiff -u -r1.1444.2.12 -r1.1444.2.13 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1444.2.12 src/doc/3RDPARTY:1.1444.2.13
--- src/doc/3RDPARTY:1.1444.2.12	Thu Jun  7 18:34:03 2018
+++ src/doc/3RDPARTY	Sat Jun 23 11:14:23 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1444.2.12 2018/06/07 18:34:03 martin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1444.2.13 2018/06/23 11:14:23 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -334,8 +334,8 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	7.0.5b
-Current Vers:	7.0.5b
+Version:	7.0.6
+Current Vers:	7.0.6
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/



CVS commit: [netbsd-8] src/external/bsd/dhcpcd/dist/src

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:13:33 UTC 2018

Modified Files:
src/external/bsd/dhcpcd/dist/src [netbsd-8]: common.c defs.h
dhcpcd.8.in dhcpcd.c dhcpcd.conf.5.in duid.c

Log Message:
Pull up the following, requested by roy in ticket #896:

external/bsd/dhcpcd/dist/src/common.c   up to 1.1.1.5
external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.14
external/bsd/dhcpcd/dist/src/dhcpcd.8.inup to 1.1.1.10
external/bsd/dhcpcd/dist/src/dhcpcd.c   up to 1.13
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.10
external/bsd/dhcpcd/dist/src/duid.c up to 1.1.1.3

Import dhcpcd 7.0.6.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2.8.1 -r1.1.1.2.8.2 \
src/external/bsd/dhcpcd/dist/src/common.c
cvs rdiff -u -r1.1.1.4.2.3 -r1.1.1.4.2.4 \
src/external/bsd/dhcpcd/dist/src/defs.h \
src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in \
src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.8.1 src/external/bsd/dhcpcd/dist/src/duid.c

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

Modified files:

Index: src/external/bsd/dhcpcd/dist/src/common.c
diff -u src/external/bsd/dhcpcd/dist/src/common.c:1.1.1.2.8.1 src/external/bsd/dhcpcd/dist/src/common.c:1.1.1.2.8.2
--- src/external/bsd/dhcpcd/dist/src/common.c:1.1.1.2.8.1	Sat Jan 13 21:35:30 2018
+++ src/external/bsd/dhcpcd/dist/src/common.c	Sat Jun 23 11:13:33 2018
@@ -140,10 +140,15 @@ hwaddr_aton(uint8_t *buffer, const char 
 	size_t len = 0;
 
 	c[2] = '\0';
-	while (*p) {
+	while (*p != '\0') {
+		/* Skip separators */
 		c[0] = *p++;
-		if (c[0] == '\n')
+		switch (c[0]) {
+		case '\n':	/* long duid split on lines */
+		case ':':	/* typical mac address */
+		case '-':	/* uuid */
 			continue;
+		}
 		c[1] = *p++;
 		/* Ensure that digits are hex */
 		if (isxdigit((unsigned char)c[0]) == 0 ||
@@ -157,15 +162,6 @@ hwaddr_aton(uint8_t *buffer, const char 
 			errno = EINVAL;
 			return 0;
 		}
-		/* Ensure that next data is EOL or a seperator with data */
-		if (!(*p == '\0' || *p == '\n' ||
-		(*p == ':' && *(p + 1) != '\0')))
-		{
-			errno = EINVAL;
-			return 0;
-		}
-		if (*p)
-			p++;
 		if (bp)
 			*bp++ = (uint8_t)strtol(c, NULL, 16);
 		len++;

Index: src/external/bsd/dhcpcd/dist/src/defs.h
diff -u src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.4.2.3 src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.4.2.4
--- src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.4.2.3	Thu Jun  7 18:34:03 2018
+++ src/external/bsd/dhcpcd/dist/src/defs.h	Sat Jun 23 11:13:33 2018
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"7.0.5"
+#define VERSION			"7.0.6"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"
Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.4.2.3 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.4.2.4
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.4.2.3	Thu Jun  7 18:34:03 2018
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in	Sat Jun 23 11:13:33 2018
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 29, 2018
+.Dd June 5, 2018
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -253,15 +253,17 @@ Use this
 instead of the default
 .Pa @SCRIPT@ .
 .It Fl D , Fl Fl duid
-Generate an
-.Li RFC 4361
-compliant clientid.
-This requires persistent storage and not all DHCP servers work with it so it
-is not enabled by default.
-.Nm
-generates the DUID and stores it in
-.Pa @DBDIR@/duid .
-This file should not be copied to other hosts.
+Use a DHCP Unique Identifier.
+If a system UUID is available, that will be used to create a DUID-UUID,
+otheriwse if persistent storage is available then a DUID-LLT
+(link local address + time) is generated,
+otherwise DUID-LL is generated (link local address).
+This, plus the IAID will be used as the
+.Fl I, Fl Fl clientid .
+The DUID generated will be held in
+.Pa @DBDIR@/duid
+and should not be copied to other hosts.
+This file also takes precedence over the above rules.
 .It Fl d , Fl Fl debug
 Echo debug messages to the stderr and syslog.
 .It Fl E , Fl Fl lastlease
@@ -823,8 +825,8 @@ RFC\ 951, RFC\ 1534, RFC\ 2104, RFC\ 213
 RFC\ 3004, RFC\ 3118, RFC\ 3203, RFC\ 3315, RFC\ 3361, RFC\ 3633, RFC\ 3396,
 RFC\ 3397, RFC\ 3442, RFC\ 3495, RFC\ 3925, RFC\ 3927, RFC\ 4039, RFC\ 4075,
 RFC\ 4242, RFC\ 4361, RFC\ 4390, RFC\ 4702, RFC\ 4074, RFC\ 4861, RFC\ 4833,
-RFC\ 4941, RFC\ 5227, RFC\ 5942, RFC\ 5969, RFC\ 6106, RFC\ 6334, RFC\ 6603,
-RFC\ 6704, RFC\ 7217, RFC\ 7550.
+RFC\ 4941, RFC\ 5227, RFC\ 5942, RFC\ 5969, RFC\ 6106, RFC\ 6334, RFC\ 6355,
+RFC\ 6603, RFC\ 6704, RFC\ 7217, RFC\ 7550.
 .Sh AUTHORS
 .An Roy Marples Aq Mt 

CVS commit: src/usr.sbin/intrctl

2018-06-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Jun 23 11:11:00 UTC 2018

Modified Files:
src/usr.sbin/intrctl: intrctl_io.c

Log Message:
fix intrctl_io_firstline() to properly return NULL if there are no records
to show


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/intrctl/intrctl_io.c

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

Modified files:

Index: src/usr.sbin/intrctl/intrctl_io.c
diff -u src/usr.sbin/intrctl/intrctl_io.c:1.3 src/usr.sbin/intrctl/intrctl_io.c:1.4
--- src/usr.sbin/intrctl/intrctl_io.c:1.3	Fri Aug  5 06:58:55 2016
+++ src/usr.sbin/intrctl/intrctl_io.c	Sat Jun 23 11:11:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intrctl_io.c,v 1.3 2016/08/05 06:58:55 knakahara Exp $	*/
+/*	$NetBSD: intrctl_io.c,v 1.4 2018/06/23 11:11:00 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: intrctl_io.c,v 1.3 2016/08/05 06:58:55 knakahara Exp $");
+__RCSID("$NetBSD: intrctl_io.c,v 1.4 2018/06/23 11:11:00 jdolecek Exp $");
 
 #include 
 #include 
@@ -108,8 +108,15 @@ struct intrio_list_line *
 intrctl_io_firstline(void *handle)
 {
 	struct intrio_list *list = handle;
+	struct intrio_list_line *next;
+	char *buf_end;
 
-	return (struct intrio_list_line *)((char *)list + list->il_lineoffset);
+	buf_end = (char *)list + list->il_bufsize;
+	next = (struct intrio_list_line *)((char *)list + list->il_lineoffset);
+	if ((char *)next >= buf_end)
+		return NULL;
+
+	return next;
 }
 
 struct intrio_list_line *



CVS commit: [netbsd-8] src/usr.sbin/sysinst

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:09:24 UTC 2018

Modified Files:
src/usr.sbin/sysinst [netbsd-8]: util.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #895):

usr.sbin/sysinst/util.c: revision 1.9

Fix invalid free(3) in sysinst(8)

The path variable is assigned with an allocation on the heap with
strdup(3). Later this pointer is changed with strsep(3) and this caused
invalid free(3).

Store the original pointer in a new helper variable opath and pass it to
free(3). With this change, the problem is going away.

Detected with MKSANITIZER=yes with AddressSanitizer.


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

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

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.7.8.1 src/usr.sbin/sysinst/util.c:1.7.8.2
--- src/usr.sbin/sysinst/util.c:1.7.8.1	Sat Jun  9 15:19:27 2018
+++ src/usr.sbin/sysinst/util.c	Sat Jun 23 11:09:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.7.8.1 2018/06/09 15:19:27 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.7.8.2 2018/06/23 11:09:24 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1681,14 +1681,16 @@ set_menu_select(menudesc *m, void *arg)
 int
 binary_available(const char *prog)
 {
-char *p, tmp[MAXPATHLEN], *path = getenv("PATH");
+char *p, tmp[MAXPATHLEN], *path = getenv("PATH"), *opath;
  
 if (path == NULL)
 return access(prog, X_OK) == 0;
 path = strdup(path);
 if (path == NULL)
 return 0;
- 
+
+	opath = path;
+
 while ((p = strsep(, ":")) != NULL) {
 if (strlcpy(tmp, p, MAXPATHLEN) >= MAXPATHLEN)
 continue;
@@ -1697,11 +1699,11 @@ binary_available(const char *prog)
 if (strlcat(tmp, prog, MAXPATHLEN) >= MAXPATHLEN)
 continue;
 if (access(tmp, X_OK) == 0) {
-free(path);
+free(opath);
 return 1;
 }
 }
-free(path);
+free(opath);
 return 0;
 }
 



CVS commit: [netbsd-8] src/sys/dev/ata

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:05:21 UTC 2018

Modified Files:
src/sys/dev/ata [netbsd-8]: ata_raid.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #894):

sys/dev/ata/ata_raid.c: revision 1.40

Call config_cfattach_attach() regardless of whether the module is
being built as part of a kernel or as a external module.

Addresses kern/53389 - thanks for the report!

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.8.1 src/sys/dev/ata/ata_raid.c

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

Modified files:

Index: src/sys/dev/ata/ata_raid.c
diff -u src/sys/dev/ata/ata_raid.c:1.39 src/sys/dev/ata/ata_raid.c:1.39.8.1
--- src/sys/dev/ata/ata_raid.c:1.39	Tue Sep 27 08:05:34 2016
+++ src/sys/dev/ata/ata_raid.c	Sat Jun 23 11:05:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid.c,v 1.39 2016/09/27 08:05:34 pgoyette Exp $	*/
+/*	$NetBSD: ata_raid.c,v 1.39.8.1 2018/06/23 11:05:21 martin Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.39 2016/09/27 08:05:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.39.8.1 2018/06/23 11:05:21 martin Exp $");
 
 #include 
 #include 
@@ -338,26 +338,27 @@ ataraid_modcmd(modcmd_t cmd, void *arg)
 		error = config_cfdriver_attach(_cd);
 		if (error) 
 			break;
+#endif
 
 		error = config_cfattach_attach(ataraid_cd.cd_name, _ca);
 		if (error) {
+#ifdef _MODULE
 			config_cfdriver_detach(_cd);
+#endif
 			aprint_error("%s: unable to register cfattach for \n"
 			"%s, error %d", __func__, ataraid_cd.cd_name,
 			error);
 			break;
 		}
-#endif
 		break;
 	case MODULE_CMD_FINI:
-#ifdef _MODULE
-
 		error = config_cfattach_detach(ataraid_cd.cd_name, _ca);
 		if (error) {
 			aprint_error("%s: failed to detach %s cfattach, "
 			"error %d\n", __func__, ataraid_cd.cd_name, error);
 			break;
 		}
+#ifdef _MODULE
 		error = config_cfdriver_detach(_cd);
 		if (error) {
 			(void)config_cfattach_attach(ataraid_cd.cd_name,



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

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:03:27 UTC 2018

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

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

sys/netinet6/icmp6.c: revision 1.228,1.230

Remove the RH0 code from ICMPv6. RH0 is deprecated by RFC5095 (2007) for
security reasons. We already removed it in Route6.

In addition there was an mbuf bug here: calling IP6_EXTHDR_GET twice with
the same offset, but still using the pointer from the first call, which
could have been made invalid. By luck, m_pulldown leaves zero-sized mbufs
in place, instead of freeing them.

And in general, using a 'finaldst' pointer on the mbuf, and then modifying
that mbuf with IP6_EXTHDR_GET with a smaller offset, was really error-
prone.

Fix 'icmp6len', it shouldn't be ip6_plen, because we may not be at the
beginning of the packet (off+ip6_plen is beyond the end of the mbuf). By
luck, the IP6_EXTHDR_GET that follows will fail and prevent buffer
overflows in non-jumbogram packets.

For jumbograms we will probably be in trouble here; but it doesn't seem
possible to craft reliably a jumbogram for a non-jumbogram-enabled device.

So I don't think it's a huge problem.


To generate a diff of this commit:
cvs rdiff -u -r1.211.6.6 -r1.211.6.7 src/sys/netinet6/icmp6.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/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.211.6.6 src/sys/netinet6/icmp6.c:1.211.6.7
--- src/sys/netinet6/icmp6.c:1.211.6.6	Fri Jun  8 10:14:33 2018
+++ src/sys/netinet6/icmp6.c	Sat Jun 23 11:03:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.211.6.6 2018/06/08 10:14:33 martin Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.211.6.7 2018/06/23 11:03:27 martin Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.211.6.6 2018/06/08 10:14:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.211.6.7 2018/06/23 11:03:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -969,8 +969,6 @@ icmp6_notify_error(struct mbuf *m, int o
 		int icmp6type = icmp6->icmp6_type;
 		struct ip6_frag *fh;
 		struct ip6_rthdr *rth;
-		struct ip6_rthdr0 *rth0;
-		int rthlen;
 		struct ifnet *rcvif;
 		int s;
 
@@ -995,46 +993,15 @@ icmp6_notify_error(struct mbuf *m, int o
 nxt = eh->ip6e_nxt;
 break;
 			case IPPROTO_ROUTING:
-/*
- * When the erroneous packet contains a
- * routing header, we should examine the
- * header to determine the final destination.
- * Otherwise, we can't properly update
- * information that depends on the final
- * destination (e.g. path MTU).
- */
+/* Ignore the option. */
 IP6_EXTHDR_GET(rth, struct ip6_rthdr *, m,
 	   eoff, sizeof(*rth));
 if (rth == NULL) {
 	ICMP6_STATINC(ICMP6_STAT_TOOSHORT);
 	return (-1);
 }
-rthlen = (rth->ip6r_len + 1) << 3;
-/*
- * XXX: currently there is no
- * officially defined type other
- * than type-0.
- * Note that if the segment left field
- * is 0, all intermediate hops must
- * have been passed.
- */
-if (rth->ip6r_segleft &&
-rth->ip6r_type == IPV6_RTHDR_TYPE_0) {
-	int hops;
-
-	IP6_EXTHDR_GET(rth0,
-		   struct ip6_rthdr0 *, m,
-		   eoff, rthlen);
-	if (rth0 == NULL) {
-		ICMP6_STATINC(ICMP6_STAT_TOOSHORT);
-		return (-1);
-	}
-	/* just ignore a bogus header */
-	if ((rth0->ip6r0_len % 2) == 0 &&
-	(hops = rth0->ip6r0_len/2))
-		finaldst = (struct in6_addr *)(rth0 + 1) + (hops - 1);
-}
-eoff += rthlen;
+
+eoff += (rth->ip6r_len + 1) << 3;
 nxt = rth->ip6r_nxt;
 break;
 			case IPPROTO_FRAGMENT:
@@ -2268,7 +2235,7 @@ icmp6_redirect_input(struct mbuf *m, int
 	struct ifnet *ifp;
 	struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
 	struct nd_redirect *nd_rd;
-	int icmp6len = ntohs(ip6->ip6_plen);
+	int icmp6len = m->m_pkthdr.len - off;
 	char *lladdr = NULL;
 	int lladdrlen = 0;
 	struct rtentry *rt = NULL;



CVS commit: [netbsd-8] src/lib/libc/sys

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 11:01:14 UTC 2018

Modified Files:
src/lib/libc/sys [netbsd-8]: sched.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #892):

lib/libc/sys/sched.c: revision 1.5

PR/52826: Onno van der Linden: Return PRI_NONE for sched_get_priority_m{in,ax}
and SCHED_OTHER.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.24.1 src/lib/libc/sys/sched.c

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

Modified files:

Index: src/lib/libc/sys/sched.c
diff -u src/lib/libc/sys/sched.c:1.4 src/lib/libc/sys/sched.c:1.4.24.1
--- src/lib/libc/sys/sched.c:1.4	Sun Mar 18 02:04:39 2012
+++ src/lib/libc/sys/sched.c	Sat Jun 23 11:01:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched.c,v 1.4 2012/03/18 02:04:39 christos Exp $	*/
+/*	$NetBSD: sched.c,v 1.4.24.1 2018/06/23 11:01:14 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, Mindaugas Rasiukevicius 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: sched.c,v 1.4 2012/03/18 02:04:39 christos Exp $");
+__RCSID("$NetBSD: sched.c,v 1.4.24.1 2018/06/23 11:01:14 martin Exp $");
 
 #include 
 #include 
@@ -101,22 +101,32 @@ int
 sched_get_priority_max(int policy)
 {
 
-	if (policy < SCHED_OTHER || policy > SCHED_RR) {
+	switch (policy) {
+	case SCHED_OTHER:
+		return PRI_NONE;
+	case SCHED_RR:
+	case SCHED_FIFO:
+		return (int)sysconf(_SC_SCHED_PRI_MAX);
+	default:
 		errno = EINVAL;
 		return -1;
 	}
-	return (int)sysconf(_SC_SCHED_PRI_MAX);
 }
 
 int
 sched_get_priority_min(int policy)
 {
 
-	if (policy < SCHED_OTHER || policy > SCHED_RR) {
+	switch (policy) {
+	case SCHED_OTHER:
+		return PRI_NONE;
+	case SCHED_RR:
+	case SCHED_FIFO:
+		return (int)sysconf(_SC_SCHED_PRI_MIN);
+	default:
 		errno = EINVAL;
 		return -1;
 	}
-	return (int)sysconf(_SC_SCHED_PRI_MIN);
 }
 
 int



CVS commit: [netbsd-8] src/crypto/external/bsd/openssl/dist/crypto

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 10:52:31 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/asn1 [netbsd-8]: asn1.h
src/crypto/external/bsd/openssl/dist/crypto/dh [netbsd-8]: dh.h
src/crypto/external/bsd/openssl/dist/crypto/dsa [netbsd-8]: dsa.h
src/crypto/external/bsd/openssl/dist/crypto/ecdsa [netbsd-8]: ecdsa.h
src/crypto/external/bsd/openssl/dist/crypto/evp [netbsd-8]: evp.h
src/crypto/external/bsd/openssl/dist/crypto/hmac [netbsd-8]: hmac.h
src/crypto/external/bsd/openssl/dist/crypto/rsa [netbsd-8]: rsa.h
src/crypto/external/bsd/openssl/dist/crypto/x509v3 [netbsd-8]: x509v3.h

Log Message:
Apply patch, requested by christos in ticket #891:

Provide future compatibility API when OPENSSL_API_COMPAT is
defined to >= 0x1010L.


To generate a diff of this commit:
cvs rdiff -u -r1.2.6.1 -r1.2.6.2 \
src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h
cvs rdiff -u -r1.2 -r1.2.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/dh/dh.h
cvs rdiff -u -r1.2 -r1.2.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h
cvs rdiff -u -r1.2 -r1.2.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/ecdsa/ecdsa.h
cvs rdiff -u -r1.1.1.9 -r1.1.1.9.4.1 \
src/crypto/external/bsd/openssl/dist/crypto/evp/evp.h
cvs rdiff -u -r1.2 -r1.2.8.1 \
src/crypto/external/bsd/openssl/dist/crypto/hmac/hmac.h
cvs rdiff -u -r1.4 -r1.4.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa.h
cvs rdiff -u -r1.1.1.4 -r1.1.1.4.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/x509v3/x509v3.h

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/dist/crypto/asn1/asn1.h
diff -u src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h:1.2.6.1 src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h:1.2.6.2
--- src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h:1.2.6.1	Wed Apr 18 13:51:35 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h	Sat Jun 23 10:52:30 2018
@@ -1414,6 +1414,14 @@ void ERR_load_ASN1_strings(void);
 # define ASN1_R_WRONG_TAG 168
 # define ASN1_R_WRONG_TYPE169
 
+#if OPENSSL_API_COMPAT >= 0x1010L
+static inline const unsigned char *
+ASN1_STRING_get0_data(const ASN1_STRING *x)
+{
+	return ASN1_STRING_data(__UNCONST(x));
+}
+#endif
+
 #ifdef  __cplusplus
 }
 #endif

Index: src/crypto/external/bsd/openssl/dist/crypto/dh/dh.h
diff -u src/crypto/external/bsd/openssl/dist/crypto/dh/dh.h:1.2 src/crypto/external/bsd/openssl/dist/crypto/dh/dh.h:1.2.6.1
--- src/crypto/external/bsd/openssl/dist/crypto/dh/dh.h:1.2	Fri Oct 14 16:23:18 2016
+++ src/crypto/external/bsd/openssl/dist/crypto/dh/dh.h	Sat Jun 23 10:52:31 2018
@@ -387,6 +387,69 @@ void ERR_load_DH_strings(void);
 # define DH_R_PEER_KEY_ERROR  113
 # define DH_R_SHARED_INFO_ERROR   114
 
+#if OPENSSL_API_COMPAT >= 0x1010L
+static inline void
+DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
+{
+	if (pub_key)
+		*pub_key = dh->pub_key;
+	if (priv_key)
+		*priv_key = dh->priv_key;
+}
+
+static inline int
+DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
+{
+	if (pub_key) {
+		BN_free(dh->pub_key);
+		dh->pub_key = pub_key;
+	}
+	if (priv_key) {
+		BN_free(dh->priv_key);
+		dh->priv_key = priv_key;
+	}
+	return 1;
+}
+
+static inline void
+DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
+const BIGNUM **g)
+{
+	if (p)
+		*p = dh->p;
+	if (q)
+		*q = dh->q;
+	if (g)
+		*g = dh->g;
+}
+
+static inline int
+DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
+{
+	if (p)
+		dh->p = p;
+	if (q)
+		dh->q = q;
+	if (g)
+		dh->g = g;
+	return 1;
+}
+
+static inline void
+DH_set_length(DH *dh, long length)
+{
+	dh->length = length;
+}
+
+static inline const char *
+DH_meth_get0_name(const DH_METHOD *meth)
+{
+	return meth->name;
+}   
+
+
+#endif
+
 #ifdef  __cplusplus
 }
 #endif

Index: src/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h
diff -u src/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h:1.2 src/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h:1.2.6.1
--- src/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h:1.2	Fri Oct 14 16:23:19 2016
+++ src/crypto/external/bsd/openssl/dist/crypto/dsa/dsa.h	Sat Jun 23 10:52:31 2018
@@ -326,6 +326,89 @@ void ERR_load_DSA_strings(void);
 # define DSA_R_PARAMETER_ENCODING_ERROR   105
 # define DSA_R_Q_NOT_PRIME113
 
+#if OPENSSL_API_COMPAT >= 0x1010L
+static inline void
+DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **r, const BIGNUM **s)
+{
+	if (r)
+		*r = sig->r;
+	if (s)
+		*s = sig->s;
+}
+
+static inline int
+DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
+{
+	if (r) {
+		BN_free(r);
+		sig->r = r;
+	}
+	if (s) {
+		

CVS commit: [netbsd-7] src/doc

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 10:44:47 UTC 2018

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

Log Message:
Ticket #1617


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.92 -r1.1.2.93 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.92 src/doc/CHANGES-7.2:1.1.2.93
--- src/doc/CHANGES-7.2:1.1.2.92	Thu Jun 14 19:44:56 2018
+++ src/doc/CHANGES-7.2	Sat Jun 23 10:44:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.92 2018/06/14 19:44:56 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.93 2018/06/23 10:44:47 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5545,3 +5545,9 @@ share/i18n/esdb/ISO-8859/ISO-8859.alias	
 	Add more aliases for Hebrew and Arabic ISO-8859-... encodings.
 	[maya, ticket #1616]
 
+external/gpl3/gcc/dist/libstdc++-v3/include/std/complex 1.2
+
+	Use the c99 cabs math builtins directly, because cabs and cabsf
+	have broken ABI's and cabsl does not exist.
+	[maya, ticket #1617]
+



CVS commit: [netbsd-7] src/external/gpl3/gcc/dist/libstdc++-v3/include/std

2018-06-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 23 10:43:57 UTC 2018

Modified Files:
src/external/gpl3/gcc/dist/libstdc++-v3/include/std [netbsd-7]: complex

Log Message:
Pull up following revision(s) (requested by maya in ticket #1617):

external/gpl3/gcc/dist/libstdc++-v3/include/std/complex: revision 1.2

PR/50646: Use the c99 cabs math builtins directly, because cabs and cabsf
have broken ABI's can cabsl does not exist. The correct(?) probably fix is
to change the cabs builtins to point to the c99 variants directly...

XXX: pullup-7 and the same file from the gcc.old tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.4.1 \
src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex

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

Modified files:

Index: src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex
diff -u src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex:1.1.1.2 src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex:1.1.1.2.4.1
--- src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex:1.1.1.2	Sat Mar  1 08:41:31 2014
+++ src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex	Sat Jun 23 10:43:57 2018
@@ -44,6 +44,16 @@
 #include 
 #include 
 
+#if _GLIBCXX_USE_C99_COMPLEX
+// This is disgusting; we can't include ccomplex because that c++11
+// and we can't use the builtins because those point to the wrong
+// ABI-wise cabs/cabsf so we manually declare those here and use
+// them directly.
+extern "C" float __c99_cabsf(_Complex float);
+extern "C" double __c99_cabs(_Complex double);
+extern "C" long double __c99_cabsl(_Complex long double);
+#endif
+
 // Get rid of a macro possibly defined in 
 #undef complex
 
@@ -580,15 +590,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 }
 
 #if _GLIBCXX_USE_C99_COMPLEX
+  // XXX: We can't use __builtin_cabs* because they are broken
   inline float
-  __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); }
+  __complex_abs(__complex__ float __z) { return __c99_cabsf(__z); }
 
   inline double
-  __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); }
+  __complex_abs(__complex__ double __z) { return __c99_cabs(__z); }
 
   inline long double
   __complex_abs(const __complex__ long double& __z)
-  { return __builtin_cabsl(__z); }
+  { return __c99_cabsl(__z); }
 
   template
 inline _Tp



CVS commit: src/sys/arch

2018-06-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Jun 23 10:30:22 UTC 2018

Modified Files:
src/sys/arch/x86/x86: identcpu.c
src/sys/arch/xen/x86: cpu.c

Log Message:
re-do the XEN XSAVE support, this time to leave all probe code in
cpu_probe_fpu(), and have XEN cpu_init() just act

the xen probe is now guarded by XEN_USE_XSAVE option and XSAVE
support is thus still disabled by default (same as before), so it
wouldn't interfere with maxv's eager fpu rototil, while still
allowing testing for others

PR kern/50332


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/xen/x86/cpu.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/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.76 src/sys/arch/x86/x86/identcpu.c:1.77
--- src/sys/arch/x86/x86/identcpu.c:1.76	Sat Jun 23 10:02:39 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sat Jun 23 10:30:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.76 2018/06/23 10:02:39 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.77 2018/06/23 10:30:22 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.76 2018/06/23 10:02:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.77 2018/06/23 10:30:22 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -795,15 +795,23 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	x86_fpu_save = FPU_SAVE_FXSAVE;
 
-#ifdef XEN
-	/* We don't support XSAVE on Xen. */
-	return;
-#endif
-
 	/* See if xsave (for AVX) is supported */
 	if ((ci->ci_feat_val[1] & CPUID2_XSAVE) == 0)
 		return;
 
+#ifdef XEN
+	/*
+	 * Xen kernel can disable XSAVE via "no-xsave" option, in that case
+	 * XSAVE instructions like xrstor become privileged and trigger
+	 * supervisor trap. OSXSAVE flag seems to be reliably set according
+	 * to whether XSAVE is actually available.
+	 */
+#ifdef XEN_USE_XSAVE
+	if ((ci->ci_feat_val[1] & CPUID2_OSXSAVE) == 0)
+#endif
+		return;
+#endif
+
 	x86_fpu_save = FPU_SAVE_XSAVE;
 
 #if 0 /* XXX PR 52966 */

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.121 src/sys/arch/xen/x86/cpu.c:1.122
--- src/sys/arch/xen/x86/cpu.c:1.121	Sat Jun 23 09:51:34 2018
+++ src/sys/arch/xen/x86/cpu.c	Sat Jun 23 10:30:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.121 2018/06/23 09:51:34 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.122 2018/06/23 10:30:22 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.121 2018/06/23 09:51:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.122 2018/06/23 10:30:22 jdolecek Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -527,24 +527,52 @@ cpu_attach_common(device_t parent, devic
 void
 cpu_init(struct cpu_info *ci)
 {
+	uint32_t cr4 = 0;
 
 	/*
 	 * If we have FXSAVE/FXRESTOR, use them.
 	 */
 	if (cpu_feature[0] & CPUID_FXSR) {
-		lcr4(rcr4() | CR4_OSFXSR);
+		cr4 |= CR4_OSFXSR;
 
 		/*
 		 * If we have SSE/SSE2, enable XMM exceptions.
 		 */
 		if (cpu_feature[0] & (CPUID_SSE|CPUID_SSE2))
-			lcr4(rcr4() | CR4_OSXMMEXCPT);
+			cr4 |= CR4_OSXMMEXCPT;
+	}
+
+	/* If xsave is supported, enable it */
+	if (cpu_feature[1] & CPUID2_XSAVE && x86_fpu_save >= FPU_SAVE_XSAVE)
+		cr4 |= CR4_OSXSAVE;
+
+	if (cr4) {
+		cr4 |= rcr4();
+		lcr4(cr4);
 	}
 
 	if (x86_fpu_save >= FPU_SAVE_FXSAVE) {
 		fpuinit_mxcsr_mask();
 	}
 
+	/*
+	 * Changing CR4 register may change cpuid values. For example, setting
+	 * CR4_OSXSAVE sets CPUID2_OSXSAVE. The CPUID2_OSXSAVE is in
+	 * ci_feat_val[1], so update it.
+	 * XXX Other than ci_feat_val[1] might be changed.
+	 */
+	if (cpuid_level >= 1) {
+		u_int descs[4];
+
+		x86_cpuid(1, descs);
+		ci->ci_feat_val[1] = descs[2];
+	}
+
+	/* If xsave is enabled, enable all fpu features */
+	if (cr4 & CR4_OSXSAVE) {
+		wrxcr(0, x86_xsave_features & XCR0_FPU);
+	}
+
 	atomic_or_32(>ci_flags, CPUF_RUNNING);
 }
 



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

2018-06-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun 23 10:06:02 UTC 2018

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

Log Message:
Add XXX in fpuinit_mxcsr_mask.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x86/x86/fpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.42 src/sys/arch/x86/x86/fpu.c:1.43
--- src/sys/arch/x86/x86/fpu.c:1.42	Fri Jun 22 06:22:37 2018
+++ src/sys/arch/x86/x86/fpu.c	Sat Jun 23 10:06:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.42 2018/06/22 06:22:37 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.43 2018/06/23 10:06:02 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.42 2018/06/22 06:22:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.43 2018/06/23 10:06:02 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -263,6 +263,11 @@ fpuinit_mxcsr_mask(void)
 		x86_fpu_mxcsr_mask = fpusave.sv_xmm.fx_mxcsr_mask;
 	}
 #else
+	/*
+	 * XXX XXX XXX: On Xen the FXSAVE above faults. That's because
+	 *  is not 16-byte aligned. Stack alignment problem
+	 * somewhere, it seems.
+	 */
 	x86_fpu_mxcsr_mask = __INITIAL_MXCSR_MASK__;
 #endif
 }



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

2018-06-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun 23 10:02:39 UTC 2018

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

Log Message:
Reorder the code a little. On Xen, return earlier, we don't need to do
the XSAVE-related initialization if we don't support XSAVE.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/x86/x86/identcpu.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/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.75 src/sys/arch/x86/x86/identcpu.c:1.76
--- src/sys/arch/x86/x86/identcpu.c:1.75	Sat Jun 23 09:51:34 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sat Jun 23 10:02:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.75 2018/06/23 09:51:34 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.76 2018/06/23 10:02:39 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.75 2018/06/23 09:51:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.76 2018/06/23 10:02:39 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -795,6 +795,11 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	x86_fpu_save = FPU_SAVE_FXSAVE;
 
+#ifdef XEN
+	/* We don't support XSAVE on Xen. */
+	return;
+#endif
+
 	/* See if xsave (for AVX) is supported */
 	if ((ci->ci_feat_val[1] & CPUID2_XSAVE) == 0)
 		return;
@@ -802,7 +807,6 @@ cpu_probe_fpu(struct cpu_info *ci)
 	x86_fpu_save = FPU_SAVE_XSAVE;
 
 #if 0 /* XXX PR 52966 */
-	/* xsaveopt ought to be faster than xsave */
 	x86_cpuid2(0xd, 1, descs);
 	if (descs[0] & CPUID_PES1_XSAVEOPT)
 		x86_fpu_save = FPU_SAVE_XSAVEOPT;
@@ -813,12 +817,7 @@ cpu_probe_fpu(struct cpu_info *ci)
 	if (descs[2] > 512)
 		x86_fpu_save_size = descs[2];
 
-#ifdef XEN
-	/* Don't use xsave, force fxsave with x86_xsave_features = 0. */
-	x86_fpu_save = FPU_SAVE_FXSAVE;
-#else
 	x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
-#endif
 }
 
 void



CVS commit: src/sys/arch

2018-06-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun 23 09:51:34 UTC 2018

Modified Files:
src/sys/arch/x86/x86: identcpu.c
src/sys/arch/xen/x86: cpu.c

Log Message:
Revert the rest of jdolecek's changes. This puts us back in a clean,
sensical state.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/xen/x86/cpu.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/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.74 src/sys/arch/x86/x86/identcpu.c:1.75
--- src/sys/arch/x86/x86/identcpu.c:1.74	Fri Jun 22 23:00:54 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sat Jun 23 09:51:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.74 2018/06/22 23:00:54 christos Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.75 2018/06/23 09:51:34 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.74 2018/06/22 23:00:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.75 2018/06/23 09:51:34 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -813,7 +813,12 @@ cpu_probe_fpu(struct cpu_info *ci)
 	if (descs[2] > 512)
 		x86_fpu_save_size = descs[2];
 
+#ifdef XEN
+	/* Don't use xsave, force fxsave with x86_xsave_features = 0. */
+	x86_fpu_save = FPU_SAVE_FXSAVE;
+#else
 	x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
+#endif
 }
 
 void

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.120 src/sys/arch/xen/x86/cpu.c:1.121
--- src/sys/arch/xen/x86/cpu.c:1.120	Fri Jun 22 06:22:37 2018
+++ src/sys/arch/xen/x86/cpu.c	Sat Jun 23 09:51:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.120 2018/06/22 06:22:37 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.121 2018/06/23 09:51:34 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.120 2018/06/22 06:22:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.121 2018/06/23 09:51:34 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -527,64 +527,24 @@ cpu_attach_common(device_t parent, devic
 void
 cpu_init(struct cpu_info *ci)
 {
-	uint32_t cr4 = 0;
 
 	/*
 	 * If we have FXSAVE/FXRESTOR, use them.
 	 */
 	if (cpu_feature[0] & CPUID_FXSR) {
-		cr4 |= CR4_OSFXSR;
+		lcr4(rcr4() | CR4_OSFXSR);
 
 		/*
 		 * If we have SSE/SSE2, enable XMM exceptions.
 		 */
 		if (cpu_feature[0] & (CPUID_SSE|CPUID_SSE2))
-			cr4 |= CR4_OSXMMEXCPT;
-	}
-
-	/*
-	 * Xen kernel sets OSXSAVE if appropriate for the hardware,
-	 * or disables it with no-xsave flag or due to security bugs with
-	 * particular CPUs.
-	 * If it's unset, it also means the xrstor() et.al. are privileged
-	 * and trigger supervisor trap. So, contrary to what regular x86
-	 * does, here we only set CR4_OSXSAVE if the feature is already
-	 * enabled according to CPUID.
-	 */
-	if (cpu_feature[1] & CPUID2_OSXSAVE)
-		cr4 |= CR4_OSXSAVE;
-	else {
-		x86_xsave_features = 0;
-		x86_fpu_save = FPU_SAVE_FXSAVE;
-	}
-
-	if (cr4) {
-		cr4 |= rcr4();
-		lcr4(cr4);
+			lcr4(rcr4() | CR4_OSXMMEXCPT);
 	}
 
 	if (x86_fpu_save >= FPU_SAVE_FXSAVE) {
 		fpuinit_mxcsr_mask();
 	}
 
-	/*
-	 * Changing CR4 register may change cpuid values. For example, setting
-	 * CR4_OSXSAVE sets CPUID2_OSXSAVE. The CPUID2_OSXSAVE is in
-	 * ci_feat_val[1], so update it.
-	 * XXX Other than ci_feat_val[1] might be changed.
-	 */
-	if (cpuid_level >= 1) {
-		u_int descs[4];
-
-		x86_cpuid(1, descs);
-		ci->ci_feat_val[1] = descs[2];
-	}
-
-	/* If xsave is enabled, enable all fpu features */
-	if (cr4 & CR4_OSXSAVE) {
-		wrxcr(0, x86_xsave_features & XCR0_FPU);
-	}
-
 	atomic_or_32(>ci_flags, CPUF_RUNNING);
 }
 



CVS commit: src/sys/sys

2018-06-23 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Jun 23 07:23:06 UTC 2018

Modified Files:
src/sys/sys: ipc.h

Log Message:
No semicolon after macro do ... while (0) wrapper.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/ipc.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/sys/ipc.h
diff -u src/sys/sys/ipc.h:1.36 src/sys/sys/ipc.h:1.37
--- src/sys/sys/ipc.h:1.36	Tue May 19 12:17:53 2015
+++ src/sys/sys/ipc.h	Sat Jun 23 07:23:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipc.h,v 1.36 2015/05/19 12:17:53 joerg Exp $	*/
+/*	$NetBSD: ipc.h,v 1.37 2018/06/23 07:23:06 gson Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -131,7 +131,7 @@ __END_DECLS
 	(dst).cgid = (src).cgid; \
 	(dst).mode = (src).mode; \
 	(dst)._seq = (src)._seq; \
-} while (/*CONSTCOND*/ 0);
+} while (/*CONSTCOND*/ 0)
 
 /*
  * Set-up the sysctl routine for COMPAT_50



CVS commit: src/libexec/ftpd

2018-06-23 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Jun 23 07:21:00 UTC 2018

Modified Files:
src/libexec/ftpd: extern.h

Log Message:
No semicolon after macro do ... while (0) wrapper.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/libexec/ftpd/extern.h

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

Modified files:

Index: src/libexec/ftpd/extern.h
diff -u src/libexec/ftpd/extern.h:1.63 src/libexec/ftpd/extern.h:1.64
--- src/libexec/ftpd/extern.h:1.63	Thu Mar 21 05:53:01 2013
+++ src/libexec/ftpd/extern.h	Sat Jun 23 07:21:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.63 2013/03/21 05:53:01 lukem Exp $	*/
+/*	$NetBSD: extern.h,v 1.64 2018/06/23 07:21:00 gson Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -358,7 +358,7 @@ extern	struct tab	cmdtab[];
 
 #define	CPUTC(c, f)	do { \
 putc(c, f); total_bytes++; total_bytes_out++; \
-			} while (0);
+			} while (0)
 
 #define CURCLASSTYPE	curclass.type == CLASS_GUEST  ? "GUEST"  : \
 			curclass.type == CLASS_CHROOT ? "CHROOT" : \



CVS commit: src/sys/dev

2018-06-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun 23 06:57:24 UTC 2018

Modified Files:
src/sys/dev/isa: gus.c
src/sys/dev/pci: if_ep_pci.c
src/sys/dev/usb: if_atu.c

Log Message:
constify


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/isa/gus.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_ep_pci.c
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/if_atu.c

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

Modified files:

Index: src/sys/dev/isa/gus.c
diff -u src/sys/dev/isa/gus.c:1.112 src/sys/dev/isa/gus.c:1.113
--- src/sys/dev/isa/gus.c:1.112	Tue Oct 31 21:53:48 2017
+++ src/sys/dev/isa/gus.c	Sat Jun 23 06:57:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gus.c,v 1.112 2017/10/31 21:53:48 nat Exp $	*/
+/*	$NetBSD: gus.c,v 1.113 2018/06/23 06:57:24 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1999, 2008 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.112 2017/10/31 21:53:48 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.113 2018/06/23 06:57:24 maxv Exp $");
 
 #include 
 #include 
@@ -3239,7 +3239,7 @@ gus_halt_in_dma(void *addr)
 }
 
 
-static ad1848_devmap_t gusmapping[] = {
+static const ad1848_devmap_t gusmapping[] = {
 	{ GUSMAX_DAC_LVL, AD1848_KIND_LVL, AD1848_AUX1_CHANNEL },
 	{ GUSMAX_LINE_IN_LVL, AD1848_KIND_LVL, AD1848_LINE_CHANNEL },
 	{ GUSMAX_MONO_LVL, AD1848_KIND_LVL, AD1848_MONO_CHANNEL },
@@ -3255,7 +3255,7 @@ static ad1848_devmap_t gusmapping[] = {
 	{ GUSMAX_RECORD_SOURCE, AD1848_KIND_RECORDSOURCE, -1 }
 };
 
-static int nummap = sizeof(gusmapping) / sizeof(gusmapping[0]);
+static const int nummap = sizeof(gusmapping) / sizeof(gusmapping[0]);
 
 STATIC int
 gusmax_mixer_get_port(void *addr, mixer_ctrl_t *cp)

Index: src/sys/dev/pci/if_ep_pci.c
diff -u src/sys/dev/pci/if_ep_pci.c:1.53 src/sys/dev/pci/if_ep_pci.c:1.54
--- src/sys/dev/pci/if_ep_pci.c:1.53	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_ep_pci.c	Sat Jun 23 06:57:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ep_pci.c,v 1.53 2014/03/29 19:28:24 christos Exp $	*/
+/*	$NetBSD: if_ep_pci.c,v 1.54 2018/06/23 06:57:24 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ep_pci.c,v 1.53 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ep_pci.c,v 1.54 2018/06/23 06:57:24 maxv Exp $");
 
 #include 
 #include 
@@ -103,7 +103,7 @@ static void	ep_pci_attach(device_t , dev
 CFATTACH_DECL_NEW(ep_pci, sizeof(struct ep_softc),
 ep_pci_match, ep_pci_attach, NULL, NULL);
 
-static struct ep_pci_product {
+static const struct ep_pci_product {
 	u_int32_t	epp_prodid;	/* PCI product ID */
 	u_short		epp_chipset;	/* 3Com chipset used */
 	int		epp_flags;	/* initial softc flags */
@@ -149,7 +149,7 @@ static struct ep_pci_product {
 static const struct ep_pci_product *
 ep_pci_lookup(const struct pci_attach_args *pa)
 {
-	struct ep_pci_product *epp;
+	const struct ep_pci_product *epp;
 
 	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_3COM)
 		return (NULL);

Index: src/sys/dev/usb/if_atu.c
diff -u src/sys/dev/usb/if_atu.c:1.59 src/sys/dev/usb/if_atu.c:1.60
--- src/sys/dev/usb/if_atu.c:1.59	Fri Jun 22 04:17:42 2018
+++ src/sys/dev/usb/if_atu.c	Sat Jun 23 06:57:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_atu.c,v 1.59 2018/06/22 04:17:42 msaitoh Exp $ */
+/*	$NetBSD: if_atu.c,v 1.60 2018/06/23 06:57:24 maxv Exp $ */
 /*	$OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
 /*
  * Copyright (c) 2003, 2004
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.59 2018/06/22 04:17:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.60 2018/06/23 06:57:24 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -209,7 +209,7 @@ static const struct atu_type atu_devs[] 
 	  RadioIntersil,	ATU_NO_QUIRK },
 };
 
-struct atu_radfirm {
+static const struct atu_radfirm {
 	enum	atu_radio_type atur_type;
 	unsigned char	*atur_internal;
 	size_t		atur_internal_sz;



CVS commit: src/sys/dev/pci

2018-06-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun 23 06:45:51 UTC 2018

Modified Files:
src/sys/dev/pci: ahd_pci.c auacer.c siside.c

Log Message:
constify


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pci/ahd_pci.c src/sys/dev/pci/siside.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/auacer.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/ahd_pci.c
diff -u src/sys/dev/pci/ahd_pci.c:1.36 src/sys/dev/pci/ahd_pci.c:1.37
--- src/sys/dev/pci/ahd_pci.c:1.36	Mon Jan 15 12:43:42 2018
+++ src/sys/dev/pci/ahd_pci.c	Sat Jun 23 06:45:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahd_pci.c,v 1.36 2018/01/15 12:43:42 maya Exp $	*/
+/*	$NetBSD: ahd_pci.c,v 1.37 2018/06/23 06:45:51 maxv Exp $	*/
 
 /*
  * Product specific probe and attach routines for:
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.36 2018/01/15 12:43:42 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.37 2018/06/23 06:45:51 maxv Exp $");
 
 #define AHD_PCI_IOADDR	PCI_MAPREG_START	/* I/O Address */
 #define AHD_PCI_MEMADDR	(PCI_MAPREG_START + 4)	/* Mem I/O Address */
@@ -129,7 +129,7 @@ static ahd_device_setup_t ahd_aic7901A_s
 static ahd_device_setup_t ahd_aic7902_setup;
 static ahd_device_setup_t ahd_aic790X_setup;
 
-static struct ahd_pci_identity ahd_pci_ident_table [] =
+static const struct ahd_pci_identity ahd_pci_ident_table[] =
 {
 	/* aic7901 based controllers */
 	{
Index: src/sys/dev/pci/siside.c
diff -u src/sys/dev/pci/siside.c:1.36 src/sys/dev/pci/siside.c:1.37
--- src/sys/dev/pci/siside.c:1.36	Sat May 31 16:25:29 2014
+++ src/sys/dev/pci/siside.c	Sat Jun 23 06:45:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: siside.c,v 1.36 2014/05/31 16:25:29 christos Exp $	*/
+/*	$NetBSD: siside.c,v 1.37 2018/06/23 06:45:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.36 2014/05/31 16:25:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.37 2018/06/23 06:45:51 maxv Exp $");
 
 #include 
 #include 
@@ -112,7 +112,7 @@ siside_attach(device_t parent, device_t 
 	}
 }
 
-static struct sis_hostbr_type {
+static const struct sis_hostbr_type {
 	u_int16_t id;
 	u_int8_t rev;
 	u_int8_t udma_mode;
@@ -175,7 +175,7 @@ static struct sis_hostbr_type {
 	{PCI_PRODUCT_SIS_965,   0x00, 6, "965", SIS_TYPE_133NEW},
 };
 
-static struct sis_hostbr_type *sis_hostbr_type_match;
+static const struct sis_hostbr_type *sis_hostbr_type_match;
 
 static int
 sis_hostbr_match(const struct pci_attach_args *pa)

Index: src/sys/dev/pci/auacer.c
diff -u src/sys/dev/pci/auacer.c:1.33 src/sys/dev/pci/auacer.c:1.34
--- src/sys/dev/pci/auacer.c:1.33	Thu Jun  1 02:45:10 2017
+++ src/sys/dev/pci/auacer.c	Sat Jun 23 06:45:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: auacer.c,v 1.33 2017/06/01 02:45:10 chs Exp $	*/
+/*	$NetBSD: auacer.c,v 1.34 2018/06/23 06:45:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2008 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.33 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.34 2018/06/23 06:45:51 maxv Exp $");
 
 #include 
 #include 
@@ -189,7 +189,7 @@ static int	auacer_set_rate(struct auacer
 
 static void auacer_reset(struct auacer_softc *sc);
 
-static struct audio_hw_if auacer_hw_if = {
+static const struct audio_hw_if auacer_hw_if = {
 	NULL,			/* open */
 	NULL,			/* close */
 	NULL,			/* drain */



CVS commit: src/sys/dev/ic

2018-06-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun 23 06:40:43 UTC 2018

Modified Files:
src/sys/dev/ic: awi.c elinkxl.c rt2860.c wi.c

Log Message:
constify


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/ic/awi.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/ic/elinkxl.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/rt2860.c
cvs rdiff -u -r1.245 -r1.246 src/sys/dev/ic/wi.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/ic/awi.c
diff -u src/sys/dev/ic/awi.c:1.92 src/sys/dev/ic/awi.c:1.93
--- src/sys/dev/ic/awi.c:1.92	Tue May 23 02:19:14 2017
+++ src/sys/dev/ic/awi.c	Sat Jun 23 06:40:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: awi.c,v 1.92 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: awi.c,v 1.93 2018/06/23 06:40:43 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.92 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.93 2018/06/23 06:40:43 maxv Exp $");
 
 #include "opt_inet.h"
 
@@ -159,7 +159,7 @@ static struct mbuf *awi_ether_modcap(str
 	 (((u_int8_t *)(p))[2] = (((u_int32_t)(v) >> 16) & 0xff)),	\
 	 (((u_int8_t *)(p))[3] = (((u_int32_t)(v) >> 24) & 0xff)))
 
-struct awi_chanset awi_chanset[] = {
+static const struct awi_chanset awi_chanset[] = {
 /* PHY typedomainmin max def */
 { AWI_PHY_TYPE_FH, AWI_REG_DOMAIN_JP,  6, 17,  6 },
 { AWI_PHY_TYPE_FH, AWI_REG_DOMAIN_ES,  0, 26,  1 },
@@ -1358,7 +1358,7 @@ awi_init_mibs(struct awi_softc *sc)
 {
 	int chan, i, error;
 	struct ieee80211com *ic = >sc_ic;
-	struct awi_chanset *cs;
+	const struct awi_chanset *cs;
 
 	if ((error = awi_mib(sc, AWI_CMD_GET_MIB, AWI_MIB_LOCAL, AWI_WAIT)) ||
 	(error = awi_mib(sc, AWI_CMD_GET_MIB, AWI_MIB_ADDR, AWI_WAIT)) ||

Index: src/sys/dev/ic/elinkxl.c
diff -u src/sys/dev/ic/elinkxl.c:1.122 src/sys/dev/ic/elinkxl.c:1.123
--- src/sys/dev/ic/elinkxl.c:1.122	Fri Jun 22 04:17:42 2018
+++ src/sys/dev/ic/elinkxl.c	Sat Jun 23 06:40:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: elinkxl.c,v 1.122 2018/06/22 04:17:42 msaitoh Exp $	*/
+/*	$NetBSD: elinkxl.c,v 1.123 2018/06/23 06:40:43 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.122 2018/06/22 04:17:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.123 2018/06/23 06:40:43 maxv Exp $");
 
 #include 
 #include 
@@ -119,7 +119,7 @@ struct ex_media {
  * Media table for 3c90x chips.  Note that chips with MII have no
  * `native' media.
  */
-struct ex_media ex_native_media[] = {
+static const struct ex_media ex_native_media[] = {
 	{ ELINK_PCI_10BASE_T,	"10baseT",	IFM_ETHER|IFM_10_T,
 	  ELINKMEDIA_10BASE_T },
 	{ ELINK_PCI_10BASE_T,	"10baseT-FDX",	IFM_ETHER|IFM_10_T|IFM_FDX,
@@ -523,7 +523,7 @@ ex_probemedia(struct ex_softc *sc)
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
 	struct ifmedia *ifm = >ex_mii.mii_media;
-	struct ex_media *exm;
+	const struct ex_media *exm;
 	uint16_t config1, reset_options, default_media;
 	int defmedia = 0;
 	const char *sep = "", *defmedianame = NULL;

Index: src/sys/dev/ic/rt2860.c
diff -u src/sys/dev/ic/rt2860.c:1.30 src/sys/dev/ic/rt2860.c:1.31
--- src/sys/dev/ic/rt2860.c:1.30	Sun Jan 14 18:23:03 2018
+++ src/sys/dev/ic/rt2860.c	Sat Jun 23 06:40:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2860.c,v 1.30 2018/01/14 18:23:03 maxv Exp $	*/
+/*	$NetBSD: rt2860.c,v 1.31 2018/06/23 06:40:43 maxv Exp $	*/
 /*	$OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $	*/
 /*	$FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
 
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.30 2018/01/14 18:23:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.31 2018/06/23 06:40:43 maxv Exp $");
 
 #include 
 #include 
@@ -196,7 +196,7 @@ static const struct rfprog {
 	RT2860_RF2850
 };
 
-struct {
+static const struct {
 	uint8_t	n, r, k;
 } rt3090_freqs[] = {
 	RT3070_RF3052

Index: src/sys/dev/ic/wi.c
diff -u src/sys/dev/ic/wi.c:1.245 src/sys/dev/ic/wi.c:1.246
--- src/sys/dev/ic/wi.c:1.245	Fri Jun 22 04:17:42 2018
+++ src/sys/dev/ic/wi.c	Sat Jun 23 06:40:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wi.c,v 1.245 2018/06/22 04:17:42 msaitoh Exp $	*/
+/*	$NetBSD: wi.c,v 1.246 2018/06/23 06:40:43 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.245 2018/06/22 04:17:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.246 2018/06/23 06:40:43 maxv Exp $");
 
 #define WI_HERMES_AUTOINC_WAR	/* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR	/* Work around stats counter bug. */
@@ -243,8 +243,7 @@ static int wi_sysctl_verify_debug(SYSCTL
 #define WI_INTRS	(WI_EV_RX | WI_EV_ALLOC |