CVS commit: [pgoyette-compat] src/share/man/man9

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Mar 14 02:47:42 UTC 2018

Modified Files:
src/share/man/man9 [pgoyette-compat]: module.9

Log Message:
Update to describe module aliases.


To generate a diff of this commit:
cvs rdiff -u -r1.42.2.3 -r1.42.2.4 src/share/man/man9/module.9

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

Modified files:

Index: src/share/man/man9/module.9
diff -u src/share/man/man9/module.9:1.42.2.3 src/share/man/man9/module.9:1.42.2.4
--- src/share/man/man9/module.9:1.42.2.3	Sun Mar 11 00:44:32 2018
+++ src/share/man/man9/module.9	Wed Mar 14 02:47:41 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: module.9,v 1.42.2.3 2018/03/11 00:44:32 pgoyette Exp $
+.\"	$NetBSD: module.9,v 1.42.2.4 2018/03/14 02:47:41 pgoyette Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 16, 2017
+.Dd March 14, 2018
 .Dt MODULE 9
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .Sh SYNOPSIS
 .In sys/module.h
 .Fn MODULE "class" "name" "required"
+.Fn MODULE_WITH_ALIAS "class" "name" "required" "aliases"
 .Ft int
 .Fn module_load "const char *name" "int flags" "prop_dictionary_t props" \
 "modclass_t class"
@@ -95,9 +96,12 @@ The module subsystem is protected by the
 .Sh FUNCTIONS
 .Bl -tag -width abcd
 .It Fn MODULE "class" "name" "required"
+.It Fn MODULE_WITH_ALIASES "class" "name" "required" "aliases"
 The
 .Fn MODULE
-macro creates and initializes a
+and
+.Fn MODULE_WITH_ALIASES
+macros create and initialize a
 .Vt modinfo_t
 structure.
 The
@@ -140,7 +144,30 @@ When a module is loaded, all of its requ
 initialized before the module itself is loaded.
 Loading of required modules is a recursive operation.
 .Pp
-If there are no required modules, this argument should be specified as
+The
+.Fa aliases
+argument is a pointer to a NULL-terminated constant array of constant
+strings.
+Each string in the array is an alternate name (i.e., an alias) of the
+module.
+Module names and aliases must all be unique; a module cannot be loaded
+if its name or any of its aliases matches the name or an alias of any
+already-loaded module.
+(Module names are displayed by the
+.Xr modstat 8
+utility, with an
+.Dv A
+in the flags column.)
+.Pp
+For example,
+.Bd -literal
+	const char * const my_pets[] = { "dog", "cat", "bird", NULL };
+
+	MODULE_WITH_ALIASES(MODULE_CLASS_MISC, pets, NULL, _pets);
+.Ed
+.Pp
+If there are no required modules or aliases, these argument should be
+specified as
 .Dv NULL .
 .Pp
 In addition to the explicit arguments, the



CVS commit: [pgoyette-compat] src/share/man/man9

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Mar 14 02:47:42 UTC 2018

Modified Files:
src/share/man/man9 [pgoyette-compat]: module.9

Log Message:
Update to describe module aliases.


To generate a diff of this commit:
cvs rdiff -u -r1.42.2.3 -r1.42.2.4 src/share/man/man9/module.9

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



CVS commit: [pgoyette-compat] src/sys

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Mar 14 02:24:56 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_mod.c
files.common
src/sys/kern [pgoyette-compat]: vfs_syscalls.c
src/sys/sys [pgoyette-compat]: vfs_syscalls.h
Added Files:
src/sys/compat/common [pgoyette-compat]: vfs_syscalls_10.c

Log Message:
Make do_openat()'s handling of path=NULL modular


To generate a diff of this commit:
cvs rdiff -u -r1.7.18.1 -r1.7.18.2 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.24.14.5 -r1.24.14.6 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/vfs_syscalls_10.c
cvs rdiff -u -r1.518 -r1.518.2.1 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/sys/vfs_syscalls.h

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



CVS commit: [pgoyette-compat] src/sys

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Mar 14 02:24:56 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_mod.c
files.common
src/sys/kern [pgoyette-compat]: vfs_syscalls.c
src/sys/sys [pgoyette-compat]: vfs_syscalls.h
Added Files:
src/sys/compat/common [pgoyette-compat]: vfs_syscalls_10.c

Log Message:
Make do_openat()'s handling of path=NULL modular


To generate a diff of this commit:
cvs rdiff -u -r1.7.18.1 -r1.7.18.2 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.24.14.5 -r1.24.14.6 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/vfs_syscalls_10.c
cvs rdiff -u -r1.518 -r1.518.2.1 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/sys/vfs_syscalls.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/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.7.18.1 src/sys/compat/common/Makefile.sysio:1.7.18.2
--- src/sys/compat/common/Makefile.sysio:1.7.18.1	Tue Mar 13 09:10:31 2018
+++ src/sys/compat/common/Makefile.sysio	Wed Mar 14 02:24:56 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sysio,v 1.7.18.1 2018/03/13 09:10:31 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.7.18.2 2018/03/14 02:24:56 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -9,6 +9,9 @@ SRCS+=	kern_exit_43.c kern_info_43.c ker
 # Compatibility code for NetBSD 0.9
 SRCS+=	kern_info_09.c
 
+# Compatability code for NetBSD 1.0
+SRCS+=	vfs_syscalls_10.c
+
 # Compatibility code for NetBSD 1.2
 SRCS+=	kern_xxx_12.c vfs_syscalls_12.c vm_12.c
 

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.5 src/sys/compat/common/compat_mod.c:1.24.14.6
--- src/sys/compat/common/compat_mod.c:1.24.14.5	Tue Mar 13 09:10:31 2018
+++ src/sys/compat/common/compat_mod.c	Wed Mar 14 02:24:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.5 2018/03/13 09:10:31 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.6 2018/03/14 02:24:56 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.5 2018/03/13 09:10:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.6 2018/03/14 02:24:56 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -275,10 +276,16 @@ compat_modcmd(modcmd_t cmd, void *arg)
 		sendsig_sigcontext_vec = sendsig_sigcontext;
 #endif
 #endif
+#ifdef COMPAT_10
+		vfs_syscalls_10_init();
+#endif
 		compat_sysctl_init();
 		return 0;
 
 	case MODULE_CMD_FINI:
+#ifdef COMPAT_10
+		vfs_syscalls_10_fini();
+#endif
 #ifdef COMPAT_16
 		/*
 		 * Ensure sendsig_sigcontext() is not being used.

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.7 src/sys/compat/common/files.common:1.1.2.8
--- src/sys/compat/common/files.common:1.1.2.7	Tue Mar 13 09:10:31 2018
+++ src/sys/compat/common/files.common	Wed Mar 14 02:24:56 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.7 2018/03/13 09:10:31 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.8 2018/03/14 02:24:56 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -25,6 +25,9 @@ file	compat/common/if_43.c			compat_netb
 # Compatibility code for NetBSD 0.9
 file	compat/common/kern_info_09.c		compat_netbsd
 
+# Compatability code for NetBSD 1.0
+file	compat/common/vfs_syscalls_10.c		compat_netbsd
+
 # Compatibility code for NetBSD 1.2
 file	compat/common/kern_xxx_12.c		compat_netbsd
 file	compat/common/vfs_syscalls_12.c		compat_netbsd

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.518 src/sys/kern/vfs_syscalls.c:1.518.2.1
--- src/sys/kern/vfs_syscalls.c:1.518	Tue Jan  9 03:31:13 2018
+++ src/sys/kern/vfs_syscalls.c	Wed Mar 14 02:24:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.518 2018/01/09 03:31:13 christos Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.518.2.1 2018/03/14 02:24:56 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.518 2018/01/09 03:31:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.518.2.1 2018/03/14 02:24:56 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -141,6 +141,10 @@ static int fd_nameiat(struct lwp *, int,
 static int fd_nameiat_simple_user(struct lwp *, int, const char *,
 namei_simple_flags_t, struct vnode **);
 
+/* Routine for COMPAT_10 handling of NULL pathbuf passed to do_sys_openat */
+
+static int stub_sys_openat_10(struct pathbuf **);
+int 

CVS commit: src

2018-03-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Mar 14 02:13:47 UTC 2018

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_zombie.c

Log Message:
Add new ATF tests: kernel/t_zombie

New tests attempting to kill, stop, drop or revive a zombie:
 - signal1 (SIGKILL)
 - signal2 (SIGSTOP)
 - signal3 (SIGABRT)
 - signal4 (SIGHUP)
 - signal5 (SIGCONT)

New test race1 verifying whether there are any kernel races when processing
signals to zombies, executing in a loop for 5 seconds.

These tests were inspired by a kernel unexpected behavior when a lookup
of a dying process could result in two detected entities once as an alive
process and once as a zombie.

race1 is similar to t_ptrace_wait* race1, however without ptrace(2) involved.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.776 -r1.777 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.52 -r1.53 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_zombie.c

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.244 src/distrib/sets/lists/debug/mi:1.245
--- src/distrib/sets/lists/debug/mi:1.244	Fri Mar  9 20:20:48 2018
+++ src/distrib/sets/lists/debug/mi	Wed Mar 14 02:13:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.244 2018/03/09 20:20:48 joerg Exp $
+# $NetBSD: mi,v 1.245 2018/03/14 02:13:47 kamil Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1750,6 +1750,7 @@
 ./usr/libdata/debug/usr/tests/kernel/t_timeleft.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_ucontext.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_writev.debug			tests-obsolete		obsolete,compattestfile
+./usr/libdata/debug/usr/tests/kernel/t_zombie.debug			tests-kernel-tests	debug,atf,rump
 ./usr/libdata/debug/usr/tests/kernel/tty/t_pr.debug			tests-kernel-tests	debug,atf,rump
 ./usr/libdata/debug/usr/tests/kyua-cli/bootstrap/atf_helpers.debug			tests-kyua-tests	debug,atf,kyua,compattestfile
 ./usr/libdata/debug/usr/tests/kyua-cli/bootstrap/plain_helpers.debug			tests-kyua-tests	debug,atf,kyua,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.776 src/distrib/sets/lists/tests/mi:1.777
--- src/distrib/sets/lists/tests/mi:1.776	Fri Mar  9 20:20:48 2018
+++ src/distrib/sets/lists/tests/mi	Wed Mar 14 02:13:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.776 2018/03/09 20:20:48 joerg Exp $
+# $NetBSD: mi,v 1.777 2018/03/14 02:13:47 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2197,6 +2197,7 @@
 ./usr/tests/kernel/t_umount			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_umountstress		tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_writev			tests-obsolete		obsolete
+./usr/tests/kernel/t_zombie			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/ttytests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/tty/Atffile			tests-kernel-tests	atf,rump
 ./usr/tests/kernel/tty/Kyuafile			tests-kernel-tests	atf,rump,kyua

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.52 src/tests/kernel/Makefile:1.53
--- src/tests/kernel/Makefile:1.52	Thu Dec 14 14:38:17 2017
+++ src/tests/kernel/Makefile	Wed Mar 14 02:13:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.52 2017/12/14 14:38:17 nakayama Exp $
+# $NetBSD: Makefile,v 1.53 2018/03/14 02:13:47 kamil Exp $
 
 NOMAN=		# defined
 
@@ -16,6 +16,7 @@ TESTS_C+=	t_subr_prf
 TESTS_C+=	t_kauth_pr_47598
 TESTS_C+=	t_sysctl
 TESTS_C+=	t_timeleft
+TESTS_C+=	t_zombie
 
 TESTS_SH=	t_umount
 TESTS_SH+=	t_umountstress

Added files:

Index: src/tests/kernel/t_zombie.c
diff -u /dev/null src/tests/kernel/t_zombie.c:1.1
--- /dev/null	Wed Mar 14 02:13:47 2018
+++ src/tests/kernel/t_zombie.c	Wed Mar 14 02:13:47 2018
@@ -0,0 +1,276 @@
+/*	$NetBSD: t_zombie.c,v 1.1 2018/03/14 02:13:47 kamil Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD 

CVS commit: src

2018-03-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Mar 14 02:13:47 UTC 2018

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_zombie.c

Log Message:
Add new ATF tests: kernel/t_zombie

New tests attempting to kill, stop, drop or revive a zombie:
 - signal1 (SIGKILL)
 - signal2 (SIGSTOP)
 - signal3 (SIGABRT)
 - signal4 (SIGHUP)
 - signal5 (SIGCONT)

New test race1 verifying whether there are any kernel races when processing
signals to zombies, executing in a loop for 5 seconds.

These tests were inspired by a kernel unexpected behavior when a lookup
of a dying process could result in two detected entities once as an alive
process and once as a zombie.

race1 is similar to t_ptrace_wait* race1, however without ptrace(2) involved.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.776 -r1.777 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.52 -r1.53 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_zombie.c

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 23:03:21 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Try to improve markup in the Built-ins section.
Mostly sprinkle missing .Ic and .Ar


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.186 src/bin/sh/sh.1:1.187
--- src/bin/sh/sh.1:1.186	Tue Mar 13 21:49:15 2018
+++ src/bin/sh/sh.1	Tue Mar 13 23:03:21 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.186 2018/03/13 21:49:15 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.187 2018/03/13 23:03:21 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -2038,7 +2038,10 @@ must be first (after !)
 and the
 .Dq \(mi
 last, in the character class.
+.\"
+.\"
 .Ss Built-ins
+.\"
 This section lists the built-in commands which are built-in because they
 need to perform some operation that can't be performed by a separate
 process.
@@ -2050,10 +2053,10 @@ be built in for efficiency (e.g.
 .Xr test 1 ,
 etc).
 .Bl -tag -width 5n
-.It : [ Ar arg ... ]
+.It Ic : Oo Ar arg ... Oc
 A null command that returns a 0 (true) exit value.
 Any arguments or redirects are evaluated, then ignored.
-.It \&. file
+.It Ic \&. Ar file
 The dot command reads and executes the commands from the specified
 .Ar file
 in the current shell environment.
@@ -2062,10 +2065,9 @@ listed in the
 .Ev PATH
 variable if its name does not contain a directory separator
 .Pq Sq / .
-The return command
-(see
-.Sx Built-ins
-below)
+The
+.Ic return
+command (see below)
 can be used for a premature return from the sourced file.
 .Pp
 The POSIX standard has been unclear on how loop control keywords (break
@@ -2073,9 +2075,9 @@ and continue) behave across a dot comman
 This implementation allows them to control loops surrounding the dot command,
 but obviously such behavior should not be relied on.
 It is now permitted by the standard, but not required.
-.It alias Op Ar name Ns Op Ar "=string ..."
+.It Ic alias Op Ar name Ns Op Li = Ns Ar string ...
 If
-.Ar name=string
+.Ar name Ns Li = Ns Ar string
 is specified, the shell defines the alias
 .Ar name
 with value
@@ -2090,10 +2092,10 @@ With no arguments, the
 built-in prints the
 names and values of all defined aliases (see
 .Ic unalias ) .
-.It bg [ Ar job ] ...
+.It Ic bg Op Ar job ...
 Continue the specified jobs (or the current job if no
 jobs are given) in the background.
-.It command Oo Fl p Oc Oo Fl v Oc Oo Fl V Oc Ar command Oo Ar arg ... Oc
+.It Ic command Oo Fl pVv Oc Ar command Op Ar arg ...
 Execute the specified command but ignore shell functions when searching
 for it.
 (This is useful when you
@@ -2115,7 +2117,7 @@ Do not execute the command but
 search for the command and print the absolute pathname
 of utilities, the name for built-ins or the expansion of aliases.
 .El
-.It cd Oo Fl P Oc Op Ar directory Op Ar replace
+.It Ic cd Oo Fl P Oc Op Ar directory Op Ar replace
 Switch to the specified directory (default
 .Ev $HOME ) .
 If
@@ -2128,7 +2130,7 @@ in the current directory name with
 Otherwise if
 .Ar directory
 is
-.Sq - ,
+.Sq Li - ,
 then the current working directory is changed to the previous current
 working directory as set in
 .Ev OLDPWD .
@@ -2173,7 +2175,7 @@ command will print out the name of the
 directory that it actually switched to if this is different from the name
 that the user gave,
 or always if the
-.Ic cdprint
+.Cm cdprint
 option is set.
 The destination may be different either because the
 .Ev CDPATH
@@ -2182,11 +2184,13 @@ mechanism was used
 or if the
 .Ar replace
 argument was used.
-.It eval Ar string ...
+.It Ic eval Ar string ...
 Concatenate all the arguments with spaces.
 Then re-parse and execute the command.
-.It exec Op Ar command arg ...
-Unless command is omitted, the shell process is replaced with the
+.It Ic exec Op Ar command Op Ar arg ...
+Unless
+.Ar command
+is omitted, the shell process is replaced with the
 specified program (which must be a real program, not a shell built-in or
 function).
 Any redirections on the
@@ -2195,7 +2199,7 @@ command are marked as permanent, so that
 .Ic exec
 command finishes.
 When the
-.Ic posix
+.Cm posix
 option is not set,
 file descriptors created via such redirections are marked close-on-exec
 (see
@@ -2212,7 +2216,7 @@ Traditionally Bourne-like shells
 .Xr ksh 1 ) ,
 made those file descriptors available to exec'ed processes.
 This behavior is required by the POSIX standard, so when the
-.Ic posix
+.Cm posix
 option is set, this shell also acts that way.
 To be assured the close-on-exec setting is off,
 redirect the descriptor to (or from) itself,
@@ -2228,14 +2232,14 @@ Alternatively, see the
 .Ic fdflags
 command below, which can set, or clear, this, and other,
 file descriptor flags.
-.It exit Op Ar exitstatus
+.It 

CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 23:03:21 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Try to improve markup in the Built-ins section.
Mostly sprinkle missing .Ic and .Ar


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/bin/sh/sh.1

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



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

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 13 21:59:51 UTC 2018

Modified Files:
src/sys/uvm [pgoyette-compat]: uvm_swap.c

Log Message:
Properly detect 'compat handler for SWAP_STATSxx not present' and return
EINVAL as we would for any other unsupported command.


To generate a diff of this commit:
cvs rdiff -u -r1.175.2.1 -r1.175.2.2 src/sys/uvm/uvm_swap.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_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.175.2.1 src/sys/uvm/uvm_swap.c:1.175.2.2
--- src/sys/uvm/uvm_swap.c:1.175.2.1	Tue Mar 13 09:10:31 2018
+++ src/sys/uvm/uvm_swap.c	Tue Mar 13 21:59:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.175.2.1 2018/03/13 09:10:31 pgoyette Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.175.2.2 2018/03/13 21:59:51 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.175.2.1 2018/03/13 09:10:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.175.2.2 2018/03/13 21:59:51 pgoyette Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -499,19 +499,21 @@ sys_swapctl(struct lwp *l, const struct 
 	 * to grab the uvm_swap_data_lock because we may fault during
 	 * copyout() and we don't want to be holding that lock then!
 	 */
