CVS commit: src/external/mit/xorg/lib/libxcb/files

2018-03-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 14 06:47:28 UTC 2018

Modified Files:
src/external/mit/xorg/lib/libxcb/files: config.h dri3.c dri3.h
present.h randr.c randr.h res.c shm.c xinput.c xinput.h xkb.c
xproto.c

Log Message:
regenerate these for libxcb 1.13.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mit/xorg/lib/libxcb/files/config.h \
src/external/mit/xorg/lib/libxcb/files/xkb.c
cvs rdiff -u -r1.3 -r1.4 src/external/mit/xorg/lib/libxcb/files/dri3.c \
src/external/mit/xorg/lib/libxcb/files/dri3.h \
src/external/mit/xorg/lib/libxcb/files/present.h
cvs rdiff -u -r1.5 -r1.6 src/external/mit/xorg/lib/libxcb/files/randr.c \
src/external/mit/xorg/lib/libxcb/files/randr.h \
src/external/mit/xorg/lib/libxcb/files/res.c \
src/external/mit/xorg/lib/libxcb/files/shm.c \
src/external/mit/xorg/lib/libxcb/files/xinput.c \
src/external/mit/xorg/lib/libxcb/files/xinput.h \
src/external/mit/xorg/lib/libxcb/files/xproto.c

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

Modified files:

Index: src/external/mit/xorg/lib/libxcb/files/config.h
diff -u src/external/mit/xorg/lib/libxcb/files/config.h:1.4 src/external/mit/xorg/lib/libxcb/files/config.h:1.5
--- src/external/mit/xorg/lib/libxcb/files/config.h:1.4	Sun Mar  5 09:27:53 2017
+++ src/external/mit/xorg/lib/libxcb/files/config.h	Wed Mar 14 06:47:28 2018
@@ -77,7 +77,7 @@
 #define PACKAGE_NAME "libxcb"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libxcb 1.12"
+#define PACKAGE_STRING "libxcb 1.13"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "libxcb"
@@ -86,13 +86,13 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.12"
+#define PACKAGE_VERSION "1.13"
 
 /* Major version of this package */
 #define PACKAGE_VERSION_MAJOR 1
 
 /* Minor version of this package */
-#define PACKAGE_VERSION_MINOR 12
+#define PACKAGE_VERSION_MINOR 13
 
 /* Patch version of this package */
 #define PACKAGE_VERSION_PATCHLEVEL 0
@@ -126,7 +126,7 @@
 
 
 /* Version number of package */
-#define VERSION "1.12"
+#define VERSION "1.13"
 
 /* XCB buffer queue size */
 #define XCB_QUEUE_BUFFER_SIZE 16384
