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

2018-03-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 31 04:23:34 UTC 2018

Modified Files:
src/sys/arch/atari/conf: HADES

Log Message:
Regen from HADES.in rev 1.16:

> Remove duplicated devices already defined in the common GENERIC.in.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/atari/conf/HADES

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/atari/conf/HADES
diff -u src/sys/arch/atari/conf/HADES:1.113 src/sys/arch/atari/conf/HADES:1.114
--- src/sys/arch/atari/conf/HADES:1.113	Sat Mar 31 04:17:27 2018
+++ src/sys/arch/atari/conf/HADES	Sat Mar 31 04:23:33 2018
@@ -1,11 +1,11 @@
 #
-# $NetBSD: HADES,v 1.113 2018/03/31 04:17:27 tsutsui Exp $
+# $NetBSD: HADES,v 1.114 2018/03/31 04:23:33 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: HADES.in,v 1.15 2016/12/13 20:42:16 christos Exp $
+#		NetBSD: HADES.in,v 1.16 2018/03/31 04:19:41 tsutsui Exp $
 #		NetBSD: GENERIC.in,v 1.115 2018/01/23 14:47:54 sevan Exp $
 include "arch/atari/conf/std.hades"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -115,7 +115,3 @@ ss* at scsibus? target ? lun ? # SCSI sc
 se* at scsibus? target ? lun ? # SCSI ethernet
 uk* at scsibus? target ? lun ? # SCSI unknown
 ne0 at isa0 port 0x300 irq 5 # NE2000 ethernet
-ep* at pci0 dev ? function 0 # 3Com 3c59x/3c90x Ethernet
-eso* at pci? dev ? function ? # ESS Solo-1 PCI AudioDrive
-audio* at eso?
-spkr* at audio? # PC speaker (synthesized)



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

2018-03-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 31 04:19:41 UTC 2018

Modified Files:
src/sys/arch/atari/conf: HADES.in

Log Message:
Remove duplicated devices already defined in the common GENERIC.in.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/conf/HADES.in

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/atari/conf/HADES.in
diff -u src/sys/arch/atari/conf/HADES.in:1.15 src/sys/arch/atari/conf/HADES.in:1.16
--- src/sys/arch/atari/conf/HADES.in:1.15	Tue Dec 13 20:42:16 2016
+++ src/sys/arch/atari/conf/HADES.in	Sat Mar 31 04:19:41 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: HADES.in,v 1.15 2016/12/13 20:42:16 christos Exp $
+#	$NetBSD: HADES.in,v 1.16 2018/03/31 04:19:41 tsutsui Exp $
 #
 # Medusa-Hades
 #
@@ -64,12 +64,5 @@ uk* 	at scsibus? target ? lun ?	# SCSI u
 #if !defined(SMALL030_KERNEL)
 # Networking...
 ne0	at isa0 port 0x300 irq 5	# NE2000 ethernet
-ep*	at pci0 dev ? function 0	# 3Com 3c59x/3c90x Ethernet
-
-# Sound...
-eso*	at pci? dev ? function ?	# ESS Solo-1 PCI AudioDrive
-audio*	at eso?
-
-spkr*	at audio?		# PC speaker (synthesized)
 
 #endif /* SMALL030_KERNEL */



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

2018-03-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 31 04:17:27 UTC 2018

Modified Files:
src/sys/arch/atari/conf: ATARITT FALCON HADES MILAN-ISAIDE MILAN-PCIIDE
SMALL030

Log Message:
Regen to denote GENERIC.in rev 1.115 in "Created from:" lines.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/atari/conf/SMALL030

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/atari/conf/ATARITT
diff -u src/sys/arch/atari/conf/ATARITT:1.118 src/sys/arch/atari/conf/ATARITT:1.119
--- src/sys/arch/atari/conf/ATARITT:1.118	Sat Jan 20 16:30:57 2018
+++ src/sys/arch/atari/conf/ATARITT	Sat Mar 31 04:17:27 2018
@@ -1,11 +1,11 @@
 #
-# $NetBSD: ATARITT,v 1.118 2018/01/20 16:30:57 tsutsui Exp $
+# $NetBSD: ATARITT,v 1.119 2018/03/31 04:17:27 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
+#		NetBSD: GENERIC.in,v 1.115 2018/01/23 14:47:54 sevan Exp $
 include "arch/atari/conf/std.atari"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/FALCON
diff -u src/sys/arch/atari/conf/FALCON:1.115 src/sys/arch/atari/conf/FALCON:1.116
--- src/sys/arch/atari/conf/FALCON:1.115	Sat Jan 20 16:30:57 2018
+++ src/sys/arch/atari/conf/FALCON	Sat Mar 31 04:17:27 2018
@@ -1,11 +1,11 @@
 #
-# $NetBSD: FALCON,v 1.115 2018/01/20 16:30:57 tsutsui Exp $
+# $NetBSD: FALCON,v 1.116 2018/03/31 04:17:27 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
+#		NetBSD: GENERIC.in,v 1.115 2018/01/23 14:47:54 sevan Exp $
 include "arch/atari/conf/std.atari"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/HADES
diff -u src/sys/arch/atari/conf/HADES:1.112 src/sys/arch/atari/conf/HADES:1.113
--- src/sys/arch/atari/conf/HADES:1.112	Sat Jan 20 16:30:57 2018
+++ src/sys/arch/atari/conf/HADES	Sat Mar 31 04:17:27 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: HADES,v 1.112 2018/01/20 16:30:57 tsutsui Exp $
+# $NetBSD: HADES,v 1.113 2018/03/31 04:17:27 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
 #		NetBSD: HADES.in,v 1.15 2016/12/13 20:42:16 christos Exp $
-#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
+#		NetBSD: GENERIC.in,v 1.115 2018/01/23 14:47:54 sevan Exp $
 include "arch/atari/conf/std.hades"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.90 src/sys/arch/atari/conf/MILAN-ISAIDE:1.91
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.90	Sat Jan 20 19:26:38 2018
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Sat Mar 31 04:17:27 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.90 2018/01/20 19:26:38 tsutsui Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.91 2018/03/31 04:17:27 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
 #		NetBSD: MILAN.in,v 1.28 2018/01/20 19:24:27 tsutsui Exp $
-#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
+#		NetBSD: GENERIC.in,v 1.115 2018/01/23 14:47:54 sevan Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.94 src/sys/arch/atari/conf/MILAN-PCIIDE:1.95
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.94	Sat Jan 20 19:26:38 2018
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Sat Mar 31 04:17:27 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.94 2018/01/20 19:26:38 tsutsui Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.95 2018/03/31 04:17:27 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
 #		NetBSD: MILAN.in,v 1.28 2018/01/20 19:24:27 tsutsui Exp $
-#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
+#		NetBSD: GENERIC.in,v 1.115 2018/01/23 14:47:54 sevan Exp $
 include 

CVS commit: [pgoyette-compat] src/sys

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 31 01:20:44 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_60_mod.c kern_cpu_60.c
src/sys/modules/compat_60 [pgoyette-compat]: Makefile

Log Message:
Re-enable inclusion of CPU_UCODE for i386/amd64.  Even though it won't
build correctly on XEN (won't use the XEN ABI), it works fine on real
hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/compat/common/compat_60_mod.c
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/compat/common/kern_cpu_60.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/modules/compat_60/Makefile

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

Modified files:

Index: src/sys/compat/common/compat_60_mod.c
diff -u src/sys/compat/common/compat_60_mod.c:1.1.2.14 src/sys/compat/common/compat_60_mod.c:1.1.2.15
--- src/sys/compat/common/compat_60_mod.c:1.1.2.14	Mon Mar 26 10:49:45 2018
+++ src/sys/compat/common/compat_60_mod.c	Sat Mar 31 01:20:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_60_mod.c,v 1.1.2.14 2018/03/26 10:49:45 pgoyette Exp $	*/
+/*	$NetBSD: compat_60_mod.c,v 1.1.2.15 2018/03/31 01:20:44 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.14 2018/03/26 10:49:45 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.15 2018/03/31 01:20:44 pgoyette Exp $");
 
 #include 
 #include 
@@ -78,11 +78,9 @@ compat_60_fini(void)
 {
 	int error = 0;
 
-#ifdef NOTYET
 #ifdef CPU_UCODE
 	kern_cpu_60_fini();
 #endif
-#endif
 	ccd_60_fini();
 	kern_tty_60_fini();
 
@@ -91,11 +89,9 @@ compat_60_fini(void)
 	if (error != 0) {
 		kern_tty_60_init();
 		ccd_60_init();
-#ifdef NOTYET
 #ifdef CPU_UCODE
 		kern_cpu_60_init();
 #endif
-#endif
 		return error;
 	}
 
@@ -104,11 +100,9 @@ compat_60_fini(void)
 		kern_sa_60_init();
 		kern_tty_60_init();
 		ccd_60_init();
-#ifdef NOTYET
 #ifdef CPU_UCODE
 		kern_cpu_60_init();
 #endif
-#endif
 		return error;
 	}
 

Index: src/sys/compat/common/kern_cpu_60.c
diff -u src/sys/compat/common/kern_cpu_60.c:1.1.2.5 src/sys/compat/common/kern_cpu_60.c:1.1.2.6
--- src/sys/compat/common/kern_cpu_60.c:1.1.2.5	Sun Mar 18 23:34:25 2018
+++ src/sys/compat/common/kern_cpu_60.c	Sat Mar 31 01:20:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu_60.c,v 1.1.2.5 2018/03/18 23:34:25 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu_60.c,v 1.1.2.6 2018/03/31 01:20:44 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.5 2018/03/18 23:34:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.6 2018/03/31 01:20:44 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_cpu_ucode.h"
@@ -50,9 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.
 static int
 compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
 {
-#if defined(CPU_UCODE) && defined(COMPAT_60)
-	int error;
-#endif
 
 	switch (cmd) {
 #if defined(CPU_UCODE) && defined(COMPAT_60)
@@ -60,11 +57,15 @@ compat6_cpuctl_ioctl(struct lwp *l, u_lo
 		return compat6_cpu_ucode_get_version(data);
 
 	case OIOC_CPU_UCODE_APPLY:
+	{
+		int error;
+
 		error = kauth_authorize_machdep(l->l_cred,
 		KAUTH_MACHDEP_CPU_UCODE_APPLY, NULL, NULL, NULL, NULL);
 		if (error)
 			return error;
 		return compat6_cpu_ucode_apply(data);
+	}
 #endif
  	default:
 		return ENOTTY;

Index: src/sys/modules/compat_60/Makefile
diff -u src/sys/modules/compat_60/Makefile:1.1.2.12 src/sys/modules/compat_60/Makefile:1.1.2.13
--- src/sys/modules/compat_60/Makefile:1.1.2.12	Mon Mar 26 10:49:45 2018
+++ src/sys/modules/compat_60/Makefile	Sat Mar 31 01:20:44 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1.2.12 2018/03/26 10:49:45 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.1.2.13 2018/03/31 01:20:44 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -11,13 +11,11 @@ CPPFLAGS+=	-DCOMPAT_60 -DCOMPAT_70 -DCOM
 SRCS+=	compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c ccd_60.c \
 	kern_cpu_60.c
 
-.if NOTYET
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
 CPPFLAGS+=	-DCPU_UCODE
 
 .PATH:	${S}/arch/x86/x86
 SRCS+=	compat_60_cpu_ucode.c
 .endif
-.endif
 
 .include 



CVS commit: [pgoyette-compat] src

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 23:58:00 UTC 2018

Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi
src/sys/compat/common [pgoyette-compat]: compat_30_mod.c compat_util.c
src/sys/modules [pgoyette-compat]: Makefile
Added Files:
src/sys/modules/compat_util [pgoyette-compat]: Makefile

Log Message:
Create the compat_util module for use by version-specific compat code.
(It's automatically included in the monolithic compat module, as well
as in kernels with built-in compat code.)


To generate a diff of this commit:
cvs rdiff -u -r1.114.2.12 -r1.114.2.13 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/compat/common/compat_30_mod.c
cvs rdiff -u -r1.46.18.1 -r1.46.18.2 src/sys/compat/common/compat_util.c
cvs rdiff -u -r1.202.2.16 -r1.202.2.17 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_util/Makefile

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/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.114.2.12 src/distrib/sets/lists/modules/mi:1.114.2.13
--- src/distrib/sets/lists/modules/mi:1.114.2.12	Fri Mar 30 11:18:34 2018
+++ src/distrib/sets/lists/modules/mi	Fri Mar 30 23:57:59 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.12 2018/03/30 11:18:34 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.13 2018/03/30 23:57:59 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/compatbase-kernel-modules	kmod
 ./@MODULEDIR@/compat/compat.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/compat_util			base-kernel-modules	kmod
+./@MODULEDIR@/compat_util/compat_util.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/compat_13base-kernel-modules	kmod
 ./@MODULEDIR@/compat_13/compat_13.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_14base-kernel-modules	kmod

Index: src/sys/compat/common/compat_30_mod.c
diff -u src/sys/compat/common/compat_30_mod.c:1.1.2.3 src/sys/compat/common/compat_30_mod.c:1.1.2.4
--- src/sys/compat/common/compat_30_mod.c:1.1.2.3	Thu Mar 29 11:20:02 2018
+++ src/sys/compat/common/compat_30_mod.c	Fri Mar 30 23:57:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_30_mod.c,v 1.1.2.3 2018/03/29 11:20:02 pgoyette Exp $	*/
+/*	$NetBSD: compat_30_mod.c,v 1.1.2.4 2018/03/30 23:57:59 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.1.2.3 2018/03/29 11:20:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.1.2.4 2018/03/30 23:57:59 pgoyette Exp $");
 
 #include 
 #include 
@@ -100,7 +100,7 @@ compat_30_fini(void)
 
 #ifdef _MODULE
 
-#define REQD_30	"compat_80,compat_70,compat_60,compat_50,compat_40"
+#define REQD_30	"compat_util,compat_80,compat_70,compat_60,compat_50,compat_40"
 
 MODULE(MODULE_CLASS_EXEC, compat_30, REQD_30);
 

Index: src/sys/compat/common/compat_util.c
diff -u src/sys/compat/common/compat_util.c:1.46.18.1 src/sys/compat/common/compat_util.c:1.46.18.2
--- src/sys/compat/common/compat_util.c:1.46.18.1	Tue Mar  6 10:37:41 2018
+++ src/sys/compat/common/compat_util.c	Fri Mar 30 23:57:59 2018
@@ -1,4 +1,4 @@
-/* 	$NetBSD: compat_util.c,v 1.46.18.1 2018/03/06 10:37:41 pgoyette Exp $	*/
+/* 	$NetBSD: compat_util.c,v 1.46.18.2 2018/03/30 23:57:59 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_util.c,v 1.46.18.1 2018/03/06 10:37:41 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_util.c,v 1.46.18.2 2018/03/30 23:57:59 pgoyette Exp $");
 
 #include 
 #include 
@@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: compat_util.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -155,3 +156,21 @@ compat_elf_check_interp(struct exec_pack
 	}
 	return error;
 }
+
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_MISC, compat_util, NULL);
+
+int
+compat_util_modcmd(modcmd_t cmd, void *arg)
+{
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+	case MODULE_CMD_FINI:
+		return 0;
+	default:
+		return ENOTTY;
+	}
+}
+#endif	/* _MODULE */

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.202.2.16 src/sys/modules/Makefile:1.202.2.17
--- src/sys/modules/Makefile:1.202.2.16	Fri Mar 30 11:18:34 2018
+++ src/sys/modules/Makefile	Fri Mar 30 23:58:00 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.202.2.16 2018/03/30 11:18:34 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.202.2.17 2018/03/30 23:58:00 pgoyette Exp $
 
 .include 
 
@@ -6,9 +6,10 @@
 
 # Modules for compatability with earlier versions of NetBSD
 
-SUBDIR+=	compatcompat_80 compat_70 compat_60 compat_50
-SUBDIR+=	compat_40 compat_30 compat_20 compat_16 compat_14
-SUBDIR+=	compat_13 #compat_12 compat_10 compat_09
+SUBDIR+=	compat  

CVS commit: [pgoyette-compat] src/sys/net

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 23:56:18 UTC 2018

Modified Files:
src/sys/net [pgoyette-compat]: if_spppsubr.c

Log Message:
Import fixes from HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.179.2.1 -r1.179.2.2 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.179.2.1 src/sys/net/if_spppsubr.c:1.179.2.2
--- src/sys/net/if_spppsubr.c:1.179.2.1	Wed Mar 21 10:12:49 2018
+++ src/sys/net/if_spppsubr.c	Fri Mar 30 23:56:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.179.2.1 2018/03/21 10:12:49 pgoyette Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.179.2.2 2018/03/30 23:56:18 pgoyette Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179.2.1 2018/03/21 10:12:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179.2.2 2018/03/30 23:56:18 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2275,6 +2275,7 @@ sppp_lcp_down(struct sppp *sp)
 			"%s: Down event (carrier loss)\n",
 			ifp->if_xname);
 	}