-	len = 0;
-	if (SCARG(uap, cmd) == SWAP_STATS)
-		len = sizeof(struct swapent);
-	else if (SCARG(uap, cmd) == SWAP_STATS13)
-		len = swapstats_len_13;
-	else if (SCARG(uap, cmd) == SWAP_STATS50)
-		len = swapstats_len_50;
-	/*
-	 * If the compat_* code isn't loaded, len will still be zero
-	 * and we'll just fall through and return EINVAL
-	 */
-	if (len > 0) {
-		if (misc < 0) {
+	if (SCARG(uap,cmd) == SWAP_STATS || SCARG(uap, cmd) == SWAP_STATS13 ||
+	SCARG(uap,cmd) == SWAP_STATS50) {
+		len = 0;
+		if (SCARG(uap, cmd) == SWAP_STATS)
+			len = sizeof(struct swapent);
+		else if (SCARG(uap, cmd) == SWAP_STATS13)
+			len = swapstats_len_13;
+		else if (SCARG(uap, cmd) == SWAP_STATS50)
+			len = swapstats_len_50;
+		/*
+		 * If len is still zero at this point, no compat code
+		 * for the current cmd exists, so error out.  Also,
+		 * error if user-specified buffer size is less than zero.
+		 */
+		if (len == 0 || misc < 0) {
 			error = EINVAL;
 			goto out;
 		}



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

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 13 21:59:51 UTC 2018

Modified Files:
src/sys/uvm [pgoyette-compat]: uvm_swap.c

Log Message:
Properly detect 'compat handler for SWAP_STATSxx not present' and return
EINVAL as we would for any other unsupported command.


To generate a diff of this commit:
cvs rdiff -u -r1.175.2.1 -r1.175.2.2 src/sys/uvm/uvm_swap.c

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 21:49:16 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Try to improve markup in the Parameter Expansion section.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 21:49:16 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Try to improve markup in the Parameter Expansion section.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.185 src/bin/sh/sh.1:1.186
--- src/bin/sh/sh.1:1.185	Tue Mar 13 21:04:57 2018
+++ src/bin/sh/sh.1	Tue Mar 13 21:49:15 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.185 2018/03/13 21:04:57 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.186 2018/03/13 21:49:15 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1615,25 +1615,32 @@ In variable assignments,
 an unquoted tilde immediately after the assignment operator (=), and
 each unquoted tilde immediately after an unquoted colon in the value
 to be assigned is also subject to tilde expansion as just stated.
+.\"
+.\"
 .Ss Parameter Expansion
+.\"
 The format for parameter expansion is as follows:
 .Pp
-.Dl ${expression}
+.Dl ${ Ns Ar expression Ns Li }
 .Pp
-where expression consists of all characters until the matching
-.Dq } .
+where
+.Ar expression
+consists of all characters until the matching
+.Sq Li } .
 Any
-.Dq }
+.Sq Li }
 escaped by a backslash or within a quoted string, and characters in
 embedded arithmetic expansions, command substitutions, and variable
 expansions, are not examined in determining the matching
-.Dq } .
+.Sq Li } .
 .Pp
 The simplest form for parameter expansion is:
 .Pp
-.Dl ${parameter}
+.Dl ${ Ns Ar parameter Ns Li }
 .Pp
-The value, if any, of parameter is substituted.
+The value, if any, of
+.Ar parameter
+is substituted.
 .Pp
 The parameter name or symbol can be enclosed in braces,
 which are optional in this simple case,
@@ -1643,47 +1650,74 @@ part of the name.
 If a parameter expansion occurs inside double quotes:
 .Bl -enum
 .It
-Pathname expansion is not performed on the results of the expansion.
+pathname expansion is not performed on the results of the expansion;
 .It
-Field splitting is not performed on the results of the
-expansion, with the exception of the special rules for @.
+field splitting is not performed on the results of the
+expansion, with the exception of the special rules for
+.Dv @ .
 .El
 .Pp
 In addition, a parameter expansion where braces are used,
 can be modified by using one of the following formats.
 If the
-.Dq Dv \&:
+.Sq Ic \&:
 is omitted in the following modifiers, then the test in the expansion
 applies only to unset parameters, not null ones.
 .Bl -tag -width aaparameterworda