Index: src/external/mit/xorg/lib/libxcb/files/xkb.c
diff -u src/external/mit/xorg/lib/libxcb/files/xkb.c:1.4 src/external/mit/xorg/lib/libxcb/files/xkb.c:1.5
--- src/external/mit/xorg/lib/libxcb/files/xkb.c:1.4	Sun Mar  5 09:27:53 2017
+++ src/external/mit/xorg/lib/libxcb/files/xkb.c	Wed Mar 14 06:47:28 2018
@@ -11373,9 +11373,9 @@ xcb_xkb_set_device_info_checked (xcb_con
 struct iovec xcb_parts[8];
 xcb_void_cookie_t xcb_ret;
 xcb_xkb_set_device_info_request_t xcb_out;
-unsigned int i;
 unsigned int xcb_tmp_len;
 char *xcb_tmp;
+unsigned int i;
 
 xcb_out.deviceSpec = deviceSpec;
 xcb_out.firstBtn = firstBtn;
@@ -11428,9 +11428,9 @@ xcb_xkb_set_device_info (xcb_connection_
 struct iovec xcb_parts[8];
 xcb_void_cookie_t xcb_ret;
 xcb_xkb_set_device_info_request_t xcb_out;
-unsigned int i;
 unsigned int xcb_tmp_len;
 char *xcb_tmp;
+unsigned int i;
 
 xcb_out.deviceSpec = deviceSpec;
 xcb_out.firstBtn = firstBtn;

Index: src/external/mit/xorg/lib/libxcb/files/dri3.c
diff -u src/external/mit/xorg/lib/libxcb/files/dri3.c:1.3 src/external/mit/xorg/lib/libxcb/files/dri3.c:1.4
--- src/external/mit/xorg/lib/libxcb/files/dri3.c:1.3	Sun Mar  5 09:27:53 2017
+++ src/external/mit/xorg/lib/libxcb/files/dri3.c	Wed Mar 14 06:47:28 2018
@@ -176,6 +176,7 @@ xcb_dri3_pixmap_from_buffer_checked (xcb
 xcb_void_cookie_t xcb_ret;
 xcb_dri3_pixmap_from_buffer_request_t xcb_out;
 int fds[1];
+int fd_index = 0;
 
 xcb_out.pixmap = pixmap;
 xcb_out.drawable = drawable;
@@ -191,7 +192,7 @@ xcb_dri3_pixmap_from_buffer_checked (xcb
 xcb_parts[3].iov_base = 0;
 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
 
-fds[0] = pixmap_fd;
+fds[fd_index++] = pixmap_fd;
 xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, 1, fds);
 return xcb_ret;
 }
@@ -219,6 +220,7 @@ xcb_dri3_pixmap_from_buffer (xcb_connect
 xcb_void_cookie_t xcb_ret;
 xcb_dri3_pixmap_from_buffer_request_t xcb_out;
 int fds[1];
+int fd_index = 0;
 
 xcb_out.pixmap = pixmap;
 xcb_out.drawable = drawable;
@@ -234,7 +236,7 @@ xcb_dri3_pixmap_from_buffer (xcb_connect
 xcb_parts[3].iov_base = 0;
 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
 
-fds[0] = pixmap_fd;
+fds[fd_index++] = pixmap_fd;
 xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, 1, fds);
 return xcb_ret;
 }
@@ -324,6 +326,7 @@ xcb_dri3_fence_from_fd_checked (xcb_conn
 xcb_void_cookie_t xcb_ret;
 xcb_dri3_fence_from_fd_request_t xcb_out;
 int fds

CVS commit: xsrc/external/mit/libxcb

2018-03-13 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Wed Mar 14 06:43:46 UTC 2018

Modified Files:
xsrc/external/mit/libxcb/dist/src: xcb_in.c
xsrc/external/mit/libxcb/include: config.h
Removed Files:
xsrc/external/mit/libxcb/dist: compile config.guess config.sub depcomp
install-sh ltmain.sh missing

Log Message:
merge libxcb 1.13.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 xsrc/external/mit/libxcb/dist/compile
cvs rdiff -u -r1.1.1.5 -r0 xsrc/external/mit/libxcb/dist/config.guess \
xsrc/external/mit/libxcb/dist/config.sub
cvs rdiff -u -r1.1.1.4 -r0 xsrc/external/mit/libxcb/dist/depcomp \
xsrc/external/mit/libxcb/dist/ltmain.sh
cvs rdiff -u -r1.1.1.3 -r0 xsrc/external/mit/libxcb/dist/install-sh \
xsrc/external/mit/libxcb/dist/missing
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/libxcb/dist/src/xcb_in.c
cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/libxcb/include/config.h

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

Modified files:

Index: xsrc/external/mit/libxcb/dist/src/xcb_in.c
diff -u xsrc/external/mit/libxcb/dist/src/xcb_in.c:1.5 xsrc/external/mit/libxcb/dist/src/xcb_in.c:1.6
--- xsrc/external/mit/libxcb/dist/src/xcb_in.c:1.5	Tue Oct  4 22:01:49 2016
+++ xsrc/external/mit/libxcb/dist/src/xcb_in.c	Wed Mar 14 06:43:45 2018
@@ -661,6 +661,8 @@ int xcb_poll_for_reply(xcb_connection_t 
 assert(reply != 0);
 pthread_mutex_lock(&c->iolock);
 ret = poll_for_reply(c, widen(c, request), reply, error);
+if(!ret && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */
+ret = poll_for_reply(c, widen(c, request), reply, error);
 pthread_mutex_unlock(&c->iolock);
 return ret;
 }
@@ -678,6 +680,8 @@ int xcb_poll_for_reply64(xcb_connection_
 assert(reply != 0);
 pthread_mutex_lock(&c->iolock);
 ret = poll_for_reply(c, request, reply, error);
+if(!ret && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */
+ret = poll_for_reply(c, request, reply, error);
 pthread_mutex_unlock(&c->iolock);
 return ret;
 }
@@ -768,6 +772,8 @@ xcb_generic_event_t *xcb_poll_for_specia
 return 0;
 pthread_mutex_lock(&c->iolock);
 event = get_special_event(c, se);
+if(!event && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */
+event = get_special_event(c, se);
 pthread_mutex_unlock(&c->iolock);
 return event;
 }

Index: xsrc/external/mit/libxcb/include/config.h
diff -u xsrc/external/mit/libxcb/include/config.h:1.7 xsrc/external/mit/libxcb/include/config.h:1.8
--- xsrc/external/mit/libxcb/include/config.h:1.7	Sun Mar  5 08:58:25 2017
+++ xsrc/external/mit/libxcb/include/config.h	Wed Mar 14 06:43:45 2018
@@ -75,7 +75,7 @@
 #define PACKAGE_NAME "libxcb"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libxcb 1.12"
+#define PACKAGE_STRING "libxcb 1.13"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "libxcb"
@@ -84,13 +84,13 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.12"
+#define PACKAGE_VERSION "1.13"
 
 /* Major version of this package */
 #define PACKAGE_VERSION_MAJOR 1
 
 /* Minor version of this package */
-#define PACKAGE_VERSION_MINOR 12
+#define PACKAGE_VERSION_MINOR 13
 
 /* Patch version of this package */
 #define PACKAGE_VERSION_PATCHLEVEL 0
@@ -124,7 +124,7 @@
 
 
 /* Version number of package */
-#define VERSION "1.12"
+#define VERSION "1.13"
 
 /* XCB buffer queue size */
 #define XCB_QUEUE_BUFFER_SIZE 16384



CVS import: xsrc/external/mit/libxcb/dist

2018-03-13 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Wed Mar 14 06:43:05 UTC 2018

Update of /cvsroot/xsrc/external/mit/libxcb/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv2658

Log Message:
initial import of libxcb-1.13

Status:

Vendor Tag: xorg
Release Tags:   libxcb-1-13

U xsrc/external/mit/libxcb/dist/xcb-composite.pc.in
U xsrc/external/mit/libxcb/dist/Makefile.am
U xsrc/external/mit/libxcb/dist/configure
U xsrc/external/mit/libxcb/dist/configure.ac
U xsrc/external/mit/libxcb/dist/aclocal.m4
U xsrc/external/mit/libxcb/dist/Makefile.in
U xsrc/external/mit/libxcb/dist/xcb-present.pc.in
U xsrc/external/mit/libxcb/dist/xcb-damage.pc.in
U xsrc/external/mit/libxcb/dist/xcb-dpms.pc.in
U xsrc/external/mit/libxcb/dist/xcb-dri2.pc.in
U xsrc/external/mit/libxcb/dist/xcb-dri3.pc.in
N xsrc/external/mit/libxcb/dist/xcb-ge.pc.in
U xsrc/external/mit/libxcb/dist/xcb-glx.pc.in
U xsrc/external/mit/libxcb/dist/xcb-screensaver.pc.in
U xsrc/external/mit/libxcb/dist/xcb-randr.pc.in
U xsrc/external/mit/libxcb/dist/xcb-record.pc.in
U xsrc/external/mit/libxcb/dist/xcb-render.pc.in
U xsrc/external/mit/libxcb/dist/COPYING
U xsrc/external/mit/libxcb/dist/xcb-res.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xf86dri.pc.in
U xsrc/external/mit/libxcb/dist/xcb-shape.pc.in
U xsrc/external/mit/libxcb/dist/xcb-shm.pc.in
U xsrc/external/mit/libxcb/dist/xcb-sync.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xevie.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xinerama.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xfixes.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xselinux.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xinput.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xkb.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xprint.pc.in
U xsrc/external/mit/libxcb/dist/README
U xsrc/external/mit/libxcb/dist/check-pc-requires
U xsrc/external/mit/libxcb/dist/xcb-xtest.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xv.pc.in
U xsrc/external/mit/libxcb/dist/xcb-xvmc.pc.in
U xsrc/external/mit/libxcb/dist/xcb.pc.in
U xsrc/external/mit/libxcb/dist/ChangeLog
U xsrc/external/mit/libxcb/dist/INSTALL
U xsrc/external/mit/libxcb/dist/NEWS
U xsrc/external/mit/libxcb/dist/autogen.sh
U xsrc/external/mit/libxcb/dist/build-aux/config.guess
U xsrc/external/mit/libxcb/dist/build-aux/compile
U xsrc/external/mit/libxcb/dist/build-aux/config.sub
U xsrc/external/mit/libxcb/dist/build-aux/install-sh
U xsrc/external/mit/libxcb/dist/build-aux/ltmain.sh
U xsrc/external/mit/libxcb/dist/build-aux/missing
U xsrc/external/mit/libxcb/dist/build-aux/test-driver
U xsrc/external/mit/libxcb/dist/build-aux/depcomp
U xsrc/external/mit/libxcb/dist/m4/lt~obsolete.m4
U xsrc/external/mit/libxcb/dist/m4/libtool.m4
U xsrc/external/mit/libxcb/dist/m4/ltoptions.m4
U xsrc/external/mit/libxcb/dist/m4/ltsugar.m4
U xsrc/external/mit/libxcb/dist/m4/ltversion.m4
U xsrc/external/mit/libxcb/dist/m4/xcb.m4
U xsrc/external/mit/libxcb/dist/tools/api_conv.pl
U xsrc/external/mit/libxcb/dist/tools/README
U xsrc/external/mit/libxcb/dist/tools/constants
U xsrc/external/mit/libxcb/dist/src/xcb_windefs.h
U xsrc/external/mit/libxcb/dist/src/Makefile.am
U xsrc/external/mit/libxcb/dist/src/xcbint.h
U xsrc/external/mit/libxcb/dist/src/xcb.h
U xsrc/external/mit/libxcb/dist/src/xcbext.h
U xsrc/external/mit/libxcb/dist/src/Makefile.in
U xsrc/external/mit/libxcb/dist/src/config.h.in
U xsrc/external/mit/libxcb/dist/src/xcb_conn.c
U xsrc/external/mit/libxcb/dist/src/xcb_out.c
C xsrc/external/mit/libxcb/dist/src/xcb_in.c
U xsrc/external/mit/libxcb/dist/src/xcb_ext.c
U xsrc/external/mit/libxcb/dist/src/xcb_xid.c
U xsrc/external/mit/libxcb/dist/src/xcb_list.c
U xsrc/external/mit/libxcb/dist/src/xcb_util.c
U xsrc/external/mit/libxcb/dist/src/xcb_auth.c
U xsrc/external/mit/libxcb/dist/src/c_client.py
U xsrc/external/mit/libxcb/dist/tests/check_suites.h
U xsrc/external/mit/libxcb/dist/tests/Makefile.am
U xsrc/external/mit/libxcb/dist/tests/Makefile.in
U xsrc/external/mit/libxcb/dist/tests/check_all.c
U xsrc/external/mit/libxcb/dist/tests/check_public.c
U xsrc/external/mit/libxcb/dist/tests/CheckLog.xsl
U xsrc/external/mit/libxcb/dist/doc/xcb.doxygen.in
U xsrc/external/mit/libxcb/dist/doc/Makefile.am
U xsrc/external/mit/libxcb/dist/doc/Makefile.in
U xsrc/external/mit/libxcb/dist/doc/xkb_internals
U xsrc/external/mit/libxcb/dist/doc/xkb_issues
U xsrc/external/mit/libxcb/dist/doc/tutorial/index.html
U xsrc/external/mit/libxcb/dist/doc/tutorial/xcb.css
U xsrc/external/mit/libxcb/dist/man/xcb-examples.man
U xsrc/external/mit/libxcb/dist/man/Makefile.am
U xsrc/external/mit/libxcb/dist/man/Makefile.in
U xsrc/external/mit/libxcb/dist/man/xcb-requests.man

1 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jxorg:yesterday -jxorg xsrc/external/mit/libxcb/dist



CVS import: xsrc/external/mit/xcb-proto/dist

2018-03-13 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Wed Mar 14 06:43:06 UTC 2018

Update of /cvsroot/xsrc/external/mit/xcb-proto/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv9739

Log Message:
initial import of xcb-proto-1.13

Status:

Vendor Tag: xorg
Release Tags:   xcb-proto-1-13

U xsrc/external/mit/xcb-proto/dist/xcb-proto.pc.in
U xsrc/external/mit/xcb-proto/dist/Makefile.am
U xsrc/external/mit/xcb-proto/dist/configure
U xsrc/external/mit/xcb-proto/dist/configure.ac
U xsrc/external/mit/xcb-proto/dist/aclocal.m4
U xsrc/external/mit/xcb-proto/dist/Makefile.in
U xsrc/external/mit/xcb-proto/dist/install-sh
U xsrc/external/mit/xcb-proto/dist/COPYING
U xsrc/external/mit/xcb-proto/dist/INSTALL
U xsrc/external/mit/xcb-proto/dist/NEWS
U xsrc/external/mit/xcb-proto/dist/README
U xsrc/external/mit/xcb-proto/dist/TODO
U xsrc/external/mit/xcb-proto/dist/missing
U xsrc/external/mit/xcb-proto/dist/autogen.sh
U xsrc/external/mit/xcb-proto/dist/py-compile
U xsrc/external/mit/xcb-proto/dist/doc/xml-xcb.txt
U xsrc/external/mit/xcb-proto/dist/src/composite.xml
U xsrc/external/mit/xcb-proto/dist/src/Makefile.am
U xsrc/external/mit/xcb-proto/dist/src/xcb.xsd
U xsrc/external/mit/xcb-proto/dist/src/xproto.xml
U xsrc/external/mit/xcb-proto/dist/src/bigreq.xml
U xsrc/external/mit/xcb-proto/dist/src/screensaver.xml
U xsrc/external/mit/xcb-proto/dist/src/damage.xml
U xsrc/external/mit/xcb-proto/dist/src/dpms.xml
U xsrc/external/mit/xcb-proto/dist/src/dri2.xml
U xsrc/external/mit/xcb-proto/dist/src/dri3.xml
U xsrc/external/mit/xcb-proto/dist/src/ge.xml
U xsrc/external/mit/xcb-proto/dist/src/glx.xml
U xsrc/external/mit/xcb-proto/dist/src/present.xml
U xsrc/external/mit/xcb-proto/dist/src/randr.xml
U xsrc/external/mit/xcb-proto/dist/src/record.xml
U xsrc/external/mit/xcb-proto/dist/src/render.xml
U xsrc/external/mit/xcb-proto/dist/src/res.xml
U xsrc/external/mit/xcb-proto/dist/src/shape.xml
U xsrc/external/mit/xcb-proto/dist/src/shm.xml
U xsrc/external/mit/xcb-proto/dist/src/sync.xml
U xsrc/external/mit/xcb-proto/dist/src/xc_misc.xml
U xsrc/external/mit/xcb-proto/dist/src/xevie.xml
U xsrc/external/mit/xcb-proto/dist/src/xf86dri.xml
U xsrc/external/mit/xcb-proto/dist/src/xf86vidmode.xml
U xsrc/external/mit/xcb-proto/dist/src/xfixes.xml
U xsrc/external/mit/xcb-proto/dist/src/xinerama.xml
U xsrc/external/mit/xcb-proto/dist/src/xinput.xml
U xsrc/external/mit/xcb-proto/dist/src/xkb.xml
U xsrc/external/mit/xcb-proto/dist/src/xprint.xml
U xsrc/external/mit/xcb-proto/dist/src/xselinux.xml
U xsrc/external/mit/xcb-proto/dist/src/xtest.xml
U xsrc/external/mit/xcb-proto/dist/src/xv.xml
U xsrc/external/mit/xcb-proto/dist/src/xvmc.xml
U xsrc/external/mit/xcb-proto/dist/src/Makefile.in
U xsrc/external/mit/xcb-proto/dist/xcbgen/Makefile.am
U xsrc/external/mit/xcb-proto/dist/xcbgen/__init__.py
U xsrc/external/mit/xcb-proto/dist/xcbgen/error.py
U xsrc/external/mit/xcb-proto/dist/xcbgen/expr.py
U xsrc/external/mit/xcb-proto/dist/xcbgen/align.py
U xsrc/external/mit/xcb-proto/dist/xcbgen/matcher.py
U xsrc/external/mit/xcb-proto/dist/xcbgen/state.py
U xsrc/external/mit/xcb-proto/dist/xcbgen/xtypes.py
U xsrc/external/mit/xcb-proto/dist/xcbgen/Makefile.in

No conflicts created by this import



CVS commit: src/sys/arch/evbarm/fdt

2018-03-13 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Mar 14 06:35:31 UTC 2018

Modified Files:
src/sys/arch/evbarm/fdt: platform.h

Log Message:
fix compile error on evbarm/EXYNOS. platform.h may be included from *.S


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/fdt/platform.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/evbarm/fdt/platform.h
diff -u src/sys/arch/evbarm/fdt/platform.h:1.2 src/sys/arch/evbarm/fdt/platform.h:1.3
--- src/sys/arch/evbarm/fdt/platform.h:1.2	Sun Dec 10 21:38:27 2017
+++ src/sys/arch/evbarm/fdt/platform.h	Wed Mar 14 06:35:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: platform.h,v 1.2 2017/12/10 21:38:27 skrll Exp $ */
+/* $NetBSD: platform.h,v 1.3 2018/03/14 06:35:31 ryo Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -29,7 +29,9 @@
 #ifndef _EVBARM_FDT_PLATFORM_H
 #define _EVBARM_FDT_PLATFORM_H
 
+#ifndef _LOCORE
 void fdt_add_reserved_memory_range(uint64_t, uint64_t);
+#endif
 
 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 #define KERNEL_VM_BASE		0xc000



CVS commit: src/external/mit/xorg/bin/xterm

2018-03-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 14 06:06:40 UTC 2018

Modified Files:
src/external/mit/xorg/bin/xterm: Makefile

Log Message:
build Tekparse.hin VTparse.hin normally.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/mit/xorg/bin/xterm/Makefile

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

Modified files:

Index: src/external/mit/xorg/bin/xterm/Makefile
diff -u src/external/mit/xorg/bin/xterm/Makefile:1.15 src/external/mit/xorg/bin/xterm/Makefile:1.16
--- src/external/mit/xorg/bin/xterm/Makefile:1.15	Thu Jul 23 09:37:59 2015
+++ src/external/mit/xorg/bin/xterm/Makefile	Wed Mar 14 06:06:40 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2015/07/23 09:37:59 mrg Exp $
+#	$NetBSD: Makefile,v 1.16 2018/03/14 06:06:40 mrg Exp $
 
 .include 
 
@@ -12,7 +12,8 @@ SRCS=	button.c charproc.c charsets.c cur
 # graphics_regis.c graphics_sixel.c
 # xterm.appdata.xml
 
-CPPFLAGS+=	-I${X11SRCDIR.${PROG}} \
+CPPFLAGS+=	-I. \
+		-I${X11SRCDIR.${PROG}} \
 		-I${X11SRCDIR.${PROG}}/../include \
 		-I${DESTDIR}${X11INCDIR}/freetype2 \
 		-DPROJECTROOT=${X11ROOTDIR} \
@@ -44,6 +45,12 @@ COPTS.input.c+=	-Wno-error	# uses XKeyco
 
 # XXXMRG should probably build builtin_icons.h
 
+.SUFFIXES: .def .hin
+.def.hin:
+	${TOOL_AWK} '/^CASE_/{printf "#define %s %d\n", $$1, n++}' < $< >$@
+DPSRCS+= Tekparse.hin VTparse.hin
+CLEANFILES+= Tekparse.hin VTparse.hin
+
 .include "Makefile.inc"
 
 .include 



CVS commit: xsrc/external/mit/xterm/include

2018-03-13 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Wed Mar 14 06:06:01 UTC 2018

Modified Files:
xsrc/external/mit/xterm/include: xtermcfg.h
Removed Files:
xsrc/external/mit/xterm/include: Tekparse.hin VTparse.hin

Log Message:
merge xterm 330.  remove files we'll build now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 xsrc/external/mit/xterm/include/Tekparse.hin \
xsrc/external/mit/xterm/include/VTparse.hin
cvs rdiff -u -r1.11 -r1.12 xsrc/external/mit/xterm/include/xtermcfg.h

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

Modified files:

Index: xsrc/external/mit/xterm/include/xtermcfg.h
diff -u xsrc/external/mit/xterm/include/xtermcfg.h:1.11 xsrc/external/mit/xterm/include/xtermcfg.h:1.12
--- xsrc/external/mit/xterm/include/xtermcfg.h:1.11	Wed Mar  8 02:55:45 2017
+++ xsrc/external/mit/xterm/include/xtermcfg.h	Wed Mar 14 06:06:01 2018
@@ -187,6 +187,7 @@
 /* #undef OPT_XMC_GLITCH */		/* CF_ARG_ENABLE(xmc-glitch) */
 /* #undef OPT_ZICONBEEP */		/* CF_ARG_DISABLE(ziconbeep) */
 /* #undef OWN_TERMINFO_DIR */		/* AC_ARG_WITH(own-terminfo) */
+/* #undef OWN_TERMINFO_ENV */		/* AC_ARG_ENABLE(env-terminfo) */
 /* #undef PROCFS_ROOT */		/* CF_ARG_ENABLE(exec-xterm) */
 #define SCROLLBAR_RIGHT 1		/* CF_ARG_ENABLE(rightbar) */
 #define SIG_ATOMIC_T volatile sig_atomic_t		/* CF_SIG_ATOMIC_T */



CVS commit: xsrc/external/mit/xterm/dist

2018-03-13 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Wed Mar 14 06:04:47 UTC 2018

Modified Files:
xsrc/external/mit/xterm/dist: XTerm.ad fontutils.c misc.c ptyx.h
xterm.man

Log Message:
merge xterm 330.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 xsrc/external/mit/xterm/dist/XTerm.ad
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xterm/dist/fontutils.c
cvs rdiff -u -r1.14 -r1.15 xsrc/external/mit/xterm/dist/misc.c
cvs rdiff -u -r1.13 -r1.14 xsrc/external/mit/xterm/dist/ptyx.h
cvs rdiff -u -r1.15 -r1.16 xsrc/external/mit/xterm/dist/xterm.man

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

Modified files:

Index: xsrc/external/mit/xterm/dist/XTerm.ad
diff -u xsrc/external/mit/xterm/dist/XTerm.ad:1.9 xsrc/external/mit/xterm/dist/XTerm.ad:1.10
--- xsrc/external/mit/xterm/dist/XTerm.ad:1.9	Wed Mar  8 02:55:12 2017
+++ xsrc/external/mit/xterm/dist/XTerm.ad	Wed Mar 14 06:04:47 2018
@@ -1,4 +1,4 @@
-! $XTermId: XTerm.ad,v 1.101 2016/01/28 02:15:29 tom Exp $
+! $XTermId: XTerm.ad,v 1.102 2016/12/22 02:07:39 tom Exp $
 ! -
 ! this file is part of xterm
 !
@@ -135,6 +135,7 @@
 
 *fontMenu*allow-color-ops*Label:	Allow Color Ops
 *fontMenu*allow-font-ops*Label:	Allow Font Ops
+*fontMenu*allow-mouse-ops*Label:	Allow Mouse Ops
 *fontMenu*allow-tcap-ops*Label:	Allow Termcap Ops
 *fontMenu*allow-title-ops*Label:	Allow Title Ops
 *fontMenu*allow-window-ops*Label:	Allow Window Ops

Index: xsrc/external/mit/xterm/dist/fontutils.c
diff -u xsrc/external/mit/xterm/dist/fontutils.c:1.6 xsrc/external/mit/xterm/dist/fontutils.c:1.7
--- xsrc/external/mit/xterm/dist/fontutils.c:1.6	Wed Mar  8 02:55:12 2017
+++ xsrc/external/mit/xterm/dist/fontutils.c	Wed Mar 14 06:04:47 2018
@@ -1,7 +1,7 @@
-/* $XTermId: fontutils.c,v 1.453 2016/06/03 08:56:53 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.531 2017/06/20 09:10:19 tom Exp $ */
 
 /*
- * Copyright 1998-2015,2016 by Thomas E. Dickey
+ * Copyright 1998-2016,2017 by Thomas E. Dickey
  *
  * All Rights Reserved
  *
@@ -120,6 +120,13 @@ typedef struct {
 char *end;
 } FontNameProperties;
 
+#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS
+static Boolean merge_sublist(char ***, char **);
+#endif
+
+static void save2FontList(XtermWidget, const char *, XtermFontNames *,
+			  VTFontEnum, const char *, Bool);
+
 #if OPT_RENDERFONT
 static void fillInFaceSize(XtermWidget, int);
 #endif
@@ -178,20 +185,18 @@ setupPackedFonts(XtermWidget xw)
 Bool value = False;
 
 #if OPT_RENDERFONT
-#define MIXED(name) screen->name[fontnum].map.mixed
 if (xw->work.render_font == True) {
-	int fontnum = screen->menu_font_number;
+	int e;
 
-	screen->allow_packing = (Boolean) (MIXED(renderFontNorm)
-	   || MIXED(renderFontBold)
-	   || MIXED(renderFontItal)
-#if OPT_RENDERWIDE
-	   || MIXED(renderWideNorm)
-	   || MIXED(renderWideBold)
-	   || MIXED(renderWideItal)
-#endif
-	);
-#undef MIXED
+	for (e = 0; e < fMAX; ++e) {
+	XTermXftFonts *data = getMyXftFont(xw, e, screen->menu_font_number);
+	if (data != 0) {
+		if (data->map.mixed) {
+		screen->allow_packing = True;
+		break;
+		}
+	}
+	}
 }
 #endif /* OPT_RENDERFONT */
 
@@ -455,11 +460,58 @@ bold_font_name(FontNameProperties *props
 
 #if OPT_WIDE_ATTRS
 static char *
-italic_font_name(FontNameProperties *props, int use_average_width)
+italic_font_name(FontNameProperties *props, const char *slant)
 {
 FontNameProperties myprops = *props;
-myprops.slant = "o";
-return derive_font_name(&myprops, props->weight, use_average_width, props->end);
+myprops.slant = slant;
+return derive_font_name(&myprops, props->weight, myprops.average_width, props->end);
+}
+
+static Boolean
+open_italic_font(XtermWidget xw, int n, FontNameProperties *fp, XTermFonts * data)
+{
+static const char *slant[] =
+{
+	"o",
+	"i"
+};
+char *name;
+Cardinal pass;
+Boolean result = False;
+
+for (pass = 0; pass < XtNumber(slant); ++pass) {
+	if ((name = italic_font_name(fp, slant[pass])) != 0) {
+	TRACE(("open_italic_font %s %s\n",
+		   whichFontEnum((VTFontEnum) n), name));
+	if (xtermOpenFont(xw, name, data, False)) {
+		result = (data->fs != 0);
+#if OPT_REPORT_FONTS
+		if (resource.reportFonts) {
+		printf("opened italic version of %s:\n\t%s\n",
+			   whichFontEnum(n),
+			   name);
+		}
+#endif
+	}
+	free(name);
+	if (result)
+		break;
+	}
+}
+#if OPT_TRACE
+if (result) {
+	XFontStruct *fs = data->fs;
+	if (fs != 0) {
+	TRACE(("...actual size %dx%d (ascent %d, descent %d)\n",
+		   fs->ascent +
+		   fs->descent,
+		   fs->max_bounds.width,
+		   fs->ascent,
+		   fs->descent));
+	}
+}
+#endif
+return result;
 }
 #endif
 
@@ -489,8 +541,9 @@ widebold_font_name(FontNameProperties *p
  * fonts we double the pixel-size and Y-resolution
  */
 char *
-x

CVS import: xsrc/external/mit/xterm/dist

2018-03-13 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Wed Mar 14 06:04:24 UTC 2018

Update of /cvsroot/xsrc/external/mit/xterm/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv22335

Log Message:
initial import of xterm-330

Status:

Vendor Tag: xorg
Release Tags:   xterm-330

C xsrc/external/mit/xterm/dist/fontutils.c
U xsrc/external/mit/xterm/dist/data.h
U xsrc/external/mit/xterm/dist/uxterm.desktop
U xsrc/external/mit/xterm/dist/make.com
U xsrc/external/mit/xterm/dist/graphics_sixel.h
U xsrc/external/mit/xterm/dist/256colres.pl
U xsrc/external/mit/xterm/dist/xtermcfg.hin
U xsrc/external/mit/xterm/dist/Tekparse.h
U xsrc/external/mit/xterm/dist/README.i18n
U xsrc/external/mit/xterm/dist/XTerm-col.ad
U xsrc/external/mit/xterm/dist/charclass.c
U xsrc/external/mit/xterm/dist/xterm.desktop
C xsrc/external/mit/xterm/dist/xterm.man
U xsrc/external/mit/xterm/dist/data.c
U xsrc/external/mit/xterm/dist/print.c
U xsrc/external/mit/xterm/dist/fontutils.h
U xsrc/external/mit/xterm/dist/precompose.h
C xsrc/external/mit/xterm/dist/misc.c
U xsrc/external/mit/xterm/dist/precompose.c
U xsrc/external/mit/xterm/dist/main.h
U xsrc/external/mit/xterm/dist/keysym2ucs.c
U xsrc/external/mit/xterm/dist/trace.c
U xsrc/external/mit/xterm/dist/error.h
U xsrc/external/mit/xterm/dist/version.c
U xsrc/external/mit/xterm/dist/tabs.c
U xsrc/external/mit/xterm/dist/koi8rxterm.man
U xsrc/external/mit/xterm/dist/scrollback.c
U xsrc/external/mit/xterm/dist/graphics.c
U xsrc/external/mit/xterm/dist/ctlseqs.ms
U xsrc/external/mit/xterm/dist/version.h
U xsrc/external/mit/xterm/dist/ptydata.c
U xsrc/external/mit/xterm/dist/aclocal.m4
C xsrc/external/mit/xterm/dist/ptyx.h
U xsrc/external/mit/xterm/dist/trace.h
U xsrc/external/mit/xterm/dist/button.c
U xsrc/external/mit/xterm/dist/xtermcap.c
U xsrc/external/mit/xterm/dist/charsets.c
U xsrc/external/mit/xterm/dist/xutf8.h
U xsrc/external/mit/xterm/dist/xterm.log.html
U xsrc/external/mit/xterm/dist/charproc.c
U xsrc/external/mit/xterm/dist/install-sh
U xsrc/external/mit/xterm/dist/plink.sh
U xsrc/external/mit/xterm/dist/Makefile.in
U xsrc/external/mit/xterm/dist/minstall.in
U xsrc/external/mit/xterm/dist/ctlseqs.txt
U xsrc/external/mit/xterm/dist/README
U xsrc/external/mit/xterm/dist/xstrings.c
U xsrc/external/mit/xterm/dist/xstrings.h
U xsrc/external/mit/xterm/dist/configure.in
U xsrc/external/mit/xterm/dist/Tekproc.c
U xsrc/external/mit/xterm/dist/vms.h
U xsrc/external/mit/xterm/dist/cachedGCs.c
U xsrc/external/mit/xterm/dist/uxterm.man
U xsrc/external/mit/xterm/dist/configure
U xsrc/external/mit/xterm/dist/resize.c
U xsrc/external/mit/xterm/dist/charclass.h
U xsrc/external/mit/xterm/dist/xutf8.c
U xsrc/external/mit/xterm/dist/NEWS
U xsrc/external/mit/xterm/dist/cursor.c
U xsrc/external/mit/xterm/dist/terminfo
U xsrc/external/mit/xterm/dist/xterm.dat
U xsrc/external/mit/xterm/dist/html.c
U xsrc/external/mit/xterm/dist/uxterm
U xsrc/external/mit/xterm/dist/graphics.h
C xsrc/external/mit/xterm/dist/XTerm.ad
U xsrc/external/mit/xterm/dist/df-install.in
U xsrc/external/mit/xterm/dist/termcap
U xsrc/external/mit/xterm/dist/256colres.h
U xsrc/external/mit/xterm/dist/menu.c
U xsrc/external/mit/xterm/dist/vms.c
U xsrc/external/mit/xterm/dist/88colres.h
U xsrc/external/mit/xterm/dist/TekPrsTbl.c
U xsrc/external/mit/xterm/dist/xterm.appdata.xml
U xsrc/external/mit/xterm/dist/AAA_README_VMS.txt
U xsrc/external/mit/xterm/dist/graphics_regis.h
U xsrc/external/mit/xterm/dist/koi8rxterm
U xsrc/external/mit/xterm/dist/xtermcap.h
U xsrc/external/mit/xterm/dist/scrollbar.c
U xsrc/external/mit/xterm/dist/link_axp.com
U xsrc/external/mit/xterm/dist/KOI8RXTerm.ad
U xsrc/external/mit/xterm/dist/88colres.pl
U xsrc/external/mit/xterm/dist/graphics_regis.c
U xsrc/external/mit/xterm/dist/run-tic.sh
U xsrc/external/mit/xterm/dist/VTPrsTbl.c
U xsrc/external/mit/xterm/dist/graphics_sixel.c
U xsrc/external/mit/xterm/dist/doublechr.c
U xsrc/external/mit/xterm/dist/xcharmouse.h
U xsrc/external/mit/xterm/dist/Tests
U xsrc/external/mit/xterm/dist/xterm_io.h
U xsrc/external/mit/xterm/dist/wcwidth.c
U xsrc/external/mit/xterm/dist/menu.h
U xsrc/external/mit/xterm/dist/keysym2ucs.h
U xsrc/external/mit/xterm/dist/resize.man
U xsrc/external/mit/xterm/dist/THANKS
U xsrc/external/mit/xterm/dist/config.sub
U xsrc/external/mit/xterm/dist/Imakefile
U xsrc/external/mit/xterm/dist/Tekparse.def
U xsrc/external/mit/xterm/dist/INSTALL
U xsrc/external/mit/xterm/dist/xterm.h
U xsrc/external/mit/xterm/dist/gen-pc-fkeys.pl
U xsrc/external/mit/xterm/dist/UXTerm.ad
U xsrc/external/mit/xterm/dist/main.c
U xsrc/external/mit/xterm/dist/input.c
U xsrc/external/mit/xterm/dist/README.os390
U xsrc/external/mit/xterm/dist/config.guess
U xsrc/external/mit/xterm/dist/wcwidth.h
U xsrc/external/mit/xterm/dist/svg.c
U xsrc/external/mit/xterm/dist/xterm_axp.opt
U xsrc/external/mit/xterm/dist/VTparse.h
U xsrc/external/mit/xterm/dist/MANIFEST
U xsrc/external/mit/xterm/dist/testxmc.c
U xsrc/external/mit/xterm/dist/util.c
U xsrc/external/mit/xter

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, &my_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/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 (*ve

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 FOUNDAT

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 I

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&sleep 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: 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 i

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 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: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.

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.182 src/bin/sh/sh.1:1.183
--- src/bin/sh/sh.1:1.182	Tue Mar 13 20:39:25 2018
+++ src/bin/sh/sh.1	Tue Mar 13 20:40:52 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.182 2018/03/13 20:39:25 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.183 2018/03/13 20:40:52 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1431,8 +1431,7 @@ EOF
 \&}
 .Ed
 .Pp
-which reads and processes the
-.Ic here document
+which reads and processes the here-document
 each time the shell executes the function, and which applies
 that input only to the cat command, not to any other commands
 that might appear in the function.



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: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: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 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: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.

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-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-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] 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/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/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), &ipn);
 
-#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), &ip6n);
 
-#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, &prot);
 
+#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), &ipn);
 
-#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), &ip6n);
 
-#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-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), &ipn);
 
-#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), &ip6n);
 
-#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, &prot);
 
+#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), &ipn);
 
-#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), &ip6n);
 
-#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), &ipn);
 
-#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), &ip6n);
 
-#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, &prot);
 
+#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), &ipn);
 
-#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), &ip6n);
 
-#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-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, &error);
+			}
 			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, &error);
+			}
 			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, &tshim)) == NULL))