+	sp->fail_counter[IDX_LCP] = 0;
 	sp->pp_flags &= ~PP_CALLIN;
 	if (sp->state[IDX_LCP] != STATE_INITIAL)
 		lcp.Close(sp);



CVS commit: [pgoyette-compat] src/sys/kern

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 23:49:42 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
Use an SLIST-based stack rather than a statically-allocated array for
recursion control.  This eliminates the MAXDEPTH constraint.

XXX We still have a static limit on MAXMODDEPS


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.4 -r1.130.2.5 src/sys/kern/kern_module.c

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

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.4 src/sys/kern/kern_module.c:1.130.2.5
--- src/sys/kern/kern_module.c:1.130.2.4	Sun Mar 11 11:47:45 2018
+++ src/sys/kern/kern_module.c	Fri Mar 30 23:49:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.4 2018/03/11 11:47:45 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.5 2018/03/30 23:49:42 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.4 2018/03/11 11:47:45 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.5 2018/03/30 23:49:42 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -902,13 +902,19 @@ module_do_load(const char *name, bool is
 	   prop_dictionary_t props, module_t **modp, modclass_t modclass,
 	   bool autoload)
 {
-#define MODULE_MAX_DEPTH 6
-
+	/* The pending list for this level of recursion */
 	TAILQ_HEAD(pending_t, module);
-	static int depth = 0;
-	static struct pending_t *pending_lists[MODULE_MAX_DEPTH];
 	struct pending_t *pending;
 	struct pending_t new_pending = TAILQ_HEAD_INITIALIZER(new_pending);
+
+	/* The stack of pending lists */
+	static SLIST_HEAD(pend_head, pend_entry) pend_stack =
+		SLIST_HEAD_INITIALIZER(pend_stack);
+	struct pend_entry {
+		SLIST_ENTRY(pend_entry) pe_entry;
+		struct pending_t *pe_pending;
+	} *my_pend_entry;
+
 	modinfo_t *mi;
 	module_t *mod, *mod2, *prev_active;
 	prop_dictionary_t filedict;
@@ -924,27 +930,21 @@ module_do_load(const char *name, bool is
 	error = 0;
 
 	/*
-	 * Avoid recursing too far.
-	 */
-	if (++depth > MODULE_MAX_DEPTH) {
-		module_error("recursion too deep for `%s' %d > %d", name,
-		depth, MODULE_MAX_DEPTH);
-		depth--;
-		return EMLINK;
-	}
-
-	/*
-	 * Set up the pending list for this depth.  If this is a
-	 * recursive entry, then use same list as for outer call,
-	 * else use the locally allocated list.  In either case,
-	 * remember which one we're using.
+	 * Set up the pending list for this entry.  If this is an
+	 * internal entry (for a dependency), then use the same list
+	 * as for the outer call;  otherwise, it's an external entry
+	 * (possibly recursive, ie a module's xxx_modcmd(init, ...)
+	 * routine called us), so use the locally allocated list.  In
+	 * either case, add it to our stack.
 	 */
 	if (isdep) {
-		KASSERT(depth > 1);
-		pending = pending_lists[depth - 2];
+		KASSERT(SLIST_FIRST(_stack) != NULL);
+		pending = SLIST_FIRST(_stack)->pe_pending;
 	} else
 		pending = _pending;
-	pending_lists[depth - 1] = pending;
+	my_pend_entry = kmem_zalloc(sizeof(*my_pend_entry), KM_SLEEP);
+	my_pend_entry->pe_pending = pending;
+	SLIST_INSERT_HEAD(_stack, my_pend_entry, pe_entry);
 
 	/*
 	 * Search the list of disabled builtins first.
@@ -961,11 +961,13 @@ module_do_load(const char *name, bool is
 module_error("use -f to reinstate "
 "builtin module `%s'", name);
 			}
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return EPERM;
 		} else {
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			error = module_do_builtin(mod, name, modp, props);
-			depth--;
 			return error;
 		}
 	}
@@ -993,14 +995,16 @@ module_do_load(const char *name, bool is
 			}
 			module_print("%s module `%s' already loaded",
 			isdep ? "dependent" : "requested", name);
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return EEXIST;
 		}
 
 		mod = module_newmodule(MODULE_SOURCE_FILESYS);
 		if (mod == NULL) {
 			module_error("out of memory for `%s'", name);
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return ENOMEM;
 		}
 
@@ -1020,7 +1024,8 @@ module_do_load(const char *name, bool is
 "error %d", name, error);
 #endif
 			kmem_free(mod, sizeof(*mod));
-			depth--;
+			SLIST_REMOVE_HEAD(_stack, pe_entry);
+			kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 			return error;
 		}
 		TAILQ_INSERT_TAIL(pending, mod, mod_chain);
@@ -1235,7 +1240,8 @@ module_do_load(const char *name, bool is
 		mod->mod_flags |= MODFLG_AUTO_LOADED;
 		module_thread_kick();
 	}
-	depth--;
+	SLIST_REMOVE_HEAD(_stack, pe_entry);
+	kmem_free(my_pend_entry, sizeof(*my_pend_entry));
 	

CVS commit: src/sys/kern

2018-03-30 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Mar 30 22:59:43 UTC 2018

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

Log Message:
correct typo: and and -> and

from chris28.


To generate a diff of this commit:
cvs rdiff -u -r1.275 -r1.276 src/sys/kern/tty.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/tty.c
diff -u src/sys/kern/tty.c:1.275 src/sys/kern/tty.c:1.276
--- src/sys/kern/tty.c:1.275	Wed Oct 25 08:12:39 2017
+++ src/sys/kern/tty.c	Fri Mar 30 22:59:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.275 2017/10/25 08:12:39 maya Exp $	*/
+/*	$NetBSD: tty.c,v 1.276 2018/03/30 22:59:43 maya Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.275 2017/10/25 08:12:39 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.276 2018/03/30 22:59:43 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -302,8 +302,8 @@ sysctl_kern_tty_setup(void)
 	sysctl_createv(_tkstat_sysctllog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT,
 		   CTLTYPE_NODE, "tkstat",
-		   SYSCTL_DESCR("Number of characters sent and and "
-"received on ttys"),
+		   SYSCTL_DESCR("Number of characters sent and received "
+"on ttys"),
 		   NULL, 0, NULL, 0,
 		   CTL_KERN, KERN_TKSTAT, CTL_EOL);
 



CVS commit: src/sys

2018-03-30 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Mar 30 22:54:37 UTC 2018

Modified Files:
src/sys/dev/tc: stic.c
src/sys/kern: sysv_msg.c
src/sys/netinet: ip_output.c sctp_output.c

Log Message:
correct typo: and and -> and (comments only)

heads up on this being a common typo from chris28.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/tc/stic.c
cvs rdiff -u -r1.71 -r1.72 src/sys/kern/sysv_msg.c
cvs rdiff -u -r1.298 -r1.299 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netinet/sctp_output.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/tc/stic.c
diff -u src/sys/dev/tc/stic.c:1.52 src/sys/dev/tc/stic.c:1.53
--- src/sys/dev/tc/stic.c:1.52	Wed Jan 24 05:35:58 2018
+++ src/sys/dev/tc/stic.c	Fri Mar 30 22:54:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: stic.c,v 1.52 2018/01/24 05:35:58 riastradh Exp $	*/
+/*	$NetBSD: stic.c,v 1.53 2018/03/30 22:54:36 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stic.c,v 1.52 2018/01/24 05:35:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stic.c,v 1.53 2018/03/30 22:54:36 maya Exp $");
 
 #include 
 #include 
@@ -421,7 +421,7 @@ stic_attach(device_t self, struct stic_i
 
 	/*
 	 * Allocate backing for the console.  We could trawl back through
-	 * msgbuf and and fill the backing, but it's not worth the hassle.
+	 * msgbuf and fill the backing, but it's not worth the hassle.
 	 * We could also grab backing using pmap_steal_memory() early on,
 	 * but that's a little ugly.
 	 */

Index: src/sys/kern/sysv_msg.c
diff -u src/sys/kern/sysv_msg.c:1.71 src/sys/kern/sysv_msg.c:1.72
--- src/sys/kern/sysv_msg.c:1.71	Mon Sep  5 14:13:50 2016
+++ src/sys/kern/sysv_msg.c	Fri Mar 30 22:54:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_msg.c,v 1.71 2016/09/05 14:13:50 christos Exp $	*/
+/*	$NetBSD: sysv_msg.c,v 1.72 2018/03/30 22:54:37 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.71 2016/09/05 14:13:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.72 2018/03/30 22:54:37 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -315,8 +315,8 @@ msgrealloc(int newmsgmni, int newmsgseg)
 		memcpy(nmptr, mptr, sizeof(struct msqid_ds));
 
 		/*
-		 * Go through the message headers, and and copy each
-		 * one by taking the new ones, and thus defragmenting.
+		 * Go through the message headers, and copy each one
+		 * by taking the new ones, and thus defragmenting.
 		 */
 		nmsghdr = pmsghdr = NULL;
 		msghdr = mptr->_msg_first;

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.298 src/sys/netinet/ip_output.c:1.299
--- src/sys/netinet/ip_output.c:1.298	Sat Mar  3 09:39:29 2018
+++ src/sys/netinet/ip_output.c	Fri Mar 30 22:54:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.298 2018/03/03 09:39:29 maxv Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.299 2018/03/30 22:54:37 maya Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.298 2018/03/03 09:39:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.299 2018/03/30 22:54:37 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -548,7 +548,7 @@ ip_output(struct mbuf *m0, struct mbuf *
 	}
 
 	/*
-	 * Look for broadcast address and and verify user is allowed to
+	 * Look for broadcast address and verify user is allowed to
 	 * send such a packet.
 	 */
 	if (isbroadcast) {

Index: src/sys/netinet/sctp_output.c
diff -u src/sys/netinet/sctp_output.c:1.12 src/sys/netinet/sctp_output.c:1.13
--- src/sys/netinet/sctp_output.c:1.12	Sun Dec 10 11:52:14 2017
+++ src/sys/netinet/sctp_output.c	Fri Mar 30 22:54:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sctp_output.c,v 1.12 2017/12/10 11:52:14 rjs Exp $ */
+/*	$NetBSD: sctp_output.c,v 1.13 2018/03/30 22:54:37 maya Exp $ */
 /*	$KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.12 2017/12/10 11:52:14 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.13 2018/03/30 22:54:37 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -7669,7 +7669,7 @@ sctp_send_sack(struct sctp_tcb *stcb)
 	/*
 	 * Queue up a SACK in the control queue. We must first check to
 	 * see if a SACK is somehow on the control queue. If so, we will
-	 * take and and remove the old one.
+	 * take and remove the old one.
 	 */
 	struct sctp_association *asoc;
 	struct sctp_tmit_chunk *chk, *a_chk;



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

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 19:58:05 UTC 2018

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

Log Message:
Improve the detection. Future generations of Intel CPUs will have a bit to
say they are not affected by Meltdown.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/x86/svs.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/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.16 src/sys/arch/x86/x86/svs.c:1.17
--- src/sys/arch/x86/x86/svs.c:1.16	Thu Mar 29 07:24:26 2018
+++ src/sys/arch/x86/x86/svs.c	Fri Mar 30 19:58:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.16 2018/03/29 07:24:26 maxv Exp $	*/
+/*	$NetBSD: svs.c,v 1.17 2018/03/30 19:58:05 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.16 2018/03/29 07:24:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.17 2018/03/30 19:58:05 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -750,8 +750,21 @@ sysctl_machdep_svs_enabled(SYSCTLFN_ARGS
 void
 svs_init(void)
 {
+	uint64_t msr;
+
 	if (cpu_vendor != CPUVENDOR_INTEL) {
 		return;
 	}
+	if (cpu_info_primary.ci_feat_val[7] & CPUID_SEF_ARCH_CAP) {
+		msr = rdmsr(MSR_IA32_ARCH_CAPABILITIES);
+		if (msr & IA32_ARCH_RDCL_NO) {
+			/*
+			 * The processor indicates it is not vulnerable to the
+			 * Rogue Data Cache Load (Meltdown) flaw.
+			 */
+			return;
+		}
+	}
+
 	svs_enable();
 }



CVS commit: src/sys/arch/x86

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 19:51:53 UTC 2018

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

Log Message:
Retrieve cpuid.7:%edx.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 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/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.89 src/sys/arch/x86/include/cpu.h:1.90
--- src/sys/arch/x86/include/cpu.h:1.89	Thu Jan 18 07:25:34 2018
+++ src/sys/arch/x86/include/cpu.h	Fri Mar 30 19:51:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.89 2018/01/18 07:25:34 maxv Exp $	*/
+/*	$NetBSD: cpu.h,v 1.90 2018/03/30 19:51:53 maxv Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -167,7 +167,7 @@ struct cpu_info {
 	uint32_t	ci_max_ext_cpuid; /* cpuid.8000:%eax */
 	volatile uint32_t	ci_lapic_counter;
 
-	uint32_t	ci_feat_val[7]; /* X86 CPUID feature bits */
+	uint32_t	ci_feat_val[8]; /* X86 CPUID feature bits */
 			/* [0] basic features cpuid.1:%edx
 			 * [1] basic features cpuid.1:%ecx (CPUID2_xxx bits)
 			 * [2] extended features cpuid:8001:%edx
@@ -175,6 +175,7 @@ struct cpu_info {
 			 * [4] VIA padlock features
 			 * [5] structured extended features cpuid.7:%ebx
 			 * [6] structured extended features cpuid.7:%ecx
+			 * [7] structured extended features cpuid.7:%edx
 			 */
 	
 	const struct cpu_functions *ci_func;  /* start/stop functions */

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.70 src/sys/arch/x86/x86/identcpu.c:1.71
--- src/sys/arch/x86/x86/identcpu.c:1.70	Mon Mar 12 07:12:54 2018
+++ src/sys/arch/x86/x86/identcpu.c	Fri Mar 30 19:51:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.70 2018/03/12 07:12:54 msaitoh Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.71 2018/03/30 19:51:53 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.70 2018/03/12 07:12:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.71 2018/03/30 19:51:53 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -883,6 +883,7 @@ cpu_probe(struct cpu_info *ci)
 		x86_cpuid(7, descs);
 		ci->ci_feat_val[5] = descs[1]; /* %ebx */
 		ci->ci_feat_val[6] = descs[2]; /* %ecx */
+		ci->ci_feat_val[7] = descs[3]; /* %edx */
 	}
 
 	cpu_probe_intel(ci);



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

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 19:49:49 UTC 2018

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