-.It ${parameter:\(miword}
-Use Default Values.
-If parameter is unset or null, the expansion of word
-is substituted; otherwise, the value of parameter is substituted.
-.It ${parameter:=word}
-Assign Default Values.
-If parameter is unset or null, the expansion of
-word is assigned to parameter.
-In all cases, the final value of parameter is substituted.
+.It Li ${ Ns Ar parameter Ns Ic :- Ns Ar word Ns Li }
+.Sy Use Default Values.
+If
+.Ar parameter
+is unset or null, the expansion of
+.Ar word
+is substituted; otherwise, the value of
+.Ar parameter
+is substituted.
+.It Li ${ Ns Ar parameter Ns Ic := Ns Ar word Ns Li }
+.Sy Assign Default Values.
+If
+.Ar parameter
+is unset or null, the expansion of
+.Ar word
+is assigned to
+.Ar parameter .
+In all cases, the final value of
+.Ar parameter
+is substituted.
 Only variables, not positional parameters or special
 parameters, can be assigned in this way.
-.It ${parameter:?[word]}
-Indicate Error if Null or Unset.
-If parameter is unset or null, the
-expansion of word (or a message indicating it is unset if word is omitted)
+.It Li ${ Ns Ar parameter Ns Ic :? Ns Oo Ar word\^ Oc Ns Li }
+.Sy Indicate Error if Null or Unset.
+If
+.Ar parameter
+is unset or null, the expansion of
+.Ar word
+(or a message indicating it is unset if
+.Ar word
+is omitted)
 is written to standard error and a non-interactive shell exits with
 a nonzero exit status.
 An interactive shell will not exit, but any associated command(s) will
 not be executed.
-If the parameter is set, its value is substituted.
-.It ${parameter:+word}
-Use Alternative Value.
-If parameter is unset or null, null is
-substituted; otherwise, the expansion of word is substituted.
-The value of parameter is not used in this expansion.
-.It ${#parameter}
-String Length.
-The length in characters of the value of parameter.
+If the
+.Ar parameter
+is set, its value is substituted.
+.It Li ${ Ns Ar parameter Ns Ic :+ Ns Ar word Ns Li }
+.Sy Use Alternative Value.
+If
+.Ar parameter
+is unset or null, null is substituted;
+otherwise, the expansion of
+.Ar word
+is substituted.
+The value of
+.Ar parameter
+.Em is not used
+in this expansion.
+.It Li ${ Ns Ic # Ns Ar parameter Ns Li }
+.Sy String Length.
+The length 

CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 21:04:57 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Try to improve markup of the redirections definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.184 src/bin/sh/sh.1:1.185
--- src/bin/sh/sh.1:1.184	Tue Mar 13 20:48:00 2018
+++ src/bin/sh/sh.1	Tue Mar 13 21:04:57 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.184 2018/03/13 20:48:00 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.185 2018/03/13 21:04:57 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -859,39 +859,44 @@ If present it must occur immediately bef
 operator, with no intervening white space, and becomes a
 part of that operator.
 .Bl -tag -width aaabsfiles -offset indent
-.It Oo Ar n Oc Ns > Ar file
-Redirect standard output (or n) to
+.It Oo Ar n Oc Ns Ic > Ar file
+Redirect standard output (or
+.Ar n )
+to
 .Ar file .
-.It Oo Ar n Oc Ns >| file
+.It Oo Ar n Oc Ns Ic >| Ar file
 The same, but override the
 .Fl C
 option.
-.It Oo Ar n Oc Ns >> Ar file
-Append standard output (or n) to
+.It Oo Ar n Oc Ns Ic >> Ar file
+Append standard output (or
+.Ar n )
+to
 .Ar file .
-.It Oo Ar n Oc Ns < Ar file
+.It Oo Ar n Oc Ns Ic < Ar file
 Redirect standard input (or
 .Ar n )
 from
 .Ar file .
-.It Oo Ar n1 Oc Ns <& Ns Ar n2
+.It Oo Ar n1 Oc Ns Ic <& Ns Ar n2
 Duplicate standard input (or
 .Ar n1 )
 from file descriptor
 .Ar n2 .
 .Ar n2
 is expanded if not a digit string, the result must be a number.
-.It Oo Ar n Oc Ns <&-
+.It Oo Ar n Oc Ns Ic <&-
 Close standard input (or
 .Ar n ) .
-.It Oo Ar n1 Oc Ns >& Ns Ar n2
+.It Oo Ar n1 Oc Ns Ic >& Ns Ar n2
 Duplicate standard output (or
 .Ar n1 )
 to
 .Ar n2 .
-.It Oo Ar n Oc Ns >&-
-Close standard output (or n).
-.It Oo Ar n Oc Ns <> Ar file
+.It Oo Ar n Oc Ns Ic >&-
+Close standard output (or
+.Ar n ) .
+.It Oo Ar n Oc Ns Ic <> Ar file
 Open
 .Ar file
 for reading and writing on standard input (or
@@ -900,10 +905,10 @@ for reading and writing on standard inpu
 .Pp
 The following redirection is often called a
 .Dq here-document .
-.Bd -literal -offset indent
-[n]<< delimiter
-\&... here-doc-text ...
-delimiter
+.Bd -unfilled -offset indent
+.Oo Ar n Oc Ns Ic << Ar delimiter
+.Li \&... here-doc-text ...
+.Ar delimiter
 .Ed
 .Pp
 The
@@ -932,9 +937,9 @@ expansion as described in the
 .Sx Word Expansions
 section below.
 If the operator is
-.Dq <<\(mi
+.Ic <<-
 instead of
-.Dq << ,
+.Ic << ,
 then leading tabs in all lines in the here-doc-text, including before the
 end delimiter, are stripped.
 If the delimiter is not quoted, lines in here-doc-text that end with



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 21:04:57 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Try to improve markup of the redirections definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:48:00 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Fix horrendous markup abuse in the here-document example.
Consistently spell "here-document" in full.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.183 src/bin/sh/sh.1:1.184
--- src/bin/sh/sh.1:1.183	Tue Mar 13 20:40:52 2018
+++ src/bin/sh/sh.1	Tue Mar 13 20:48:00 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.183 2018/03/13 20:40:52 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.184 2018/03/13 20:48:00 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -900,20 +900,19 @@ for reading and writing on standard inpu
 .Pp
 The following redirection is often called a
 .Dq here-document .
-.Bl -item -offset indent
-.It
-.Li [n]<< delimiter
-.Dl here-doc-text ...
-.Li delimiter
-.El
+.Bd -literal -offset indent
+[n]<< delimiter
+\&... here-doc-text ...
+delimiter
+.Ed
 .Pp
 The
 .Dq here-doc-text
 starts immediately after the next unquoted newline character following
-the here-doc redirection operator.
+the here-document redirection operator.
 If there is more than one here-document redirection on the same
 line, then the text for the first (from left to right) is read
-first, and subsequent here-doc-text for later here-doc redirections
+first, and subsequent here-doc-text for later here-document redirections
 follows immediately after, until all such redirections have been
 processed.
 .Pp
@@ -940,7 +939,8 @@ then leading tabs in all lines in the he
 end delimiter, are stripped.
 If the delimiter is not quoted, lines in here-doc-text that end with
 an unquoted \e are joined to the following line, the \e and following
-newline are simply removed while reading the here-doc, which thus guarantees
+newline are simply removed while reading the here-document,
+which thus guarantees
 that neither of those lines can be the end delimiter.
 .Pp
 It is a syntax error for the end of the input file (or string) to be



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:48:00 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Fix horrendous markup abuse in the here-document example.
Consistently spell "here-document" in full.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:40:52 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Spell "here-document" with a hyphen, don't mark it up as a command.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:39:25 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Mark up "in" (of the "for" command) appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:39:25 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Mark up "in" (of the "for" command) appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.181 src/bin/sh/sh.1:1.182
--- src/bin/sh/sh.1:1.181	Tue Mar 13 20:29:13 2018
+++ src/bin/sh/sh.1	Tue Mar 13 20:39:25 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.181 2018/03/13 20:29:13 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.182 2018/03/13 20:39:25 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1264,12 +1264,12 @@ done
 .Ed
 .Pp
 The words are expanded, or "$@" if
-.Dq in
+.Ic in
 (and the following words) is not present,
 and then the list is executed repeatedly with the
 variable set to each word in turn.
 If
-.Dq in
+.Ic in
 appears after the variable, but no words are
 present, the list is not executed, and the exit status is zero.
 .Ic do



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:29:13 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Use \(or not \*(Ba when discussing case patterns.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.180 src/bin/sh/sh.1:1.181
--- src/bin/sh/sh.1:1.180	Tue Mar 13 20:18:16 2018
+++ src/bin/sh/sh.1	Tue Mar 13 20:29:13 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.180 2018/03/13 20:18:16 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.181 2018/03/13 20:29:13 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1327,7 +1327,7 @@ esac
 The pattern can actually be one or more patterns (see
 .Sx Shell Patterns
 described later), separated by
-.Dq \*(Ba
+.Dq \(or
 characters.
 .Pp
 Word is expanded and matched against each pattern in turn,



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:29:13 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Use \(or not \*(Ba when discussing case patterns.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:18:16 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Use \(em for em-dash


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.179 src/bin/sh/sh.1:1.180
--- src/bin/sh/sh.1:1.179	Tue Mar 13 20:08:11 2018
+++ src/bin/sh/sh.1	Tue Mar 13 20:18:16 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.179 2018/03/13 20:08:11 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.180 2018/03/13 20:18:16 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -947,7 +947,7 @@ It is a syntax error for the end of the 
 reached before the delimiter is encountered.
 .Ss Search and Execution
 There are three types of commands: shell functions, built-in commands, and
-normal programs -- and the command is searched for (by name) in that order.
+normal programs \(em and the command is searched for (by name) in that order.
 A command that contains a slash
 .Sq \&/
 in its name is always a normal program.
@@ -1127,7 +1127,7 @@ to the standard input of command2.
 .Pp
 Note that unlike some other shells, each process in the pipeline is a
 child of the invoking shell (unless it is a shell built-in, in which case
-it executes in the current shell -- but any effect it has on the
+it executes in the current shell \(em but any effect it has on the
 environment is wiped).
 .Pp
 A pipeline is a simple case of an AND-OR-list (described below.)
@@ -1145,10 +1145,10 @@ after they have completed,
 can be obtained using the
 .Ic wait
 built-in command described later.
-.Ss Background Commands -- &
+.Ss Background Commands \(em &
 If a command, pipeline, or AND-OR-list
 is terminated by the control operator ampersand (&), the
-shell executes the command asynchronously -- that is, the shell does not
+shell executes the command asynchronously \(em that is, the shell does not
 wait for the command to finish before executing the next command.
 .Pp
 The format for running a command in background is:
@@ -1164,7 +1164,7 @@ background can be obtained from the valu
 (see
 .Sx Special Parameters )
 provided it is accessed before the next asynchronous command is started.
-.Ss Lists -- Generally Speaking
+.Ss Lists \(em Generally Speaking
 A list is a sequence of one or more commands separated by newlines,
 semicolons, or ampersands, and optionally terminated by one of these three
 characters.
@@ -1208,7 +1208,7 @@ writes
 .Dq baz
 and nothing else.
 This is not the way it works in C.
-.Ss Flow-Control Constructs -- if, while, until, for, case
+.Ss Flow-Control Constructs \(em if, while, until, for, case
 These commands are instances of compound commands.
 The syntax of the
 .Ic if



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:18:16 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Use \(em for em-dash


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:08:11 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Standalone | means \[ba] while we want \[or] so add \& protection to
the few places where it was missing.


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.178 src/bin/sh/sh.1:1.179
--- src/bin/sh/sh.1:1.178	Tue Mar 13 19:43:52 2018
+++ src/bin/sh/sh.1	Tue Mar 13 20:08:11 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.178 2018/03/13 19:43:52 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.179 2018/03/13 20:08:11 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -550,7 +550,7 @@ operators (their meaning is discussed la
 The following is a list of operators:
 .Bl -ohang -offset indent
 .It "Control operators:"
-.Dl &  &&  \&(  \&)  \&;  ;; ;& | || 
+.Dl &  &&  \&(  \&)  \&;  ;; ;& \&| || 
 .It "Redirection operators:"
 .Dl <  >  >|  <<  >>  <&  >&  <<-  <>
 .El
@@ -1081,7 +1081,7 @@ as is the standard input of the first co
 .Pp
 The format for a pipeline is:
 .Pp
-.Dl [!] command1 [ | command2 ...]
+.Dl [!] command1 [ \&| command2 ...]
 .Pp
 The standard output of command1 is connected to the standard input of
 command2.
@@ -1120,7 +1120,7 @@ Because pipeline assignment of standard 
 takes place before redirection, it can be modified by redirection.
 For example:
 .Pp
-.Dl $ command1 2>&1 | command2
+.Dl $ command1 2>&1 \&| command2
 .Pp
 sends both the standard output and standard error of command1
 to the standard input of command2.



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 20:08:11 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Standalone | means \[ba] while we want \[or] so add \& protection to
the few places where it was missing.


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 19:43:52 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
.Dl is a a single line .Bd -literal -offset indent so don't abuse
multiple consecutive .Dl and use proper .Bd instead.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.177 src/bin/sh/sh.1:1.178
--- src/bin/sh/sh.1:1.177	Tue Mar 13 19:35:46 2018
+++ src/bin/sh/sh.1	Tue Mar 13 19:43:52 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.177 2018/03/13 19:35:46 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.178 2018/03/13 19:43:52 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1410,18 +1410,27 @@ function is called.
 This means that a simple
 .Dq Hello World
 function might be written (in the extended syntax) as:
-.Dl hello() cat <

CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 19:43:52 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
.Dl is a a single line .Bd -literal -offset indent so don't abuse
multiple consecutive .Dl and use proper .Bd instead.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 19:35:46 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
.Bd expects the display type to come first, so move -compact to the end.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 19:35:46 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
.Bd expects the display type to come first, so move -compact to the end.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.176 src/bin/sh/sh.1:1.177
--- src/bin/sh/sh.1:1.176	Tue Mar 13 19:18:53 2018
+++ src/bin/sh/sh.1	Tue Mar 13 19:35:46 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.176 2018/03/13 19:18:53 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.177 2018/03/13 19:35:46 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -442,7 +442,7 @@ option to be sent to standard error as i
 .Fl X
 option is enabled (regardless of its previous state.)
 For example:
-.Bd -compact -literal
+.Bd -literal -compact
 set -X 2>/tmp/trace-file
 .Ed
 will arrange for tracing output to be sent to the file named,
@@ -3527,7 +3527,7 @@ ignored by the terminal if received, as 
 .Xr editline 7
 is not in use, the prompt strings are simply written to the terminal.
 For example, setting:
-.Bd -compact -literal -offset left
+.Bd -literal -offset left -compact
   PSlit="$(printf\ '\e1')"
   PS1="${PSlit}$(tput\ bold\ blink)${PSlit}\e$${PSlit}$(tput\ sgr0)${PSlit}\ "
 .Ed



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 19:18:53 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Add missing word.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2018-03-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Mar 13 19:18:53 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Add missing word.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.175 src/bin/sh/sh.1:1.176
--- src/bin/sh/sh.1:1.175	Mon Jan 15 11:27:39 2018
+++ src/bin/sh/sh.1	Tue Mar 13 19:18:53 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.175 2018/01/15 11:27:39 kre Exp $
+.\"	$NetBSD: sh.1,v 1.176 2018/03/13 19:18:53 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1432,8 +1432,9 @@ Variables may be declared to be local to
 .Ic local
 command.
 This should usually appear as the first statement of a function,
-though is an executable command which can be used anywhere in a
-function.
+though
+.Ic local
+is an executable command which can be used anywhere in a function.
 See
 .Sx Built-ins
 below for its definition.



CVS commit: [netbsd-6] src/doc

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 18:06:22 UTC 2018

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

Log Message:
1516, 1518-1520, 1522, 1532-1538


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.326 -r1.1.2.327 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.326 src/doc/CHANGES-6.2:1.1.2.327
--- src/doc/CHANGES-6.2:1.1.2.326	Sat Mar  3 20:50:38 2018
+++ src/doc/CHANGES-6.2	Tue Mar 13 18:06:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.326 2018/03/03 20:50:38 snj Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.327 2018/03/13 18:06:22 snj Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -21093,3 +21093,75 @@ dist/pf/etc/pf.os1.4-1.5
 	Add DragonFly BSD fingerprints.
 	[sevan, ticket #1515]
 
+sys/dev/fss.c	1.101-1.103
+
+	fss:
+	- Bounds check against media size for non-persistent snapshots.
+	- Treat partial read from backing store as I/O error.
+	- Pass residual back to b_resid for persistent snapshots.
+	[hannken, ticket #1516]
+
+sys/netinet6/ip6_forward.c			1.89-1.90 via patch
+
+	Fix use-after-free of mbuf in ip6flow_create and ip6flow_create.
+	[ozaki-r, ticket #1518]
+
+sys/arch/sparc/sparc/timer.c			1.33-1.34 via patch
+sys/arch/sparc/sparc/timer_sun4m.c		1.31 via patch
+sys/arch/sparc/sparc/timerreg.h			1.10 via patch
+
+	Fix time goes backwards problems on sparc.
+	[mrg, ticket #1519]
+
+bin/ksh/history.c1.18 via patch
+
+	Use 0600 as the mode for histfile.  PR bin/52480
+	[maya, ticket #1520]
+
+sys/arch/macppc/dev/snapper.c			1.42
+
+	Fix issue with audio being downpitched.  PR 52949.
+	[sevan, ticket #1522]
+
+sys/netipsec/xform_ah.c1.77 via patch
+sys/netipsec/xform_esp.c			1.73 via patch
+sys/netipsec/xform_ipip.c			1.56-1.57 via patch
+
+	Several fixes in IPsec: strengthen sanity checks (AH/ESP), and
+	fix possible use-after-free (Tunnel).
+	[maxv, ticket #1532]
+
+sys/dev/sbus/be.c1.86
+
+	Fix spl leak.
+	[msaitoh, ticket #1533]
+
+lib/libc/arch/powerpc/gen/swapcontext.S		1.8 via patch
+lib/libc/arch/powerpc/genassym.cf		1.5 via patch
+
+	PIC code clobbers %r30 so we need to update the saved oucp with
+	caller's %r30 manually.  Makes old context happy when it needs
+	to do more function calls after restore.
+	[uwe, ticket #1534]
+
+sys/net/if_mpls.c1.31-1.33 via patch
+sys/netmpls/mpls_ttl.c1.9 via patch
+
+   	Fix several memory corruptions and inconsistencies in MPLS.
+	[maxv, ticket #1535]
+
+sys/netipsec/ipsec_input.c			1.57-1.58
+
+	Fix out-of-bounds read.
+	[maxv, ticket #1536]
+
+sys/dev/ppbus/if_plip.c1.28
+
+	Fix spl leak.
+	[msaitoh, ticket #1537]
+
+share/man/man4/altq.41.3
+
+	Update URL for the cited paper
+	[sevan, ticket #1538]
+



CVS commit: [netbsd-6] src/doc

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 18:06:22 UTC 2018

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

Log Message:
1516, 1518-1520, 1522, 1532-1538


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.326 -r1.1.2.327 src/doc/CHANGES-6.2

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 18:02:25 UTC 2018

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

Log Message:
1518-1520, 1532, 1535, 1536


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

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.130 src/doc/CHANGES-6.1.6:1.1.2.131
--- src/doc/CHANGES-6.1.6:1.1.2.130	Sat Mar  3 20:51:09 2018
+++ src/doc/CHANGES-6.1.6	Tue Mar 13 18:02:25 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.130 2018/03/03 20:51:09 snj Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.131 2018/03/13 18:02:25 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -15024,3 +15024,39 @@ sys/sys/cprng.h	patch
 	/dev/random.
 	[riastradh, ticket #1512]
 
+sys/netinet6/ip6_forward.c			1.89-1.90 via patch
+
+	Fix use-after-free of mbuf in ip6flow_create and ip6flow_create.
+	[ozaki-r, ticket #1518]
+
+sys/arch/sparc/sparc/timer.c			1.33-1.34 via patch
+sys/arch/sparc/sparc/timer_sun4m.c		1.31 via patch
+sys/arch/sparc/sparc/timerreg.h			1.10 via patch
+
+	Fix time goes backwards problems on sparc.
+	[mrg, ticket #1519]
+
+bin/ksh/history.c1.18 via patch
+
+	Use 0600 as the mode for histfile.  PR bin/52480
+	[maya, ticket #1520]
+
+sys/netipsec/xform_ah.c1.77 via patch
+sys/netipsec/xform_esp.c			1.73 via patch
+sys/netipsec/xform_ipip.c			1.56-1.57 via patch
+
+	Several fixes in IPsec: strengthen sanity checks (AH/ESP), and
+	fix possible use-after-free (Tunnel).
+	[maxv, ticket #1532]
+
+sys/net/if_mpls.c1.31-1.33 via patch
+sys/netmpls/mpls_ttl.c1.9 via patch
+
+   	Fix several memory corruptions and inconsistencies in MPLS.
+	[maxv, ticket #1535]
+
+sys/netipsec/ipsec_input.c			1.57-1.58
+
+	Fix out-of-bounds read.
+	[maxv, ticket #1536]
+



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 18:02:25 UTC 2018

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

Log Message:
1518-1520, 1532, 1535, 1536


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

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:59:51 UTC 2018

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

Log Message:
1518-1520, 1532, 1535, 1536


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

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.133 src/doc/CHANGES-6.0.7:1.1.2.134
--- src/doc/CHANGES-6.0.7:1.1.2.133	Sat Mar  3 20:51:26 2018
+++ src/doc/CHANGES-6.0.7	Tue Mar 13 17:59:51 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.133 2018/03/03 20:51:26 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.134 2018/03/13 17:59:51 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -15355,3 +15355,39 @@ sys/sys/cprng.h	patch
 	/dev/random.
 	[riastradh, ticket #1512]
 
+sys/netinet6/ip6_forward.c			1.89-1.90 via patch
+
+	Fix use-after-free of mbuf in ip6flow_create and ip6flow_create.
+	[ozaki-r, ticket #1518]
+
+sys/arch/sparc/sparc/timer.c			1.33-1.34 via patch
+sys/arch/sparc/sparc/timer_sun4m.c		1.31 via patch
+sys/arch/sparc/sparc/timerreg.h			1.10 via patch
+
+	Fix time goes backwards problems on sparc.
+	[mrg, ticket #1519]
+
+bin/ksh/history.c1.18 via patch
+
+	Use 0600 as the mode for histfile.  PR bin/52480
+	[maya, ticket #1520]
+
+sys/netipsec/xform_ah.c1.77 via patch
+sys/netipsec/xform_esp.c			1.73 via patch
+sys/netipsec/xform_ipip.c			1.56-1.57 via patch
+
+	Several fixes in IPsec: strengthen sanity checks (AH/ESP), and
+	fix possible use-after-free (Tunnel).
+	[maxv, ticket #1532]
+
+sys/net/if_mpls.c1.31-1.33 via patch
+sys/netmpls/mpls_ttl.c1.9 via patch
+
+   	Fix several memory corruptions and inconsistencies in MPLS.
+	[maxv, ticket #1535]
+
+sys/netipsec/ipsec_input.c			1.57-1.58
+
+	Fix out-of-bounds read.
+	[maxv, ticket #1536]
+



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:59:51 UTC 2018

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

Log Message:
1518-1520, 1532, 1535, 1536


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

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



CVS commit: [netbsd-6] src/share/man/man4

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:52:37 UTC 2018

Modified Files:
src/share/man/man4 [netbsd-6]: altq.4

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1538):
share/man/man4/altq.4: 1.3
Update URL for the cited paper


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/share/man/man4/altq.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/altq.4
diff -u src/share/man/man4/altq.4:1.2 src/share/man/man4/altq.4:1.2.4.1
--- src/share/man/man4/altq.4:1.2	Thu Jun 23 07:47:22 2011
+++ src/share/man/man4/altq.4	Tue Mar 13 17:52:37 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: altq.4,v 1.2 2011/06/23 07:47:22 wiz Exp $
+.\" $NetBSD: altq.4,v 1.2.4.1 2018/03/13 17:52:37 snj Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\"
@@ -24,7 +24,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 June 22, 2011
+.Dd March 08, 2018
 .Dt ALTQ 4
 .Os
 .Sh NAME
@@ -77,7 +77,7 @@ are required in order to use a certain n
 .%D March, 2004
 .%C Taipei, Taiwan
 .%O Asia BSD conference
-.%U http://www.sonycsl.co.jp/~kjc/papers/fittingtheory.pdf
+.%U http://www.sonycsl.co.jp/person/kjc/papers/fittingtheory.pdf
 .Re
 .\" .Sh HISTORY
 .\"



CVS commit: [netbsd-6] src/share/man/man4

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:52:37 UTC 2018

Modified Files:
src/share/man/man4 [netbsd-6]: altq.4

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1538):
share/man/man4/altq.4: 1.3
Update URL for the cited paper


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/share/man/man4/altq.4

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



CVS commit: [netbsd-6] src/sys/dev/ppbus

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:48:21 UTC 2018

Modified Files:
src/sys/dev/ppbus [netbsd-6]: if_plip.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1537):
sys/dev/ppbus/if_plip.c: 1.28
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.14.1 src/sys/dev/ppbus/if_plip.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/ppbus/if_plip.c
diff -u src/sys/dev/ppbus/if_plip.c:1.24 src/sys/dev/ppbus/if_plip.c:1.24.14.1
--- src/sys/dev/ppbus/if_plip.c:1.24	Mon Apr  5 07:21:47 2010
+++ src/sys/dev/ppbus/if_plip.c	Tue Mar 13 17:48:21 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.24 2010/04/05 07:21:47 joerg Exp $ */
+/* $NetBSD: if_plip.c,v 1.24.14.1 2018/03/13 17:48:21 snj Exp $ */
 
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.24 2010/04/05 07:21:47 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.24.14.1 2018/03/13 17:48:21 snj Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -445,6 +445,7 @@ lpioctl(struct ifnet *ifp, u_long cmd, v
 		case AF_INET:
 			break;
 		default:
+			splx(s);
 			return EAFNOSUPPORT;
 		}
 		break;



CVS commit: [netbsd-6] src/sys/dev/ppbus

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:48:21 UTC 2018

Modified Files:
src/sys/dev/ppbus [netbsd-6]: if_plip.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1537):
sys/dev/ppbus/if_plip.c: 1.28
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.14.1 src/sys/dev/ppbus/if_plip.c

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:47:14 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1536):
sys/netipsec/ipsec_input.c: 1.57-1.58
Extend these #ifdef notyet. The m_copydata's in these branches are wrong,
we are not guaranteed to have enough room for another struct ip, and we
may crash here. Triggerable remotely, but after authentication, by sending
an AH packet that has a one-byte-sized IPIP payload.
--
Argh, in my previous commit in this file I forgot to fix the IPv6
entry point; apply the same fix there.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.2.1 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.



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:47:13 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1536):
sys/netipsec/ipsec_input.c: 1.57-1.58
Extend these #ifdef notyet. The m_copydata's in these branches are wrong,
we are not guaranteed to have enough room for another struct ip, and we
may crash here. Triggerable remotely, but after authentication, by sending
an AH packet that has a one-byte-sized IPIP payload.
--
Argh, in my previous commit in this file I forgot to fix the IPv6
entry point; apply the same fix there.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.16.1 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.29 src/sys/netipsec/ipsec_input.c:1.29.16.1
--- src/sys/netipsec/ipsec_input.c:1.29	Wed Jan 25 21:58:10 2012
+++ src/sys/netipsec/ipsec_input.c	Tue Mar 13 17:47:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.29 2012/01/25 21:58:10 drochner Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.29.16.1 2018/03/13 17:47:12 snj 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.29 2012/01/25 21:58:10 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.29.16.1 2018/03/13 17:47:12 snj Exp $");
 
 /*
  * IPsec input processing.
@@ -332,14 +332,15 @@ ipsec4_common_input_cb(struct mbuf *m, s
 	ip->ip_len = htons(m->m_pkthdr.len);
 	prot = ip->ip_p;
 
+#ifdef notyet
 	/* IP-in-IP encapsulation */
 	if (prot == IPPROTO_IPIP) {
 		struct ip ipn;
 
 		/* ipn will now contain the inner IPv4 header */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip), );
 
-#ifdef notyet
 		/* XXX PROXY address isn't recorded in SAH */
 		/*
 		 * Check that the inner source address is the same as
@@ -367,7 +368,6 @@ ipsec4_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #if INET6
 	/* IPv6-in-IP encapsulation. */
@@ -375,9 +375,9 @@ ipsec4_common_input_cb(struct mbuf *m, s
 		struct ip6_hdr ip6n;
 
 		/* ip6n will now contain the inner IPv6 header. */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip6_hdr), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -403,9 +403,9 @@ ipsec4_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #endif /* INET6 */
+#endif /* notyet */
 
 	/*
 	 * Record what we've done to the packet (under what SA it was
@@ -651,15 +651,16 @@ ipsec6_common_input_cb(struct mbuf *m, s
 	/* Save protocol */
 	m_copydata(m, protoff, 1, );
 
+#ifdef notyet
 #ifdef INET
 	/* IP-in-IP encapsulation */
 	if (prot == IPPROTO_IPIP) {
 		struct ip ipn;
 
 		/* ipn will now contain the inner IPv4 header */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, skip, sizeof(struct ip), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -683,18 +684,16 @@ ipsec6_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #endif /* INET */
-
 	/* IPv6-in-IP encapsulation */
 	if (prot == IPPROTO_IPV6) {
 		struct ip6_hdr ip6n;
 
 		/* ip6n will now contain the inner IPv6 header. */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, skip, sizeof(struct ip6_hdr), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -719,8 +718,8 @@ ipsec6_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
+#endif /* notyet */
 
 	/*
 	 * Record what we've done to the packet (under what SA it was



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:47:14 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1536):
sys/netipsec/ipsec_input.c: 1.57-1.58
Extend these #ifdef notyet. The m_copydata's in these branches are wrong,
we are not guaranteed to have enough room for another struct ip, and we
may crash here. Triggerable remotely, but after authentication, by sending
an AH packet that has a one-byte-sized IPIP payload.
--
Argh, in my previous commit in this file I forgot to fix the IPv6
entry point; apply the same fix there.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.2.1 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.29 src/sys/netipsec/ipsec_input.c:1.29.2.1
--- src/sys/netipsec/ipsec_input.c:1.29	Wed Jan 25 21:58:10 2012
+++ src/sys/netipsec/ipsec_input.c	Tue Mar 13 17:47:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.29 2012/01/25 21:58:10 drochner Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.29.2.1 2018/03/13 17:47:14 snj 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.29 2012/01/25 21:58:10 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.29.2.1 2018/03/13 17:47:14 snj Exp $");
 
 /*
  * IPsec input processing.
@@ -332,14 +332,15 @@ ipsec4_common_input_cb(struct mbuf *m, s
 	ip->ip_len = htons(m->m_pkthdr.len);
 	prot = ip->ip_p;
 
+#ifdef notyet
 	/* IP-in-IP encapsulation */
 	if (prot == IPPROTO_IPIP) {
 		struct ip ipn;
 
 		/* ipn will now contain the inner IPv4 header */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip), );
 
-#ifdef notyet
 		/* XXX PROXY address isn't recorded in SAH */
 		/*
 		 * Check that the inner source address is the same as
@@ -367,7 +368,6 @@ ipsec4_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #if INET6
 	/* IPv6-in-IP encapsulation. */
@@ -375,9 +375,9 @@ ipsec4_common_input_cb(struct mbuf *m, s
 		struct ip6_hdr ip6n;
 
 		/* ip6n will now contain the inner IPv6 header. */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip6_hdr), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -403,9 +403,9 @@ ipsec4_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #endif /* INET6 */
+#endif /* notyet */
 
 	/*
 	 * Record what we've done to the packet (under what SA it was
@@ -651,15 +651,16 @@ ipsec6_common_input_cb(struct mbuf *m, s
 	/* Save protocol */
 	m_copydata(m, protoff, 1, );
 
+#ifdef notyet
 #ifdef INET
 	/* IP-in-IP encapsulation */
 	if (prot == IPPROTO_IPIP) {
 		struct ip ipn;
 
 		/* ipn will now contain the inner IPv4 header */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, skip, sizeof(struct ip), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -683,18 +684,16 @@ ipsec6_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #endif /* INET */
-
 	/* IPv6-in-IP encapsulation */
 	if (prot == IPPROTO_IPV6) {
 		struct ip6_hdr ip6n;
 
 		/* ip6n will now contain the inner IPv6 header. */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, skip, sizeof(struct ip6_hdr), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -719,8 +718,8 @@ ipsec6_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
+#endif /* notyet */
 
 	/*
 	 * Record what we've done to the packet (under what SA it was



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:47:11 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1536):
sys/netipsec/ipsec_input.c: 1.57-1.58
Extend these #ifdef notyet. The m_copydata's in these branches are wrong,
we are not guaranteed to have enough room for another struct ip, and we
may crash here. Triggerable remotely, but after authentication, by sending
an AH packet that has a one-byte-sized IPIP payload.
--
Argh, in my previous commit in this file I forgot to fix the IPv6
entry point; apply the same fix there.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.8.1 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.29 src/sys/netipsec/ipsec_input.c:1.29.8.1
--- src/sys/netipsec/ipsec_input.c:1.29	Wed Jan 25 21:58:10 2012
+++ src/sys/netipsec/ipsec_input.c	Tue Mar 13 17:47:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.29 2012/01/25 21:58:10 drochner Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.29.8.1 2018/03/13 17:47:11 snj 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.29 2012/01/25 21:58:10 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.29.8.1 2018/03/13 17:47:11 snj Exp $");
 
 /*
  * IPsec input processing.
@@ -332,14 +332,15 @@ ipsec4_common_input_cb(struct mbuf *m, s
 	ip->ip_len = htons(m->m_pkthdr.len);
 	prot = ip->ip_p;
 
+#ifdef notyet
 	/* IP-in-IP encapsulation */
 	if (prot == IPPROTO_IPIP) {
 		struct ip ipn;
 
 		/* ipn will now contain the inner IPv4 header */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip), );
 
-#ifdef notyet
 		/* XXX PROXY address isn't recorded in SAH */
 		/*
 		 * Check that the inner source address is the same as
@@ -367,7 +368,6 @@ ipsec4_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #if INET6
 	/* IPv6-in-IP encapsulation. */
@@ -375,9 +375,9 @@ ipsec4_common_input_cb(struct mbuf *m, s
 		struct ip6_hdr ip6n;
 
 		/* ip6n will now contain the inner IPv6 header. */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip6_hdr), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -403,9 +403,9 @@ ipsec4_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #endif /* INET6 */
+#endif /* notyet */
 
 	/*
 	 * Record what we've done to the packet (under what SA it was
@@ -651,15 +651,16 @@ ipsec6_common_input_cb(struct mbuf *m, s
 	/* Save protocol */
 	m_copydata(m, protoff, 1, );
 
+#ifdef notyet
 #ifdef INET
 	/* IP-in-IP encapsulation */
 	if (prot == IPPROTO_IPIP) {
 		struct ip ipn;
 
 		/* ipn will now contain the inner IPv4 header */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, skip, sizeof(struct ip), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -683,18 +684,16 @@ ipsec6_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
 #endif /* INET */
-
 	/* IPv6-in-IP encapsulation */
 	if (prot == IPPROTO_IPV6) {
 		struct ip6_hdr ip6n;
 
 		/* ip6n will now contain the inner IPv6 header. */
+		/* XXX: check m_pkthdr.len */
 		m_copydata(m, skip, sizeof(struct ip6_hdr), );
 
-#ifdef notyet
 		/*
 		 * Check that the inner source address is the same as
 		 * the proxy address, if available.
@@ -719,8 +718,8 @@ ipsec6_common_input_cb(struct mbuf *m, s
 			error = EACCES;
 			goto bad;
 		}
-#endif /*XXX*/
 	}
+#endif /* notyet */
 
 	/*
 	 * Record what we've done to the packet (under what SA it was



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:47:11 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1536):
sys/netipsec/ipsec_input.c: 1.57-1.58
Extend these #ifdef notyet. The m_copydata's in these branches are wrong,
we are not guaranteed to have enough room for another struct ip, and we
may crash here. Triggerable remotely, but after authentication, by sending
an AH packet that has a one-byte-sized IPIP payload.
--
Argh, in my previous commit in this file I forgot to fix the IPv6
entry point; apply the same fix there.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.8.1 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.



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:47:13 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1536):
sys/netipsec/ipsec_input.c: 1.57-1.58
Extend these #ifdef notyet. The m_copydata's in these branches are wrong,
we are not guaranteed to have enough room for another struct ip, and we
may crash here. Triggerable remotely, but after authentication, by sending
an AH packet that has a one-byte-sized IPIP payload.
--
Argh, in my previous commit in this file I forgot to fix the IPv6
entry point; apply the same fix there.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.16.1 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.



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:42:39 UTC 2018

Modified Files:
src/sys/net [netbsd-6-1]: if_mpls.c
src/sys/netmpls [netbsd-6-1]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
sys/net/if_mpls.c: 1.31-1.33 via patch
sys/netmpls/mpls_ttl.c: 1.9 via patch
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.


To generate a diff of this commit:
cvs rdiff -u -r1.8.22.1 -r1.8.22.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.3 -r1.3.32.1 src/sys/netmpls/mpls_ttl.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_mpls.c
diff -u src/sys/net/if_mpls.c:1.8.22.1 src/sys/net/if_mpls.c:1.8.22.2
--- src/sys/net/if_mpls.c:1.8.22.1	Tue Jul 30 03:06:42 2013
+++ src/sys/net/if_mpls.c	Tue Mar 13 17:42:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mpls.c,v 1.8.22.1 2013/07/30 03:06:42 msaitoh Exp $ */
+/*	$NetBSD: if_mpls.c,v 1.8.22.2 2018/03/13 17:42:39 snj Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8.22.1 2013/07/30 03:06:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8.22.2 2018/03/13 17:42:39 snj Exp $");
 
 #include "opt_inet.h"
 #include "opt_mpls.h"
@@ -83,12 +83,12 @@ static int mpls_send_frame(struct mbuf *
 static int mpls_lse(struct mbuf *);
 
 #ifdef INET
-static int mpls_unlabel_inet(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet(struct mbuf *, union mpls_shim *, uint);
 #endif
 
 #ifdef INET6
-static int mpls_unlabel_inet6(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet6(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet6(struct mbuf *, union mpls_shim *, uint);
 #endif
 
@@ -308,6 +308,12 @@ mpls_lse(struct mbuf *m)
 	int error = ENOBUFS;
 	uint psize = sizeof(struct sockaddr_mpls);
 
+	/* If we're not accepting MPLS frames, leave now. */
+	if (!mpls_accept) {
+		error = EINVAL;
+		goto done;
+	}
+
 	if (m->m_len < sizeof(union mpls_shim) &&
 	(m = m_pullup(m, sizeof(union mpls_shim))) == NULL)
 		goto done;
@@ -316,10 +322,7 @@ mpls_lse(struct mbuf *m)
 	dst.smpls_family = AF_MPLS;
 	dst.smpls_addr.s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr);
 
-	/* Check if we're accepting MPLS Frames */
 	error = EINVAL;
-	if (!mpls_accept)
-		goto done;
 
 	/* TTL decrement */
 	if ((m = mpls_ttl_dec(m)) == NULL)
@@ -331,15 +334,17 @@ mpls_lse(struct mbuf *m)
 #ifdef INET
 		case MPLS_LABEL_IPV4NULL:
 			/* Pop shim and push mbuf to IP stack */
-			if (dst.smpls_addr.shim.bos)
-error = mpls_unlabel_inet(m);
+			if (dst.smpls_addr.shim.bos) {
+m = mpls_unlabel_inet(m, );
+			}
 			break;
 #endif
 #ifdef INET6
 		case MPLS_LABEL_IPV6NULL:
 			/* Pop shim and push mbuf to IPv6 stack */
-			if (dst.smpls_addr.shim.bos)
-error = mpls_unlabel_inet6(m);
+			if (dst.smpls_addr.shim.bos) {
+m = mpls_unlabel_inet6(m, );
+			}
 			break;
 #endif
 		case MPLS_LABEL_RTALERT:	/* Yeah, I'm all alerted */
@@ -393,8 +398,10 @@ mpls_lse(struct mbuf *m)
 		tshim.shim.bos = tshim.shim.exp = 0;
 		tshim.shim.ttl = mpls_defttl;
 		if (tshim.shim.label != MPLS_LABEL_IMPLNULL &&
-		((m = mpls_prepend_shim(m, )) == NULL))
-			return ENOBUFS;
+		((m = mpls_prepend_shim(m, )) == NULL)) {
+			error = ENOBUFS;
+			goto done;
+		}
 		psize += sizeof(tshim);
 	}
 
@@ -439,11 +446,9 @@ mpls_send_frame(struct mbuf *m, struct i
 	return 0;
 }
 
-
-
 #ifdef INET
-static int
-mpls_unlabel_inet(struct mbuf *m)
+static struct mbuf *
+mpls_unlabel_inet(struct mbuf *m, int *error)
 {
 	int s, iphlen;
 	struct ip *iph;
@@ -451,7 +456,6 @@ mpls_unlabel_inet(struct mbuf *m)
 	struct ifqueue *inq;
 
 	if (mpls_mapttl_inet || mpls_mapprec_inet) {
-
 		/* get shim info */
 		ms = mtod(m, union mpls_shim *);
 		ms->s_addr = ntohl(ms->s_addr);
@@ -460,23 +464,29 @@ mpls_unlabel_inet(struct mbuf *m)
 		m_adj(m, sizeof(union mpls_shim));
 
 		/* get ip header */
-		if (m->m_len < sizeof (struct ip) &&
-		(m = m_pullup(m, sizeof(struct ip))) == NULL)
-			return ENOBUFS;
+		if (m->m_len < sizeof(struct ip) &&
+		(m = m_pullup(m, sizeof(struct ip))) == NULL) {
+			*error = ENOBUFS;
+			return NULL;
+		}
+
 		iph = mtod(m, struct ip *);
 		

CVS commit: [netbsd-6] src/sys

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:42:41 UTC 2018

Modified Files:
src/sys/net [netbsd-6]: if_mpls.c
src/sys/netmpls [netbsd-6]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
sys/net/if_mpls.c: 1.31-1.33 via patch
sys/netmpls/mpls_ttl.c: 1.9 via patch
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.


To generate a diff of this commit:
cvs rdiff -u -r1.8.8.1 -r1.8.8.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.3 -r1.3.18.1 src/sys/netmpls/mpls_ttl.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_mpls.c
diff -u src/sys/net/if_mpls.c:1.8.8.1 src/sys/net/if_mpls.c:1.8.8.2
--- src/sys/net/if_mpls.c:1.8.8.1	Tue Jul 30 03:05:39 2013
+++ src/sys/net/if_mpls.c	Tue Mar 13 17:42:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mpls.c,v 1.8.8.1 2013/07/30 03:05:39 msaitoh Exp $ */
+/*	$NetBSD: if_mpls.c,v 1.8.8.2 2018/03/13 17:42:41 snj Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8.8.1 2013/07/30 03:05:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8.8.2 2018/03/13 17:42:41 snj Exp $");
 
 #include "opt_inet.h"
 #include "opt_mpls.h"
@@ -83,12 +83,12 @@ static int mpls_send_frame(struct mbuf *
 static int mpls_lse(struct mbuf *);
 
 #ifdef INET
-static int mpls_unlabel_inet(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet(struct mbuf *, union mpls_shim *, uint);
 #endif
 
 #ifdef INET6
-static int mpls_unlabel_inet6(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet6(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet6(struct mbuf *, union mpls_shim *, uint);
 #endif
 
@@ -308,6 +308,12 @@ mpls_lse(struct mbuf *m)
 	int error = ENOBUFS;
 	uint psize = sizeof(struct sockaddr_mpls);
 
+	/* If we're not accepting MPLS frames, leave now. */
+	if (!mpls_accept) {
+		error = EINVAL;
+		goto done;
+	}
+
 	if (m->m_len < sizeof(union mpls_shim) &&
 	(m = m_pullup(m, sizeof(union mpls_shim))) == NULL)
 		goto done;
@@ -316,10 +322,7 @@ mpls_lse(struct mbuf *m)
 	dst.smpls_family = AF_MPLS;
 	dst.smpls_addr.s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr);
 
-	/* Check if we're accepting MPLS Frames */
 	error = EINVAL;
-	if (!mpls_accept)
-		goto done;
 
 	/* TTL decrement */
 	if ((m = mpls_ttl_dec(m)) == NULL)
@@ -331,15 +334,17 @@ mpls_lse(struct mbuf *m)
 #ifdef INET
 		case MPLS_LABEL_IPV4NULL:
 			/* Pop shim and push mbuf to IP stack */
-			if (dst.smpls_addr.shim.bos)
-error = mpls_unlabel_inet(m);
+			if (dst.smpls_addr.shim.bos) {
+m = mpls_unlabel_inet(m, );
+			}
 			break;
 #endif
 #ifdef INET6
 		case MPLS_LABEL_IPV6NULL:
 			/* Pop shim and push mbuf to IPv6 stack */
-			if (dst.smpls_addr.shim.bos)
-error = mpls_unlabel_inet6(m);
+			if (dst.smpls_addr.shim.bos) {
+m = mpls_unlabel_inet6(m, );
+			}
 			break;
 #endif
 		case MPLS_LABEL_RTALERT:	/* Yeah, I'm all alerted */
@@ -393,8 +398,10 @@ mpls_lse(struct mbuf *m)
 		tshim.shim.bos = tshim.shim.exp = 0;
 		tshim.shim.ttl = mpls_defttl;
 		if (tshim.shim.label != MPLS_LABEL_IMPLNULL &&
-		((m = mpls_prepend_shim(m, )) == NULL))
-			return ENOBUFS;
+		((m = mpls_prepend_shim(m, )) == NULL)) {
+			error = ENOBUFS;
+			goto done;
+		}
 		psize += sizeof(tshim);
 	}
 
@@ -439,11 +446,9 @@ mpls_send_frame(struct mbuf *m, struct i
 	return 0;
 }
 
-
-
 #ifdef INET
-static int
-mpls_unlabel_inet(struct mbuf *m)
+static struct mbuf *
+mpls_unlabel_inet(struct mbuf *m, int *error)
 {
 	int s, iphlen;
 	struct ip *iph;
@@ -451,7 +456,6 @@ mpls_unlabel_inet(struct mbuf *m)
 	struct ifqueue *inq;
 
 	if (mpls_mapttl_inet || mpls_mapprec_inet) {
-
 		/* get shim info */
 		ms = mtod(m, union mpls_shim *);
 		ms->s_addr = ntohl(ms->s_addr);
@@ -460,23 +464,29 @@ mpls_unlabel_inet(struct mbuf *m)
 		m_adj(m, sizeof(union mpls_shim));
 
 		/* get ip header */
-		if (m->m_len < sizeof (struct ip) &&
-		(m = m_pullup(m, sizeof(struct ip))) == NULL)
-			return ENOBUFS;
+		if (m->m_len < sizeof(struct ip) &&
+		(m = m_pullup(m, sizeof(struct ip))) == NULL) {
+			*error = ENOBUFS;
+			return NULL;
+		}
+
 		iph = mtod(m, struct ip *);
 		iphlen = 

CVS commit: [netbsd-6] src/sys

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:42:41 UTC 2018

Modified Files:
src/sys/net [netbsd-6]: if_mpls.c
src/sys/netmpls [netbsd-6]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
sys/net/if_mpls.c: 1.31-1.33 via patch
sys/netmpls/mpls_ttl.c: 1.9 via patch
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.


To generate a diff of this commit:
cvs rdiff -u -r1.8.8.1 -r1.8.8.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.3 -r1.3.18.1 src/sys/netmpls/mpls_ttl.c

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:42:37 UTC 2018

Modified Files:
src/sys/net [netbsd-6-0]: if_mpls.c
src/sys/netmpls [netbsd-6-0]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
sys/net/if_mpls.c: 1.31-1.33 via patch
sys/netmpls/mpls_ttl.c: 1.9 via patch
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.


To generate a diff of this commit:
cvs rdiff -u -r1.8.14.1 -r1.8.14.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.3 -r1.3.24.1 src/sys/netmpls/mpls_ttl.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_mpls.c
diff -u src/sys/net/if_mpls.c:1.8.14.1 src/sys/net/if_mpls.c:1.8.14.2
--- src/sys/net/if_mpls.c:1.8.14.1	Tue Jul 30 03:07:50 2013
+++ src/sys/net/if_mpls.c	Tue Mar 13 17:42:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mpls.c,v 1.8.14.1 2013/07/30 03:07:50 msaitoh Exp $ */
+/*	$NetBSD: if_mpls.c,v 1.8.14.2 2018/03/13 17:42:37 snj Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8.14.1 2013/07/30 03:07:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8.14.2 2018/03/13 17:42:37 snj Exp $");
 
 #include "opt_inet.h"
 #include "opt_mpls.h"
@@ -83,12 +83,12 @@ static int mpls_send_frame(struct mbuf *
 static int mpls_lse(struct mbuf *);
 
 #ifdef INET
-static int mpls_unlabel_inet(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet(struct mbuf *, union mpls_shim *, uint);
 #endif
 
 #ifdef INET6
-static int mpls_unlabel_inet6(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet6(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet6(struct mbuf *, union mpls_shim *, uint);
 #endif
 
@@ -308,6 +308,12 @@ mpls_lse(struct mbuf *m)
 	int error = ENOBUFS;
 	uint psize = sizeof(struct sockaddr_mpls);
 
+	/* If we're not accepting MPLS frames, leave now. */
+	if (!mpls_accept) {
+		error = EINVAL;
+		goto done;
+	}
+
 	if (m->m_len < sizeof(union mpls_shim) &&
 	(m = m_pullup(m, sizeof(union mpls_shim))) == NULL)
 		goto done;
@@ -316,10 +322,7 @@ mpls_lse(struct mbuf *m)
 	dst.smpls_family = AF_MPLS;
 	dst.smpls_addr.s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr);
 
-	/* Check if we're accepting MPLS Frames */
 	error = EINVAL;
-	if (!mpls_accept)
-		goto done;
 
 	/* TTL decrement */
 	if ((m = mpls_ttl_dec(m)) == NULL)
@@ -331,15 +334,17 @@ mpls_lse(struct mbuf *m)
 #ifdef INET
 		case MPLS_LABEL_IPV4NULL:
 			/* Pop shim and push mbuf to IP stack */
-			if (dst.smpls_addr.shim.bos)
-error = mpls_unlabel_inet(m);
+			if (dst.smpls_addr.shim.bos) {
+m = mpls_unlabel_inet(m, );
+			}
 			break;
 #endif
 #ifdef INET6
 		case MPLS_LABEL_IPV6NULL:
 			/* Pop shim and push mbuf to IPv6 stack */
-			if (dst.smpls_addr.shim.bos)
-error = mpls_unlabel_inet6(m);
+			if (dst.smpls_addr.shim.bos) {
+m = mpls_unlabel_inet6(m, );
+			}
 			break;
 #endif
 		case MPLS_LABEL_RTALERT:	/* Yeah, I'm all alerted */
@@ -393,8 +398,10 @@ mpls_lse(struct mbuf *m)
 		tshim.shim.bos = tshim.shim.exp = 0;
 		tshim.shim.ttl = mpls_defttl;
 		if (tshim.shim.label != MPLS_LABEL_IMPLNULL &&
-		((m = mpls_prepend_shim(m, )) == NULL))
-			return ENOBUFS;
+		((m = mpls_prepend_shim(m, )) == NULL)) {
+			error = ENOBUFS;
+			goto done;
+		}
 		psize += sizeof(tshim);
 	}
 
@@ -439,11 +446,9 @@ mpls_send_frame(struct mbuf *m, struct i
 	return 0;
 }
 
-
-
 #ifdef INET
-static int
-mpls_unlabel_inet(struct mbuf *m)
+static struct mbuf *
+mpls_unlabel_inet(struct mbuf *m, int *error)
 {
 	int s, iphlen;
 	struct ip *iph;
@@ -451,7 +456,6 @@ mpls_unlabel_inet(struct mbuf *m)
 	struct ifqueue *inq;
 
 	if (mpls_mapttl_inet || mpls_mapprec_inet) {
-
 		/* get shim info */
 		ms = mtod(m, union mpls_shim *);
 		ms->s_addr = ntohl(ms->s_addr);
@@ -460,23 +464,29 @@ mpls_unlabel_inet(struct mbuf *m)
 		m_adj(m, sizeof(union mpls_shim));
 
 		/* get ip header */
-		if (m->m_len < sizeof (struct ip) &&
-		(m = m_pullup(m, sizeof(struct ip))) == NULL)
-			return ENOBUFS;
+		if (m->m_len < sizeof(struct ip) &&
+		(m = m_pullup(m, sizeof(struct ip))) == NULL) {
+			*error = ENOBUFS;
+			return NULL;
+		}
+
 		iph = mtod(m, struct ip *);
 		

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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:42:37 UTC 2018

Modified Files:
src/sys/net [netbsd-6-0]: if_mpls.c
src/sys/netmpls [netbsd-6-0]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
sys/net/if_mpls.c: 1.31-1.33 via patch
sys/netmpls/mpls_ttl.c: 1.9 via patch
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.


To generate a diff of this commit:
cvs rdiff -u -r1.8.14.1 -r1.8.14.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.3 -r1.3.24.1 src/sys/netmpls/mpls_ttl.c

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:42:39 UTC 2018

Modified Files:
src/sys/net [netbsd-6-1]: if_mpls.c
src/sys/netmpls [netbsd-6-1]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
sys/net/if_mpls.c: 1.31-1.33 via patch
sys/netmpls/mpls_ttl.c: 1.9 via patch
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.


To generate a diff of this commit:
cvs rdiff -u -r1.8.22.1 -r1.8.22.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.3 -r1.3.32.1 src/sys/netmpls/mpls_ttl.c

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



CVS commit: [netbsd-6] src/lib/libc/arch/powerpc

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:27:39 UTC 2018

Modified Files:
src/lib/libc/arch/powerpc [netbsd-6]: genassym.cf
src/lib/libc/arch/powerpc/gen [netbsd-6]: swapcontext.S

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
lib/libc/arch/powerpc/genassym.cf: 1.5 via patch
lib/libc/arch/powerpc/gen/swapcontext.S: 1.8 via patch
PIC code clobbers %r30 so we need to update the saved oucp with
caller's %r30 manually.  Makes old context happy when it needs to do
more function calls after restore.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.8.1 src/lib/libc/arch/powerpc/genassym.cf
cvs rdiff -u -r1.6 -r1.6.8.1 src/lib/libc/arch/powerpc/gen/swapcontext.S

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



CVS commit: [netbsd-6] src/lib/libc/arch/powerpc

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:27:39 UTC 2018

Modified Files:
src/lib/libc/arch/powerpc [netbsd-6]: genassym.cf
src/lib/libc/arch/powerpc/gen [netbsd-6]: swapcontext.S

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1534):
lib/libc/arch/powerpc/genassym.cf: 1.5 via patch
lib/libc/arch/powerpc/gen/swapcontext.S: 1.8 via patch
PIC code clobbers %r30 so we need to update the saved oucp with
caller's %r30 manually.  Makes old context happy when it needs to do
more function calls after restore.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.8.1 src/lib/libc/arch/powerpc/genassym.cf
cvs rdiff -u -r1.6 -r1.6.8.1 src/lib/libc/arch/powerpc/gen/swapcontext.S

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

Modified files:

Index: src/lib/libc/arch/powerpc/genassym.cf
diff -u src/lib/libc/arch/powerpc/genassym.cf:1.3 src/lib/libc/arch/powerpc/genassym.cf:1.3.8.1
--- src/lib/libc/arch/powerpc/genassym.cf:1.3	Tue Jan 18 01:23:24 2011
+++ src/lib/libc/arch/powerpc/genassym.cf	Tue Mar 13 17:27:39 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.3 2011/01/18 01:23:24 matt Exp $
+#	$NetBSD: genassym.cf,v 1.3.8.1 2018/03/13 17:27:39 snj Exp $
 
 #
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -42,6 +42,7 @@ define CALLFRAME_R31	offsetof(struct cal
 
 define UC_GREGS_R1	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_R1])
 define UC_GREGS_R3	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_R3])
+define UC_GREGS_R30	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_R30])
 define UC_GREGS_PC	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_PC])
 
 define SIG_BLOCK	SIG_BLOCK

Index: src/lib/libc/arch/powerpc/gen/swapcontext.S
diff -u src/lib/libc/arch/powerpc/gen/swapcontext.S:1.6 src/lib/libc/arch/powerpc/gen/swapcontext.S:1.6.8.1
--- src/lib/libc/arch/powerpc/gen/swapcontext.S:1.6	Sun Jan 16 02:43:10 2011
+++ src/lib/libc/arch/powerpc/gen/swapcontext.S	Tue Mar 13 17:27:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.6 2011/01/16 02:43:10 matt Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.6.8.1 2018/03/13 17:27:39 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "SYS.h"
 #include "assym.h"
 
-__RCSID("$NetBSD: swapcontext.S,v 1.6 2011/01/16 02:43:10 matt Exp $")
+__RCSID("$NetBSD: swapcontext.S,v 1.6.8.1 2018/03/13 17:27:39 snj Exp $")
 
 #define	XCALLFRAMELEN	(((2+3)*SZREG + CALLFRAMELEN - 1) & -CALLFRAMELEN)
 #define	XCALLFRAME_R30	(XCALLFRAMELEN-1*SZREG)
@@ -57,6 +57,10 @@ ENTRY(swapcontext)
 	stw	%r0,UC_GREGS_PC(%r11)		# pc <- lr
 	addi	%r0,%r1,XCALLFRAMELEN
 	stw	%r0,UC_GREGS_R1(%r11)		# adjust sp
+#ifdef PIC
+	lwz	%r0,XCALLFRAME_R30(%r1)
+	stw	%r0,UC_GREGS_R30(%r11)		# caller's r30
+#endif
 	lwz	%r3,XCALLFRAME_UCP(%r1)		# load ucp
 	bl	PIC_PLT(_C_LABEL(setcontext))	# setcontext(ucp)
 1:



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

2018-03-13 Thread Maxime Villard

Le 11/03/2018 à 22:30, Joerg Sonnenberger a écrit :

On Sat, Mar 10, 2018 at 06:58:39PM +0100, Maxime Villard wrote:

Le 09/03/2018 à 20:33, Joerg Sonnenberger a écrit :

On Fri, Mar 09, 2018 at 06:36:45PM +0100, Maxime Villard wrote:

Le 09/03/2018 à 18:14, Joerg Sonnenberger a écrit :

On Mon, Feb 26, 2018 at 05:52:50AM +, Maxime Villard wrote:

Module Name:src
Committed By:   maxv
Date:   Mon Feb 26 05:52:50 UTC 2018

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

Log Message:
Enable SVS by default.


This broke using VirtualBox and I wouldn't be surprised by other
virtualisation solutions to be affected as well.


I'm using VirtualBox with SVS enabled, and have been doing this for two
months already, everything works fine for me.


I get an instant guru meditation once the kernel is loaded and starting.


hardware-assisted or not? I use hardware-assisted, 4.x and 5.x.


Haswell, using VTx. It seems to hit a triple fault in db_panic according
to the vbox.log.


At which stage of the boot procedure does it happen? Does it happen right
before init is launched? Or does the kernel fault right after the bootloader?


CVS commit: [netbsd-6] src/sys/dev/sbus

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:20:25 UTC 2018

Modified Files:
src/sys/dev/sbus [netbsd-6]: be.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1533):
sys/dev/sbus/be.c: 1.86
spl leak, found by Mootja a long time ago


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/dev/sbus/be.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/sbus/be.c
diff -u src/sys/dev/sbus/be.c:1.78 src/sys/dev/sbus/be.c:1.78.2.1
--- src/sys/dev/sbus/be.c:1.78	Thu Feb  2 19:43:06 2012
+++ src/sys/dev/sbus/be.c	Tue Mar 13 17:20:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: be.c,v 1.78 2012/02/02 19:43:06 tls Exp $	*/
+/*	$NetBSD: be.c,v 1.78.2.1 2018/03/13 17:20:25 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.78 2012/02/02 19:43:06 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.78.2.1 2018/03/13 17:20:25 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -1126,6 +1126,7 @@ beinit(struct ifnet *ifp)
 
 	callout_reset(>sc_tick_ch, hz, be_tick, sc);
 
+	splx(s);
 	return 0;
 out:
 	splx(s);



CVS commit: [netbsd-6] src/sys/dev/sbus

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:20:25 UTC 2018

Modified Files:
src/sys/dev/sbus [netbsd-6]: be.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1533):
sys/dev/sbus/be.c: 1.86
spl leak, found by Mootja a long time ago


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/dev/sbus/be.c

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:18:14 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-1]: xform_ah.c xform_esp.c xform_ipip.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1532):
sys/netipsec/xform_ah.c: 1.77 via patch
sys/netipsec/xform_esp.c: 1.73 via patch
sys/netipsec/xform_ipip.c: 1.56-1.57 via patch
Reinforce and clarify.
--
Add missing NULL check. Normally that's not triggerable remotely, since we
are guaranteed that 8 bytes are valid at mbuf+skip.
--
Fix use-after-free. There is a path where the mbuf gets pulled up without
a proper mtod afterwards:
218 ipo = mtod(m, struct ip *);
281 m = m_pullup(m, hlen);
232 ipo->ip_src.s_addr
Found by Mootja.
Meanwhile it seems to me that 'ipo' should be set to NULL if the inner
packet is IPv6, but I'll revisit that later.
--
As I said in my last commit in this file, ipo should be set to NULL;
otherwise the 'local address spoofing' check below is always wrong on
IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.37.8.3 -r1.37.8.4 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.40 -r1.40.8.1 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.28.22.1 -r1.28.22.2 src/sys/netipsec/xform_ipip.c

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:18:16 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6]: xform_ah.c xform_esp.c xform_ipip.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1532):
sys/netipsec/xform_ah.c: 1.77 via patch
sys/netipsec/xform_esp.c: 1.73 via patch
sys/netipsec/xform_ipip.c: 1.56-1.57 via patch
Reinforce and clarify.
--
Add missing NULL check. Normally that's not triggerable remotely, since we
are guaranteed that 8 bytes are valid at mbuf+skip.
--
Fix use-after-free. There is a path where the mbuf gets pulled up without
a proper mtod afterwards:
218 ipo = mtod(m, struct ip *);
281 m = m_pullup(m, hlen);
232 ipo->ip_src.s_addr
Found by Mootja.
Meanwhile it seems to me that 'ipo' should be set to NULL if the inner
packet is IPv6, but I'll revisit that later.
--
As I said in my last commit in this file, ipo should be set to NULL;
otherwise the 'local address spoofing' check below is always wrong on
IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.3 -r1.37.2.4 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.28.8.1 -r1.28.8.2 src/sys/netipsec/xform_ipip.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_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.37.2.3 src/sys/netipsec/xform_ah.c:1.37.2.4
--- src/sys/netipsec/xform_ah.c:1.37.2.3	Thu Feb 15 16:49:04 2018
+++ src/sys/netipsec/xform_ah.c	Tue Mar 13 17:18:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.37.2.3 2018/02/15 16:49:04 martin Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.37.2.4 2018/03/13 17:18:15 snj Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.37.2.3 2018/02/15 16:49:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.37.2.4 2018/03/13 17:18:15 snj Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -498,54 +498,45 @@ ah_massage_headers(struct mbuf **m0, int
 
 		nxt = ip6.ip6_nxt & 0xff; /* Next header type. */
 
-		for (off = 0; off < skip - sizeof(struct ip6_hdr);)
+		for (off = 0; off < skip - sizeof(struct ip6_hdr);) {
+			int noff;
+
 			switch (nxt) {
 			case IPPROTO_HOPOPTS:
 			case IPPROTO_DSTOPTS:
-ip6e = (struct ip6_ext *) (ptr + off);
+ip6e = (struct ip6_ext *)(ptr + off);
+noff = off + ((ip6e->ip6e_len + 1) << 3);
+
+/* Sanity check. */
+if (noff > skip - sizeof(struct ip6_hdr)) {
+	goto error6;
+}
 
 /*
- * Process the mutable/immutable
- * options -- borrows heavily from the
- * KAME code.
+ * Zero out mutable options.
  */
 for (count = off + sizeof(struct ip6_ext);
- count < off + ((ip6e->ip6e_len + 1) << 3);) {
+ count < noff;) {
 	if (ptr[count] == IP6OPT_PAD1) {
 		count++;
-		continue; /* Skip padding. */
-	}
-
-	/* Sanity check. */
-	if (count > off +
-	((ip6e->ip6e_len + 1) << 3)) {
-		m_freem(m);
-
-		/* Free, if we allocated. */
-		if (alloc)
-			free(ptr, M_XDATA);
-		return EINVAL;
+		continue;
 	}
 
 	ad = ptr[count + 1] + 2;
 
-	/* If mutable option, zeroize. */
-	if (ptr[count] & IP6OPT_MUTABLE)
-		memcpy(ptr + count, ipseczeroes,
-		ad);
+	if (count + ad > noff) {
+		goto error6;
+	}
+
+	if (ptr[count] & IP6OPT_MUTABLE) {
+		memset(ptr + count, 0, ad);
+	}
 
 	count += ad;
+}
 
-	/* Sanity check. */
-	if (count >
-	skip - sizeof(struct ip6_hdr)) {
-		m_freem(m);
-
-		/* Free, if we allocated. */
-		if (alloc)
-			free(ptr, M_XDATA);
-		return EINVAL;
-	}
+if (count != noff) {
+	goto error6;
 }
 
 /* Advance. */
@@ -603,11 +594,13 @@ ah_massage_headers(struct mbuf **m0, int
 			default:
 DPRINTF(("ah_massage_headers: unexpected "
 "IPv6 header type %d", off));
+error6:
 if (alloc)
 	free(ptr, M_XDATA);
 m_freem(m);
 return EINVAL;
 			}
+		}
 
 		/* Copyback and free, if we allocated. */
 		if (alloc) {

Index: src/sys/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.40 src/sys/netipsec/xform_esp.c:1.40.2.1
--- src/sys/netipsec/xform_esp.c:1.40	Wed Jan 25 20:31:23 2012
+++ src/sys/netipsec/xform_esp.c	Tue Mar 13 17:18:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.40 2012/01/25 20:31:23 drochner Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.40.2.1 2018/03/13 17:18:15 snj 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.40 2012/01/25 20:31:23 

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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:18:12 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-0]: xform_ah.c xform_esp.c xform_ipip.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1532):
sys/netipsec/xform_ah.c: 1.77 via patch
sys/netipsec/xform_esp.c: 1.73 via patch
sys/netipsec/xform_ipip.c: 1.56-1.57 via patch
Reinforce and clarify.
--
Add missing NULL check. Normally that's not triggerable remotely, since we
are guaranteed that 8 bytes are valid at mbuf+skip.
--
Fix use-after-free. There is a path where the mbuf gets pulled up without
a proper mtod afterwards:
218 ipo = mtod(m, struct ip *);
281 m = m_pullup(m, hlen);
232 ipo->ip_src.s_addr
Found by Mootja.
Meanwhile it seems to me that 'ipo' should be set to NULL if the inner
packet is IPv6, but I'll revisit that later.
--
As I said in my last commit in this file, ipo should be set to NULL;
otherwise the 'local address spoofing' check below is always wrong on
IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.37.6.3 -r1.37.6.4 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.40 -r1.40.6.1 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.28.14.1 -r1.28.14.2 src/sys/netipsec/xform_ipip.c

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:18:16 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6]: xform_ah.c xform_esp.c xform_ipip.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1532):
sys/netipsec/xform_ah.c: 1.77 via patch
sys/netipsec/xform_esp.c: 1.73 via patch
sys/netipsec/xform_ipip.c: 1.56-1.57 via patch
Reinforce and clarify.
--
Add missing NULL check. Normally that's not triggerable remotely, since we
are guaranteed that 8 bytes are valid at mbuf+skip.
--
Fix use-after-free. There is a path where the mbuf gets pulled up without
a proper mtod afterwards:
218 ipo = mtod(m, struct ip *);
281 m = m_pullup(m, hlen);
232 ipo->ip_src.s_addr
Found by Mootja.
Meanwhile it seems to me that 'ipo' should be set to NULL if the inner
packet is IPv6, but I'll revisit that later.
--
As I said in my last commit in this file, ipo should be set to NULL;
otherwise the 'local address spoofing' check below is always wrong on
IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.3 -r1.37.2.4 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.28.8.1 -r1.28.8.2 src/sys/netipsec/xform_ipip.c

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:18:12 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-0]: xform_ah.c xform_esp.c xform_ipip.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1532):
sys/netipsec/xform_ah.c: 1.77 via patch
sys/netipsec/xform_esp.c: 1.73 via patch
sys/netipsec/xform_ipip.c: 1.56-1.57 via patch
Reinforce and clarify.
--
Add missing NULL check. Normally that's not triggerable remotely, since we
are guaranteed that 8 bytes are valid at mbuf+skip.
--
Fix use-after-free. There is a path where the mbuf gets pulled up without
a proper mtod afterwards:
218 ipo = mtod(m, struct ip *);
281 m = m_pullup(m, hlen);
232 ipo->ip_src.s_addr
Found by Mootja.
Meanwhile it seems to me that 'ipo' should be set to NULL if the inner
packet is IPv6, but I'll revisit that later.
--
As I said in my last commit in this file, ipo should be set to NULL;
otherwise the 'local address spoofing' check below is always wrong on
IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.37.6.3 -r1.37.6.4 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.40 -r1.40.6.1 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.28.14.1 -r1.28.14.2 src/sys/netipsec/xform_ipip.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_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.37.6.3 src/sys/netipsec/xform_ah.c:1.37.6.4
--- src/sys/netipsec/xform_ah.c:1.37.6.3	Thu Feb 15 16:50:01 2018
+++ src/sys/netipsec/xform_ah.c	Tue Mar 13 17:18:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.37.6.3 2018/02/15 16:50:01 martin Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.37.6.4 2018/03/13 17:18:12 snj Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.37.6.3 2018/02/15 16:50:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.37.6.4 2018/03/13 17:18:12 snj Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -498,54 +498,45 @@ ah_massage_headers(struct mbuf **m0, int
 
 		nxt = ip6.ip6_nxt & 0xff; /* Next header type. */
 
-		for (off = 0; off < skip - sizeof(struct ip6_hdr);)
+		for (off = 0; off < skip - sizeof(struct ip6_hdr);) {
+			int noff;
+
 			switch (nxt) {
 			case IPPROTO_HOPOPTS:
 			case IPPROTO_DSTOPTS:
-ip6e = (struct ip6_ext *) (ptr + off);
+ip6e = (struct ip6_ext *)(ptr + off);
+noff = off + ((ip6e->ip6e_len + 1) << 3);
+
+/* Sanity check. */
+if (noff > skip - sizeof(struct ip6_hdr)) {
+	goto error6;
+}
 
 /*
- * Process the mutable/immutable
- * options -- borrows heavily from the
- * KAME code.
+ * Zero out mutable options.
  */
 for (count = off + sizeof(struct ip6_ext);
- count < off + ((ip6e->ip6e_len + 1) << 3);) {
+ count < noff;) {
 	if (ptr[count] == IP6OPT_PAD1) {
 		count++;
-		continue; /* Skip padding. */
-	}
-
-	/* Sanity check. */
-	if (count > off +
-	((ip6e->ip6e_len + 1) << 3)) {
-		m_freem(m);
-
-		/* Free, if we allocated. */
-		if (alloc)
-			free(ptr, M_XDATA);
-		return EINVAL;
+		continue;
 	}
 
 	ad = ptr[count + 1] + 2;
 
-	/* If mutable option, zeroize. */
-	if (ptr[count] & IP6OPT_MUTABLE)
-		memcpy(ptr + count, ipseczeroes,
-		ad);
+	if (count + ad > noff) {
+		goto error6;
+	}
+
+	if (ptr[count] & IP6OPT_MUTABLE) {
+		memset(ptr + count, 0, ad);
+	}
 
 	count += ad;
+}
 
-	/* Sanity check. */
-	if (count >
-	skip - sizeof(struct ip6_hdr)) {
-		m_freem(m);
-
-		/* Free, if we allocated. */
-		if (alloc)
-			free(ptr, M_XDATA);
-		return EINVAL;
-	}
+if (count != noff) {
+	goto error6;
 }
 
 /* Advance. */
@@ -603,11 +594,13 @@ ah_massage_headers(struct mbuf **m0, int
 			default:
 DPRINTF(("ah_massage_headers: unexpected "
 "IPv6 header type %d", off));
+error6:
 if (alloc)
 	free(ptr, M_XDATA);
 m_freem(m);
 return EINVAL;
 			}
+		}
 
 		/* Copyback and free, if we allocated. */
 		if (alloc) {

Index: src/sys/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.40 src/sys/netipsec/xform_esp.c:1.40.6.1
--- src/sys/netipsec/xform_esp.c:1.40	Wed Jan 25 20:31:23 2012
+++ src/sys/netipsec/xform_esp.c	Tue Mar 13 17:18:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.40 2012/01/25 20:31:23 drochner Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.40.6.1 2018/03/13 17:18:12 snj 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.40 2012/01/25 20:31:23 

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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:18:14 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-1]: xform_ah.c xform_esp.c xform_ipip.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1532):
sys/netipsec/xform_ah.c: 1.77 via patch
sys/netipsec/xform_esp.c: 1.73 via patch
sys/netipsec/xform_ipip.c: 1.56-1.57 via patch
Reinforce and clarify.
--
Add missing NULL check. Normally that's not triggerable remotely, since we
are guaranteed that 8 bytes are valid at mbuf+skip.
--
Fix use-after-free. There is a path where the mbuf gets pulled up without
a proper mtod afterwards:
218 ipo = mtod(m, struct ip *);
281 m = m_pullup(m, hlen);
232 ipo->ip_src.s_addr
Found by Mootja.
Meanwhile it seems to me that 'ipo' should be set to NULL if the inner
packet is IPv6, but I'll revisit that later.
--
As I said in my last commit in this file, ipo should be set to NULL;
otherwise the 'local address spoofing' check below is always wrong on
IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.37.8.3 -r1.37.8.4 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.40 -r1.40.8.1 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.28.22.1 -r1.28.22.2 src/sys/netipsec/xform_ipip.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_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.37.8.3 src/sys/netipsec/xform_ah.c:1.37.8.4
--- src/sys/netipsec/xform_ah.c:1.37.8.3	Thu Feb 15 16:49:35 2018
+++ src/sys/netipsec/xform_ah.c	Tue Mar 13 17:18:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.37.8.3 2018/02/15 16:49:35 martin Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.37.8.4 2018/03/13 17:18:14 snj Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.37.8.3 2018/02/15 16:49:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.37.8.4 2018/03/13 17:18:14 snj Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -498,54 +498,45 @@ ah_massage_headers(struct mbuf **m0, int
 
 		nxt = ip6.ip6_nxt & 0xff; /* Next header type. */
 
-		for (off = 0; off < skip - sizeof(struct ip6_hdr);)
+		for (off = 0; off < skip - sizeof(struct ip6_hdr);) {
+			int noff;
+
 			switch (nxt) {
 			case IPPROTO_HOPOPTS:
 			case IPPROTO_DSTOPTS:
-ip6e = (struct ip6_ext *) (ptr + off);
+ip6e = (struct ip6_ext *)(ptr + off);
+noff = off + ((ip6e->ip6e_len + 1) << 3);
+
+/* Sanity check. */
+if (noff > skip - sizeof(struct ip6_hdr)) {
+	goto error6;
+}
 
 /*
- * Process the mutable/immutable
- * options -- borrows heavily from the
- * KAME code.
+ * Zero out mutable options.
  */
 for (count = off + sizeof(struct ip6_ext);
- count < off + ((ip6e->ip6e_len + 1) << 3);) {
+ count < noff;) {
 	if (ptr[count] == IP6OPT_PAD1) {
 		count++;
-		continue; /* Skip padding. */
-	}
-
-	/* Sanity check. */
-	if (count > off +
-	((ip6e->ip6e_len + 1) << 3)) {
-		m_freem(m);
-
-		/* Free, if we allocated. */
-		if (alloc)
-			free(ptr, M_XDATA);
-		return EINVAL;
+		continue;
 	}
 
 	ad = ptr[count + 1] + 2;
 
-	/* If mutable option, zeroize. */
-	if (ptr[count] & IP6OPT_MUTABLE)
-		memcpy(ptr + count, ipseczeroes,
-		ad);
+	if (count + ad > noff) {
+		goto error6;
+	}
+
+	if (ptr[count] & IP6OPT_MUTABLE) {
+		memset(ptr + count, 0, ad);
+	}
 
 	count += ad;
+}
 
-	/* Sanity check. */
-	if (count >
-	skip - sizeof(struct ip6_hdr)) {
-		m_freem(m);
-
-		/* Free, if we allocated. */
-		if (alloc)
-			free(ptr, M_XDATA);
-		return EINVAL;
-	}
+if (count != noff) {
+	goto error6;
 }
 
 /* Advance. */
@@ -603,11 +594,13 @@ ah_massage_headers(struct mbuf **m0, int
 			default:
 DPRINTF(("ah_massage_headers: unexpected "
 "IPv6 header type %d", off));
+error6:
 if (alloc)
 	free(ptr, M_XDATA);
 m_freem(m);
 return EINVAL;
 			}
+		}
 
 		/* Copyback and free, if we allocated. */
 		if (alloc) {

Index: src/sys/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.40 src/sys/netipsec/xform_esp.c:1.40.8.1
--- src/sys/netipsec/xform_esp.c:1.40	Wed Jan 25 20:31:23 2012
+++ src/sys/netipsec/xform_esp.c	Tue Mar 13 17:18:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.40 2012/01/25 20:31:23 drochner Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.40.8.1 2018/03/13 17:18:14 snj 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.40 2012/01/25 20:31:23 

CVS commit: [netbsd-6] src/sys/arch/macppc/dev

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:09:15 UTC 2018

Modified Files:
src/sys/arch/macppc/dev [netbsd-6]: snapper.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1522):
sys/arch/macppc/dev/snapper.c: 1.42
Fix issue with audio being downpitched, thanks to 
"it seems that snapper_init should be called before audio_attach_mi, as
snapper
init is setting the rate to 44100 after the hardware format has been
configured
by audio_attach_mi.
audio_attach_mi should be the last thing called during an attach of an audio
device so the audio device is ready to be configured when audio_attach_mi is
called."
Resolves PR port-macppc/52949


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/macppc/dev/snapper.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/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.38 src/sys/arch/macppc/dev/snapper.c:1.38.4.1
--- src/sys/arch/macppc/dev/snapper.c:1.38	Thu Nov 24 03:35:57 2011
+++ src/sys/arch/macppc/dev/snapper.c	Tue Mar 13 17:09:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.38 2011/11/24 03:35:57 mrg Exp $	*/
+/*	$NetBSD: snapper.c,v 1.38.4.1 2018/03/13 17:09:15 snj Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.38 2011/11/24 03:35:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.38.4.1 2018/03/13 17:09:15 snj Exp $");
 
 #include 
 #include 
@@ -839,10 +839,10 @@ snapper_defer(device_t dev)
 		break;
 	}
 
-	audio_attach_mi(_hw_if, sc, sc->sc_dev);
-
 	/* ki2c_setmode(sc->sc_i2c, I2C_STDSUBMODE); */
 	snapper_init(sc, sc->sc_node);
+
+	audio_attach_mi(_hw_if, sc, sc->sc_dev);
 }
 
 static int



CVS commit: [netbsd-6] src/sys/arch/macppc/dev

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:09:15 UTC 2018

Modified Files:
src/sys/arch/macppc/dev [netbsd-6]: snapper.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1522):
sys/arch/macppc/dev/snapper.c: 1.42
Fix issue with audio being downpitched, thanks to 
"it seems that snapper_init should be called before audio_attach_mi, as
snapper
init is setting the rate to 44100 after the hardware format has been
configured
by audio_attach_mi.
audio_attach_mi should be the last thing called during an attach of an audio
device so the audio device is ready to be configured when audio_attach_mi is
called."
Resolves PR port-macppc/52949


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/macppc/dev/snapper.c

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



CVS commit: [netbsd-6] src/bin/ksh

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:01:57 UTC 2018

Modified Files:
src/bin/ksh [netbsd-6]: history.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1520):
bin/ksh/history.c: 1.18
Use 0600 as the mode for histfile here too.
pointed out by John D. Baker in PR bin/52480


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/bin/ksh/history.c

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



CVS commit: [netbsd-6-0] src/bin/ksh

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:01:54 UTC 2018

Modified Files:
src/bin/ksh [netbsd-6-0]: history.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1520):
bin/ksh/history.c: 1.18
Use 0600 as the mode for histfile here too.
pointed out by John D. Baker in PR bin/52480


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.10.1 src/bin/ksh/history.c

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

Modified files:

Index: src/bin/ksh/history.c
diff -u src/bin/ksh/history.c:1.11 src/bin/ksh/history.c:1.11.10.1
--- src/bin/ksh/history.c:1.11	Wed Aug 31 16:24:54 2011
+++ src/bin/ksh/history.c	Tue Mar 13 17:01:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $	*/
+/*	$NetBSD: history.c,v 1.11.10.1 2018/03/13 17:01:54 snj Exp $	*/
 
 /*
  * command history
@@ -19,7 +19,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: history.c,v 1.11.10.1 2018/03/13 17:01:54 snj Exp $");
 #endif
 
 
@@ -757,7 +757,7 @@ hist_finish()
   else
 hp = histlist;
 
-  fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0777);
+  fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0600);
   /* Remove anything written before we got the lock */
   ftruncate(fd, 0);
   if (fd >= 0 && (fh = fdopen(fd, "w"))) {



CVS commit: [netbsd-6-0] src/bin/ksh

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:01:54 UTC 2018

Modified Files:
src/bin/ksh [netbsd-6-0]: history.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1520):
bin/ksh/history.c: 1.18
Use 0600 as the mode for histfile here too.
pointed out by John D. Baker in PR bin/52480


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.10.1 src/bin/ksh/history.c

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



CVS commit: [netbsd-6] src/bin/ksh

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:01:57 UTC 2018

Modified Files:
src/bin/ksh [netbsd-6]: history.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1520):
bin/ksh/history.c: 1.18
Use 0600 as the mode for histfile here too.
pointed out by John D. Baker in PR bin/52480


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/bin/ksh/history.c

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

Modified files:

Index: src/bin/ksh/history.c
diff -u src/bin/ksh/history.c:1.11 src/bin/ksh/history.c:1.11.4.1
--- src/bin/ksh/history.c:1.11	Wed Aug 31 16:24:54 2011
+++ src/bin/ksh/history.c	Tue Mar 13 17:01:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $	*/
+/*	$NetBSD: history.c,v 1.11.4.1 2018/03/13 17:01:57 snj Exp $	*/
 
 /*
  * command history
@@ -19,7 +19,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: history.c,v 1.11.4.1 2018/03/13 17:01:57 snj Exp $");
 #endif
 
 
@@ -757,7 +757,7 @@ hist_finish()
   else
 hp = histlist;
 
-  fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0777);
+  fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0600);
   /* Remove anything written before we got the lock */
   ftruncate(fd, 0);
   if (fd >= 0 && (fh = fdopen(fd, "w"))) {



CVS commit: [netbsd-6-1] src/bin/ksh

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:01:56 UTC 2018

Modified Files:
src/bin/ksh [netbsd-6-1]: history.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1520):
bin/ksh/history.c: 1.18
Use 0600 as the mode for histfile here too.
pointed out by John D. Baker in PR bin/52480


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.18.1 src/bin/ksh/history.c

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



CVS commit: [netbsd-6-1] src/bin/ksh

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 17:01:56 UTC 2018

Modified Files:
src/bin/ksh [netbsd-6-1]: history.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1520):
bin/ksh/history.c: 1.18
Use 0600 as the mode for histfile here too.
pointed out by John D. Baker in PR bin/52480


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.18.1 src/bin/ksh/history.c

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

Modified files:

Index: src/bin/ksh/history.c
diff -u src/bin/ksh/history.c:1.11 src/bin/ksh/history.c:1.11.18.1
--- src/bin/ksh/history.c:1.11	Wed Aug 31 16:24:54 2011
+++ src/bin/ksh/history.c	Tue Mar 13 17:01:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $	*/
+/*	$NetBSD: history.c,v 1.11.18.1 2018/03/13 17:01:55 snj Exp $	*/
 
 /*
  * command history
@@ -19,7 +19,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: history.c,v 1.11.18.1 2018/03/13 17:01:55 snj Exp $");
 #endif
 
 
@@ -757,7 +757,7 @@ hist_finish()
   else
 hp = histlist;
 
-  fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0777);
+  fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0600);
   /* Remove anything written before we got the lock */
   ftruncate(fd, 0);
   if (fd >= 0 && (fh = fdopen(fd, "w"))) {



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

2018-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 13 16:52:42 UTC 2018

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

Log Message:
Fix wrong order; first enable WP, then enable interrupts. Otherwise we
might get an interrupt before re-enabling WP, and be rescheduled as a
result. In practice it never happens, because the previous PSL always
has interrupts disabled too.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/x86/patch.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/patch.c
diff -u src/sys/arch/x86/x86/patch.c:1.33 src/sys/arch/x86/x86/patch.c:1.34
--- src/sys/arch/x86/x86/patch.c:1.33	Thu Feb 22 09:41:06 2018
+++ src/sys/arch/x86/x86/patch.c	Tue Mar 13 16:52:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: patch.c,v 1.33 2018/02/22 09:41:06 maxv Exp $	*/
+/*	$NetBSD: patch.c,v 1.34 2018/03/13 16:52:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.33 2018/02/22 09:41:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.34 2018/03/13 16:52:42 maxv Exp $");
 
 #include "opt_lockdebug.h"
 #ifdef i386
@@ -182,10 +182,12 @@ x86_patch_window_close(u_long psl, u_lon
 	/* Write back and invalidate cache, flush pipelines. */
 	wbinvd();
 	x86_flush();
-	x86_write_psl(psl);
 
 	/* Re-enable write protection. */
 	lcr0(cr0);
+
+	/* Restore the PSL, potentially re-enabling interrupts. */
+	x86_write_psl(psl);
 }
 
 void



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

2018-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 13 16:52:42 UTC 2018

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

Log Message:
Fix wrong order; first enable WP, then enable interrupts. Otherwise we
might get an interrupt before re-enabling WP, and be rescheduled as a
result. In practice it never happens, because the previous PSL always
has interrupts disabled too.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/x86/patch.c

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



CVS commit: [netbsd-6] src/sys/arch/sparc/sparc

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:48:05 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-6]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.8.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.28 -r1.28.8.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.118.1 src/sys/arch/sparc/sparc/timerreg.h

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:48:01 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-6-0]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.12.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.28 -r1.28.14.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.124.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.29 src/sys/arch/sparc/sparc/timer.c:1.29.12.1
--- src/sys/arch/sparc/sparc/timer.c:1.29	Sun Jul 17 23:18:23 2011
+++ src/sys/arch/sparc/sparc/timer.c	Tue Mar 13 16:48:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.29.12.1 2018/03/13 16:48:01 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29.12.1 2018/03/13 16:48:01 snj Exp $");
 
 #include 
 #include 
@@ -83,56 +83,93 @@ static u_int timer_get_timecount(struct 
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offet due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
-
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
 
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res  &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the 

CVS commit: [netbsd-6] src/sys/arch/sparc/sparc

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:48:05 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-6]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.8.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.28 -r1.28.8.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.118.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.29 src/sys/arch/sparc/sparc/timer.c:1.29.8.1
--- src/sys/arch/sparc/sparc/timer.c:1.29	Sun Jul 17 23:18:23 2011
+++ src/sys/arch/sparc/sparc/timer.c	Tue Mar 13 16:48:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.29.8.1 2018/03/13 16:48:05 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29.8.1 2018/03/13 16:48:05 snj Exp $");
 
 #include 
 #include 
@@ -83,56 +83,93 @@ static u_int timer_get_timecount(struct 
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offet due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
-
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
 
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res  &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the limit so 

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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:48:03 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-6-1]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.14.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.28 -r1.28.22.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.134.1 src/sys/arch/sparc/sparc/timerreg.h

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:48:01 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-6-0]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.12.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.28 -r1.28.14.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.124.1 src/sys/arch/sparc/sparc/timerreg.h

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



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:48:03 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-6-1]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1519):
sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31
sys/arch/sparc/sparc/timer.c: 1.33
sys/arch/sparc/sparc/timer.c: 1.33 1.34
sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.14.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.28 -r1.28.22.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.134.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.29 src/sys/arch/sparc/sparc/timer.c:1.29.14.1
--- src/sys/arch/sparc/sparc/timer.c:1.29	Sun Jul 17 23:18:23 2011
+++ src/sys/arch/sparc/sparc/timer.c	Tue Mar 13 16:48:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.29.14.1 2018/03/13 16:48:03 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29.14.1 2018/03/13 16:48:03 snj Exp $");
 
 #include 
 #include 
@@ -83,56 +83,93 @@ static u_int timer_get_timecount(struct 
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offet due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
-
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
 
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res  &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the 

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

2018-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 13 16:45:52 UTC 2018

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

Log Message:
Mmh, add a missing x86_disable_intr(). My intention there was to ensure
interrupts were disabled before the barriers.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/arch/x86/x86/svs.c:1.14
--- src/sys/arch/x86/x86/svs.c:1.13	Thu Mar  1 16:49:06 2018
+++ src/sys/arch/x86/x86/svs.c	Tue Mar 13 16:45:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.13 2018/03/01 16:49:06 maxv Exp $	*/
+/*	$NetBSD: svs.c,v 1.14 2018/03/13 16:45:52 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.13 2018/03/01 16:49:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14 2018/03/13 16:45:52 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -647,6 +647,7 @@ svs_disable_cpu(void *arg1, void *arg2)
 	u_long psl;
 
 	psl = x86_read_psl();
+	x86_disable_intr();
 
 	atomic_dec_ulong(_cpu_barrier1);
 	while (atomic_cas_ulong(_cpu_barrier1, 0, 0) != 0) {



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

2018-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 13 16:45:52 UTC 2018

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

Log Message:
Mmh, add a missing x86_disable_intr(). My intention there was to ensure
interrupts were disabled before the barriers.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:43:03 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1518):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.69.6.1 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.



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:43:06 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1518):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.69.2.1 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.



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:43:06 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1518):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.69.2.1 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.69 src/sys/netinet6/ip6_forward.c:1.69.2.1
--- src/sys/netinet6/ip6_forward.c:1.69	Mon Dec 19 11:59:58 2011
+++ src/sys/netinet6/ip6_forward.c	Tue Mar 13 16:43:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.69 2011/12/19 11:59:58 drochner Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.69.2.1 2018/03/13 16:43:06 snj 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.69 2011/12/19 11:59:58 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.69.2.1 2018/03/13 16:43:06 snj Exp $");
 
 #include "opt_gateway.h"
 #include "opt_ipsec.h"
@@ -645,8 +645,8 @@ ip6_forward(struct mbuf *m, int srcrt)
 			IP6_STATINC(IP6_STAT_REDIRECTSENT);
 		else {
 #ifdef GATEWAY
-			if (m->m_flags & M_CANFASTFWD)
-ip6flow_create(_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(_forward_rt, mcopy);
 #endif
 			if (mcopy)
 goto freecopy;



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:43:05 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1518):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.69.8.1 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.69 src/sys/netinet6/ip6_forward.c:1.69.8.1
--- src/sys/netinet6/ip6_forward.c:1.69	Mon Dec 19 11:59:58 2011
+++ src/sys/netinet6/ip6_forward.c	Tue Mar 13 16:43:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.69 2011/12/19 11:59:58 drochner Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.69.8.1 2018/03/13 16:43:04 snj 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.69 2011/12/19 11:59:58 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.69.8.1 2018/03/13 16:43:04 snj Exp $");
 
 #include "opt_gateway.h"
 #include "opt_ipsec.h"
@@ -645,8 +645,8 @@ ip6_forward(struct mbuf *m, int srcrt)
 			IP6_STATINC(IP6_STAT_REDIRECTSENT);
 		else {
 #ifdef GATEWAY
-			if (m->m_flags & M_CANFASTFWD)
-ip6flow_create(_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(_forward_rt, mcopy);
 #endif
 			if (mcopy)
 goto freecopy;



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:43:03 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1518):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.69.6.1 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.69 src/sys/netinet6/ip6_forward.c:1.69.6.1
--- src/sys/netinet6/ip6_forward.c:1.69	Mon Dec 19 11:59:58 2011
+++ src/sys/netinet6/ip6_forward.c	Tue Mar 13 16:43:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.69 2011/12/19 11:59:58 drochner Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.69.6.1 2018/03/13 16:43:03 snj 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.69 2011/12/19 11:59:58 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.69.6.1 2018/03/13 16:43:03 snj Exp $");
 
 #include "opt_gateway.h"
 #include "opt_ipsec.h"
@@ -645,8 +645,8 @@ ip6_forward(struct mbuf *m, int srcrt)
 			IP6_STATINC(IP6_STAT_REDIRECTSENT);
 		else {
 #ifdef GATEWAY
-			if (m->m_flags & M_CANFASTFWD)
-ip6flow_create(_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(_forward_rt, mcopy);
 #endif
 			if (mcopy)
 goto freecopy;



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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:38:28 UTC 2018

Modified Files:
src/sys/dev [netbsd-6]: fss.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1516):
sys/dev/fss.c: 1.101-1.103
Bounds check against media size for non-persistent snapshots.
--
Treat partial read from backing store as I/O error.
--
Pass residual back to b_resid for persistent snapshots.


To generate a diff of this commit:
cvs rdiff -u -r1.81.4.4 -r1.81.4.5 src/sys/dev/fss.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/fss.c
diff -u src/sys/dev/fss.c:1.81.4.4 src/sys/dev/fss.c:1.81.4.5
--- src/sys/dev/fss.c:1.81.4.4	Sat Aug 27 14:47:47 2016
+++ src/sys/dev/fss.c	Tue Mar 13 16:38:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.81.4.4 2016/08/27 14:47:47 bouyer Exp $	*/
+/*	$NetBSD: fss.c,v 1.81.4.5 2018/03/13 16:38:28 snj Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.81.4.4 2016/08/27 14:47:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.81.4.5 2018/03/13 16:38:28 snj Exp $");
 
 #include 
 #include 
@@ -90,7 +90,7 @@ static void fss_softc_free(struct fss_so
 static int fss_read_cluster(struct fss_softc *, u_int32_t);
 static void fss_bs_thread(void *);
 static int fss_bs_io(struct fss_softc *, fss_io_type,
-u_int32_t, off_t, int, void *);
+u_int32_t, off_t, int, void *, size_t *);
 static u_int32_t *fss_bs_indir(struct fss_softc *, u_int32_t);
 
 static kmutex_t fss_device_lock;	/* Protect all units. */
@@ -266,20 +266,26 @@ fss_strategy(struct buf *bp)
 	mutex_enter(>sc_slock);
 
 	if (write || !FSS_ISVALID(sc)) {
-
-		mutex_exit(>sc_slock);
-
 		bp->b_error = (write ? EROFS : ENXIO);
-		bp->b_resid = bp->b_bcount;
-		biodone(bp);
-		return;
+		goto done;
 	}
+	/* Check bounds for non-persistent snapshots. */
+	if ((sc->sc_flags & FSS_PERSISTENT) == 0 &&
+	bounds_check_with_mediasize(bp, DEV_BSIZE,
+	btodb(FSS_CLTOB(sc, sc->sc_clcount - 1) + sc->sc_clresid)) <= 0)
+		goto done;
 
 	bp->b_rawblkno = bp->b_blkno;
 	bufq_put(sc->sc_bufq, bp);
 	cv_signal(>sc_work_cv);
 
 	mutex_exit(>sc_slock);
+	return;
+
+done:
+	mutex_exit(>sc_slock);
+	bp->b_resid = bp->b_bcount;
+	biodone(bp);
 }
 
 int
@@ -993,6 +999,8 @@ restart:
 		todo -= len;
 	}
 	error = biowait(mbp);
+	if (error == 0 && mbp->b_resid != 0)
+		error = EIO;
 	putiobuf(mbp);
 
 	mutex_enter(>sc_slock);
@@ -1014,7 +1022,7 @@ restart:
  */
 static int
 fss_bs_io(struct fss_softc *sc, fss_io_type rw,
-u_int32_t cl, off_t off, int len, void *data)
+u_int32_t cl, off_t off, int len, void *data, size_t *resid)
 {
 	int error;
 
@@ -1025,7 +1033,7 @@ fss_bs_io(struct fss_softc *sc, fss_io_t
 	error = vn_rdwr((rw == FSS_READ ? UIO_READ : UIO_WRITE), sc->sc_bs_vp,
 	data, len, off, UIO_SYSSPACE,
 	IO_ADV_ENCODE(POSIX_FADV_NOREUSE) | IO_NODELOCKED,
-	sc->sc_bs_lwp->l_cred, NULL, NULL);
+	sc->sc_bs_lwp->l_cred, resid, NULL);
 	if (error == 0) {
 		mutex_enter(sc->sc_bs_vp->v_interlock);
 		error = VOP_PUTPAGES(sc->sc_bs_vp, trunc_page(off),
@@ -1054,7 +1062,7 @@ fss_bs_indir(struct fss_softc *sc, u_int
 
 	if (sc->sc_indir_dirty) {
 		if (fss_bs_io(sc, FSS_WRITE, sc->sc_indir_cur, 0,
-		FSS_CLSIZE(sc), (void *)sc->sc_indir_data) != 0)
+		FSS_CLSIZE(sc), (void *)sc->sc_indir_data, NULL) != 0)
 			return NULL;
 		setbit(sc->sc_indir_valid, sc->sc_indir_cur);
 	}
@@ -1064,7 +1072,7 @@ fss_bs_indir(struct fss_softc *sc, u_int
 
 	if (isset(sc->sc_indir_valid, sc->sc_indir_cur)) {
 		if (fss_bs_io(sc, FSS_READ, sc->sc_indir_cur, 0,
-		FSS_CLSIZE(sc), (void *)sc->sc_indir_data) != 0)
+		FSS_CLSIZE(sc), (void *)sc->sc_indir_data, NULL) != 0)
 			return NULL;
 	} else
 		memset(sc->sc_indir_data, 0, FSS_CLSIZE(sc));
@@ -1085,6 +1093,7 @@ fss_bs_thread(void *arg)
 	long off;
 	char *addr;
 	u_int32_t c, cl, ch, *indirp;
+	size_t resid;
 	struct buf *bp, *nbp;
 	struct fss_softc *sc;
 	struct fss_cache *scp, *scl;
@@ -1121,14 +1130,18 @@ fss_bs_thread(void *arg)
 disk_busy(sc->sc_dkdev);
 error = fss_bs_io(sc, FSS_READ, 0,
 dbtob(bp->b_blkno), bp->b_bcount,
-bp->b_data);
+bp->b_data, );
+if (error)
+	resid = bp->b_bcount;
 disk_unbusy(sc->sc_dkdev,
 (error ? 0 : bp->b_bcount), is_read);
-			} else
+			} else {
 error = ENXIO;
+resid = bp->b_bcount;
+			}
 
 			bp->b_error = error;
-			bp->b_resid = (error ? bp->b_bcount : 0);
+			bp->b_resid = resid;
 			biodone(bp);
 
 			mutex_enter(>sc_slock);
@@ -1149,7 +1162,7 @@ fss_bs_thread(void *arg)
 			indirp = fss_bs_indir(sc, scp->fc_cluster);
 			if (indirp != NULL) {
 error = fss_bs_io(sc, FSS_WRITE, sc->sc_clnext,
-0, FSS_CLSIZE(sc), scp->fc_data);
+0, FSS_CLSIZE(sc), scp->fc_data, NULL);
 			} else
 error = EIO;
 
@@ -1217,6 +1230,8 

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

2018-03-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar 13 16:38:28 UTC 2018

Modified Files:
src/sys/dev [netbsd-6]: fss.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1516):
sys/dev/fss.c: 1.101-1.103
Bounds check against media size for non-persistent snapshots.
--
Treat partial read from backing store as I/O error.
--
Pass residual back to b_resid for persistent snapshots.


To generate a diff of this commit:
cvs rdiff -u -r1.81.4.4 -r1.81.4.5 src/sys/dev/fss.c

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



CVS commit: src/sys/net/npf

2018-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 13 16:23:40 UTC 2018

Modified Files:
src/sys/net/npf: npf_inet.c

Log Message:
Mmh, put back the RFC6946 check (about dummy fragments), otherwise NPF
is not happy in npf_reassembly, because NPC_IPFRAG is again returned after
the packet was reassembled.

I'm wondering whether it would not be better to just remove the fragment
header in frag6_input directly.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/npf/npf_inet.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/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.40 src/sys/net/npf/npf_inet.c:1.41
--- src/sys/net/npf/npf_inet.c:1.40	Tue Mar 13 09:04:02 2018
+++ src/sys/net/npf/npf_inet.c	Tue Mar 13 16:23:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.40 2018/03/13 09:04:02 maxv Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.41 2018/03/13 16:23:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.40 2018/03/13 09:04:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.41 2018/03/13 16:23:40 maxv Exp $");
 
 #include 
 #include 
@@ -392,6 +392,13 @@ npf_cache_ip(npf_cache_t *npc, nbuf_t *n
 if (ip6f == NULL)
 	return NPC_FMTERR;
 
+/* RFC6946: Skip dummy fragments. */
+if (!ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK) &&
+!(ip6f->ip6f_offlg & IP6F_MORE_FRAG)) {
+	hlen = sizeof(struct ip6_frag);
+	break;
+}
+
 hlen = 0;
 flags |= NPC_IPFRAG;
 



CVS commit: src/sys/net/npf

2018-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 13 16:23:40 UTC 2018

Modified Files:
src/sys/net/npf: npf_inet.c

Log Message:
Mmh, put back the RFC6946 check (about dummy fragments), otherwise NPF
is not happy in npf_reassembly, because NPC_IPFRAG is again returned after
the packet was reassembled.

I'm wondering whether it would not be better to just remove the fragment
header in frag6_input directly.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/npf/npf_inet.c

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



CVS commit: [netbsd-8] src/doc

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:50:31 UTC 2018

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

Log Message:
Tickets #619 - #629


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.140 -r1.1.2.141 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.140 src/doc/CHANGES-8.0:1.1.2.141
--- src/doc/CHANGES-8.0:1.1.2.140	Thu Mar  8 14:39:22 2018
+++ src/doc/CHANGES-8.0	Tue Mar 13 15:50:31 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.140 2018/03/08 14:39:22 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.141 2018/03/13 15:50:31 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -10179,3 +10179,126 @@ sys/net/if_ethersubr.c1.245,1.247
 	Modify ether_ioctl() for readability. No functional change.
 	[msaitoh, ticket #618]
 
+share/man/man4/altq.41.3
+
+	Update URL for the cited paper.
+	[sevan, ticket #619]
+
+sys/sys/bitops.h1.13-1.14
+
+	Fix size of the shift to depend on the type of the bitmap so that
+	we get the correct width and avoid undefined behaviour.
+	[mrg, ticket #621]
+
+sys/net/if_llatbl.c1.24 (via patch),1.25,1.26
+sys/net/if_llatbl.h1.14
+sys/net/route.c	1.204
+sys/netinet/if_arp.c1.269,1.270 (via patch)
+sys/netinet/in.c1.216,1.220,1.221 (via patch),
+		1.222,1.223
+sys/netinet6/in6.c1.259,1.261,1.262 (via patch),
+		1.263,1.264
+sys/netinet6/nd6.c1.246 (via patch)
+
+	Suppress noisy debugging outputs.
+	Tweak sanity checks and add assertions.
+	Fix memory leaks on arp -d and ndp -d for static entries.
+	Use pool(9) for llentry allocations.
+	[ozaki-r, ticket #622]
+
+external/bsd/mdocml/dist/configure		1.10
+tools/mandoc/Makefile1.10
+
+	Honor HOST_CC.
+	[hans, ticket #623]
+
+distrib/sets/lists/base/md.atari		1.55
+sys/arch/atari/atari/atari_init.c		1.101
+sys/arch/atari/atari/bus.c			1.59-1.60
+sys/arch/atari/atari/locore.s			1.111
+sys/arch/atari/atari/pmap_bootstrap.c		1.9
+sys/arch/atari/conf/MILAN.in			1.28
+sys/arch/conf/MILAN-PCIIDE			(regen)
+sys/arch/atari/conf/MILAN-ISAIDE		(regen)
+sys/arch/atari/dev/nvram.c			1.21
+sys/arch/atari/include/vmparam.h		1.32
+sys/arch/atari/isa/isa_machdep.c		1.41
+sys/arch/atari/isa/isa_milan.c			1.15-1.16
+sys/arch/atari/pci/pci_machdep.c		1.55-1.56
+sys/arch/atari/pci/pci_milan.c			1.15
+sys/arch/atari/stand/xxboot/ahdi-xxboot/milan/Makefile 1.4
+sys/arch/atari/stand/xxboot/sdboot/milan/Makefile 1.4
+sys/dev/isa/fd.c1.111
+
+	Fix support for Atari compatible Milan.
+	[tsutsui, ticket #624]
+
+sys/arch/i386/stand/efiboot/Makefile.efiboot	1.10
+sys/arch/i386/stand/efiboot/TODO.efiboot	1.4
+sys/arch/i386/stand/efiboot/boot.c		1.6
+sys/arch/i386/stand/efiboot/devopen.c		1.2
+sys/arch/i386/stand/efiboot/efiboot.c		1.5
+sys/arch/i386/stand/efiboot/efiboot.h		1.6
+sys/arch/i386/stand/efiboot/efidev.c		1.1
+sys/arch/i386/stand/efiboot/efidisk.c		1.2
+sys/arch/i386/stand/efiboot/efidisk.h		1.2
+sys/arch/i386/stand/efiboot/efidisk_ll.c	1.2
+sys/arch/i386/stand/lib/biosdisk.c		1.47
+sys/arch/i386/stand/lib/biosdisk.h		1.9
+sys/arch/i386/stand/lib/biosdisk_ll.h		1.16
+sys/lib/libsa/cd9660.c1.31
+
+	efiboot: support booting from CD/DVD-ROM media.
+	[nonaka, ticket #625]
+
+sys/dev/pci/ixgbe/ix_txrx.c			1.35
+sys/dev/pci/ixgbe/ixgbe.c			1.134
+sys/dev/pci/ixgbe/ixgbe.h			1.35
+sys/dev/pci/ixgbe/ixv.c1.87
+
+	Make all remaining event counters MP safe.
+	[msaitoh, ticket #626]
+
+sys/net/if_ipsec.c1.4-1.6
+sys/netipsec/ipsecif.c1.4
+
+	NAT-T src and dst port in ipsec_variant should be network byte order.
+	Fix missing sadb_x_ipsecrequest informations for PF_KEY message.
+	Fix ipsecif(4) esp_frag support.
+	[knakahara, ticket #620]
+
+sys/net/if_ipsec.c1.7
+sys/netipsec/ipsecif.c1.5
+tests/net/if_ipsec/t_ipsec.sh			1.4
+
+	Fix IPv6 ipsecif(4) ATF regression.
+	Enhance assertion ipsecif(4) ATF to avoid confusing setkey(8)
+	error message.
+	When setkey(8) says "syntax error at [-E]", it must mean
+	get_if_ipsec_unique() failed.
+	[knakahara, ticket #627]
+
+sys/net/if_ethersubr.c1.248,1.250-1.252
+
+	Use kmem_alloc instead of kmem_intr_alloc in ether_addmulti.
+	Fix the net.ether.multicast sysctl.
+	Style and several fixes
+	[ozaki-r, ticket #628]
+
+sys/arch/amd64/amd64/genassym.cf		via patch: 1.63,1.64
+sys/arch/amd64/amd64/locore.S			via patch: 1.144
+sys/arch/amd64/amd64/machdep.c			via patch: 1.281-1.283
+sys/arch/i386/i386/genassym.cf			via patch: 1.105-1.106
+sys/arch/i386/i386/locore.S			via patch: 1.155
+sys/arch/i386/i386/machdep.c			via patch: 1.802 (adapted),1.803
+sys/arch/x86/include/cpu.h			via patch: 1.85
+sys/arch/x86/x86/intr.cvia patch: 1.115-1.116
+sys/arch/x86/x86/pmap.cvia patch: 1.275
+sys/arch/x86/x86/sys_machdep.c			via patch: 1.45
+sys/arch/xen/x86/cpu.cvia patch: 

CVS commit: [netbsd-8] src/doc

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:50:31 UTC 2018

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

Log Message:
Tickets #619 - #629


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.140 -r1.1.2.141 src/doc/CHANGES-8.0

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



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

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:47:45 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: genassym.cf locore.S machdep.c
src/sys/arch/i386/i386 [netbsd-8]: genassym.cf locore.S machdep.c
src/sys/arch/x86/include [netbsd-8]: cpu.h
src/sys/arch/x86/x86 [netbsd-8]: intr.c pmap.c sys_machdep.c
src/sys/arch/xen/x86 [netbsd-8]: cpu.c

Log Message:
Pullup the following revisions via patch, requested by maxv in ticket #629:

sys/arch/amd64/amd64/genassym.cf1.63,1.64
sys/arch/amd64/amd64/locore.S   1.144
sys/arch/amd64/amd64/machdep.c  1.281-1.283
sys/arch/i386/i386/genassym.cf  1.105-1.106
sys/arch/i386/i386/locore.S 1.155
sys/arch/i386/i386/machdep.c1.802 (adapted),1.803
sys/arch/x86/include/cpu.h  1.85
sys/arch/x86/x86/intr.c 1.115-1.116
sys/arch/x86/x86/pmap.c 1.275
sys/arch/x86/x86/sys_machdep.c  1.45
sys/arch/xen/x86/cpu.c  1.117

Stop sharing the double-fault stack.
Merge the TSS structures into one single cpu_tss structure, and
allocate it dynamically.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.10.1 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.123.6.3 -r1.123.6.4 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.255.6.3 -r1.255.6.4 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.99 -r1.99.10.1 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.145.6.2 -r1.145.6.3 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.782.6.3 -r1.782.6.4 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.71.2.1 -r1.71.2.2 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.101.2.1 -r1.101.2.2 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.245.6.3 -r1.245.6.4 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.35.6.2 -r1.35.6.3 src/sys/arch/x86/x86/sys_machdep.c
cvs rdiff -u -r1.110 -r1.110.6.1 src/sys/arch/xen/x86/cpu.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.60 src/sys/arch/amd64/amd64/genassym.cf:1.60.10.1
--- src/sys/arch/amd64/amd64/genassym.cf:1.60	Fri Nov 20 11:58:00 2015
+++ src/sys/arch/amd64/amd64/genassym.cf	Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.60 2015/11/20 11:58:00 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.60.10.1 2018/03/13 15:47:44 martin Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -223,6 +223,8 @@ define	TF_REGSIZE		offsetof(struct trapf
 # Total size includes registers pushed by hardware
 define	FRAMESIZE		sizeof(struct trapframe)
 
+define	TSS_RSP0		offsetof(struct cpu_tss, tss.tss_rsp0)
+
 define	CPU_INFO_SCRATCH	offsetof(struct cpu_info, ci_scratch)
 define	CPU_INFO_SELF		offsetof(struct cpu_info, ci_self)
 define	CPU_INFO_RESCHED	offsetof(struct cpu_info, ci_want_resched)
@@ -233,7 +235,7 @@ define	CPU_INFO_CURLWP		offsetof(struct 
 define	CPU_INFO_CURLDT		offsetof(struct cpu_info, ci_curldt)
 define	CPU_INFO_IDLELWP	offsetof(struct cpu_info, ci_data.cpu_idlelwp)
 define	CPU_INFO_PMAP		offsetof(struct cpu_info, ci_pmap)
-define	CPU_INFO_RSP0		offsetof(struct cpu_info, ci_tss.tss_rsp0)
+define	CPU_INFO_TSS		offsetof(struct cpu_info, ci_tss)
 define	CPU_INFO_NSYSCALL	offsetof(struct cpu_info, ci_data.cpu_nsyscall)
 define	CPU_INFO_NTRAP		offsetof(struct cpu_info, ci_data.cpu_ntrap)
 define	CPU_INFO_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.3 src/sys/arch/amd64/amd64/locore.S:1.123.6.4
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.3	Wed Mar  7 14:50:56 2018
+++ src/sys/arch/amd64/amd64/locore.S	Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.3 2018/03/07 14:50:56 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.4 2018/03/13 15:47:44 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1099,7 +1099,8 @@ skip_save:
 	/* Switch ring0 stack */
 #ifndef XEN
 	movq	PCB_RSP0(%r14),%rax
-	movq	%rax,CPUVAR(RSP0)
+	movq	CPUVAR(TSS),%rdi
+	movq	%rax,TSS_RSP0(%rdi)
 #else
 	movq	%r14,%rdi
 	callq	_C_LABEL(x86_64_switch_context);

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.255.6.3 src/sys/arch/amd64/amd64/machdep.c:1.255.6.4
--- src/sys/arch/amd64/amd64/machdep.c:1.255.6.3	Mon Jan  1 19:09:03 2018
+++ src/sys/arch/amd64/amd64/machdep.c	Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.255.6.3 2018/01/01 19:09:03 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.255.6.4 2018/03/13 15:47:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 

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

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:47:45 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: genassym.cf locore.S machdep.c
src/sys/arch/i386/i386 [netbsd-8]: genassym.cf locore.S machdep.c
src/sys/arch/x86/include [netbsd-8]: cpu.h
src/sys/arch/x86/x86 [netbsd-8]: intr.c pmap.c sys_machdep.c
src/sys/arch/xen/x86 [netbsd-8]: cpu.c

Log Message:
Pullup the following revisions via patch, requested by maxv in ticket #629:

sys/arch/amd64/amd64/genassym.cf1.63,1.64
sys/arch/amd64/amd64/locore.S   1.144
sys/arch/amd64/amd64/machdep.c  1.281-1.283
sys/arch/i386/i386/genassym.cf  1.105-1.106
sys/arch/i386/i386/locore.S 1.155
sys/arch/i386/i386/machdep.c1.802 (adapted),1.803
sys/arch/x86/include/cpu.h  1.85
sys/arch/x86/x86/intr.c 1.115-1.116
sys/arch/x86/x86/pmap.c 1.275
sys/arch/x86/x86/sys_machdep.c  1.45
sys/arch/xen/x86/cpu.c  1.117

Stop sharing the double-fault stack.
Merge the TSS structures into one single cpu_tss structure, and
allocate it dynamically.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.10.1 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.123.6.3 -r1.123.6.4 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.255.6.3 -r1.255.6.4 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.99 -r1.99.10.1 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.145.6.2 -r1.145.6.3 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.782.6.3 -r1.782.6.4 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.71.2.1 -r1.71.2.2 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.101.2.1 -r1.101.2.2 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.245.6.3 -r1.245.6.4 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.35.6.2 -r1.35.6.3 src/sys/arch/x86/x86/sys_machdep.c
cvs rdiff -u -r1.110 -r1.110.6.1 src/sys/arch/xen/x86/cpu.c

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



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

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:40:25 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #628):
sys/net/if_ethersubr.c: revision 1.250
sys/net/if_ethersubr.c: revision 1.251
sys/net/if_ethersubr.c: revision 1.252
sys/net/if_ethersubr.c: revision 1.248
Use kmem_alloc instead of kmem_intr_alloc in ether_addmulti

ether_addmulti is now not called in softint thanks to wqinput that
pulled input routines of ICMP out of softint.

style

Fix the net.ether.multicast sysctl. If there is no multicast address
don't kmem_alloc(0) (which panics the kernel), and if the number of
multicast addresses has decreased don't copyout uninitialized kernel
data.

Several fixes:
 - Style and typos
 - Use kmem_zalloc, in case there is a padding between the fields of
   the structures
 - Use ETHER_ADDR_LEN instead of a hard-coded '6'
 - kmem_alloc(KM_SLEEP) can't fail
 - Simplify ether_aton_r
 - Use mutex_obj_free, not to leak memory


To generate a diff of this commit:
cvs rdiff -u -r1.242.6.4 -r1.242.6.5 src/sys/net/if_ethersubr.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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.242.6.4 src/sys/net/if_ethersubr.c:1.242.6.5
--- src/sys/net/if_ethersubr.c:1.242.6.4	Thu Mar  8 14:37:58 2018
+++ src/sys/net/if_ethersubr.c	Tue Mar 13 15:40:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.242.6.4 2018/03/08 14:37:58 martin Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.242.6.5 2018/03/13 15:40:25 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.4 2018/03/08 14:37:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.242.6.5 2018/03/13 15:40:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -192,7 +192,7 @@ ether_output(struct ifnet * const ifp0, 
 {
 	uint16_t etype = 0;
 	int error = 0, hdrcmplt = 0;
- 	uint8_t esrc[6], edst[6];
+	uint8_t esrc[6], edst[6];
 	struct mbuf *m = m0;
 	struct mbuf *mcopy = NULL;
 	struct ether_header *eh;
@@ -301,7 +301,7 @@ ether_output(struct ifnet * const ifp0, 
 		break;
 #endif
 #ifdef NETATALK
-case AF_APPLETALK: {
+	case AF_APPLETALK: {
 		struct ifaddr *ifa;
 		int s;
 
@@ -347,7 +347,7 @@ ether_output(struct ifnet * const ifp0, 
 		pserialize_read_exit(s);
 		KERNEL_UNLOCK_ONE(NULL);
 		break;
-	}
+	}
 #endif /* NETATALK */
 	case pseudo_AF_HDRCMPLT:
 		hdrcmplt = 1;
@@ -357,7 +357,7 @@ ether_output(struct ifnet * const ifp0, 
 		/* FALLTHROUGH */
 
 	case AF_UNSPEC:
- 		memcpy(edst,
+		memcpy(edst,
 		((const struct ether_header *)dst->sa_data)->ether_dhost,
 		sizeof(edst));
 		/* AF_UNSPEC doesn't swap the byte order of the ether_type. */
@@ -401,7 +401,7 @@ ether_output(struct ifnet * const ifp0, 
 	eh = mtod(m, struct ether_header *);
 	/* Note: etype is already in network byte order. */
 	(void)memcpy(>ether_type, , sizeof(eh->ether_type));
- 	memcpy(eh->ether_dhost, edst, sizeof(edst));
+	memcpy(eh->ether_dhost, edst, sizeof(edst));
 	if (hdrcmplt)
 		memcpy(eh->ether_shost, esrc, sizeof(eh->ether_shost));
 	else
@@ -538,7 +538,7 @@ altq_etherclassify(struct ifaltq *ifq, s
 
 	return;
 
- bad:
+bad:
 	m->m_pkthdr.pattr_class = NULL;
 	m->m_pkthdr.pattr_hdr = NULL;
 	m->m_pkthdr.pattr_af = AF_UNSPEC;
@@ -579,7 +579,7 @@ ether_input(struct ifnet *ifp, struct mb
 	etype = ntohs(eh->ether_type);
 	ehlen = sizeof(*eh);
 
-	if(__predict_false(earlypkts < 100 || !rnd_initial_entropy)) {
+	if (__predict_false(earlypkts < 100 || !rnd_initial_entropy)) {
 		rnd_add_data(NULL, eh, ehlen, 0);
 		earlypkts++;
 	}
@@ -640,6 +640,7 @@ ether_input(struct ifnet *ifp, struct mb
 			return;
 	}
 #endif /* NCARP > 0 */
+
 	if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
 	(ifp->if_flags & IFF_PROMISC) != 0 &&
 	memcmp(CLLADDR(ifp->if_sadl), eh->ether_dhost,
@@ -695,7 +696,7 @@ ether_input(struct ifnet *ifp, struct mb
 		/*
 		 * If there is a tag of 0, then the VLAN header was probably
 		 * just being used to store the priority.  Extract the ether
-		 * type, and if IP or IPV6, let them deal with it. 
+		 * type, and if IP or IPV6, let them deal with it.
 		 */
 		if (m->m_len <= sizeof(*evl)
 		&& EVL_VLANOFTAG(evl->evl_tag) == 0) {
@@ -804,7 +805,7 @@ ether_input(struct ifnet *ifp, struct mb
 m_freem(m);
 return;
 			}
-#ifdef GATEWAY  
+#ifdef GATEWAY
 			if (ip6flow_fastforward())
 return;
 #endif
@@ -878,10 +879,10 @@ ether_input(struct ifnet *ifp, struct mb
 			m_freem(m);
 			return;
 		}
-#else /* ISO || LLC || NETATALK*/
+#else /* LLC || NETATALK */
 		m_freem(m);
 		return;
-#endif /* ISO || LLC || NETATALK*/
+#endif /* LLC || NETATALK */
 	}
 
 	if (__predict_true(pktq)) {
@@ -997,9 

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

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:40:25 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #628):
sys/net/if_ethersubr.c: revision 1.250
sys/net/if_ethersubr.c: revision 1.251
sys/net/if_ethersubr.c: revision 1.252
sys/net/if_ethersubr.c: revision 1.248
Use kmem_alloc instead of kmem_intr_alloc in ether_addmulti

ether_addmulti is now not called in softint thanks to wqinput that
pulled input routines of ICMP out of softint.

style

Fix the net.ether.multicast sysctl. If there is no multicast address
don't kmem_alloc(0) (which panics the kernel), and if the number of
multicast addresses has decreased don't copyout uninitialized kernel
data.

Several fixes:
 - Style and typos
 - Use kmem_zalloc, in case there is a padding between the fields of
   the structures
 - Use ETHER_ADDR_LEN instead of a hard-coded '6'
 - kmem_alloc(KM_SLEEP) can't fail
 - Simplify ether_aton_r
 - Use mutex_obj_free, not to leak memory


To generate a diff of this commit:
cvs rdiff -u -r1.242.6.4 -r1.242.6.5 src/sys/net/if_ethersubr.c

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



CVS commit: [netbsd-8] src

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:34:34 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_ipsec.c
src/sys/netipsec [netbsd-8]: ipsecif.c
src/tests/net/if_ipsec [netbsd-8]: t_ipsec.sh

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #627):
sys/netipsec/ipsecif.c: revision 1.5
tests/net/if_ipsec/t_ipsec.sh: revision 1.4
sys/net/if_ipsec.c: revision 1.7
Fix IPv6 ipsecif(4) ATF regression, sorry.
There must *not* be padding between the src sockaddr and the dst sockaddr
after struct sadb_x_policy.

Comment out confusing (and incorrect) code and add comment. Pointed out by 
maxv@n.o, thanks.

Enhance assertion ipsecif(4) ATF to avoid confusing setkey(8) error message.

When setkey(8) says "syntax error at [-E]", it must mean get_if_ipsec_unique()
failed.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/netipsec/ipsecif.c
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/tests/net/if_ipsec/t_ipsec.sh

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_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.3.2.3 src/sys/net/if_ipsec.c:1.3.2.4
--- src/sys/net/if_ipsec.c:1.3.2.3	Tue Mar 13 15:29:45 2018
+++ src/sys/net/if_ipsec.c	Tue Mar 13 15:34:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.3.2.3 2018/03/13 15:29:45 martin Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.3.2.4 2018/03/13 15:34:33 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.3 2018/03/13 15:29:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.4 2018/03/13 15:34:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1310,27 +1310,37 @@ if_ipsec_unshare_sp(struct ipsec_variant
 }
 
 static inline void
-if_ipsec_add_mbuf(struct mbuf *m0, void *data, size_t len)
+if_ipsec_add_mbuf_optalign(struct mbuf *m0, void *data, size_t len, bool align)
 {
 	struct mbuf *m;
 
 	MGET(m, M_WAITOK | M_ZERO, MT_DATA);
-	m->m_len = PFKEY_ALIGN8(len);
+	if (align)
+		m->m_len = PFKEY_ALIGN8(len);
+	else
+		m->m_len = len;
 	m_copyback(m, 0, len, data);
 	m_cat(m0, m);
 }
 
 static inline void
-if_ipsec_add_mbuf_addr_port(struct mbuf *m0, struct sockaddr *addr, in_port_t port)
+if_ipsec_add_mbuf(struct mbuf *m0, void *data, size_t len)
+{
+
+	if_ipsec_add_mbuf_optalign(m0, data, len, true);
+}
+
+static inline void
+if_ipsec_add_mbuf_addr_port(struct mbuf *m0, struct sockaddr *addr, in_port_t port, bool align)
 {
 
 	if (port == 0) {
-		if_ipsec_add_mbuf(m0, addr, addr->sa_len);
+		if_ipsec_add_mbuf_optalign(m0, addr, addr->sa_len, align);
 	} else {
 		struct sockaddr addrport;
 
 		if_ipsec_set_addr_port(, addr, port);
-		if_ipsec_add_mbuf(m0, , addrport.sa_len);
+		if_ipsec_add_mbuf_optalign(m0, , addrport.sa_len, align);
 	}
 }
 
@@ -1412,10 +1422,8 @@ if_ipsec_set_sadb_x_policy(struct sadb_x
 	size = sizeof(*xpl);
 	if (policy == IPSEC_POLICY_IPSEC) {
 		size += PFKEY_ALIGN8(sizeof(*xisr));
-		if (src != NULL)
-			size += PFKEY_ALIGN8(src->sa_len);
-		if (dst != NULL)
-			size += PFKEY_ALIGN8(dst->sa_len);
+		if (src != NULL && dst != NULL)
+			size += PFKEY_ALIGN8(src->sa_len + dst->sa_len);
 	}
 	xpl->sadb_x_policy_len = PFKEY_UNIT64(size);
 	xpl->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
@@ -1427,10 +1435,9 @@ if_ipsec_set_sadb_x_policy(struct sadb_x
 
 	if (policy == IPSEC_POLICY_IPSEC) {
 		xisr->sadb_x_ipsecrequest_len = PFKEY_ALIGN8(sizeof(*xisr));
-		if (src != NULL)
-			xisr->sadb_x_ipsecrequest_len += PFKEY_ALIGN8(src->sa_len);
-		if (dst != NULL)
-			xisr->sadb_x_ipsecrequest_len += PFKEY_ALIGN8(dst->sa_len);
+		if (src != NULL && dst != NULL)
+			xisr->sadb_x_ipsecrequest_len +=
+PFKEY_ALIGN8(src->sa_len + dst->sa_len);
 		xisr->sadb_x_ipsecrequest_proto = IPPROTO_ESP;
 		xisr->sadb_x_ipsecrequest_mode = IPSEC_MODE_TRANSPORT;
 		xisr->sadb_x_ipsecrequest_level = level;
@@ -1539,13 +1546,13 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	m_copyback(m, 0, sizeof(msg), );
 
 	if_ipsec_add_mbuf(m, , sizeof(xsrc));
-	if_ipsec_add_mbuf_addr_port(m, src, sport);
+	if_ipsec_add_mbuf_addr_port(m, src, sport, true);
 	padlen = PFKEY_UNUNIT64(xsrc.sadb_address_len)
 		- (sizeof(xsrc) + PFKEY_ALIGN8(src->sa_len));
 	if_ipsec_add_pad(m, padlen);
 
 	if_ipsec_add_mbuf(m, , sizeof(xdst));
-	if_ipsec_add_mbuf_addr_port(m, dst, dport);
+	if_ipsec_add_mbuf_addr_port(m, dst, dport, true);
 	padlen = PFKEY_UNUNIT64(xdst.sadb_address_len)
 		- (sizeof(xdst) + PFKEY_ALIGN8(dst->sa_len));
 	if_ipsec_add_pad(m, padlen);
@@ -1553,14 +1560,12 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	if_ipsec_add_mbuf(m, , sizeof(xpl));
 	if (policy == IPSEC_POLICY_IPSEC) {
 		if_ipsec_add_mbuf(m, , sizeof(xisr));
-		if_ipsec_add_mbuf_addr_port(m, src, sport);
-		

CVS commit: [netbsd-8] src

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:34:34 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_ipsec.c
src/sys/netipsec [netbsd-8]: ipsecif.c
src/tests/net/if_ipsec [netbsd-8]: t_ipsec.sh

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #627):
sys/netipsec/ipsecif.c: revision 1.5
tests/net/if_ipsec/t_ipsec.sh: revision 1.4
sys/net/if_ipsec.c: revision 1.7
Fix IPv6 ipsecif(4) ATF regression, sorry.
There must *not* be padding between the src sockaddr and the dst sockaddr
after struct sadb_x_policy.

Comment out confusing (and incorrect) code and add comment. Pointed out by 
maxv@n.o, thanks.

Enhance assertion ipsecif(4) ATF to avoid confusing setkey(8) error message.

When setkey(8) says "syntax error at [-E]", it must mean get_if_ipsec_unique()
failed.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/netipsec/ipsecif.c
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/tests/net/if_ipsec/t_ipsec.sh

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



CVS commit: [netbsd-8] src/sys

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 15:29:45 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_ipsec.c
src/sys/netipsec [netbsd-8]: ipsecif.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #620):
sys/netipsec/ipsecif.c: revision 1.4
sys/net/if_ipsec.c: revision 1.4
sys/net/if_ipsec.c: revision 1.5
sys/net/if_ipsec.c: revision 1.6
NAT-T src and dst port in ipsec_variant should be network byte order.
Fix missing sadb_x_ipsecrequest informations for PF_KEY message.
Functionalize duplicated code. No functional changes.
Fix ipsec(4) I/F esp_frag support.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/netipsec/ipsecif.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_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.3.2.2 src/sys/net/if_ipsec.c:1.3.2.3
--- src/sys/net/if_ipsec.c:1.3.2.2	Sun Feb 11 21:17:34 2018
+++ src/sys/net/if_ipsec.c	Tue Mar 13 15:29:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.3.2.2 2018/02/11 21:17:34 snj Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.3.2.3 2018/03/13 15:29:45 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.2 2018/02/11 21:17:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.3 2018/03/13 15:29:45 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -109,7 +109,8 @@ static inline size_t if_ipsec_set_sadb_s
 static inline size_t if_ipsec_set_sadb_dst(struct sadb_address *,
 struct sockaddr *, int);
 static inline size_t if_ipsec_set_sadb_x_policy(struct sadb_x_policy *,
-struct sadb_x_ipsecrequest *, uint16_t, uint8_t, uint32_t, uint8_t);
+struct sadb_x_ipsecrequest *, uint16_t, uint8_t, uint32_t, uint8_t,
+struct sockaddr *, struct sockaddr *);
 static inline void if_ipsec_set_sadb_msg(struct sadb_msg *, uint16_t, uint8_t);
 static inline void if_ipsec_set_sadb_msg_add(struct sadb_msg *, uint16_t);
 static inline void if_ipsec_set_sadb_msg_del(struct sadb_msg *, uint16_t);
@@ -892,7 +893,7 @@ if_ipsec_set_tunnel(struct ifnet *ifp,
 	switch(nsrc->sa_family) {
 #ifdef INET
 	case AF_INET:
-		nsport = ntohs(satosin(src)->sin_port);
+		nsport = satosin(src)->sin_port;
 		/*
 		 * avoid confuse SP when NAT-T disabled,
 		 * e.g.
@@ -900,15 +901,15 @@ if_ipsec_set_tunnel(struct ifnet *ifp,
 		 * confuse : 10.0.1.2[600] 10.0.1.1[600] 4(ipv4)
 		 */
 		satosin(nsrc)->sin_port = 0;
-		ndport = ntohs(satosin(dst)->sin_port);
+		ndport = satosin(dst)->sin_port;
 		satosin(ndst)->sin_port = 0;
 		break;
 #endif /* INET */
 #ifdef INET6
 	case AF_INET6:
-		nsport = ntohs(satosin6(src)->sin6_port);
+		nsport = satosin6(src)->sin6_port;
 		satosin6(nsrc)->sin6_port = 0;
-		ndport = ntohs(satosin6(dst)->sin6_port);
+		ndport = satosin6(dst)->sin6_port;
 		satosin6(ndst)->sin6_port = 0;
 		break;
 #endif /* INET6 */
@@ -1320,6 +1321,20 @@ if_ipsec_add_mbuf(struct mbuf *m0, void 
 }
 
 static inline void
+if_ipsec_add_mbuf_addr_port(struct mbuf *m0, struct sockaddr *addr, in_port_t port)
+{
+
+	if (port == 0) {
+		if_ipsec_add_mbuf(m0, addr, addr->sa_len);
+	} else {
+		struct sockaddr addrport;
+
+		if_ipsec_set_addr_port(, addr, port);
+		if_ipsec_add_mbuf(m0, , addrport.sa_len);
+	}
+}
+
+static inline void
 if_ipsec_add_pad(struct mbuf *m0, size_t len)
 {
 	struct mbuf *m;
@@ -1388,7 +1403,7 @@ if_ipsec_set_sadb_dst(struct sadb_addres
 static inline size_t
 if_ipsec_set_sadb_x_policy(struct sadb_x_policy *xpl,
 struct sadb_x_ipsecrequest *xisr, uint16_t policy, uint8_t dir, uint32_t id,
-uint8_t level)
+uint8_t level, struct sockaddr *src, struct sockaddr *dst)
 {
 	size_t size;
 
@@ -1397,6 +1412,10 @@ if_ipsec_set_sadb_x_policy(struct sadb_x
 	size = sizeof(*xpl);
 	if (policy == IPSEC_POLICY_IPSEC) {
 		size += PFKEY_ALIGN8(sizeof(*xisr));
+		if (src != NULL)
+			size += PFKEY_ALIGN8(src->sa_len);
+		if (dst != NULL)
+			size += PFKEY_ALIGN8(dst->sa_len);
 	}
 	xpl->sadb_x_policy_len = PFKEY_UNIT64(size);
 	xpl->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
@@ -1408,6 +1427,10 @@ if_ipsec_set_sadb_x_policy(struct sadb_x
 
 	if (policy == IPSEC_POLICY_IPSEC) {
 		xisr->sadb_x_ipsecrequest_len = PFKEY_ALIGN8(sizeof(*xisr));
+		if (src != NULL)
+			xisr->sadb_x_ipsecrequest_len += PFKEY_ALIGN8(src->sa_len);
+		if (dst != NULL)
+			xisr->sadb_x_ipsecrequest_len += PFKEY_ALIGN8(dst->sa_len);
 		xisr->sadb_x_ipsecrequest_proto = IPPROTO_ESP;
 		xisr->sadb_x_ipsecrequest_mode = IPSEC_MODE_TRANSPORT;
 		xisr->sadb_x_ipsecrequest_level = level;
@@ -1459,14 +1482,14 @@ if_ipsec_set_addr_port(struct sockaddr *
 #ifdef INET
 	case AF_INET: {
 		struct sockaddr_in *sin = satosin(addrport);
-		sin->sin_port = htons(port);
+		sin->sin_port = 

  1   2   >