-			return ENOBUFS;
+		((m = mpls_prepend_shim(m, &tshim)) == 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

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, &error);
+			}
 			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, &error);
+			}
 			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, &tshim)) == NULL))
-			return ENOBUFS;
+		((m = mpls_prepend_shim(m, &tshim)) == 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.

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, &error);
+			}
 			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, &error);
+			}
 			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, &tshim)) == NULL))
-			return ENOBUFS;
+		((m = mpls_prepend_shim(m, &tshim)) == 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

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:



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->sc_tick_ch, hz, be_tick, sc);
 
+	splx(s);
 	return 0;
 out:
 	splx(s);



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 droc

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(&snapper_hw_if, sc, sc->sc_dev);
-
 	/* ki2c_setmode(sc->sc_i2c, I2C_STDSUBMODE); */
 	snapper_init(sc, sc->sc_node);
+
+	audio_attach_mi(&snapper_hw_if, sc, sc->sc_dev);
 }
 
 static int



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] 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.

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: [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 */
-	&cntr			/* 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 =		&cntr,
 };
 
 /*
  * 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(&cntr.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 t

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 */
-	&cntr			/* 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 =		&cntr,
 };
 
 /*
  * 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(&cntr.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 case

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 */
-	&cntr			/* 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 =		&cntr,
 };
 
 /*
  * 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(&cntr.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 t

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(&svs_cpu_barrier1);
 	while (atomic_cas_ulong(&svs_cpu_barrier1, 0, 0) != 0) {



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(&ip6_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(&ip6_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(&ip6_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(&ip6_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(&ip6_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(&ip6_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->sc_slock);
 
 	if (write || !FSS_ISVALID(sc)) {
-
-		mutex_exit(&sc->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->sc_work_cv);
 
 	mutex_exit(&sc->sc_slock);
+	return;
+
+done:
+	mutex_exit(&sc->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->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, &resid);
+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->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
 

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: [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: 1.11

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 @@
  */
 
 #incl

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(&eh->ether_type, &etype, 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(&m))
 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)) 

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(&addrport, addr, port);
-		if_ipsec_add_mbuf(m0, &addrport, addrport.sa_len);
+		if_ipsec_add_mbuf_optalign(m0, &addrport, 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), &msg);
 
 	if_ipsec_add_mbuf(m, &xsrc, 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, &xdst, 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, &xpl, sizeof(xpl));
 	if (policy == IPSEC_POLICY_IPSEC) {
 		if_ipsec_add_mbuf(m, &xisr, sizeof(xisr));
-		if_ipsec_add_m

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(&addrport, addr, port);
+		if_ipsec_add_mbuf(m0, &addrport, 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);
+		s

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

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 14:59:06 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #626):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.134
sys/dev/pci/ixgbe/ixgbe.h: revision 1.35
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.35
sys/dev/pci/ixgbe/ixv.c: revision 1.87
  Make some event counters MP safe. Now all of the event counters are
MP safe.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.6 -r1.24.2.7 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.13 -r1.88.2.14 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.6 -r1.24.6.7 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.10 -r1.56.2.11 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.6 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.7
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.6	Tue Mar  6 11:12:40 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue Mar 13 14:59:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.6 2018/03/06 11:12:40 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.7 2018/03/13 14:59:06 martin Exp $ */
 
 /**
 
@@ -392,10 +392,10 @@ retry:
 
 		switch (error) {
 		case EAGAIN:
-			adapter->eagain_tx_dma_setup.ev_count++;
+			txr->q_eagain_tx_dma_setup++;
 			return EAGAIN;
 		case ENOMEM:
-			adapter->enomem_tx_dma_setup.ev_count++;
+			txr->q_enomem_tx_dma_setup++;
 			return EAGAIN;
 		case EFBIG:
 			/* Try it again? - one try */
@@ -405,23 +405,23 @@ retry:
  * XXX: m_defrag will choke on
  * non-MCLBYTES-sized clusters
  */
-adapter->efbig_tx_dma_setup.ev_count++;
+txr->q_efbig_tx_dma_setup++;
 m = m_defrag(m_head, M_NOWAIT);
 if (m == NULL) {
-	adapter->mbuf_defrag_failed.ev_count++;
+	txr->q_mbuf_defrag_failed++;
 	return ENOBUFS;
 }
 m_head = m;
 goto retry;
 			} else {
-adapter->efbig2_tx_dma_setup.ev_count++;
+txr->q_efbig2_tx_dma_setup++;
 return error;
 			}
 		case EINVAL:
-			adapter->einval_tx_dma_setup.ev_count++;
+			txr->q_einval_tx_dma_setup++;
 			return error;
 		default:
-			adapter->other_tx_dma_setup.ev_count++;
+			txr->q_other_tx_dma_setup++;
 			return error;
 		}
 	}

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.13 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.14
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.13	Thu Mar  8 12:31:25 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Mar 13 14:59:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.13 2018/03/08 12:31:25 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.14 2018/03/13 14:59:06 martin Exp $ */
 
 /**
 
@@ -1980,8 +1980,8 @@ ixgbe_clear_evcnt(struct adapter *adapte
 	adapter->other_tx_dma_setup.ev_count = 0;
 	adapter->eagain_tx_dma_setup.ev_count = 0;
 	adapter->enomem_tx_dma_setup.ev_count = 0;
-	adapter->watchdog_events.ev_count = 0;
 	adapter->tso_err.ev_count = 0;
+	adapter->watchdog_events.ev_count = 0;
 	adapter->link_irq.ev_count = 0;
 
 	txr = adapter->tx_rings;
@@ -1995,6 +1995,14 @@ ixgbe_clear_evcnt(struct adapter *adapte
 #ifndef IXGBE_LEGACY_TX
 		txr->pcq_drops.ev_count = 0;
 #endif
+		txr->q_efbig_tx_dma_setup = 0;
+		txr->q_mbuf_defrag_failed = 0;
+		txr->q_efbig2_tx_dma_setup = 0;
+		txr->q_einval_tx_dma_setup = 0;
+		txr->q_other_tx_dma_setup = 0;
+		txr->q_eagain_tx_dma_setup = 0;
+		txr->q_enomem_tx_dma_setup = 0;
+		txr->q_tso_err = 0;
 
 		if (i < __arraycount(stats->mpc)) {
 			stats->mpc[i].ev_count = 0;
@@ -4190,7 +4198,9 @@ ixgbe_local_timer1(void *arg)
 	device_t	dev = adapter->dev;
 	struct ix_queue *que = adapter->queues;
 	u64		queues = 0;
+	u64		v0, v1, v2, v3, v4, v5, v6, v7;
 	int		hung = 0;
+	int		i;
 
 	KASSERT(mutex_owned(&adapter->core_mtx));
 
@@ -4202,12 +4212,37 @@ ixgbe_local_timer1(void *arg)
 	ixgbe_update_link_status(adapter);
 	ixgbe_update_stats_counters(adapter);
 
+	/* Update some event counters */
+	v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = 0;
+	que = adapter->queues;
+	for (i = 0; i < adapter->num_queues; i++, que++) {
+		struct tx_ring  *txr = que->txr;
+
+		v0 += txr->q_efbig_tx_dma_setup;
+		v1 += txr->q_mbuf_defrag_failed;
+		v2 += txr->q_efbig2_tx_dma_setup;
+		v3 += txr->q_einval_tx_dma_setup;
+		v4 += txr->q_other_tx_dma_setup;
+		v5 += txr->q_eagain_tx_dma_setup;
+		v6 += txr->q_enomem_tx_dma_setup;
+		v7 += txr->q_tso_err;
+	}
+	adapter->efbig_tx_dma_setup.ev_count = v0;
+	adapter->mbuf_defrag_failed.ev_count = v1;
+	adapter->efbig2_tx_dma_setup.ev_count = v2;
+	adapter->einval_tx_dma_setup.ev_count = v3;
+	adapter->other_tx_dma_setup.ev_count = v4;
+	adapter->eagain_tx_dma_se