Log Message:
Add RDCL_NO and IBRS_ALL.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 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.119 src/sys/arch/x86/include/specialreg.h:1.120
--- src/sys/arch/x86/include/specialreg.h:1.119	Fri Mar 30 09:30:56 2018
+++ src/sys/arch/x86/include/specialreg.h	Fri Mar 30 19:49:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.119 2018/03/30 09:30:56 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.120 2018/03/30 19:49:49 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -658,6 +658,8 @@
 #define MSR_IA32_EXT_CONFIG	0x0ee	/* Undocumented. Core Solo/Duo only */
 #define MSR_MTRRcap		0x0fe
 #define MSR_IA32_ARCH_CAPABILITIES 0x10a
+#define 	IA32_ARCH_RDCL_NO	0x01
+#define 	IA32_ARCH_IBRS_ALL	0x02
 #define MSR_BBL_CR_ADDR		0x116	/* PII+ only */
 #define MSR_BBL_CR_DECC		0x118	/* PII+ only */
 #define MSR_BBL_CR_CTL		0x119	/* PII+ only */



CVS commit: src/share/man/man4/man4.macppc

2018-03-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Mar 30 14:34:55 UTC 2018

Modified Files:
src/share/man/man4/man4.macppc: snapper.4

Log Message:
Add email addresses to author names.
snapper(4) was enabled by default in r1.208 of GENERIC over 12 years ago, drop
the bugs section about needing more testing.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/man4.macppc/snapper.4

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/man4/man4.macppc/snapper.4
diff -u src/share/man/man4/man4.macppc/snapper.4:1.4 src/share/man/man4/man4.macppc/snapper.4:1.5
--- src/share/man/man4/man4.macppc/snapper.4:1.4	Fri Feb 17 22:24:47 2017
+++ src/share/man/man4/man4.macppc/snapper.4	Fri Mar 30 14:34:55 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: snapper.4,v 1.4 2017/02/17 22:24:47 christos Exp $
+.\" $NetBSD: snapper.4,v 1.5 2018/03/30 14:34:55 sevan Exp $
 .\"
 .\" Copyright (c) 2006 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 February 17, 2017
+.Dd March 30, 2018
 .Dt SNAPPER 4 macppc
 .Os
 .Sh NAME
@@ -63,8 +63,6 @@ device driver appeared in
 The
 .Nm
 driver was written by
-.An Tsubai Masanari
+.An Tsubai Masanari Aq Mt tsu...@netbsd.org
 with modifications by
-.An Jared D. McNeill .
-.Sh BUGS
-This driver needs more testing.
+.An Jared D. McNeill Aq Mt jmcne...@netbsd.org .



CVS commit: src/share/man/man4/man4.macppc

2018-03-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Mar 30 14:25:20 UTC 2018

Modified Files:
src/share/man/man4/man4.macppc: awacs.4

Log Message:
Add email address for author.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/man4.macppc/awacs.4

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/man4/man4.macppc/awacs.4
diff -u src/share/man/man4/man4.macppc/awacs.4:1.5 src/share/man/man4/man4.macppc/awacs.4:1.6
--- src/share/man/man4/man4.macppc/awacs.4:1.5	Fri Mar 30 14:06:39 2018
+++ src/share/man/man4/man4.macppc/awacs.4	Fri Mar 30 14:25:20 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: awacs.4,v 1.5 2018/03/30 14:06:39 sevan Exp $
+.\" $NetBSD: awacs.4,v 1.6 2018/03/30 14:25:20 sevan Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -50,6 +50,6 @@ device driver appeared in
 The
 .Nm
 driver was written by
-.An Tsubai Masanari .
+.An Tsubai Masanari Aq Mt tsu...@netbsd.org .
 .Sh BUGS
 This manual page needs more precision and detail.



CVS commit: src/share/man/man4/man4.macppc

2018-03-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Mar 30 14:21:04 UTC 2018

Modified Files:
src/share/man/man4/man4.macppc: obio.4

Log Message:
Remove Tn, comment out mediabay(4) because it doesn't exist.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/man4.macppc/obio.4

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/man4/man4.macppc/obio.4
diff -u src/share/man/man4/man4.macppc/obio.4:1.9 src/share/man/man4/man4.macppc/obio.4:1.10
--- src/share/man/man4/man4.macppc/obio.4:1.9	Fri Mar 30 13:54:24 2018
+++ src/share/man/man4/man4.macppc/obio.4	Fri Mar 30 14:21:04 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: obio.4,v 1.9 2018/03/30 13:54:24 sevan Exp $
+.\"	$NetBSD: obio.4,v 1.10 2018/03/30 14:21:04 wiz Exp $
 .\"
 .\" Copyright (c) 2003 Alex Zepeda 
 .\" All rights reserved.
@@ -44,19 +44,13 @@ system to help find and attach devices (
 controllers) connected to the Macintosh onboard I/O bus.
 .Sh HARDWARE
 .Nx
-includes machine-dependent
-.Tn On-Board
-drivers, sorted by device type and driver name:
+includes machine-dependent On-Board drivers, sorted by device type and driver name:
 .Ss SCSI interfaces
 .Bl -tag -width burgundy -offset indent
 .It esp
-NCR 53C9x
-.Tn SCSI
-interfaces.
+NCR 53C9x SCSI interfaces.
 .It mesh
-Apple Macintosh Enhanced SCSI Hardware
-.Tn SCSI
-interfaces.
+Apple Macintosh Enhanced SCSI Hardware SCSI interfaces.
 .El
 .Ss Disk and tape controllers
 .Bl -tag -width burgundy -offset indent
@@ -105,7 +99,7 @@ Placeholder device for the persistent sy
 .Xr macppc/intro 4 ,
 .Xr macppc/mesh 4 ,
 .Xr mc 4 ,
-.Xr mediabay 4 ,
+.\" .Xr mediabay 4 ,
 .Xr wdc 4 ,
 .Xr wi 4 ,
 .Xr zsc 4



CVS commit: src/share/man/man4/man4.macppc

2018-03-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Mar 30 14:06:39 UTC 2018

Modified Files:
src/share/man/man4/man4.macppc: awacs.4

Log Message:
Use An macro for author name.
awacs(4) has qualified to be enabled by default in GENERIC config as of r1.343.
It should get a whole lot more testing so drop the note in BUGS section.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/man4.macppc/awacs.4

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/man4/man4.macppc/awacs.4
diff -u src/share/man/man4/man4.macppc/awacs.4:1.4 src/share/man/man4/man4.macppc/awacs.4:1.5
--- src/share/man/man4/man4.macppc/awacs.4:1.4	Wed Apr 30 13:10:56 2008
+++ src/share/man/man4/man4.macppc/awacs.4	Fri Mar 30 14:06:39 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: awacs.4,v 1.4 2008/04/30 13:10:56 martin Exp $
+.\" $NetBSD: awacs.4,v 1.5 2018/03/30 14:06:39 sevan Exp $
 .\"
 .\" Copyright (c) 2001 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 May 9, 2001
+.Dd March 30, 2018
 .Dt AWACS 4 macppc
 .Os
 .Sh NAME
@@ -49,8 +49,7 @@ device driver appeared in
 .Sh AUTHORS
 The
 .Nm
-driver was written by Tsubai Masanari.
+driver was written by
+.An Tsubai Masanari .
 .Sh BUGS
-This driver needs more testing.
-.Pp
 This manual page needs more precision and detail.



CVS commit: src/share/man/man4/man4.macppc

2018-03-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Mar 30 13:54:24 UTC 2018

Modified Files:
src/share/man/man4/man4.macppc: obio.4

Log Message:
awacs(4) is enabled by default in GENERIC as of r1.343.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/man4.macppc/obio.4

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/man4/man4.macppc/obio.4
diff -u src/share/man/man4/man4.macppc/obio.4:1.8 src/share/man/man4/man4.macppc/obio.4:1.9
--- src/share/man/man4/man4.macppc/obio.4:1.8	Sat Feb 18 22:39:01 2017
+++ src/share/man/man4/man4.macppc/obio.4	Fri Mar 30 13:54:24 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: obio.4,v 1.8 2017/02/18 22:39:01 wiz Exp $
+.\"	$NetBSD: obio.4,v 1.9 2018/03/30 13:54:24 sevan Exp $
 .\"
 .\" Copyright (c) 2003 Alex Zepeda 
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 17, 2017
+.Dd March 30, 2018
 .Dt OBIO 4 macppc
 .Os
 .Sh NAME
@@ -87,7 +87,6 @@ Zilog 8530 serial communications interfa
 Apple's
 .Sq "audio waveform amplifier and converter for sound"
 audio device found on most macppc models.
-May not work on several G4 and iBook models.
 .El
 .Ss Miscellaneous devices
 .Bl -tag -width burgundy -offset indent



CVS commit: src/sys/net

2018-03-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Mar 30 13:29:19 UTC 2018

Modified Files:
src/sys/net: if_spppsubr.c

Log Message:
Reset fail counter when link goes down so that next session starts
with the correct retry count.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.179 src/sys/net/if_spppsubr.c:1.180
--- src/sys/net/if_spppsubr.c:1.179	Tue Feb  6 03:15:15 2018
+++ src/sys/net/if_spppsubr.c	Fri Mar 30 13:29:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.179 2018/02/06 03:15:15 knakahara Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.180 2018/03/30 13:29:19 mlelstv Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179 2018/02/06 03:15:15 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.180 2018/03/30 13:29:19 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2274,6 +2274,7 @@ sppp_lcp_down(struct sppp *sp)
 			"%s: Down event (carrier loss)\n",
 			ifp->if_xname);
 	}
+	sp->fail_counter[IDX_LCP] = 0;
 	sp->pp_flags &= ~PP_CALLIN;
 	if (sp->state[IDX_LCP] != STATE_INITIAL)
 		lcp.Close(sp);



CVS commit: src/sys/net

2018-03-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Mar 30 13:21:24 UTC 2018

Modified Files:
src/sys/net: if_media.c

Log Message:
add prototypes, validate ifm_change and ifm_status vectors. NFC.


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

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

Modified files:

Index: src/sys/net/if_media.c
diff -u src/sys/net/if_media.c:1.35 src/sys/net/if_media.c:1.36
--- src/sys/net/if_media.c:1.35	Wed Nov 22 03:03:18 2017
+++ src/sys/net/if_media.c	Fri Mar 30 13:21:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.c,v 1.35 2017/11/22 03:03:18 ozaki-r Exp $	*/
+/*	$NetBSD: if_media.c,v 1.36 2018/03/30 13:21:24 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.35 2017/11/22 03:03:18 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.36 2018/03/30 13:21:24 mlelstv Exp $");
 
 #include 
 #include 
@@ -89,6 +89,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_media.c,v
 #include 
 #include 
 
+static void	ifmedia_status(struct ifmedia *, struct ifnet *, struct ifmediareq *);
+static int	_ifmedia_ioctl(struct ifnet *, struct ifreq *, struct ifmedia *, u_long);
+
 /*
  * Compile-time options:
  * IFMEDIA_DEBUG:
@@ -122,9 +125,22 @@ ifmedia_init(struct ifmedia *ifm, int do
 int
 ifmedia_change(struct ifmedia *ifm, struct ifnet *ifp)
 {
+
+	if (ifm->ifm_change == NULL)
+		return -1;
 	return (*ifm->ifm_change)(ifp);
 }
 
+static void
+ifmedia_status(struct ifmedia *ifm, struct ifnet *ifp,
+	struct ifmediareq *ifmr)
+{
+
+	if (ifm->ifm_status == NULL)
+		return;
+	(*ifm->ifm_status)(ifp, ifmr);
+}
+
 /*
  * Add a media configuration to the list of supported media
  * for a specific interface instance.
@@ -317,8 +333,7 @@ _ifmedia_ioctl(struct ifnet *ifp, struct
 		ifm->ifm_cur->ifm_media : IFM_NONE;
 		ifmr->ifm_mask = ifm->ifm_mask;
 		ifmr->ifm_status = 0;
-		/* ifmedia_status */
-		(*ifm->ifm_status)(ifp, ifmr);
+		ifmedia_status(ifm, ifp, ifmr);
 
 		/*
 		 * Count them so we know a-priori how much is the max we'll



CVS commit: src/sbin/mbrlabel

2018-03-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Mar 30 13:14:25 UTC 2018

Modified Files:
src/sbin/mbrlabel: mbrlabel.c

Log Message:
Handle sector sizes != 512, check partition overlaps, improve guessing
of filesystem parameters.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sbin/mbrlabel/mbrlabel.c

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

Modified files:

Index: src/sbin/mbrlabel/mbrlabel.c
diff -u src/sbin/mbrlabel/mbrlabel.c:1.28 src/sbin/mbrlabel/mbrlabel.c:1.29
--- src/sbin/mbrlabel/mbrlabel.c:1.28	Sat Jul 14 20:14:17 2012
+++ src/sbin/mbrlabel/mbrlabel.c	Fri Mar 30 13:14:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbrlabel.c,v 1.28 2012/07/14 20:14:17 wiz Exp $	*/
+/*	$NetBSD: mbrlabel.c,v 1.29 2018/03/30 13:14:25 mlelstv Exp $	*/
 
 /*
  * Copyright (C) 1998 Wolfgang Solfrank.
@@ -33,7 +33,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mbrlabel.c,v 1.28 2012/07/14 20:14:17 wiz Exp $");
+__RCSID("$NetBSD: mbrlabel.c,v 1.29 2018/03/30 13:14:25 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -116,20 +116,32 @@ getlong(void *p)
 static int
 getparts(int sd, u_int32_t off, u_int32_t extoff, int verbose)
 {
-	unsigned char		buf[DEV_BSIZE];
+	unsigned char		*buf;
 	struct mbr_partition	parts[MBR_PART_COUNT];
 	struct partition	npe;
 	off_t			loff;
 	int			i, j, unused, changed;
+	unsigned		bsize = label.d_secsize;
+
+	if (bsize < DEV_BSIZE) {
+		fprintf(stderr,"Invalid sector size %u\n", bsize);
+		exit(1);
+	}
+
+	buf = malloc(bsize);
+	if (buf == NULL) {
+		perror("malloc I/O buffer");
+		exit(1);
+	}
 
 	changed = 0;
-	loff = (off_t)off * DEV_BSIZE;
+	loff = (off_t)off * bsize;
 
 	if (lseek(sd, loff, SEEK_SET) != loff) {
 		perror("seek label");
 		exit(1);
 	}
-	if (read(sd, buf, sizeof buf) != DEV_BSIZE) {
+	if (read(sd, buf, bsize) != (ssize_t)bsize) {
 		if (off != MBR_BBSECTOR)
 			perror("read label (sector is possibly out of "
 			"range)");
@@ -160,31 +172,50 @@ getparts(int sd, u_int32_t off, u_int32_
 			"Found %s partition; size %u (%u MB), offset %u\n",
 			fstypenames[npe.p_fstype],
 			npe.p_size, npe.p_size / 2048, npe.p_offset);
+
 		for (j = 0; j < label.d_npartitions; j++) {
 			struct partition *lpe;
 
 			if (j == RAW_PART)
 continue;
 			lpe = _partitions[j];
+
 			if (lpe->p_size == npe.p_size &&
-			lpe->p_offset == npe.p_offset
-#ifdef notyet
-			&& (lpe->p_fstype == npe.p_fstype ||
-			 lpe->p_fstype == FS_UNUSED) */
-#endif
-			 ) {
+			lpe->p_offset == npe.p_offset) {
 if (verbose)
 	printf(
-			"  skipping existing %s partition at slot %c.\n",
+	"  skipping existing %s partition at slot %c.\n",
 	fstypenames[lpe->p_fstype],
 	j + 'a');
 unused = -2;	/* flag as existing */
 break;
 			}
+
 			if (unused == -1 && lpe->p_size == 0 &&
 			lpe->p_fstype == FS_UNUSED)
 unused = j;
 		}
+		if (unused == -1) {
+			for (j = 0; j < label.d_npartitions; j++) {
+struct partition *lpe;
+
+if (j == RAW_PART)
+	continue;
+lpe = _partitions[j];
+
+if ((npe.p_offset >= lpe->p_offset &&
+npe.p_offset < lpe->p_offset + lpe->p_size) ||
+   (npe.p_offset + npe.p_size - 1 >= lpe->p_offset &&
+npe.p_offset + npe.p_size - 1 < lpe->p_offset + lpe->p_size)) {
+	printf(
+	"  skipping overlapping %s partition at slot %c.\n",
+	fstypenames[lpe->p_fstype],
+	j + 'a');
+	unused = -2;	/* flag as existing */
+	break;
+}
+			}
+		}
 		if (unused == -2)
 			continue;	/* entry exists, skip... */
 		if (unused == -1) {
@@ -202,23 +233,25 @@ getparts(int sd, u_int32_t off, u_int32_
 		if (verbose)
 			printf("  adding %s partition to slot %c.\n",
 			fstypenames[npe.p_fstype], unused + 'a');
+
+		/*
+		 * XXX guess some filesystem parameters, these should be
+		 * scanned from the superblocks
+		 */
 		switch (npe.p_fstype) {
 		case FS_BSDFFS:
 		case FS_APPLEUFS:
-			npe.p_size = 16384;	/* XXX */
 			npe.p_fsize = 1024;
 			npe.p_frag = 8;
 			npe.p_cpg = 16;
 			break;
-#ifdef	__does_not_happen__
 		case FS_BSDLFS:
-			npe.p_size = 16384;	/* XXX */
 			npe.p_fsize = 1024;
 			npe.p_frag = 8;
-			npe.p_sgs = XXX;
+			npe.p_sgs = 7;
 			break;
-#endif
 		}
+
 		changed++;
 		label.d_partitions[unused] = npe;
 	}
@@ -233,6 +266,8 @@ getparts(int sd, u_int32_t off, u_int32_
 			extoff ? extoff : poff, verbose);
 		}
 	}
+
+	free(buf);
 	return (changed);
 }
 



CVS commit: src/sbin/fsck_lfs

2018-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 30 12:56:46 UTC 2018

Modified Files:
src/sbin/fsck_lfs: bufcache.c bufcache.h

Log Message:
PR/51418: Jose Luis Rodriguez Garcia: Fix incore src/sbin/fsck_lfs/bufcache.c
XXX: pullup-8, pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sbin/fsck_lfs/bufcache.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/fsck_lfs/bufcache.h

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

Modified files:

Index: src/sbin/fsck_lfs/bufcache.c
diff -u src/sbin/fsck_lfs/bufcache.c:1.19 src/sbin/fsck_lfs/bufcache.c:1.20
--- src/sbin/fsck_lfs/bufcache.c:1.19	Thu Aug 25 03:43:18 2016
+++ src/sbin/fsck_lfs/bufcache.c	Fri Mar 30 08:56:46 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: bufcache.c,v 1.19 2016/08/25 07:43:18 christos Exp $ */
+/* $NetBSD: bufcache.c,v 1.20 2018/03/30 12:56:46 christos Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -191,7 +191,7 @@ bremfree(struct ubuf * bp)
 
 /* Return a buffer if it is in the cache, otherwise return NULL. */
 struct ubuf *
-incore(struct uvnode * vp, int lbn)
+incore(struct uvnode * vp, daddr_t lbn)
 {
 	struct ubuf *bp;
 	int hash, depth;

Index: src/sbin/fsck_lfs/bufcache.h
diff -u src/sbin/fsck_lfs/bufcache.h:1.13 src/sbin/fsck_lfs/bufcache.h:1.14
--- src/sbin/fsck_lfs/bufcache.h:1.13	Thu Aug 18 04:08:02 2016
+++ src/sbin/fsck_lfs/bufcache.h	Fri Mar 30 08:56:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bufcache.h,v 1.13 2016/08/18 08:08:02 christos Exp $	*/
+/*	$NetBSD: bufcache.h,v 1.14 2018/03/30 12:56:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@ void bufrehash(int);
 void bufstats(void);
 void buf_destroy(struct ubuf *);
 void bremfree(struct ubuf *);
-struct ubuf *incore(struct uvnode *, int);
+struct ubuf *incore(struct uvnode *, daddr_t);
 struct ubuf *getblk(struct uvnode *, daddr_t, int);
 void bwrite(struct ubuf *);
 void brelse(struct ubuf *, int);



CVS commit: [netbsd-8] src/doc

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 12:11:07 UTC 2018

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

Log Message:
Tickets #660-#664, #666-#673


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.154 -r1.1.2.155 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.154 src/doc/CHANGES-8.0:1.1.2.155
--- src/doc/CHANGES-8.0:1.1.2.154	Mon Mar 26 11:20:48 2018
+++ src/doc/CHANGES-8.0	Fri Mar 30 12:11:07 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.154 2018/03/26 11:20:48 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.155 2018/03/30 12:11:07 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -10606,3 +10606,96 @@ sys/arch/x86/x86/intr.c1.124
 	Avoid a panic from "intrctl list" during attach of MSI/MSI-X devices.
 	[knakahara, ticket #658]
 
+usr.sbin/makefs/cd9660/cd9660_eltorito.c	1.22,1.23
+
+	Initialize boot_catalog_entry's entry_type properly.
+	Correctly mark the last El Torito section header.
+	[nonaka, ticket #660]
+
+sys/netinet/ip_encap.c1.67
+
+	Fix memory leak.
+	[maxv, ticket #661]
+
+sys/netinet/tcp_input.c1.383 (patch)
+
+	Enforce the IPsec policy on TCP-RST packets.
+	[maxv, ticket #662]
+
+sys/netinet6/frag6.c1.64
+
+	Kick zero-sized fragments.
+	[maxv, ticket #663]
+
+sys/netinet6/dest6.c1.21
+
+	Fix the calculation of the ICMP6 error pointer.
+	[maxv, ticket #664]
+
+sys/netinet6/raw_ip6.c1.161
+
+	Fix use-after-free.
+	[maxv, ticket #666]
+
+sys/netipsec/ipsec_input.c			1.54
+
+	Fix (harmless) use-after-free.
+	[maxv, ticket #667]
+
+sys/netinet/ip_reass.c1.12
+
+	ip_reass_packet(): make sure that the end of each fragment does
+	not exceed IP_MAXPACKET.
+	[maxv, ticket #668]
+
+sys/netipsec/ipsec.c1.134
+
+	Fix ipsec4_get_ulp().
+	[maxv, ticket #669]
+
+sys/netipsec/xform_esp.c			1.73
+
+	Add missing NULL check.
+	[maxv, ticket #670]
+
+sys/netinet6/ip6_forward.c			1.91
+
+	Fix two IPv6 ipsec use-after-free issues.
+	[maxv, ticket #671]
+
+sys/netinet6/in6_proto.c			1.120
+
+	Change ip6_hdrnestlimit to be 15 instead of 50.
+	[maxv, ticket #672]
+
+sys/dev/pci/ixgbe/if_bypass.c			1.3
+sys/dev/pci/ixgbe/if_sriov.c			1.2
+sys/dev/pci/ixgbe/ix_txrx.c			1.36
+sys/dev/pci/ixgbe/ixgbe.c			1.135-1.137
+sys/dev/pci/ixgbe/ixgbe.h			1.36-1.37
+sys/dev/pci/ixgbe/ixgbe_common.c		1.17-1.18
+sys/dev/pci/ixgbe/ixgbe_common.h		1.10
+sys/dev/pci/ixgbe/ixgbe_osdep.c			1.3
+sys/dev/pci/ixgbe/ixgbe_osdep.h			1.20
+sys/dev/pci/ixgbe/ixgbe_phy.c			1.15
+sys/dev/pci/ixgbe/ixgbe_sriov.h			1.2
+sys/dev/pci/ixgbe/ixgbe_type.h			1.32
+sys/dev/pci/ixgbe/ixgbe_vf.h			1.12
+sys/dev/pci/ixgbe/ixgbe_x540.c			1.13
+sys/dev/pci/ixgbe/ixgbe_x550.c			1.8-1.9
+sys/dev/pci/ixgbe/ixv.c1.88-1.89
+
+	- Initialize firmware command buffer correctly in
+	   ixgbe_read_ee_hostif_X550() and ixgbe_read_ee_hostif_buffer_X550().
+	- Fix a bug that ixgbe_mng_present() misunderstand management
+	  capability on X550 and newer on some environment.
+	- Fix checksum calculation in ixgbe_set_fw_drv_ver_generic()
+	  (not used).			 
+	- Check offset correctly in ixgbe_get_oem_prod_version() (not used).
+	- Set PHY correctly in ixgbe_setup_mac_link_sfp_x550a() if a device is
+	  a C3000 KR SFP+.		
+	- Fix race about writing adapter->link_active for ixg(4) and ixv(4).
+	- Add some unused funtions.  
+	- Whitespace fix.
+	[msaitoh, ticket #673]
+



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 12:07:35 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c if_sriov.c ix_txrx.c
ixgbe.c ixgbe.h ixgbe_common.c ixgbe_common.h ixgbe_osdep.c
ixgbe_osdep.h ixgbe_phy.c ixgbe_sriov.h ixgbe_type.h ixgbe_vf.h
ixgbe_x540.c ixgbe_x550.c ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #673):

sys/dev/pci/ixgbe/if_sriov.c: revision 1.2
sys/dev/pci/ixgbe/ixgbe.c: revision 1.135
sys/dev/pci/ixgbe/ixgbe.c: revision 1.136
sys/dev/pci/ixgbe/ixgbe.c: revision 1.137
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.17
sys/dev/pci/ixgbe/if_bypass.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.18
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.10
sys/dev/pci/ixgbe/ixgbe.h: revision 1.36
sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe.h: revision 1.37
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.36
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.32
sys/dev/pci/ixgbe/ixgbe_vf.h: revision 1.12
sys/dev/pci/ixgbe/ixgbe_sriov.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.20
sys/dev/pci/ixgbe/ixv.c: revision 1.88
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.15
sys/dev/pci/ixgbe/ixv.c: revision 1.89
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.8
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.9

Add some changes from ix-3.2.17.tar.gz and r328265. Not fully synchronized.

Some others (e.g. sfp cage interrupt and bypass adapter  stuff) will be merged
later:

- Initialize firmware command buffer correctly in ixgbe_read_ee_hostif_X550()
  and ixgbe_read_ee_hostif_buffer_X550(). These functions are used when reading
  NVM.
- Fix a bug that ixgbe_mng_present() misunderstand management capability on
  X550 and newer on some environment. X550 changed FWSM bit definition.
  See X540 document and X550's document and compare them.
- Fix checksum calculation in ixgbe_set_fw_drv_ver_generic(). This function is
  not used in NetBSD.
- Add some unused funtions.
- Whitespace fix.
- Check offset correctly in ixgbe_get_oem_prod_version(). Note that this
  function is not used.
- Set PHY correctly in ixgbe_setup_mac_link_sfp_x550a() if a device is a
  C3000 KR SFP+.

Fix race about writing adapter->link_active for ixg(4).
adapter->link_active is updated by ixgbe_update_link_status() only.

The function is called from the following four functions.
- ixgbe_media_status()
- ixgbe_local_timer1()
- ixgbe_stop()
- ixgbe_handle_link()

The functions other than ixgbe_handle_link() call ixgbe_update_link_status()
with holding IXGBE_CORE_LOCK, however ixgbe_handle_link() calls it without
holding IXGBE_CORE_LOCK. That can cause race. So, add IXGBE_CORE_LOCK to
ixgbe_handle_link().

Tested by msaitoh@n.o and me.

Fix race about writing adapter->link_active for ixv(4).
adapter->link_active is updated by ixv_update_link_status() only.

The function is called from the following two functions.
- ixv_media_status()
- ixv_handle_link()

ixv_media_status() calls ixv_update_link_status() with holding
IXGBE_CORE_LOCK, however ixv_handle_link() calls it without
holding IXGBE_CORE_LOCK, the same as ixg(4).

ok by msaitoh@n.o.

- Add link related softint's counter.
- Fix indent.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/if_sriov.c \
src/sys/dev/pci/ixgbe/ixgbe_sriov.h
cvs rdiff -u -r1.24.2.7 -r1.24.2.8 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.14 -r1.88.2.15 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.7 -r1.24.6.8 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.13.2.1 -r1.13.2.2 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.1 -r1.7.8.2 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.1.12.1 -r1.1.12.2 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
cvs rdiff -u -r1.17.6.1 -r1.17.6.2 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.11.6.1 -r1.11.6.2 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.22.2.3 -r1.22.2.4 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.8.6.1 -r1.8.6.2 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.9.6.1 -r1.9.6.2 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.5.6.1 -r1.5.6.2 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.11 -r1.56.2.12 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/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.2 src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.3
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.2	Thu Dec 21 19:28:54 2017
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Fri Mar 30 12:07:34 

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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 12:01:31 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #672):
sys/netinet6/in6_proto.c: revision 1.120
Change ip6_hdrnestlimit to be 15 instead of 50. I couldn't find any
reference in RFCs about what a correct limit should be, but FreeBSD already
uses 15.
If an IPv6 packet has 50 options, there is clearly something wrong with it.


To generate a diff of this commit:
cvs rdiff -u -r1.117.4.2 -r1.117.4.3 src/sys/netinet6/in6_proto.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/in6_proto.c
diff -u src/sys/netinet6/in6_proto.c:1.117.4.2 src/sys/netinet6/in6_proto.c:1.117.4.3
--- src/sys/netinet6/in6_proto.c:1.117.4.2	Tue Oct 24 08:55:55 2017
+++ src/sys/netinet6/in6_proto.c	Fri Mar 30 12:01:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_proto.c,v 1.117.4.2 2017/10/24 08:55:55 snj Exp $	*/
+/*	$NetBSD: in6_proto.c,v 1.117.4.3 2018/03/30 12:01:30 martin Exp $	*/
 /*	$KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.117.4.2 2017/10/24 08:55:55 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.117.4.3 2018/03/30 12:01:30 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -569,7 +569,7 @@ int	ip6_accept_rtadv = 0;	/* "IPV6FORWAR
 int	ip6_maxfragpackets = 200;
 int	ip6_maxfrags = 200;
 int	ip6_log_interval = 5;
-int	ip6_hdrnestlimit = 50;	/* appropriate? */
+int	ip6_hdrnestlimit = 15;	/* appropriate? */
 int	ip6_dad_count = 1;	/* DupAddrDetectionTransmits */
 int	ip6_auto_flowlabel = 1;
 int	ip6_use_deprecated = 1;	/* allow deprecated addr (RFC2462 5.5.4) */



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:57:13 UTC 2018

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

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

sys/netinet6/ip6_forward.c: revision 1.91

Fix two pretty bad mistakes. If ipsec6_check_policy fails m is not freed,
and a 'goto out' is missing after ipsec6_process_packet.


To generate a diff of this commit:
cvs rdiff -u -r1.87.2.2 -r1.87.2.3 src/sys/netinet6/ip6_forward.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/ip6_forward.c
diff -u src/sys/netinet6/ip6_forward.c:1.87.2.2 src/sys/netinet6/ip6_forward.c:1.87.2.3
--- src/sys/netinet6/ip6_forward.c:1.87.2.2	Tue Jan  9 19:30:45 2018
+++ src/sys/netinet6/ip6_forward.c	Fri Mar 30 11:57:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.87.2.2 2018/01/09 19:30:45 snj Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.87.2.3 2018/03/30 11:57:13 martin Exp $	*/
 /*	$KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.87.2.2 2018/01/09 19:30:45 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.87.2.3 2018/03/30 11:57:13 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -197,6 +197,7 @@ ip6_forward(struct mbuf *m, int srcrt)
 			 */
 			if (error == -EINVAL)
 error = 0;
+			m_freem(m);
 			goto freecopy;
 		}
 	}
@@ -268,8 +269,10 @@ ip6_forward(struct mbuf *m, int srcrt)
 		int s = splsoftnet();
 		error = ipsec6_process_packet(m, sp->req);
 		splx(s);