CVS commit: [netbsd-8] src/sys

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 14:54:52 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: Makefile.efiboot
TODO.efiboot boot.c devopen.c efiboot.c efiboot.h efidisk.c
efidisk.h efidisk_ll.c
src/sys/arch/i386/stand/lib [netbsd-8]: biosdisk.c biosdisk.h
biosdisk_ll.h
src/sys/lib/libsa [netbsd-8]: cd9660.c
Added Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: efidev.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #625):
sys/arch/i386/stand/efiboot/efidisk.c: revision 1.2
sys/arch/i386/stand/efiboot/devopen.c: revision 1.2
sys/arch/i386/stand/efiboot/efidisk.h: revision 1.2
sys/arch/i386/stand/efiboot/boot.c: revision 1.6
sys/arch/i386/stand/efiboot/efidisk_ll.c: revision 1.2
sys/arch/i386/stand/efiboot/efidev.c: revision 1.1
sys/arch/i386/stand/lib/biosdisk_ll.h: revision 1.16
sys/arch/i386/stand/lib/biosdisk.h: revision 1.9
sys/lib/libsa/cd9660.c: revision 1.31
sys/arch/i386/stand/efiboot/efiboot.c: revision 1.5
sys/arch/i386/stand/efiboot/efiboot.h: revision 1.6
sys/arch/i386/stand/lib/biosdisk.c: revision 1.47
sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.10
sys/arch/i386/stand/efiboot/TODO.efiboot: revision 1.4
efiboot: system can boot from CD/DVD-ROM media.

Add missed file in previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.3 -r1.3.10.1 src/sys/arch/i386/stand/efiboot/TODO.efiboot
cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/arch/i386/stand/efiboot/boot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.1 -r1.1.12.1 src/sys/arch/i386/stand/efiboot/devopen.c \
src/sys/arch/i386/stand/efiboot/efidisk.c \
src/sys/arch/i386/stand/efiboot/efidisk.h \
src/sys/arch/i386/stand/efiboot/efidisk_ll.c
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/arch/i386/stand/efiboot/efiboot.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/i386/stand/efiboot/efidev.c
cvs rdiff -u -r1.46 -r1.46.6.1 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.8 -r1.8.52.1 src/sys/arch/i386/stand/lib/biosdisk.h
cvs rdiff -u -r1.15 -r1.15.90.1 src/sys/arch/i386/stand/lib/biosdisk_ll.h
cvs rdiff -u -r1.30 -r1.30.22.1 src/sys/lib/libsa/cd9660.c

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.9 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.9.2.1
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.9	Sat Apr 29 00:05:35 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Tue Mar 13 14:54:52 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.9 2017/04/29 00:05:35 nonaka Exp $
+# $NetBSD: Makefile.efiboot,v 1.9.2.1 2018/03/13 14:54:52 martin Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -12,8 +12,8 @@ SOURCES?= start.S conf.c devopen.c efibo
 LIBI386SRCS= boot.c biosdisk.c bootinfo.c bootinfo_biosgeom.c
 LIBI386SRCS+= bootmenu.c diskbuf.c exec.c menuutils.c
 LIBI386SRCS+= panic.c parseutils.c pread.c
-LIBI386SRCS+= eficons.c efidelay.c efidisk.c efidisk_ll.c efigetsecs.c
-LIBI386SRCS+= efimemory.c
+LIBI386SRCS+= eficons.c efidelay.c efidev.c efidisk.c efidisk_ll.c
+LIBI386SRCS+= efigetsecs.c efimemory.c
 SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS}
 
 PIE_CFLAGS=
@@ -54,9 +54,11 @@ CPPFLAGS+= -Wno-pointer-sign
 CPPFLAGS+= -DEFI_ALLOCATE_MAX_ADDRESS=0x1ULL
 CPPFLAGS+= -DHEAP_VARIABLE
 CPPFLAGS+= -DSUPPORT_CD9660
+CPPFLAGS+= -D"devb2cdb(bno)=(bno)"
 CPPFLAGS+= -DSUPPORT_DOSFS
 CPPFLAGS+= -DSUPPORT_EXT2FS
 CPPFLAGS+= -DPASS_BIOSGEOM
+CPPFLAGS+= -DBIOSDISK_DEFAULT_SECSIZE=2048	# for bootinfo_biosgeom.c
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 
 EFIDIR= ${S}/external/bsd/gnu-efi/dist
@@ -66,6 +68,7 @@ CPPFLAGS+= -I${EFIDIR}/inc/protocol
 
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT
+SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)"
 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes  # Read compressed kernels
 SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no # Netboot via TFTP, NFS
 

Index: src/sys/arch/i386/stand/efiboot/TODO.efiboot
diff -u src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.3 src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.3.10.1
--- src/sys/arch/i386/stand/efiboot/TODO.efiboot:1.3	Sun Mar 12 06:37:41 2017
+++ src/sys/arch/i386/stand/efiboot/TODO.efiboot	Tue Mar 13 14:54:52 2018
@@ -1,6 +1,5 @@
 - efiboot
  * handle UEFI variables
- * boot from CD/DVD (bootable from CD/DVD, but root fs not found.)
  * load boot.cfg from EFI system partition (FAT32)
 
 - kernel

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.5 src/sys/arch/i386/stand/efiboot/boot.c:1.5.2.1
--- src/sys/arch/

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

2018-03-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Mar 13 14:54:13 UTC 2018

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

Log Message:
ATF: Add new test race1 in t_ptrace_wait*

Reuse the attach1's test body for race1.

Add a new test race1:
  Assert that await_zombie() in attach1 always finds a single
  process and no other error is reported

race1 requires HAVE_PID in wait(2)-like function.

This test is executed in a loop for 5 seconds (16k iterations on Intel i7).
A buggy kernel was asserting an error within this timeframe almost always.

The bug in the kernel is now gone and this test is expected to pass
correctly.

Sponsored by 


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

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.25 src/tests/lib/libc/sys/t_ptrace_wait.c:1.26
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.25	Wed Mar  7 16:40:06 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Mar 13 14:54:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.25 2018/03/07 16:40:06 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.26 2018/03/13 14:54:13 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.25 2018/03/07 16:40:06 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.26 2018/03/13 14:54:13 kamil Exp $");
 
 #include 
 #include 
@@ -48,6 +48,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.25
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -312,7 +313,8 @@ ATF_TC_HEAD(attach1, tc)
 	"Assert that tracer sees process termination before the parent");
 }
 
-ATF_TC_BODY(attach1, tc)
+static void
+attach1_raw(bool raw)
 {
 	struct msg_fds parent_tracee, parent_tracer;
 	const int exitval_tracee = 5;
@@ -372,8 +374,10 @@ ATF_TC_BODY(attach1, tc)
 	PARENT_TO_CHILD("exit tracee", parent_tracee,  msg);
 
 	DPRINTF("Detect that tracee is zombie\n");
-	await_zombie(tracee);
-
+	if (raw)
+		await_zombie_raw(tracee, 0);
+	else
+		await_zombie(tracee);
 
 	DPRINTF("Assert that there is no status about tracee %d - "
 	"Tracer must detect zombie first - calling %s()\n", tracee,
@@ -402,6 +406,14 @@ ATF_TC_BODY(attach1, tc)
 	msg_close(&parent_tracer);
 	msg_close(&parent_tracee);
 }
+
+ATF_TC_BODY(attach1, tc)
+{
+
+	/* Reuse this test with race1 */
+	attach1_raw(false);
+}
+
 #endif
 
 #if defined(TWAIT_HAVE_PID)
@@ -7062,6 +7074,37 @@ ATF_TC_BODY(syscallemu1, tc)
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
 }
 
+#if defined(TWAIT_HAVE_PID)
+ATF_TC(race1);
+ATF_TC_HEAD(race1, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Assert that await_zombie() in attach1 always finds a single "
+	"process and no other error is reported");
+}
+
+ATF_TC_BODY(race1, tc)
+{
+	time_t start, end;
+	double diff;
+	unsigned long N = 0;
+
+	/* Reuse this test with attach1 */
+
+	start = time(NULL);
+	while (true) {
+		DPRINTF("Step: %lu\n", N);
+		attach1_raw(true);
+		end = time(NULL);
+		diff = difftime(end, start);
+		if (diff >= 5.0)
+			break;
+		++N;
+	}
+	DPRINTF("Iterations: %lu\n", N);
+}
+#endif
+
 #include "t_ptrace_amd64_wait.h"
 #include "t_ptrace_i386_wait.h"
 #include "t_ptrace_x86_wait.h"
@@ -7193,6 +7236,8 @@ ATF_TP_ADD_TCS(tp)
 
 	ATF_TP_ADD_TC(tp, syscallemu1);
 
+	ATF_TP_ADD_TC_HAVE_PID(tp, race1);
+
 	ATF_TP_ADD_TCS_PTRACE_WAIT_AMD64();
 	ATF_TP_ADD_TCS_PTRACE_WAIT_I386();
 	ATF_TP_ADD_TCS_PTRACE_WAIT_X86();



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

2018-03-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Mar 13 14:45:36 UTC 2018

Modified Files:
src/tests/lib/libc/sys: msg.h

Log Message:
ATF t_ptrace_wait*: Disable debug messages in msg.h

msg.h is a dummy IPC interface.

Disable additional debugging logging here, especially wanted in race*
tests.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/msg.h

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

Modified files:

Index: src/tests/lib/libc/sys/msg.h
diff -u src/tests/lib/libc/sys/msg.h:1.1 src/tests/lib/libc/sys/msg.h:1.2
--- src/tests/lib/libc/sys/msg.h:1.1	Sun Apr  2 21:44:00 2017
+++ src/tests/lib/libc/sys/msg.h	Tue Mar 13 14:45:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.h,v 1.1 2017/04/02 21:44:00 kamil Exp $	*/
+/*	$NetBSD: msg.h,v 1.2 2018/03/13 14:45:36 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ msg_write_child(const char *info, struct
 	CLOSEFD(fds->cfd[1]);
 	CLOSEFD(fds->pfd[0]);
 
-	printf("Send %s\n", info);
+//	printf("Send %s\n", info);
 	rv = write(fds->pfd[1], msg, len);
 	if (rv != (ssize_t)len)
 		return 1;
@@ -88,7 +88,7 @@ msg_write_parent(const char *info, struc
 	CLOSEFD(fds->pfd[1]);
 	CLOSEFD(fds->cfd[0]);
 
-	printf("Send %s\n", info);
+//	printf("Send %s\n", info);
 	rv = write(fds->cfd[1], msg, len);
 	if (rv != (ssize_t)len)
 		return 1;
@@ -106,7 +106,7 @@ msg_read_parent(const char *info, struct
 	CLOSEFD(fds->pfd[1]);
 	CLOSEFD(fds->cfd[0]);
 
-	printf("Wait %s\n", info);
+//	printf("Wait %s\n", info);
 	rv = read(fds->pfd[0], msg, len);
 	if (rv != (ssize_t)len)
 		return 1;
@@ -124,7 +124,7 @@ msg_read_child(const char *info, struct 
 	CLOSEFD(fds->cfd[1]);
 	CLOSEFD(fds->pfd[0]);
 
-	printf("Wait %s\n", info);
+//	printf("Wait %s\n", info);
 	rv = read(fds->cfd[0], msg, len);
 	if (rv != (ssize_t)len)
 		return 1;



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

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

Modified Files:
src/sys/arch/atari/conf [netbsd-8]: MILAN-ISAIDE MILAN-PCIIDE

Log Message:
Regen for ticket #624


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.87.8.1 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.91 -r1.91.8.1 src/sys/arch/atari/conf/MILAN-PCIIDE

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

Modified files:

Index: src/sys/arch/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.87 src/sys/arch/atari/conf/MILAN-ISAIDE:1.87.8.1
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.87	Tue Dec 13 20:42:16 2016
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Tue Mar 13 13:42:54 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.87 2016/12/13 20:42:16 christos Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.87.8.1 2018/03/13 13:42:54 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.27 2014/07/05 09:24:23 tsutsui Exp $
-#		NetBSD: GENERIC.in,v 1.109 2014/11/24 08:23:48 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.27.20.1 2018/03/13 13:41:13 martin Exp $
+#		NetBSD: GENERIC.in,v 1.112.8.1 2018/01/26 14:28:15 martin Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk
@@ -89,9 +89,7 @@ ep* at pci? dev ? function ? # 3Com 3c59
 fxp* at pci? dev ? function ? # Intel EtherExpress PRO 10+/100B
 eso* at pci? dev ? function ? # ESS Solo-1 PCI AudioDrive
 audio* at eso?
-
-spkr*	at audio?		# PC speaker (synthesized)
-
+spkr* at audio? # PC speaker (synthesized)
 options WSEMUL_VT100 # VT100 / VT220 emulation
 options WS_KERNEL_FG=WSCOL_WHITE
 options WS_KERNEL_BG=WSCOL_BLACK
@@ -114,8 +112,6 @@ wsdisplay* at vga? console ? # as a wsco
 pckbc0 at isa? # PC keyboard controller
 pckbd* at pckbc? # PC keyboard
 wskbd* at pckbd? console ? # wscons keyboard
-
 wd* at atabus? drive ?
 atapibus* at atabus? # ATAPI bus support
-
 cd* at atapibus? drive ? # ATAPI CD-ROM drives

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.91 src/sys/arch/atari/conf/MILAN-PCIIDE:1.91.8.1
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.91	Tue Dec 13 20:42:16 2016
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Tue Mar 13 13:42:54 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.91 2016/12/13 20:42:16 christos Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.91.8.1 2018/03/13 13:42:54 martin Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.27 2014/07/05 09:24:23 tsutsui Exp $
-#		NetBSD: GENERIC.in,v 1.109 2014/11/24 08:23:48 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.27.20.1 2018/03/13 13:41:13 martin Exp $
+#		NetBSD: GENERIC.in,v 1.112.8.1 2018/01/26 14:28:15 martin Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk
@@ -89,9 +89,7 @@ ep* at pci? dev ? function ? # 3Com 3c59
 fxp* at pci? dev ? function ? # Intel EtherExpress PRO 10+/100B
 eso* at pci? dev ? function ? # ESS Solo-1 PCI AudioDrive
 audio* at eso?
-
-spkr*	at audio?		# PC speaker (synthesized)
-
+spkr* at audio? # PC speaker (synthesized)
 options WSEMUL_VT100 # VT100 / VT220 emulation
 options WS_KERNEL_FG=WSCOL_WHITE
 options WS_KERNEL_BG=WSCOL_BLACK
@@ -107,19 +105,7 @@ ser0 at mainbus0
 fdcisa0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy contr.
 fdisa0 at fdcisa0 drive 0
 pciide* at pci? dev ? function ? flags 0x # GENERIC pciide driver
-acardide* at pci? dev ? function ? # Acard IDE controllers
-aceride* at pci? dev ? function ? # Acer Lab IDE controllers
-artsata* at pci? dev ? function ? # Intel i31244 SATA controller
-cmdide* at pci? dev ? function ? # CMD tech IDE controllers
-cypide* at pci? dev ? function ? # Cypress IDE controllers
-hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
-optiide* at pci? dev ? function ? # Opti IDE controllers
-pdcide* at pci? dev ? function ? # Promise IDE controllers
-pdcsata* at pci? dev ? function ? # Promise SATA150 controllers
-satalink* at pci? dev ? function ? # SiI SATALink controllers
-siside* at pci? dev ? function ? # SiS IDE controllers
-slide* at pci? dev ? function ? # Symphony Labs IDE controllers
-viaide* at pci? dev ? function ? # VIA/AMD/Nvidia IDE controllers
+piixide* at pci? dev ? function ? # Intel IDE controllers
 atabus* at ata? channel ?
 vga0 at pci? dev ? function ? # a PCI VGA card
 wsdisplay* at vga? console ? # as a wscons console



CVS commit: [netbsd-8] src

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

Modified Files:
src/distrib/sets/lists/base [netbsd-8]: md.atari
src/sys/arch/atari/atari [netbsd-8]: atari_init.c bus.c locore.s
pmap_bootstrap.c
src/sys/arch/atari/conf [netbsd-8]: MILAN.in
src/sys/arch/atari/dev [netbsd-8]: nvram.c
src/sys/arch/atari/include [netbsd-8]: vmparam.h
src/sys/arch/atari/isa [netbsd-8]: isa_machdep.c isa_milan.c
src/sys/arch/atari/pci [netbsd-8]: pci_machdep.c pci_milan.c
src/sys/arch/atari/stand/xxboot/ahdi-xxboot/milan [netbsd-8]: Makefile
src/sys/arch/atari/stand/xxboot/sdboot/milan [netbsd-8]: Makefile
src/sys/dev/isa [netbsd-8]: fd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #624):
sys/arch/atari/stand/xxboot/sdboot/milan/Makefile: revision 1.4
sys/arch/atari/dev/nvram.c: revision 1.21
sys/arch/atari/conf/MILAN.in: revision 1.28
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.9
sys/dev/isa/fd.c: revision 1.111
sys/arch/atari/atari/bus.c: revision 1.60
sys/arch/atari/stand/xxboot/ahdi-xxboot/milan/Makefile: revision 1.4
sys/arch/atari/atari/locore.s: revision 1.111
sys/arch/atari/isa/isa_machdep.c: revision 1.41
distrib/sets/lists/base/md.atari: revision 1.55
sys/arch/atari/pci/pci_machdep.c: revision 1.55
sys/arch/atari/pci/pci_machdep.c: revision 1.56
sys/arch/atari/include/vmparam.h: revision 1.32
sys/arch/atari/isa/isa_milan.c: revision 1.15
sys/arch/atari/isa/isa_milan.c: revision 1.16
sys/arch/atari/atari/bus.c: revision 1.59
sys/arch/atari/atari/atari_init.c: revision 1.101
sys/arch/atari/pci/pci_milan.c: revision 1.15
Fix I/O access failures for regions allocated by bus_space_map(9) on Milan.

Passing to PMAP_WIRED against I/O spaces seems problematic,
probably after yamt-km branch merge, which was committed
between NetBSD 3.0 and NetBSD 4.0.
(i.e. ISA and PCI devices on Milan didn't work after 4.0 release)

XXX:
According to pmap(9) man page, the "flags" arg for pmap_enter(9)
doesn't take VM_PROT_READ and VM_PROT_WRITE, but pmap_enter()
implementation in sys/arch/m68k/m68k/pmap_motolora.c historically
checks them.

Fix silent hang during config_console() (before consinit()) on Milan.
config_console() was a dirty hack used by ancient m68k ports
to probe and initialize console devices before "real" configure(9),
using subset of configure(9) functions.

In that case, most device specific data (except I/O access method)
are not initialized so we must not access device specific device_t and
softc structures in config_console() cases.

Fix silent hang after isa_intr_establish() on Milan.
The problems (wrong macro replacements) were slipped in rev 1.107:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/atari/atari/locore.s#rev1.107
Handle yet another atari specific quirk in the MI ISA fdc(4)/fd(4) driver.
This makes fd(4) drive(s) (which is necessary for installation)
properly attached on Milan.
atari uses "fdcisa" and "fdisa" for ISA fdc to co-exist other fd(4)
drivers, on-board (atari/dev/fd.c) one and Hades (atari/dev/hdfd.c) one.

Use a proper PSL value to be passed to splx(9) functions.
This should have been changed on yamt-splraiseipl branch merge
back in 2006, which made MI IPL_xxx values independent from
m68k MD PSL values for the %sr register.

Restore piixide(4) for Milan and disable other pciide devices.
piixide was removed in rev 1.18 and the log message said
"because Intel IDE disk controllers only exist as part of
 Intel chipsets for x86 systems" but the Milan actually has
the Intel 82371FB southbridge on its board.
Other pciide devices are unlikely necessary for the default
kernel for such a rare machine.
Also fix pasto in comment.

Skip NVRAM checksum check and re-initialization on Milan.
Milan's firmware seems to use different check method.

Ack EOI for IRQ_SLAVE of the master PIC after ack for IRQ of the slave PIC.
I'm not sure if there are possible races in the original code, but
this is what i8259_asm_ack2() in sys/arch/x86/include/i8259.h does
and it looks this change makes a Milan kernel a bit stable.
Replace CRTC register values with ones taken from sys/dev/ic/vga_subr.c.
This fixes noise around column 3 and 4 and makes screen output clearer
on Milan with S3 Trio64V.

Explicitly setup the secondary IDE interrupt of PIIX on Milan.
The secondary IDE interrupt is connected to MBIRQ0 on PIIX, but
the Milan's ROM bootloader (at least version 0.99.7) doesn't seem
to setup the MBIRQ0 register to route it to IRQ15.

On Milan, also explicitly disable MBIRQ1 on PIIX.
Milan's ROM bootloader v1.2 and v1.4 incorrectly set MBIRQ0 connected
to the secondary IDE to IRQ14 (not 15) and unused MBIRQ1 to IRQ15,
so both IDE channels don't work properly.

Add dumb memory probe routines for Milan to use all availabl

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

2018-03-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Mar 13 13:34:40 UTC 2018

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

Log Message:
Add a new function in ATF t_ptrace_wait*: await_zombie_raw()

Add await_zombie_raw() that is the same as await_zombie(), whith an
addition of additional "useconds_t ms" parameter indicating delays between
new polling for a zombie process.

This new function will be used for testing a race condition that has been
observed occassionally crashing a test case -- returning duplicate entries
for KERN_PROC_PID.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_ptrace_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.1 src/tests/lib/libc/sys/t_ptrace_wait.h:1.2
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.1	Sun Apr  2 21:44:00 2017
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Tue Mar 13 13:34:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.1 2017/04/02 21:44:00 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.2 2018/03/13 13:34:40 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -328,7 +328,7 @@ forkee_status_stopped(int status, int ex
 
 /* This function is currently designed to be run in the main/parent process */
 static void __used
-await_zombie(pid_t process)
+await_zombie_raw(pid_t process, useconds_t ms)
 {
 	struct kinfo_proc2 p;
 	size_t len = sizeof(p);
@@ -351,10 +351,19 @@ await_zombie(pid_t process)
 		if (p.p_stat == LSZOMB)
 			break;
 
-		ATF_REQUIRE(usleep(1000) == 0);
+		if (ms > 0) {
+			ATF_REQUIRE(usleep(ms) == 0);
+		}
 	}
 }
 
+static void __used
+await_zombie(pid_t process)
+{
+
+	await_zombie_raw(process, 1000);
+}
+
 /* Happy number sequence -- this function is used to just consume cpu cycles */
 #define	HAPPY_NUMBER	1
 



CVS commit: [netbsd-8] src

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

Modified Files:
src/external/bsd/mdocml/dist [netbsd-8]: configure
src/tools/mandoc [netbsd-8]: Makefile

Log Message:
Pull up following revision(s) (requested by hans in ticket #623):
external/bsd/mdocml/dist/configure: revision 1.10
tools/mandoc/Makefile: revision 1.10
Honor HOST_CC.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/external/bsd/mdocml/dist/configure
cvs rdiff -u -r1.9 -r1.9.8.1 src/tools/mandoc/Makefile

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

Modified files:

Index: src/external/bsd/mdocml/dist/configure
diff -u src/external/bsd/mdocml/dist/configure:1.9 src/external/bsd/mdocml/dist/configure:1.9.4.1
--- src/external/bsd/mdocml/dist/configure:1.9	Sun Mar 19 16:51:45 2017
+++ src/external/bsd/mdocml/dist/configure	Tue Mar 13 13:29:57 2018
@@ -40,7 +40,9 @@ OSNAME=
 MAKEFLAGS=
 UTF8_LOCALE=
 
-CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
+if [ -z "${CC}" ]; then
+	CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
+fi
 CFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings"
 CFLAGS="${CFLAGS} -Wno-unused-parameter"
 LDADD=

Index: src/tools/mandoc/Makefile
diff -u src/tools/mandoc/Makefile:1.9 src/tools/mandoc/Makefile:1.9.8.1
--- src/tools/mandoc/Makefile:1.9	Wed Jan 27 21:24:59 2016
+++ src/tools/mandoc/Makefile	Tue Mar 13 13:29:57 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2016/01/27 21:24:59 christos Exp $
+#	$NetBSD: Makefile,v 1.9.8.1 2018/03/13 13:29:57 martin Exp $
 
 HOSTPROGNAME=	${_TOOL_PREFIX}mandoc
 HOST_SRCDIR=	external/bsd/mdocml/bin/mandoc
@@ -17,6 +17,6 @@ DPSRCS+=	config.h
 CLEANFILES+=	config.log config.h Makefile.local
 
 config.h: configure 
-	SRCDIR=${DISTDIR} ${HOST_SH} ${DISTDIR}/configure
+	SRCDIR=${DISTDIR} CC=${HOST_CC} ${HOST_SH} ${DISTDIR}/configure
 
 .include "${.CURDIR}/../Makefile.host"



CVS commit: [netbsd-8] src/sys

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

Modified Files:
src/sys/net [netbsd-8]: if_llatbl.c if_llatbl.h route.c
src/sys/netinet [netbsd-8]: if_arp.c in.c
src/sys/netinet6 [netbsd-8]: in6.c nd6.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #622):
sys/netinet/if_arp.c: revision 1.270
sys/net/if_llatbl.c: revision 1.24 (patch)
sys/net/if_llatbl.c: revision 1.25
sys/net/if_llatbl.c: revision 1.26
sys/net/route.c: revision 1.204
sys/netinet6/in6.c: revision 1.261
sys/netinet6/in6.c: revision 1.262 (patch)
sys/netinet6/in6.c: revision 1.263
sys/netinet/in.c: revision 1.216
sys/netinet6/in6.c: revision 1.264
sys/netinet6/nd6.c: revision 1.246 (patch)
sys/netinet/if_arp.c: revision 1.269
sys/net/if_llatbl.h: revision 1.14
sys/netinet6/in6.c: revision 1.259
sys/netinet/in.c: revision 1.220
sys/netinet/in.c: revision 1.221 (patch)
sys/netinet/in.c: revision 1.222
sys/netinet/in.c: revision 1.223

Suppress noisy debugging outputs
Even if DEBUG they are too noisy under load.

Tweak sanity checks

Scheduling a timer of static entries is wrong.

Add assertions

We must not destroy llentries holding mbufs.

Fix reference leaks of llentry
callout_reset and callout_halt can cancel a pending callout without telling us.
Detect a cancel and remove a reference by using callout_pending and
callout_stop (it's a bit tricy though, we can detect it).
While here, we can remove remaining abuses of mutex_owned for softnet_lock.

Fix memory leaks on arp -d and ndp -d for static entries
We have to delete entries on in_lltable_delete and in6_lltable_delete
unconditionally.  Note that we don't need to worry about LLE_IFADDR because
there is no such entries now.

Use pool(9) for llentry allocations
llentry is easy to be leaked and pool suits for it because pool is usable to
detect leaks.

Also sweep unnecessary wrappers for llentry, in_llentry and in6_llentry.


To generate a diff of this commit:
cvs rdiff -u -r1.18.6.2 -r1.18.6.3 src/sys/net/if_llatbl.c
cvs rdiff -u -r1.10.8.2 -r1.10.8.3 src/sys/net/if_llatbl.h
cvs rdiff -u -r1.194.6.6 -r1.194.6.7 src/sys/net/route.c
cvs rdiff -u -r1.250.2.6 -r1.250.2.7 src/sys/netinet/if_arp.c
cvs rdiff -u -r1.203.2.10 -r1.203.2.11 src/sys/netinet/in.c
cvs rdiff -u -r1.245.2.8 -r1.245.2.9 src/sys/netinet6/in6.c
cvs rdiff -u -r1.232.2.6 -r1.232.2.7 src/sys/netinet6/nd6.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_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.18.6.2 src/sys/net/if_llatbl.c:1.18.6.3
--- src/sys/net/if_llatbl.c:1.18.6.2	Fri Nov 17 20:24:05 2017
+++ src/sys/net/if_llatbl.c	Tue Mar 13 13:27:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.18.6.2 2017/11/17 20:24:05 snj Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.18.6.3 2018/03/13 13:27:10 martin Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -67,6 +67,7 @@
 
 static SLIST_HEAD(, lltable) lltables;
 krwlock_t lltable_rwlock;
+static struct pool llentry_pool;
 
 static void lltable_unlink(struct lltable *llt);
 static void llentries_unlink(struct lltable *llt, struct llentries *head);
@@ -335,6 +336,24 @@ lltable_drop_entry_queue(struct llentry 
 	return (pkts_dropped);
 }
 
+struct llentry *
+llentry_pool_get(int flags)
+{
+	struct llentry *lle;
+
+	lle = pool_get(&llentry_pool, flags);
+	if (lle != NULL)
+		memset(lle, 0, sizeof(*lle));
+	return lle;
+}
+
+void
+llentry_pool_put(struct llentry *lle)
+{
+
+	pool_put(&llentry_pool, lle);
+}
+
 /*
  * Deletes an address from the address table.
  * This function is called by the timer functions
@@ -351,6 +370,8 @@ llentry_free(struct llentry *lle)
 
 	LLE_WLOCK_ASSERT(lle);
 
+	lle->la_flags |= LLE_DELETED;
+
 	if ((lle->la_flags & LLE_LINKED) != 0) {
 		llt = lle->lle_tbl;
 
@@ -358,6 +379,18 @@ llentry_free(struct llentry *lle)
 		llt->llt_unlink_entry(lle);
 	}
 
+	/*
+	 * Stop a pending callout if one exists.  If we cancel one, we have to
+	 * remove a reference to avoid a leak.  callout_pending is required to
+	 * to exclude the case that the callout has never been scheduled.
+	 */
+	/* XXX once softnet_lock goes away, we should use callout_halt */
+	if (callout_pending(&lle->la_timer)) {
+		bool expired = callout_stop(&lle->la_timer);
+		if (!expired)
+			LLE_REMREF(lle);
+	}
+
 	pkts_dropped = lltable_drop_entry_queue(lle);
 
 	LLE_FREE_LOCKED(lle);
@@ -433,28 +466,8 @@ lltable_purge_entries(struct lltable *ll
 	llentries_unlink(llt, &dchain);
 	IF_AFDATA_WUNLOCK(llt->llt_ifp);
 
-	LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) {
-		/*
-		 * We need to release the lock here to lle_timer proceeds;
-		 * lle_timer should stop immediately if LLE

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

2018-03-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 13 11:42:59 UTC 2018

Modified Files:
src/sys/sys [netbsd-8]: bitops.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #621):
sys/sys/bitops.h: revision 1.13
sys/sys/bitops.h: revision 1.14
use 1ul for a left shift that may be greater than int sized.
noticed by martin.
fixes PR#53081.

PR/53081: Fix size of the shift to depend on the type of the bitmap so that
we get the correct width.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.8.1 src/sys/sys/bitops.h

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

Modified files:

Index: src/sys/sys/bitops.h
diff -u src/sys/sys/bitops.h:1.12 src/sys/sys/bitops.h:1.12.8.1
--- src/sys/sys/bitops.h:1.12	Thu Jan 12 19:03:09 2017
+++ src/sys/sys/bitops.h	Tue Mar 13 11:42:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bitops.h,v 1.12 2017/01/12 19:03:09 christos Exp $	*/
+/*	$NetBSD: bitops.h,v 1.12.8.1 2018/03/13 11:42:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
@@ -304,7 +304,7 @@ fast_remainder32(uint32_t _v, uint32_t _
 #define __BITMAP_SIZE(__t, __n) \
 (((__n) + (__BITMAP_BITS(__t) - 1)) / __BITMAP_BITS(__t))
 #define __BITMAP_BIT(__n, __v) \
-(1 << ((__n) & __BITMAP_MASK(*(__v)->_b)))
+((__typeof__((__v)->_b[0]))1 << ((__n) & __BITMAP_MASK(*(__v)->_b)))
 #define __BITMAP_WORD(__n, __v) \
 ((__n) >> __BITMAP_SHIFT(*(__v)->_b))
 



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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.34.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.34.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 11:15:15 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.34.1 2018/03/13 11:15:15 martin 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: [pgoyette-compat] src/sys

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 13 09:10:31 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_mod.c
files.common
src/sys/uvm [pgoyette-compat]: uvm_swap.c uvm_swap.h
Added Files:
src/sys/compat/common [pgoyette-compat]: uvm_stats_13.c uvm_stats_13.h
uvm_stats_50.c uvm_stats_50.h

Log Message:
Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.18.1 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.24.14.4 -r1.24.14.5 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/uvm_stats_13.c \
src/sys/compat/common/uvm_stats_13.h src/sys/compat/common/uvm_stats_50.c \
src/sys/compat/common/uvm_stats_50.h
cvs rdiff -u -r1.175 -r1.175.2.1 src/sys/uvm/uvm_swap.c
cvs rdiff -u -r1.22 -r1.22.16.1 src/sys/uvm/uvm_swap.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 src/sys/compat/common/Makefile.sysio:1.7.18.1
--- src/sys/compat/common/Makefile.sysio:1.7	Sat Nov  5 23:30:22 2016
+++ src/sys/compat/common/Makefile.sysio	Tue Mar 13 09:10:31 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sysio,v 1.7 2016/11/05 23:30:22 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.7.18.1 2018/03/13 09:10:31 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -13,7 +13,7 @@ SRCS+=	kern_info_09.c
 SRCS+=	kern_xxx_12.c vfs_syscalls_12.c vm_12.c
 
 # Compatibility code for NetBSD 1.3
-SRCS+=	kern_sig_13.c
+SRCS+=	kern_sig_13.c uvm_stats_13.c
 
 # Compatibility code for NetBSD 1.6
 SRCS+=	kern_sig_16.c
@@ -31,8 +31,8 @@ SRCS+=	kern_time_30.c vfs_syscalls_30.c 
 SRCS+=	vfs_syscalls_40.c uipc_syscalls_40.c
 
 # Compatibility code for NetBSD 5.0
-SRCS+=	kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
-	vfs_syscalls_50.c  uipc_syscalls_50.c
+SRCS+=	kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c
+SRCS+=	vfs_syscalls_50.c  uipc_syscalls_50.c uvm_stats_50.c
 
 # Compatibility code for NetBSD 6.0
 SRCS+=	kern_sa_60.c tty_60.c kern_time_60.c

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.4 src/sys/compat/common/compat_mod.c:1.24.14.5
--- src/sys/compat/common/compat_mod.c:1.24.14.4	Thu Mar  8 01:07:13 2018
+++ src/sys/compat/common/compat_mod.c	Tue Mar 13 09:10:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.4 2018/03/08 01:07:13 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.5 2018/03/13 09:10:31 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.4 2018/03/08 01:07:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.5 2018/03/13 09:10:31 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -62,6 +62,8 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 
@@ -251,11 +253,15 @@ compat_modcmd(modcmd_t cmd, void *arg)
 		ttcompatvec = ttcompat;
 		if_43_init();
 #endif
+#ifdef COMPAT_13
+		swapstats_13_init();
+#endif
 #ifdef COMPAT_40
 		if_40_init();
 #endif
 #ifdef COMPAT_50
 		if_50_init();
+		swapstats_50_init();
 #endif
 #ifdef COMPAT_16
 #if defined(COMPAT_SIGCONTEXT)
@@ -326,6 +332,16 @@ compat_modcmd(modcmd_t cmd, void *arg)
 		rw_exit(&exec_lock);
 #endif
 #endif	/* COMPAT_16 */
+#ifdef COMPAT_13
+		swapstats_13_fini();
+#endif
+#ifdef COMPAT_40
+		if_40_fini();
+#endif
+#ifdef COMPAT_50
+		if_50_fini();
+		swapstats_50_fini();
+#endif
 		compat_sysctl_fini();
 		return 0;
 

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.6 src/sys/compat/common/files.common:1.1.2.7
--- src/sys/compat/common/files.common:1.1.2.6	Mon Mar 12 01:59:31 2018
+++ src/sys/compat/common/files.common	Tue Mar 13 09:10:31 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.6 2018/03/12 01:59:31 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.7 2018/03/13 09:10:31 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -32,6 +32,7 @@ file	compat/common/vm_12.c			compat_netb
 
 # Compatibility code for NetBSD 1.3
 file	compat/common/kern_sig_13.c		compat_netbsd
+file	compat/common/uvm_stats_13.c		compat_netbsd
 
 # Compatibility code for NetBSD 1.4
 file	compat/common/rtsock_14.c		compat_netbsd
@@ -59,6 +60,7 @@ file	compat/common/rndpseudo_50.c		compa
 file	compat/common/rtsock_50.c		compat_netbsd
 file	compat/common/vfs_syscall

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

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 13 09:07:20 UTC 2018

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

Log Message:
More clean-up of compat code interdependencies


To generate a diff of this commit:
cvs rdiff -u -r1.1196.2.4 -r1.1196.2.5 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1196.2.4 src/sys/conf/files:1.1196.2.5
--- src/sys/conf/files:1.1196.2.4	Tue Mar 13 07:21:23 2018
+++ src/sys/conf/files	Tue Mar 13 09:07:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1196.2.4 2018/03/13 07:21:23 pgoyette Exp $
+#	$NetBSD: files,v 1.1196.2.5 2018/03/13 09:07:20 pgoyette Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -158,12 +158,14 @@ defflag	opt_compat_svr4.h	COMPAT_SVR4 CO
 defflagCOMPAT_ULTRIX: COMPAT_50
 defflagCOMPAT_NETBSD32
 defflag opt_execfmt.h		EXEC_ELF32	: COMPAT_NETBSD32
-defflagCOMPAT_LINUX32 : COMPAT_LINUX, COMPAT_NETBSD32,
-		 COMPAT_50, COMPAT_SYSV,
-		 COMPAT_NETBSD32_SYSVIPC
+defflagCOMPAT_SYSV
+defflagSYSV_IPC	: SYSVSHM, SYSVSEM, SYSVMSG
 defflagCOMPAT_NETBSD32_SYSVIPC : SYSV_IPC,
 			  COMPAT_SYSV,
 			  COMPAT_NETBSD32
+defflagCOMPAT_LINUX32 : COMPAT_LINUX, COMPAT_NETBSD32,
+		 COMPAT_50, COMPAT_SYSV,
+		 COMPAT_NETBSD32_SYSVIPC
 defflagCOMPAT_AOUT_M68K: COMPAT_40
 defflagCOMPAT_M68K4K
 defflagCOMPAT_VAX1K



CVS commit: src/sys/net/npf

2018-03-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 13 09:04:03 UTC 2018

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

Log Message:
Fix two consecutive mistakes.

The first mistake was npf_inet.c rev1.37:

"Don't reassemble ipv6 fragments, instead treat the first fragment
as a regular packet (subject to filtering rules), and pass
subsequent fragments in the same group unconditionally."

Doing this was entirely wrong, because then a packet just had to push
the L4 payload in a secondary fragment, and NPF wouldn't apply rules on
it - meaning any IPv6 packet could bypass >=L4 filtering. This mistake
was supposed to be a fix for the second mistake.

The second mistake was that ip6_reass_packet (in npf_reassembly) was
getting called with npc->npc_hlen. But npc_hlen pointed to the last
encountered header in the IPv6 chain, which was not necessarily the
fragment header. So ip6_reass_packet was given garbage, and would fail,
resulting in the packet getting kicked. So basically IPv6 was broken by
NPF.

The first mistake is reverted, and the second one is fixed by doing:

-   hlen = sizeof(struct ip6_frag);
+   hlen = 0;

Now the iteration stops on the fragment header, and the call to
ip6_reass_packet is valid.

My npf_inet.c rev1.38 is partially reverted: we don't need to worry
about failing properly to advance; once the packet is reassembled
npf_cache_ip gets called again, and this time the whole chain should be
there.

Tested with a simple UDPv6 server - send a 3000-byte-sized buffer, the
packet gets correctly reassembled by NPF now.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/net/npf/npf_handler.c
cvs rdiff -u -r1.39 -r1.40 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_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.38 src/sys/net/npf/npf_handler.c:1.39
--- src/sys/net/npf/npf_handler.c:1.38	Thu Mar  8 07:06:13 2018
+++ src/sys/net/npf/npf_handler.c	Tue Mar 13 09:04:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.38 2018/03/08 07:06:13 maxv Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.39 2018/03/13 09:04:02 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.38 2018/03/08 07:06:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.39 2018/03/13 09:04:02 maxv Exp $");
 
 #include 
 #include 
@@ -166,14 +166,7 @@ npf_packet_handler(npf_t *npf, struct mb
 	/* Determine whether it is an IP fragment. */
 	if (__predict_false(flags & NPC_IPFRAG)) {
 		/*
-		 * We pass IPv6 fragments unconditionally
-		 * The first IPv6 fragment is not marked as such
-		 * and passes through the filter
-		 */
-		if (flags & NPC_IP6)
-			return 0;
-		/*
-		 * Pass to IPv4 reassembly mechanism.
+		 * Pass to IPv4/IPv6 reassembly mechanism.
 		 */
 		error = npf_reassembly(npf, &npc, mp);
 		if (error) {

Index: src/sys/net/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.39 src/sys/net/npf/npf_inet.c:1.40
--- src/sys/net/npf/npf_inet.c:1.39	Thu Mar  8 07:54:14 2018
+++ src/sys/net/npf/npf_inet.c	Tue Mar 13 09:04:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.39 2018/03/08 07:54:14 maxv Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.40 2018/03/13 09:04:02 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.39 2018/03/08 07:54:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.40 2018/03/13 09:04:02 maxv Exp $");
 
 #include 
 #include 
@@ -358,9 +358,6 @@ npf_cache_ip(npf_cache_t *npc, nbuf_t *n
 		struct ip6_frag *ip6f;
 		size_t off, hlen;
 		int frag_present;
-		bool is_frag;
-		uint8_t onxt;
-		int fragoff;
 
 		ip6 = nbuf_ensure_contig(nbuf, sizeof(struct ip6_hdr));
 		if (ip6 == NULL) {
@@ -373,7 +370,6 @@ npf_cache_ip(npf_cache_t *npc, nbuf_t *n
 		npc->npc_hlen = hlen;
 
 		frag_present = 0;
-		is_frag = false;
 
 		/*
 		 * Advance by the length of the current header.
@@ -396,27 +392,8 @@ npf_cache_ip(npf_cache_t *npc, nbuf_t *n
 if (ip6f == NULL)
 	return NPC_FMTERR;
 
-hlen = sizeof(struct ip6_frag);
-
-/* RFC6946: Skip dummy fragments. */
-fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK);
-if (fragoff == 0 &&
-!(ip6f->ip6f_offlg & IP6F_MORE_FRAG)) {
-	break;
-}
-
-is_frag = true;
-
-/*
- * We treat the first fragment as a regular
- * packet and then we pass the rest of the
- * fragments unconditionally. This way if
- * the first packet passes the rest will
- * be able to reassembled, if not they will
- * be ignored. We can do better later.
- */
-if (fragoff != 0)
-	flags |= NPC_IPFRAG;
+hlen = 0;
+flags |= NPC_IPFRAG;
 
 			

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

2018-03-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 13 08:53:06 UTC 2018

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

Log Message:
Revert the COMPAT_AS sestting back to library, the documented default.

It doesn't really matter, since we no longer build the library in any
format, but best to make the code match the comments.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/compat/common/Makefile.inc

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.inc
diff -u src/sys/compat/common/Makefile.inc:1.23 src/sys/compat/common/Makefile.inc:1.23.2.1
--- src/sys/compat/common/Makefile.inc:1.23	Sat Dec 16 08:31:36 2017
+++ src/sys/compat/common/Makefile.inc	Tue Mar 13 08:53:06 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.23 2017/12/16 08:31:36 maxv Exp $
+#	$NetBSD: Makefile.inc,v 1.23.2.1 2018/03/13 08:53:06 pgoyette Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -21,7 +21,7 @@ COMPAT_AS?=		obj
 COMPATDOTDIR?= ../../.
 
 COMPATDIR=		${S:S@^.@${COMPATDOTDIR}@:Q}/compat/common
-.if (${COMPAT_AS} == "obj")
+.if (${COMPAT_AS} == "library")
 COMPATLIB=		${COMPATDST}/libcompat.o
 COMPATLIB_PROF=	${COMPATDST}/libcompat.po
 .else



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

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

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

Log Message:
Add some more config dependencies between compat modules


To generate a diff of this commit:
cvs rdiff -u -r1.1196.2.3 -r1.1196.2.4 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1196.2.3 src/sys/conf/files:1.1196.2.4
--- src/sys/conf/files:1.1196.2.3	Tue Mar  6 10:07:35 2018
+++ src/sys/conf/files	Tue Mar 13 07:21:23 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1196.2.3 2018/03/06 10:07:35 pgoyette Exp $
+#	$NetBSD: files,v 1.1196.2.4 2018/03/13 07:21:23 pgoyette Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -159,7 +159,11 @@ defflagCOMPAT_ULTRIX: COMPAT_50
 defflagCOMPAT_NETBSD32
 defflag opt_execfmt.h		EXEC_ELF32	: COMPAT_NETBSD32
 defflagCOMPAT_LINUX32 : COMPAT_LINUX, COMPAT_NETBSD32,
-		 COMPAT_50
+		 COMPAT_50, COMPAT_SYSV,
+		 COMPAT_NETBSD32_SYSVIPC
+defflagCOMPAT_NETBSD32_SYSVIPC : SYSV_IPC,
+			  COMPAT_SYSV,
+			  COMPAT_NETBSD32
 defflagCOMPAT_AOUT_M68K: COMPAT_40
 defflagCOMPAT_M68K4K
 defflagCOMPAT_VAX1K