+		/* m is freed */
 		if (mcopy)
 			goto freecopy;
+		goto out;
 	}
 #endif   
 



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:53:13 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: xform_esp.c

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

sys/netipsec/xform_esp.c: revision 1.73

Add missing NULL check. Normally that's not triggerable remotely, since we
are guaranteed that 8 bytes are valid at mbuf+skip.


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.2 -r1.55.2.3 src/sys/netipsec/xform_esp.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/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.55.2.2 src/sys/netipsec/xform_esp.c:1.55.2.3
--- src/sys/netipsec/xform_esp.c:1.55.2.2	Mon Feb 26 13:10:52 2018
+++ src/sys/netipsec/xform_esp.c	Fri Mar 30 11:53:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.55.2.2 2018/02/26 13:10:52 martin Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.55.2.3 2018/03/30 11:53:13 martin Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.55.2.2 2018/02/26 13:10:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.55.2.3 2018/03/30 11:53:13 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -319,6 +319,10 @@ esp_input(struct mbuf *m, struct secasva
 
 	/* XXX don't pullup, just copy header */
 	IP6_EXTHDR_GET(esp, struct newesp *, m, skip, sizeof(struct newesp));
+	if (esp == NULL) {
+		/* m already freed */
+		return EINVAL;
+	}
 
 	esph = sav->tdb_authalgxform;
 	espx = sav->tdb_encalgxform;



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:50:56 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.134

Fix ipsec4_get_ulp(). We should do "goto done" instead of "return",
otherwise the port fields of spidx are uninitialized.

ok mlelstv@


To generate a diff of this commit:
cvs rdiff -u -r1.99.2.4 -r1.99.2.5 src/sys/netipsec/ipsec.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.99.2.4 src/sys/netipsec/ipsec.c:1.99.2.5
--- src/sys/netipsec/ipsec.c:1.99.2.4	Fri Feb 16 16:35:18 2018
+++ src/sys/netipsec/ipsec.c	Fri Mar 30 11:50:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.99.2.4 2018/02/16 16:35:18 martin Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.99.2.5 2018/03/30 11:50:56 martin Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.99.2.4 2018/02/16 16:35:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.99.2.5 2018/03/30 11:50:56 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -1070,7 +1070,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 		case IPPROTO_ICMP:
 			spidx->ul_proto = nxt;
 			if (off + sizeof(struct icmp) > m->m_pkthdr.len)
-return;
+goto done;
 			m_copydata(m, off, sizeof(icmph), );
 			((struct sockaddr_in *)>src)->sin_port =
 			htons((uint16_t)icmph.icmp_type);



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:45:58 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec_input.c

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

sys/netipsec/ipsec_input.c: revision 1.54

ipsec4_fixup_checksum calls m_pullup, so don't forget to do mtod() again,
to prevent use-after-free.

In fact, the m_pullup call is never reached: it is impossible for 'skip'
to be zero in this function, so add an XXX for now.


To generate a diff of this commit:
cvs rdiff -u -r1.43.2.3 -r1.43.2.4 src/sys/netipsec/ipsec_input.c

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

Modified files:

Index: src/sys/netipsec/ipsec_input.c
diff -u src/sys/netipsec/ipsec_input.c:1.43.2.3 src/sys/netipsec/ipsec_input.c:1.43.2.4
--- src/sys/netipsec/ipsec_input.c:1.43.2.3	Tue Mar  6 09:21:35 2018
+++ src/sys/netipsec/ipsec_input.c	Fri Mar 30 11:45:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.43.2.3 2018/03/06 09:21:35 martin Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.43.2.4 2018/03/30 11:45:58 martin Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $	*/
 /*	$OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $	*/
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.43.2.3 2018/03/06 09:21:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.43.2.4 2018/03/30 11:45:58 martin Exp $");
 
 /*
  * IPsec input processing.
@@ -370,6 +370,7 @@ cantpull:
 		ip->ip_sum = 0;
 		ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
 	} else {
+		/* XXX this branch is never taken */
 		ip = mtod(m, struct ip *);
 	}
 
@@ -381,6 +382,7 @@ cantpull:
 	m = ipsec4_fixup_checksum(m);
 	if (m == NULL)
 		goto cantpull;
+	ip = mtod(m, struct ip *);
 
 	prot = ip->ip_p;
 



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:43:00 UTC 2018

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

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

sys/netinet6/raw_ip6.c: revision 1.161

Fix use-after-free, the first m_copyback_cow may have freed the mbuf, so
it is wrong to read ip6->ip6_nxt.


To generate a diff of this commit:
cvs rdiff -u -r1.157.2.2 -r1.157.2.3 src/sys/netinet6/raw_ip6.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/raw_ip6.c
diff -u src/sys/netinet6/raw_ip6.c:1.157.2.2 src/sys/netinet6/raw_ip6.c:1.157.2.3
--- src/sys/netinet6/raw_ip6.c:1.157.2.2	Tue Jan 30 18:21:09 2018
+++ src/sys/netinet6/raw_ip6.c	Fri Mar 30 11:42:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip6.c,v 1.157.2.2 2018/01/30 18:21:09 martin Exp $	*/
+/*	$NetBSD: raw_ip6.c,v 1.157.2.3 2018/03/30 11:42:59 martin Exp $	*/
 /*	$KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.157.2.2 2018/01/30 18:21:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.157.2.3 2018/03/30 11:42:59 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -481,6 +481,7 @@ rip6_output(struct mbuf *m, struct socke
 
 	if (so->so_proto->pr_protocol == IPPROTO_ICMPV6 ||
 	in6p->in6p_cksum != -1) {
+		const uint8_t nxt = ip6->ip6_nxt;
 		int off;
 		u_int16_t sum;
 
@@ -502,7 +503,7 @@ rip6_output(struct mbuf *m, struct socke
 			error = ENOBUFS;
 			goto bad;
 		}
-		sum = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen);
+		sum = in6_cksum(m, nxt, sizeof(*ip6), plen);
 		m = m_copyback_cow(m, off, sizeof(sum), (void *),
 		M_DONTWAIT);
 		if (m == NULL) {



CVS commit: [pgoyette-compat] src/sys/compat/common

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 11:29:53 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_mod.c

Log Message:
Update list of modules which are included in the monolithic compat_netbsd
module.


To generate a diff of this commit:
cvs rdiff -u -r1.24.14.28 -r1.24.14.29 src/sys/compat/common/compat_mod.c

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

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.28 src/sys/compat/common/compat_mod.c:1.24.14.29
--- src/sys/compat/common/compat_mod.c:1.24.14.28	Fri Mar 30 11:18:34 2018
+++ src/sys/compat/common/compat_mod.c	Fri Mar 30 11:29:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.28 2018/03/30 11:18:34 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.29 2018/03/30 11:29:53 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.28 2018/03/30 11:18:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.29 2018/03/30 11:29:53 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -78,7 +78,7 @@ static struct sysctllog *compat_clog = N
 
 static const char * const compat_includes[] = {
 	"compat_80", "compat_70", "compat_60", "compat_50", "compat_40",
-	"compat_30", "compat_20",
+	"compat_30", "compat_20", "compat_16", "compat_14", "compat_13",
 	NULL
 };
 



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:23:20 UTC 2018

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

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

sys/netinet6/dest6.c: revision 1.21

Fix the calculation of the ICMP6 error pointer. It is not correct to use

pointer = opt - mtod(m, u_int8_t *)

because m may have gone through m_pulldown, and it is possible that
m->m_data is no longer the beginning of the packet.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.8.1 src/sys/netinet6/dest6.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/dest6.c
diff -u src/sys/netinet6/dest6.c:1.20 src/sys/netinet6/dest6.c:1.20.8.1
--- src/sys/netinet6/dest6.c:1.20	Wed Jan 11 13:08:29 2017
+++ src/sys/netinet6/dest6.c	Fri Mar 30 11:23:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: dest6.c,v 1.20 2017/01/11 13:08:29 ozaki-r Exp $	*/
+/*	$NetBSD: dest6.c,v 1.20.8.1 2018/03/30 11:23:20 martin Exp $	*/
 /*	$KAME: dest6.c,v 1.25 2001/02/22 01:39:16 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dest6.c,v 1.20 2017/01/11 13:08:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dest6.c,v 1.20.8.1 2018/03/30 11:23:20 martin Exp $");
 
 #include 
 #include 
@@ -56,7 +56,7 @@ int
 dest6_input(struct mbuf **mp, int *offp, int proto)
 {
 	struct mbuf *m = *mp;
-	int off = *offp, dstoptlen, optlen;
+	int off = *offp, erroff, dstoptlen, optlen;
 	struct ip6_dest *dstopts;
 	u_int8_t *opt;
 
@@ -89,8 +89,8 @@ dest6_input(struct mbuf **mp, int *offp,
 			optlen = *(opt + 1) + 2;
 			break;
 		default:		/* unknown option */
-			optlen = ip6_unknown_opt(opt, m,
-			opt - mtod(m, u_int8_t *));
+			erroff = *offp + (opt - (u_int8_t *)dstopts);
+			optlen = ip6_unknown_opt(opt, m, erroff);
 			if (optlen == -1)
 return (IPPROTO_DONE);
 			optlen += 2;
@@ -99,9 +99,9 @@ dest6_input(struct mbuf **mp, int *offp,
 	}
 
 	*offp = off;
-	return (dstopts->ip6d_nxt);
+	return dstopts->ip6d_nxt;
 
-  bad:
+bad:
 	m_freem(m);
-	return (IPPROTO_DONE);
+	return IPPROTO_DONE;
 }



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:19:45 UTC 2018

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

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

sys/netinet6/frag6.c: revision 1.64

Kick zero-sized fragments. We can't allow them to enter; two fragments
could be put at the same offset.


To generate a diff of this commit:
cvs rdiff -u -r1.60.6.2 -r1.60.6.3 src/sys/netinet6/frag6.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/frag6.c
diff -u src/sys/netinet6/frag6.c:1.60.6.2 src/sys/netinet6/frag6.c:1.60.6.3
--- src/sys/netinet6/frag6.c:1.60.6.2	Tue Jan 30 18:21:09 2018
+++ src/sys/netinet6/frag6.c	Fri Mar 30 11:19:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frag6.c,v 1.60.6.2 2018/01/30 18:21:09 martin Exp $	*/
+/*	$NetBSD: frag6.c,v 1.60.6.3 2018/03/30 11:19:45 martin Exp $	*/
 /*	$KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.60.6.2 2018/01/30 18:21:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.60.6.3 2018/03/30 11:19:45 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -152,13 +152,14 @@ frag6_input(struct mbuf **mp, int *offp,
 	}
 
 	/*
-	 * check whether fragment packet's fragment length is
+	 * Check whether fragment packet's fragment length is non-zero and
 	 * multiple of 8 octets.
 	 * sizeof(struct ip6_frag) == 8
 	 * sizeof(struct ip6_hdr) = 40
 	 */
 	if ((ip6f->ip6f_offlg & IP6F_MORE_FRAG) &&
-	(((ntohs(ip6->ip6_plen) - offset) & 0x7) != 0)) {
+	(((ntohs(ip6->ip6_plen) - offset) == 0) ||
+	 ((ntohs(ip6->ip6_plen) - offset) & 0x7) != 0)) {
 		icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
 		offsetof(struct ip6_hdr, ip6_plen));
 		in6_ifstat_inc(dstifp, ifs6_reass_fail);



CVS commit: [pgoyette-compat] src

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 11:18:34 UTC 2018

Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi
src/sys/compat/common [pgoyette-compat]: compat_mod.c compat_mod.h
files.common kern_sig_13.c
src/sys/modules [pgoyette-compat]: Makefile
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_13_mod.c
src/sys/modules/compat_13 [pgoyette-compat]: Makefile

Log Message:
Add compat_13 module


To generate a diff of this commit:
cvs rdiff -u -r1.114.2.11 -r1.114.2.12 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_13_mod.c
cvs rdiff -u -r1.24.14.27 -r1.24.14.28 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.15 -r1.1.42.16 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.1.2.27 -r1.1.2.28 src/sys/compat/common/files.common
cvs rdiff -u -r1.20 -r1.20.56.1 src/sys/compat/common/kern_sig_13.c
cvs rdiff -u -r1.202.2.15 -r1.202.2.16 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_13/Makefile

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/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.114.2.11 src/distrib/sets/lists/modules/mi:1.114.2.12
--- src/distrib/sets/lists/modules/mi:1.114.2.11	Fri Mar 30 10:09:07 2018
+++ src/distrib/sets/lists/modules/mi	Fri Mar 30 11:18:34 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.11 2018/03/30 10:09:07 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.12 2018/03/30 11:18:34 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/compatbase-kernel-modules	kmod
 ./@MODULEDIR@/compat/compat.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/compat_13base-kernel-modules	kmod
+./@MODULEDIR@/compat_13/compat_13.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_14base-kernel-modules	kmod
 ./@MODULEDIR@/compat_14/compat_14.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_16base-kernel-modules	kmod

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.27 src/sys/compat/common/compat_mod.c:1.24.14.28
--- src/sys/compat/common/compat_mod.c:1.24.14.27	Fri Mar 30 10:09:07 2018
+++ src/sys/compat/common/compat_mod.c	Fri Mar 30 11:18:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.27 2018/03/30 10:09:07 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.28 2018/03/30 11:18:34 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.27 2018/03/30 10:09:07 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.28 2018/03/30 11:18:34 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -140,15 +140,6 @@ static const struct syscall_package comp
 	{ SYS_compat_12_stat12, 0, (sy_call_t *)compat_12_sys_stat },
 #endif
 
-#if defined(COMPAT_13)
-	{ SYS_compat_13_sigaction13, 0, (sy_call_t *)compat_13_sys_sigaction },
-	{ SYS_compat_13_sigaltstack13, 0, (sy_call_t *)compat_13_sys_sigaltstack },
-	{ SYS_compat_13_sigpending13, 0, (sy_call_t *)compat_13_sys_sigpending },
-	{ SYS_compat_13_sigprocmask13, 0, (sy_call_t *)compat_13_sys_sigprocmask },
-	{ SYS_compat_13_sigreturn13, 0, (sy_call_t *)compat_13_sys_sigreturn },
-	{ SYS_compat_13_sigsuspend13, 0, (sy_call_t *)compat_13_sys_sigsuspend },
-#endif
-
 	{ 0, 0, NULL },
 };
 
@@ -180,10 +171,10 @@ struct compat_init_fini {
 #ifdef COMPAT_14
 	{ compat_14_init, compat_14_fini },
 #endif
-#if 0	/* NOT YET */
 #ifdef COMPAT_13
 	{ compat_13_init, compat_13_fini },
 #endif
+#if 0	/* NOT YET */
 #ifdef COMPAT_12
 	{ compat_12_init, compat_12_fini },
 #endif
@@ -242,9 +233,6 @@ compat_modcmd(modcmd_t cmd, void *arg)
  * XXX */
 #endif
 #endif /* XXX NOTYET */
-#ifdef COMPAT_13
-		uvm_13_init();
-#endif
 #ifdef COMPAT_10
 		vfs_syscalls_10_init();
 #endif
@@ -255,9 +243,6 @@ compat_modcmd(modcmd_t cmd, void *arg)
 #ifdef COMPAT_10
 		vfs_syscalls_10_fini();
 #endif
-#ifdef COMPAT_13
-		uvm_13_fini();
-#endif
 		/* Unlink the system calls. */
 		error = syscall_disestablish(NULL, compat_syscalls);
 		if (error != 0) {

Index: src/sys/compat/common/compat_mod.h
diff -u src/sys/compat/common/compat_mod.h:1.1.42.15 src/sys/compat/common/compat_mod.h:1.1.42.16
--- src/sys/compat/common/compat_mod.h:1.1.42.15	Fri Mar 30 10:09:07 2018
+++ src/sys/compat/common/compat_mod.h	Fri Mar 30 11:18:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.h,v 1.1.42.15 2018/03/30 10:09:07 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.h,v 1.1.42.16 2018/03/30 11:18:34 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -130,4 +130,13 @@ void rtsock_14_init(void);
 void rtsock_14_fini(void);
 #endif
 
+#ifdef COMPAT_13

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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:17:19 UTC 2018

Modified Files:
src/sys/netinet [netbsd-8]: tcp_input.c

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

sys/netinet/tcp_input.c: revision 1.383 (via patch)

Revert rev1.183 (2003).

It was intended as an optimization, but it increases the attack surface:

the IPsec policy is not enforced on RST packets when the socket is in the
LISTEN state, and an (unauthenticated) attacker could jam the connection
between two IPsec hosts by sending RST packets between the client's SYN
and ACK packets.

Discussed with ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.357.4.2 -r1.357.4.3 src/sys/netinet/tcp_input.c

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

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.357.4.2 src/sys/netinet/tcp_input.c:1.357.4.3
--- src/sys/netinet/tcp_input.c:1.357.4.2	Sat Oct 21 19:43:54 2017
+++ src/sys/netinet/tcp_input.c	Fri Mar 30 11:17:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.357.4.2 2017/10/21 19:43:54 snj Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.357.4.3 2018/03/30 11:17:19 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.357.4.2 2017/10/21 19:43:54 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.357.4.3 2018/03/30 11:17:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1475,16 +1475,12 @@ findpcb:
 		}
 #if defined(IPSEC)
 		if (ipsec_used) {
-			if (inp &&
-			(inp->inp_socket->so_options & SO_ACCEPTCONN) == 0
-			&& ipsec4_in_reject(m, inp)) {
+			if (inp && ipsec4_in_reject(m, inp)) {
 IPSEC_STATINC(IPSEC_STAT_IN_POLVIO);
 goto drop;
 			}
 #ifdef INET6
-			else if (in6p &&
-			(in6p->in6p_socket->so_options & SO_ACCEPTCONN) == 0
-			&& ipsec6_in_reject(m, in6p)) {
+			else if (in6p && ipsec6_in_reject(m, in6p)) {
 IPSEC_STATINC(IPSEC_STAT_IN_POLVIO);
 goto drop;
 			}
@@ -1520,9 +1516,7 @@ findpcb:
 			goto dropwithreset_ratelim;
 		}
 #if defined(IPSEC)
-		if (ipsec_used && in6p
-		&& (in6p->in6p_socket->so_options & SO_ACCEPTCONN) == 0
-		&& ipsec6_in_reject(m, in6p)) {
+		if (ipsec_used && in6p && ipsec6_in_reject(m, in6p)) {
 			IPSEC6_STATINC(IPSEC_STAT_IN_POLVIO);
 			goto drop;
 		}
@@ -1830,39 +1824,6 @@ findpcb:
 }
 #endif
 
-#if defined(IPSEC)
-if (ipsec_used) {
-	switch (af) {
-#ifdef INET
-	case AF_INET:
-		/*
-		 * inp can be NULL when
-		 * receiving an IPv4 packet on
-		 * an IPv4-mapped IPv6 address.
-		 */
-		KASSERT(inp == NULL ||
-		sotoinpcb(so) == inp);
-		if (!ipsec4_in_reject(m, inp))
-			break;
-		IPSEC_STATINC(
-		IPSEC_STAT_IN_POLVIO);
-		tp = NULL;
-		goto dropwithreset;
-#endif
-#ifdef INET6
-	case AF_INET6:
-		KASSERT(sotoin6pcb(so) == in6p);
-		if (!ipsec6_in_reject(m, in6p))
-			break;
-		IPSEC6_STATINC(
-		IPSEC_STAT_IN_POLVIO);
-		tp = NULL;
-		goto dropwithreset;
-#endif /*INET6*/
-	}
-}
-#endif /*IPSEC*/
-
 /*
  * LISTEN socket received a SYN
  * from itself?  This can't possibly



CVS commit: [pgoyette-compat] src/sys/modules/compat_20

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 11:15:25 UTC 2018

Added Files:
src/sys/modules/compat_20 [pgoyette-compat]: Makefile

Log Message:
Forgot to commit this previously.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_20/Makefile

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

Added files:

Index: src/sys/modules/compat_20/Makefile
diff -u /dev/null src/sys/modules/compat_20/Makefile:1.1.2.1
--- /dev/null	Fri Mar 30 11:15:25 2018
+++ src/sys/modules/compat_20/Makefile	Fri Mar 30 11:15:25 2018
@@ -0,0 +1,15 @@
+#	$NetBSD: Makefile,v 1.1.2.1 2018/03/30 11:15:25 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH:	${S}/compat/common
+
+KMOD=	compat_20
+
+CPPFLAGS+=	-DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+=	-DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+=	compat_20_mod.c
+SRCS+=	vfs_syscalls_20.c  ieee80211_20.c if43_20.c
+
+.include 



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:12:15 UTC 2018

Modified Files:
src/sys/netinet [netbsd-8]: ip_encap.c

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

sys/netinet/ip_encap.c: revision 1.67

Fix memory leak, found by Mootja.


To generate a diff of this commit:
cvs rdiff -u -r1.65.2.1 -r1.65.2.2 src/sys/netinet/ip_encap.c

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

Modified files:

Index: src/sys/netinet/ip_encap.c
diff -u src/sys/netinet/ip_encap.c:1.65.2.1 src/sys/netinet/ip_encap.c:1.65.2.2
--- src/sys/netinet/ip_encap.c:1.65.2.1	Sun Dec 10 09:41:31 2017
+++ src/sys/netinet/ip_encap.c	Fri Mar 30 11:12:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_encap.c,v 1.65.2.1 2017/12/10 09:41:31 snj Exp $	*/
+/*	$NetBSD: ip_encap.c,v 1.65.2.2 2018/03/30 11:12:15 martin Exp $	*/
 /*	$KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $	*/
 
 /*
@@ -68,7 +68,7 @@
 #define USE_RADIX
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.65.2.1 2017/12/10 09:41:31 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.65.2.2 2018/03/30 11:12:15 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -822,7 +822,7 @@ encap_attach_func(int af, int proto,
 
 	error = encap_add(ep);
 	if (error)
-		goto fail;
+		goto gc;
 
 	error = 0;
 #ifndef ENCAP_MPSAFE
@@ -830,6 +830,8 @@ encap_attach_func(int af, int proto,
 #endif
 	return ep;
 
+gc:
+	kmem_free(ep, sizeof(*ep));
 fail:
 #ifndef ENCAP_MPSAFE
 	splx(s);



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:10:14 UTC 2018

Modified Files:
src/sys/netinet [netbsd-8]: ip_reass.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #668):
sys/netinet/ip_reass.c: revision 1.12

Add one more check in ip_reass_packet(): make sure that the end of each
fragment does not exceed IP_MAXPACKET.

In ip_reass(), we only check the final length of the reassembled packet
against IP_MAXPACKET.

But there is an integer overflow that can happen a little earlier. We
are doing:

i = ntohs(p->ipqe_ip->ip_off) + ntohs(p->ipqe_ip->ip_len) -
ntohs(ip->ip_off);
[...]
ip->ip_off = htons(ntohs(ip->ip_off) + i);

It is possible that

ntohs(p->ipqe_ip->ip_off) + ntohs(p->ipqe_ip->ip_len) > 65535

so the computation of ip_off wraps to zero. This breaks an assumption in
the reassembler - it expects the list of fragments to be ordered by
offset, and here it's not ordered anymore. (Un)Fortunately I couldn't
turn this into anything exploitable.

With the new check, it is guaranteed that ip_off+ip_len<=65535.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/netinet/ip_reass.c

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

Modified files:

Index: src/sys/netinet/ip_reass.c
diff -u src/sys/netinet/ip_reass.c:1.11 src/sys/netinet/ip_reass.c:1.11.8.1
--- src/sys/netinet/ip_reass.c:1.11	Wed Jan 11 13:08:29 2017
+++ src/sys/netinet/ip_reass.c	Fri Mar 30 11:10:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_reass.c,v 1.11 2017/01/11 13:08:29 ozaki-r Exp $	*/
+/*	$NetBSD: ip_reass.c,v 1.11.8.1 2018/03/30 11:10:14 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.11 2017/01/11 13:08:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.11.8.1 2018/03/30 11:10:14 martin Exp $");
 
 #include 
 #include 
@@ -629,6 +629,11 @@ ip_reass_packet(struct mbuf **m0, struct
 		return EINVAL;
 	}
 
+	if (off + len > IP_MAXPACKET) {
+		IP_STATINC(IP_STAT_BADFRAGS);
+		return EINVAL;
+	}
+
 	/*
 	 * Fragment length and MF flag.  Make sure that fragments have
 	 * a data length which is non-zero and multiple of 8 bytes.



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

2018-03-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 30 11:07:12 UTC 2018

Modified Files:
src/usr.sbin/makefs/cd9660 [netbsd-8]: cd9660_eltorito.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #660):
usr.sbin/makefs/cd9660/cd9660_eltorito.c: revision 1.22
usr.sbin/makefs/cd9660/cd9660_eltorito.c: revision 1.23

Initialize boot_catalog_entry's entry_type properly.

This had been missing but the type was used in cd9660_setup_boot().
>From OpenBSD usr.sbin/makefs/cd9660/cd9660_eltorito.c r1.10.

Correctly mark the last El Torito section header.
Pointed out by Benno Rice via DM.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.4.1 src/usr.sbin/makefs/cd9660/cd9660_eltorito.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/makefs/cd9660/cd9660_eltorito.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.21 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.21.4.1
--- src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.21	Tue Jan 24 11:22:43 2017
+++ src/usr.sbin/makefs/cd9660/cd9660_eltorito.c	Fri Mar 30 11:07:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_eltorito.c,v 1.21 2017/01/24 11:22:43 nonaka Exp $	*/
+/*	$NetBSD: cd9660_eltorito.c,v 1.21.4.1 2018/03/30 11:07:12 martin Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -40,7 +40,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_eltorito.c,v 1.21 2017/01/24 11:22:43 nonaka Exp $");
+__RCSID("$NetBSD: cd9660_eltorito.c,v 1.21.4.1 2018/03/30 11:07:12 martin Exp $");
 #endif  /* !__lint */
 
 #ifdef DEBUG
@@ -247,6 +247,7 @@ cd9660_boot_setup_validation_entry(char 
 	size_t i;
 	entry = cd9660_init_boot_catalog_entry();
 
+	entry->entry_type = ET_ENTRY_VE;
 	ve = >entry_data.VE;
 
 	ve->header_id[0] = 1;
@@ -281,6 +282,7 @@ cd9660_boot_setup_default_entry(struct c
 	if (default_entry == NULL)
 		return NULL;
 
+	default_entry->entry_type = ET_ENTRY_IE;
 	ie = _entry->entry_data.IE;
 
 	ie->boot_indicator[0] = disk->bootable;
@@ -308,6 +310,7 @@ cd9660_boot_setup_section_head(char plat
 	if (entry == NULL)
 		return NULL;
 
+	entry->entry_type = ET_ENTRY_SH;
 	sh = >entry_data.SH;
 	/* More by default. The last one will manually be set to 0x91 */
 	sh->header_indicator[0] = ET_SECTION_HEADER_MORE;
@@ -324,6 +327,7 @@ cd9660_boot_setup_section_entry(struct c
 	if ((entry = cd9660_init_boot_catalog_entry()) == NULL)
 		return NULL;
 
+	entry->entry_type = ET_ENTRY_SE;
 	se = >entry_data.SE;
 
 	se->boot_indicator[0] = ET_BOOTABLE;
@@ -493,6 +497,12 @@ cd9660_setup_boot(iso9660_disk *diskStru
 		LIST_INSERT_AFTER(head, temp, ll_struct);
 	}
 
+	/* Find the last Section Header entry and mark it as the last. */
+	head = NULL;
+	LIST_FOREACH(next, >boot_entries, ll_struct) {
+		if (next->entry_type == ET_ENTRY_SH)
+			head = next;
+	}
 	if (head != NULL)
 		head->entry_data.SH.header_indicator[0] = ET_SECTION_HEADER_LAST;
 



CVS commit: [pgoyette-compat] src

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 10:09:08 UTC 2018

Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi
src/sys/arch/amd64/amd64 [pgoyette-compat]: locore.S
src/sys/arch/amd64/conf [pgoyette-compat]: GENERIC
src/sys/compat/common [pgoyette-compat]: compat_mod.c compat_mod.h
files.common rtsock_14.c
src/sys/kern [pgoyette-compat]: compat_stub.c
src/sys/modules [pgoyette-compat]: Makefile
src/sys/net [pgoyette-compat]: rtsock.c
src/sys/sys [pgoyette-compat]: compat_stub.h
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_14_mod.c
src/sys/modules/compat_14 [pgoyette-compat]: Makefile

Log Message:
Extract compat_14 stuff into its own module


To generate a diff of this commit:
cvs rdiff -u -r1.114.2.10 -r1.114.2.11 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.157.2.2 -r1.157.2.3 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.485.2.2 -r1.485.2.3 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_14_mod.c
cvs rdiff -u -r1.24.14.26 -r1.24.14.27 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.14 -r1.1.42.15 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.1.2.26 -r1.1.2.27 src/sys/compat/common/files.common
cvs rdiff -u -r1.5 -r1.5.14.1 src/sys/compat/common/rtsock_14.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.202.2.14 -r1.202.2.15 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_14/Makefile
cvs rdiff -u -r1.238.2.2 -r1.238.2.3 src/sys/net/rtsock.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/sys/compat_stub.h

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/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.114.2.10 src/distrib/sets/lists/modules/mi:1.114.2.11
--- src/distrib/sets/lists/modules/mi:1.114.2.10	Fri Mar 30 05:35:47 2018
+++ src/distrib/sets/lists/modules/mi	Fri Mar 30 10:09:07 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.10 2018/03/30 05:35:47 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.11 2018/03/30 10:09:07 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/compatbase-kernel-modules	kmod
 ./@MODULEDIR@/compat/compat.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/compat_14base-kernel-modules	kmod
+./@MODULEDIR@/compat_14/compat_14.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_16base-kernel-modules	kmod
 ./@MODULEDIR@/compat_16/compat_16.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_20base-kernel-modules	kmod

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.157.2.2 src/sys/arch/amd64/amd64/locore.S:1.157.2.3
--- src/sys/arch/amd64/amd64/locore.S:1.157.2.2	Fri Mar 30 06:20:11 2018
+++ src/sys/arch/amd64/amd64/locore.S	Fri Mar 30 10:09:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.157.2.2 2018/03/30 06:20:11 pgoyette Exp $	*/
+/*	$NetBSD: locore.S,v 1.157.2.3 2018/03/30 10:09:07 pgoyette Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1102,9 +1102,11 @@ ENTRY(cpu_switchto)
 	movq	%r12,%rsi
 #endif
 
+#ifndef XEN
 	pushq	%rdx
 	callq	_C_LABEL(speculation_barrier)
 	popq	%rdx
+#endif
 
 	/* Switch to newlwp's stack. */
 	movq	L_PCB(%r12),%r14

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.485.2.2 src/sys/arch/amd64/conf/GENERIC:1.485.2.3
--- src/sys/arch/amd64/conf/GENERIC:1.485.2.2	Fri Mar 30 06:20:11 2018
+++ src/sys/arch/amd64/conf/GENERIC	Fri Mar 30 10:09:07 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.485.2.2 2018/03/30 06:20:11 pgoyette Exp $
+# $NetBSD: GENERIC,v 1.485.2.3 2018/03/30 10:09:07 pgoyette 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.485.2.2 $"
+#ident		"GENERIC-$Revision: 1.485.2.3 $"
 
 maxusers	64		# estimated number of users
 
@@ -124,7 +124,7 @@ options 	KDTRACE_HOOKS	# kernel DTrace h
 # NetBSD backward compatibility. Support goes from COMPAT_15 up until
 # the latest release. Note that really old compat (< COMPAT_16) is only
 # useful for 32-bit i386 binaries.
-include 	"conf/compat_netbsd15.config"
+include 	"conf/compat_netbsd09.config"	# XXX PRG XXX usually 15
 
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.26 src/sys/compat/common/compat_mod.c:1.24.14.27
--- src/sys/compat/common/compat_mod.c:1.24.14.26	Fri Mar 30 05:35:47 2018
+++ src/sys/compat/common/compat_mod.c	Fri Mar 30 10:09:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.26 2018/03/30 05:35:47 pgoyette Exp $	*/
+/*	

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

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 10:01:36 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf

Log Message:
Fix warning when compiling Xen; FLAT_RING3_CS64 is defined in a child of
xen.h, which is already included in genassym.cf. So don't redefine it.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/amd64/genassym.cf

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/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.67 src/sys/arch/amd64/amd64/genassym.cf:1.68
--- src/sys/arch/amd64/amd64/genassym.cf:1.67	Thu Jan 18 07:25:34 2018
+++ src/sys/arch/amd64/amd64/genassym.cf	Fri Mar 30 10:01:36 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.67 2018/01/18 07:25:34 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.68 2018/03/30 10:01:36 maxv Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -358,7 +358,6 @@ define EVTCHN_UPCALL_MASK	offsetof(struc
 define XEN_PT_BASE		offsetof(struct start_info, pt_base)
 define XEN_NR_PT_FRAMES		offsetof(struct start_info, nr_pt_frames)
 define __HYPERVISOR_iret	__HYPERVISOR_iret
-define FLAT_RING3_CS64		FLAT_RING3_CS64
 endif
 
 define	NKL4_KIMG_ENTRIES	NKL4_KIMG_ENTRIES



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

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 09:53:08 UTC 2018

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

Log Message:
Add #ifndef XEN, xen doesn't have speculation_barrier.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/amd64/amd64/locore.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.162 src/sys/arch/amd64/amd64/locore.S:1.163
--- src/sys/arch/amd64/amd64/locore.S:1.162	Thu Mar 29 07:21:24 2018
+++ src/sys/arch/amd64/amd64/locore.S	Fri Mar 30 09:53:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.162 2018/03/29 07:21:24 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.163 2018/03/30 09:53:08 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1102,9 +1102,11 @@ ENTRY(cpu_switchto)
 	movq	%r12,%rsi
 #endif
 
+#ifndef XEN
 	pushq	%rdx
 	callq	_C_LABEL(speculation_barrier)
 	popq	%rdx
+#endif
 
 	/* Switch to newlwp's stack. */
 	movq	L_PCB(%r12),%r14



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

2018-03-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 30 09:30:57 UTC 2018

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

Log Message:
Add Some bit definitions of AMD Fn8001 %edx:
 - MMX
 - FXSR


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 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.118 src/sys/arch/x86/include/specialreg.h:1.119
--- src/sys/arch/x86/include/specialreg.h:1.118	Fri Mar 30 09:28:37 2018
+++ src/sys/arch/x86/include/specialreg.h	Fri Mar 30 09:30:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.118 2018/03/30 09:28:37 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.119 2018/03/30 09:30:56 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -498,6 +498,8 @@
 #define CPUID_MPC	0x0008	/* Multiprocessing Capable */
 #define CPUID_NOX	0x0010	/* No Execute Page Protection */
 #define CPUID_MMXX	0x0040	/* AMD MMX Extensions */
+/*	CPUID_MMX			   MMX supported */
+/*	CPUID_FXSR			   fast FP/MMX save/restore */
 #define CPUID_FFXSR	0x0200	/* FXSAVE/FXSTOR Extensions */
 /*	CPUID_P1GB			   1GB Large Page Support */
 /*	CPUID_RDTSCP			   Read TSC Pair Instruction */
@@ -506,9 +508,11 @@
 #define CPUID_3DNOW	0x8000	/* 3DNow! Instructions */
 
 #define CPUID_EXT_FLAGS	"\20" \
-	"\14" "SYSCALL/SYSRET"		"\24" "MPC"	"\25" "NOX" \
-	"\27" "MMXX"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP" \
-	"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
+		"\14" "SYSCALL/SYSRET"	\
+			"\24" "MPC"	\
+	"\25" "NOX"			"\27" "MMXX"	"\30" "MMX"	\
+	"\31" "FXSR"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP"	\
+			"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
 
 /* AMD Fn8001 extended features - %ecx */
 /* 	CPUID_LAHF			   LAHF/SAHF instruction */



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

2018-03-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 30 09:28:37 UTC 2018

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

Log Message:
>From the latest Intel SDM:
- Add Intel Fn_0006 %eax new bit 14-20 (HWP stuff).
- Intel Fn_0007 %ecx bit 22 is for both RDPID and IA32_TSC_AUX.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 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.117 src/sys/arch/x86/include/specialreg.h:1.118
--- src/sys/arch/x86/include/specialreg.h:1.117	Wed Mar 14 15:03:16 2018
+++ src/sys/arch/x86/include/specialreg.h	Fri Mar 30 09:28:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.117 2018/03/14 15:03:16 maxv Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.118 2018/03/30 09:28:37 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -300,12 +300,19 @@
 #define CPUID_DSPM_HWP_PLR __BIT(11)	/* HWP Package Level Request */
 #define CPUID_DSPM_HDC	__BIT(13)	/* Hardware Duty Cycling */
 #define CPUID_DSPM_TBMT3 __BIT(14)	/* Turbo Boost Max Technology 3.0 */
+#define CPUID_DSPM_HWP_CAP__BIT(15)	/* HWP Capabilities */
+#define CPUID_DSPM_HWP_PECI   __BIT(16)	/* HWP PECI override */
+#define CPUID_DSPM_HWP_FLEX   __BIT(17)	/* Flexible HWP */
+#define CPUID_DSPM_HWP_FAST   __BIT(18)	/* Fast access for IA32_HWP_REQUEST */
+#define CPUID_DSPM_HWP_IGNIDL __BIT(20)	/* Ignore Idle Logical Processor HWP */
 
 #define CPUID_DSPM_FLAGS	"\20" \
 	"\1" "DTS"	"\2" "IDA"	"\3" "ARAT" 			\
 	"\5" "PLN"	"\6" "ECMD"	"\7" "PTM"	"\10" "HWP"	\
 	"\11" "HWP_NOTIFY" "\12" "HWP_ACTWIN" "\13" "HWP_EPP" "\14" "HWP_PLR" \
-			"\16" "HDC"	"\17" "TBM3"
+			"\16" "HDC"	"\17" "TBM3"	"\20" "HWP_CAP" \
+	"\21" "HWP_PECI" "\22" "HWP_FLEX" "\23" "HWP_FAST"		\
+	"25" "HWP_IGNIDL"
 
 /*
  * Intel Digital Thermal Sensor and
@@ -381,7 +388,7 @@
 #define CPUID_SEF_AVX512_VNNI	__BIT(11) /* Vector neural Network Instruction */
 #define CPUID_SEF_AVX512_BITALG	__BIT(12)
 #define CPUID_SEF_AVX512_VPOPCNTDQ __BIT(14)
-#define CPUID_SEF_RDPID		__BIT(22) /* ReaD Processor ID */
+#define CPUID_SEF_RDPID		__BIT(22) /* RDPID and IA32_TSC_AUX */
 #define CPUID_SEF_SGXLC		__BIT(30) /* SGX Launch Configuration */
 
 #define CPUID_SEF_FLAGS1	"\20" \



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

2018-03-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 30 09:24:40 UTC 2018

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

Log Message:
>From the latest Intel SDM:
- Add Xeon Phi 7215, 7285 and 7295
- Add Coffee Lake


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/usr.sbin/cpuctl/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/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.83 src/usr.sbin/cpuctl/arch/i386.c:1.84
--- src/usr.sbin/cpuctl/arch/i386.c:1.83	Fri Mar  9 08:49:32 2018
+++ src/usr.sbin/cpuctl/arch/i386.c	Fri Mar 30 09:24:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.83 2018/03/09 08:49:32 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.84 2018/03/30 09:24:40 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.83 2018/03/09 08:49:32 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.84 2018/03/30 09:24:40 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -381,9 +381,9 @@ const struct cpu_cpuid_nameclass i386_cp
 [0x5f] = "Atom (Goldmont, Denverton)",
 [0x66] = "Future Core (Cannon Lake)",
 [0x7a] = "Atom (Goldmont Plus)",
-[0x85] = "Future Xeon Phi (Knights Mill)",
-[0x8e] = "7th gen Core (Kaby Lake)",
-[0x9e] = "7th gen Core (Kaby Lake)",
+[0x85] = "Xeon Phi 7215, 7285, 7295 (Knights Mill)",
+[0x8e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake)",
+[0x9e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake)",
 			},
 			"Pentium Pro, II or III",	/* Default */
 			NULL,



CVS commit: src/sys/netinet

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 08:57:32 UTC 2018

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

Log Message:
Remove dead code. It was introduced in rev1 (25 years ago), and is
irrelevant today.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/netinet/tcp_output.c

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

Modified files:

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.201 src/sys/netinet/tcp_output.c:1.202
--- src/sys/netinet/tcp_output.c:1.201	Fri Mar 30 08:53:51 2018
+++ src/sys/netinet/tcp_output.c	Fri Mar 30 08:57:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.201 2018/03/30 08:53:51 maxv Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.202 2018/03/30 08:57:32 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.201 2018/03/30 08:53:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.202 2018/03/30 08:57:32 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -194,10 +194,6 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_output.c
 #include 
 #include 
 
-#ifdef notyet
-extern struct mbuf *m_copypack();
-#endif
-
 /*
  * Knob to enable Congestion Window Monitoring, and control
  * the burst size it allows.  Default burst is 4 packets, per
@@ -428,16 +424,7 @@ tcp_build_datapkt(struct tcpcb *tp, stru
 		tcps[TCP_STAT_SNDBYTE] += len;
 	}
 	TCP_STAT_PUTREF();
-#ifdef notyet
-	if ((m = m_copypack(so->so_snd.sb_mb, off,
-	(int)len, max_linkhdr + hdrlen)) == 0)
-		return ENOBUFS;
-	/*
-	 * m_copypack left space for our hdr; use it.
-	 */
-	m->m_len += hdrlen;
-	m->m_data -= hdrlen;
-#else
+
 	MGETHDR(m, M_DONTWAIT, MT_HEADER);
 	if (__predict_false(m == NULL))
 		return ENOBUFS;
@@ -514,7 +501,6 @@ tcp_build_datapkt(struct tcpcb *tp, stru
 			TCP_OUTPUT_COUNTER_INCR(_output_copybig);
 #endif
 	}
-#endif
 
 	*mp = m;
 	return 0;



CVS commit: src/sys/netinet

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 08:53:51 UTC 2018

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

Log Message:
Style, use NULL for pointers, use KASSERT, and don't inline huge functions,
we want to debug them with DDB (and not just with GPROF).


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/netinet/tcp_output.c

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

Modified files:

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.200 src/sys/netinet/tcp_output.c:1.201
--- src/sys/netinet/tcp_output.c:1.200	Thu Mar 29 07:46:43 2018
+++ src/sys/netinet/tcp_output.c	Fri Mar 30 08:53:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.200 2018/03/29 07:46:43 maxv Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.201 2018/03/30 08:53:51 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.200 2018/03/29 07:46:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.201 2018/03/30 08:53:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -227,11 +227,7 @@ extern struct evcnt tcp_output_refbig;
 
 #endif /* TCP_OUTPUT_COUNTERS */
 
-static
-#ifndef GPROF
-inline
-#endif
-int
+static int
 tcp_segsize(struct tcpcb *tp, int *txsegsizep, int *rxsegsizep,
 bool *alwaysfragp)
 {
@@ -248,10 +244,8 @@ tcp_segsize(struct tcpcb *tp, int *txseg
 
 	*alwaysfragp = false;
 
-#ifdef DIAGNOSTIC
-	if (tp->t_inpcb && tp->t_in6pcb)
-		panic("tcp_segsize: both t_inpcb and t_in6pcb are set");
-#endif
+	KASSERT(!(tp->t_inpcb && tp->t_in6pcb));
+
 	switch (tp->t_family) {
 	case AF_INET:
 		hdrlen = sizeof(struct ip) + sizeof(struct tcphdr);
@@ -372,7 +366,7 @@ tcp_segsize(struct tcpcb *tp, int *txseg
 
 	/* there may not be any room for data if mtu is too small */
 	if (size < 0)
-		return (EMSGSIZE);
+		return EMSGSIZE;
 
 	/*
 	 * *rxsegsizep holds *estimated* inbound segment size (estimation
@@ -412,14 +406,10 @@ tcp_segsize(struct tcpcb *tp, int *txseg
 		tp->t_segsz = *txsegsizep;
 	}
 
-	return (0);
+	return 0;
 }
 
-static
-#ifndef GPROF
-inline
-#endif
-int
+static int
 tcp_build_datapkt(struct tcpcb *tp, struct socket *so, int off,
 long len, int hdrlen, struct mbuf **mp)
 {
@@ -441,7 +431,7 @@ tcp_build_datapkt(struct tcpcb *tp, stru
 #ifdef notyet
 	if ((m = m_copypack(so->so_snd.sb_mb, off,
 	(int)len, max_linkhdr + hdrlen)) == 0)
-		return (ENOBUFS);
+		return ENOBUFS;
 	/*
 	 * m_copypack left space for our hdr; use it.
 	 */
@@ -450,7 +440,7 @@ tcp_build_datapkt(struct tcpcb *tp, stru
 #else
 	MGETHDR(m, M_DONTWAIT, MT_HEADER);
 	if (__predict_false(m == NULL))
-		return (ENOBUFS);
+		return ENOBUFS;
 	MCLAIM(m, _tx_mowner);
 
 	/*
@@ -464,7 +454,7 @@ tcp_build_datapkt(struct tcpcb *tp, stru
 		MCLGET(m, M_DONTWAIT);
 		if ((m->m_flags & M_EXT) == 0) {
 			m_freem(m);
-			return (ENOBUFS);
+			return ENOBUFS;
 		}
 	}
 
@@ -508,26 +498,26 @@ tcp_build_datapkt(struct tcpcb *tp, stru
 	off = tp->t_inoff;
 
 	if (len <= M_TRAILINGSPACE(m)) {
-		m_copydata(m0, off, (int) len, mtod(m, char *) + hdrlen);
+		m_copydata(m0, off, (int)len, mtod(m, char *) + hdrlen);
 		m->m_len += len;
 		TCP_OUTPUT_COUNTER_INCR(_output_copysmall);
 	} else {
-		m->m_next = m_copym(m0, off, (int) len, M_DONTWAIT);
+		m->m_next = m_copym(m0, off, (int)len, M_DONTWAIT);
 		if (m->m_next == NULL) {
 			m_freem(m);
-			return (ENOBUFS);
+			return ENOBUFS;
 		}
 #ifdef TCP_OUTPUT_COUNTERS
 		if (m->m_next->m_flags & M_EXT)
 			TCP_OUTPUT_COUNTER_INCR(_output_refbig);
 		else
 			TCP_OUTPUT_COUNTER_INCR(_output_copybig);
-#endif /* TCP_OUTPUT_COUNTERS */
+#endif
 	}
 #endif
 
 	*mp = m;
-	return (0);
+	return 0;
 }
 
 /*
@@ -568,10 +558,8 @@ tcp_output(struct tcpcb *tp)
 #endif
 	uint64_t *tcps;
 
-#ifdef DIAGNOSTIC
-	if (tp->t_inpcb && tp->t_in6pcb)
-		panic("tcp_output: both t_inpcb and t_in6pcb are set");
-#endif
+	KASSERT(!(tp->t_inpcb && tp->t_in6pcb));
+
 	so = NULL;
 	ro = NULL;
 	if (tp->t_inpcb) {
@@ -594,19 +582,19 @@ tcp_output(struct tcpcb *tp)
 		if (tp->t_in6pcb)
 			break;
 #endif
-		return (EINVAL);
+		return EINVAL;
 #ifdef INET6
 	case AF_INET6:
 		if (tp->t_in6pcb)
 			break;
-		return (EINVAL);
+		return EINVAL;
 #endif
 	default:
-		return (EAFNOSUPPORT);
+		return EAFNOSUPPORT;
 	}
 
 	if (tcp_segsize(tp, , , ))
-		return (EMSGSIZE);
+		return EMSGSIZE;
 
 	idle = (tp->snd_max == tp->snd_una);
 
@@ -739,7 +727,7 @@ again:
 	 * now, and we previously incremented snd_cwnd in tcp_input().
 	 */
 	/*
-	 * Still in sack recovery , reset rxmit flag to zero.
+	 * Still in sack recovery, reset rxmit flag to zero.
 	 */
 	sack_rxmit = 0;
 	sack_bytes_rxmt = 0;
@@ -749,12 +737,12 @@ again:
 		long cwin;
 		if (!TCP_SACK_ENABLED(tp))
 			break;
-		if (tp->t_partialacks < 0) 
+		if (tp->t_partialacks < 0)
 			break;
 		p = tcp_sack_output(tp, _bytes_rxmt);
 

CVS commit: src/sys/arch/vax/vax

2018-03-30 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Fri Mar 30 08:34:35 UTC 2018

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
Allow allocation of PTE space to fail in pmap_enter if PMAP_CANFAIL is set.
This fixes the panic part of PR port-vax/28379.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.185 src/sys/arch/vax/vax/pmap.c:1.186
--- src/sys/arch/vax/vax/pmap.c:1.185	Mon May 22 16:53:05 2017
+++ src/sys/arch/vax/vax/pmap.c	Fri Mar 30 08:34:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.185 2017/05/22 16:53:05 ragge Exp $	   */
+/*	$NetBSD: pmap.c,v 1.186 2018/03/30 08:34:35 ragge Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.185 2017/05/22 16:53:05 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.186 2018/03/30 08:34:35 ragge Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -765,10 +765,8 @@ pmap_rmproc(struct pmap *pm)
 
 /*
  * Allocate space for user page tables, from ptemap.
- * This routine should never fail; use the same algorithm as when processes
- * are swapped.
  * Argument is needed space, in bytes.
- * Returns a pointer to the newly allocated space.
+ * Returns a pointer to the newly allocated space, or 0 if failed.
  */
 static vaddr_t
 pmap_getusrptes(pmap_t pm, vsize_t nsize)
@@ -781,9 +779,7 @@ pmap_getusrptes(pmap_t pm, vsize_t nsize
 #endif
 	while (((rv = pmap_extwrap(nsize)) == 0) && (pmap_rmproc(pm) != 0))
 		;
-	if (rv)
-		return rv;
-	panic("usrptmap space leakage");
+	return rv;
 }
 
 /*
@@ -804,7 +800,7 @@ rmptep(struct pte *pte)
 	*ptpp = 0;
 }
 
-static void 
+static int 
 grow_p0(struct pmap *pm, int reqlen)
 {
 	vaddr_t nptespc;
@@ -823,6 +819,8 @@ grow_p0(struct pmap *pm, int reqlen)
 	nptespc = pmap_getusrptes(pm, len);
 	RECURSESTART;
  
+	if (nptespc == 0)
+		return 0;
 	/*
 	 * Copy the old ptes to the new space.
 	 * Done by moving on system page table.
@@ -846,10 +844,11 @@ grow_p0(struct pmap *pm, int reqlen)
 	/* Remove the old after update_pcbs() (for multi-CPU propagation) */
 	if (inuse)
 		extent_free(ptemap, p0br, p0lr*PPTESZ, EX_WAITOK);
+	return 1;
 }
 
 
-static void
+static int
 grow_p1(struct pmap *pm, int len)
 {
 	vaddr_t nptespc, optespc;
@@ -862,6 +861,9 @@ grow_p1(struct pmap *pm, int len)
 	RECURSEEND;
 	nptespc = pmap_getusrptes(pm, nlen);
 	RECURSESTART;
+	if (nptespc == 0)
+		return 0;
+
 	olen = (NPTEPERREG*PPTESZ) - (pm->pm_p1lr * PPTESZ);
 	optespc = (vaddr_t)pm->pm_p1ap;
 
@@ -881,6 +883,7 @@ grow_p1(struct pmap *pm, int len)
 
 	if (optespc)
 		extent_free(ptemap, optespc, olen, EX_WAITOK);
+	return 1;
 }
 
 /*
@@ -1096,14 +1099,16 @@ pmap_enter(pmap_t pmap, vaddr_t v, paddr
 
 	case P0SEG:
 		if (vax_btop(v) >= pmap->pm_p0lr)
-			grow_p0(pmap, vax_btop(v));
+			if (grow_p0(pmap, vax_btop(v)) == 0)
+goto growfail;
 		pteptr = (int *)pmap->pm_p0br + vax_btop(v);
 		newpte = (prot & VM_PROT_WRITE ? PG_RW : PG_RO);
 		break;
 
 	case P1SEG:
 		if (vax_btop(v - 0x4000) < pmap->pm_p1lr)
-			grow_p1(pmap, vax_btop(v - 0x4000));
+			if (grow_p1(pmap, vax_btop(v - 0x4000)) == 0)
+goto growfail;
 		pteptr = (int *)pmap->pm_p1br + vax_btop(v - 0x4000);
 		newpte = (prot & VM_PROT_WRITE ? PG_RW : PG_RO);
 		break;
@@ -1214,6 +1219,11 @@ pmap_enter(pmap_t pmap, vaddr_t v, paddr
 
 	mtpr(0, PR_TBIA); /* Always; safety belt */
 	return 0;
+
+growfail:
+	if (flags & PMAP_CANFAIL)
+		return ENOMEM;
+	panic("usrptmap space leakage");
 }
 
 vaddr_t



CVS commit: src/sys/netinet

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 08:25:06 UTC 2018

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

Log Message:
Fix the log. mtod never returns NULL, so 'ip' is always non-NULL, and the
'ip6' branch is never taken. As a result we log garbage on IPv6 packets.

Use ip_v instead.


To generate a diff of this commit:
cvs rdiff -u -r1.402 -r1.403 src/sys/netinet/tcp_input.c

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

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.402 src/sys/netinet/tcp_input.c:1.403
--- src/sys/netinet/tcp_input.c:1.402	Fri Mar 30 07:11:40 2018
+++ src/sys/netinet/tcp_input.c	Fri Mar 30 08:25:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.402 2018/03/30 07:11:40 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.403 2018/03/30 08:25:06 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.402 2018/03/30 07:11:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.403 2018/03/30 08:25:06 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3176,16 +3176,23 @@ tcp_dooptions(struct tcpcb *tp, const u_
 #ifdef INET6
 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
 #endif
-if (ip)
+
+switch (ip->ip_v) {
+case 4:
 	in_print(buf, sizeof(buf),
 	>ip_src);
+	break;
 #ifdef INET6
-else if (ip6)
+case 6:
 	in6_print(buf, sizeof(buf),
 	>ip6_src);
+	break;
 #endif
-else
+default:
 	strlcpy(buf, "(unknown)", sizeof(buf));
+	break;
+}
+
 log(LOG_ERR, "TCP: invalid wscale %d from %s, "
 "assuming %d\n",
 tp->requested_s_scale, buf,



CVS commit: src/sys/uvm

2018-03-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Mar 30 07:22:59 UTC 2018

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

Log Message:
Increase UVM read ahead window limit a bit to match concurrency of reading
from the raw device.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_readahead.c

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

Modified files:

Index: src/sys/uvm/uvm_readahead.c
diff -u src/sys/uvm/uvm_readahead.c:1.8 src/sys/uvm/uvm_readahead.c:1.9
--- src/sys/uvm/uvm_readahead.c:1.8	Sun Jun 12 03:36:04 2011
+++ src/sys/uvm/uvm_readahead.c	Fri Mar 30 07:22:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_readahead.c,v 1.8 2011/06/12 03:36:04 rmind Exp $	*/
+/*	$NetBSD: uvm_readahead.c,v 1.9 2018/03/30 07:22:59 mlelstv Exp $	*/
 
 /*-
  * Copyright (c)2003, 2005, 2009 YAMAMOTO Takashi,
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_readahead.c,v 1.8 2011/06/12 03:36:04 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_readahead.c,v 1.9 2018/03/30 07:22:59 mlelstv Exp $");
 
 #include 
 #include 
@@ -73,7 +73,7 @@ struct uvm_ractx {
 #endif
 
 #define	RA_WINSIZE_INIT	MAXPHYS			/* initial window size */
-#define	RA_WINSIZE_MAX	(MAXPHYS * 8)		/* max window size */
+#define	RA_WINSIZE_MAX	(MAXPHYS * 16)		/* max window size */
 #define	RA_WINSIZE_SEQENTIAL	RA_WINSIZE_MAX	/* fixed window size used for
 		   SEQUENTIAL hint */
 #define	RA_MINSIZE	(MAXPHYS * 2)		/* min size to start i/o */



CVS commit: src/sys/netinet

2018-03-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 30 07:11:40 UTC 2018

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

Log Message:
Use consttime_memequal instead of memcmp, to prevent side channels. This
functions returns 1 when the buffers are equal, contrary to memcmp, hence
the !.


To generate a diff of this commit:
cvs rdiff -u -r1.401 -r1.402 src/sys/netinet/tcp_input.c

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

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.401 src/sys/netinet/tcp_input.c:1.402
--- src/sys/netinet/tcp_input.c:1.401	Thu Mar 29 21:40:53 2018
+++ src/sys/netinet/tcp_input.c	Fri Mar 30 07:11:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.401 2018/03/29 21:40:53 rmind Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.402 2018/03/30 07:11:40 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.401 2018/03/29 21:40:53 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.402 2018/03/30 07:11:40 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3236,7 +3236,8 @@ tcp_dooptions(struct tcpcb *tp, const u_
 		case TCPOPT_SIGNATURE:
 			if (optlen != TCPOLEN_SIGNATURE)
 continue;
-			if (sigp && memcmp(sigp, cp + 2, TCP_SIGLEN))
+			if (sigp &&
+			!consttime_memequal(sigp, cp + 2, TCP_SIGLEN))
 return (-1);
 
 			sigp = sigbuf;
@@ -3269,7 +3270,7 @@ tcp_dooptions(struct tcpcb *tp, const u_
 		}
 		tcp_fields_to_host(th);
 
-		if (memcmp(sig, sigp, TCP_SIGLEN)) {
+		if (!consttime_memequal(sig, sigp, TCP_SIGLEN)) {
 			TCP_STATINC(TCP_STAT_BADSIG);
 			goto out;
 		} else



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

2018-03-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 30 06:44:30 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_82599.c ixgbe_common.c
ixgbe_common.h ixgbe_x550.c ixgbe_x550.h

Log Message:
-  Add missing IFM_NONE support. If a interface support linkdown,
  "ifconfig ixgN media none" drpos link.  Not all interface can do link down.

 Tested:
82598 AT2 (T)
92599 SF+(SFI) (X520-DA2)
X540
X550-T1
X550EM_x (X10SDV-8C-TLN4F)
X550EM_a (A2SDi-H-TP4F port 0, 1 (T))

 Doesn't work:
X550EM_a (A2SDi-H-TP4F port 2, 3 (SFP+ (KR)))
X550EM_a (MA10-ST0 port 2, 3 (SFP+ (SFI)))
(Denverton SFP+ can't force link down because SFP+'s TX_DISABLE pin is
pull down. Is there a way to shutdown SFP+ cage's power?)
 Not tested:
82598 fiber.

- Change some functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/ixgbe/ixgbe_x550.h

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.139 src/sys/dev/pci/ixgbe/ixgbe.c:1.140
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.139	Fri Mar 30 03:58:20 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Mar 30 06:44:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.139 2018/03/30 03:58:20 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.140 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /**
 
@@ -1378,6 +1378,8 @@ ixgbe_add_media_types(struct adapter *ad
 #define	ADD(mm, dd)			\
 	ifmedia_add(>media, IFM_ETHER | (mm), (dd), NULL);
 
+	ADD(IFM_NONE, 0);
+
 	/* Media types with matching NetBSD media defines */
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) {
 		ADD(IFM_10G_T | IFM_FDX, 0);
@@ -2829,6 +2831,8 @@ ixgbe_media_change(struct ifnet *ifp)
 	case IFM_10_T:
 		speed |= IXGBE_LINK_SPEED_10_FULL;
 		break;
+	case IFM_NONE:
+		break;
 	default:
 		goto invalid;
 	}

Index: src/sys/dev/pci/ixgbe/ixgbe_82599.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.16 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.17
--- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.16	Wed Dec  6 04:08:50 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_82599.c	Fri Mar 30 06:44:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82599.c,v 1.16 2017/12/06 04:08:50 msaitoh Exp $ */
+/* $NetBSD: ixgbe_82599.c,v 1.17 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -56,6 +56,7 @@ static s32 ixgbe_read_eeprom_82599(struc
    u16 offset, u16 *data);
 static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset,
 	  u16 words, u16 *data);
+static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
 static s32 ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
 	u8 dev_addr, u8 *data);
 static s32 ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
@@ -914,9 +915,13 @@ s32 ixgbe_setup_mac_link_82599(struct ix
 
 	speed &= link_capabilities;
 
-	if (speed == IXGBE_LINK_SPEED_UNKNOWN) {
-		status = IXGBE_ERR_LINK_SETUP;
-		goto out;
+	if (speed == 0) {
+		ixgbe_disable_tx_laser(hw); /* For fiber */
+		ixgbe_set_phy_power(hw, false); /* For copper */
+	} else {
+		/* In case previous media setting was none(down) */
+		ixgbe_enable_tx_laser(hw); /* for Fiber */
+		ixgbe_set_phy_power(hw, true); /* For copper */
 	}
 
 	/* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
@@ -2475,7 +2480,7 @@ static s32 ixgbe_read_eeprom_82599(struc
  * Reset pipeline by asserting Restart_AN together with LMS change to ensure
  * full pipeline reset.  This function assumes the SW/FW lock is held.
  **/
-s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
+static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
 {
 	s32 ret_val;
 	u32 anlp1_reg = 0;

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.19 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.20
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.19	Fri Mar 30 03:58:20 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Fri Mar 30 06:44:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.19 2018/03/30 03:58:20 knakahara Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.20 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -5427,6 +5427,13 @@ s32 ixgbe_setup_mac_link_multispeed_fibe
 			goto out;
 	}
 
+	if (speed == 0) {
+		/* Disable the Tx laser 

CVS commit: [pgoyette-compat] src/sys/compat/common

2018-03-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 06:34:01 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: files.common

Log Message:
typo in version dependency


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/compat/common/files.common

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

Modified files:

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.25 src/sys/compat/common/files.common:1.1.2.26
--- src/sys/compat/common/files.common:1.1.2.25	Fri Mar 30 05:35:47 2018
+++ src/sys/compat/common/files.common	Fri Mar 30 06:34:00 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.25 2018/03/30 05:35:47 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.26 2018/03/30 06:34:00 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -41,7 +41,7 @@ file	compat/common/uvm_13.c			compat_13
 file	compat/common/rtsock_14.c		compat_14
 
 # Compatibility code for NetBSD 1.6
-file	compat/common/compat_16_mod.c		compat_20
+file	compat/common/compat_16_mod.c		compat_16
 file	compat/common/kern_sig_16.c		compat_16
 
 # Compatibility code for NetBSD 2.0