CVS commit: src/share/man/man4

2018-08-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Aug  3 05:27:16 UTC 2018

Modified Files:
src/share/man/man4: ifmedia.4

Log Message:
 Add some missing IFM_* entries.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/share/man/man4/ifmedia.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/ifmedia.4
diff -u src/share/man/man4/ifmedia.4:1.29 src/share/man/man4/ifmedia.4:1.30
--- src/share/man/man4/ifmedia.4:1.29	Fri Apr 10 17:07:15 2009
+++ src/share/man/man4/ifmedia.4	Fri Aug  3 05:27:16 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifmedia.4,v 1.29 2009/04/10 17:07:15 joerg Exp $
+.\"	$NetBSD: ifmedia.4,v 1.30 2018/08/03 05:27:16 msaitoh Exp $
 .\"
 .\" Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004
 .\"	The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 7, 2006
+.Dd August 3, 2018
 .Dt IFMEDIA 4
 .Os
 .Sh NAME
@@ -134,8 +134,12 @@ connector.  [100baseT4, 100T4]
 1000BASE-SX, 1Gb/s over multi-mode fiber optic cables. (short waves)
 [1000baseSX, 1000SX]
 .It Dv IFM_1000_LX
-1000BASE-LX, 1Gb/s over single-mode fiber optic cables. (long waves)
+1000BASE-LX, 1Gb/s over single-mode fiber or multi-mode fiber optic cables.
+(long waves)
 [1000baseLX, 1000LX]
+.It Dv IFM_1000_BX10
+1000BASE-BX10, 1Gb/s over bidirectional fiber optic cables. (long waves)
+[1000BASE-BX10]
 .It Dv IFM_1000_CX
 1000BASE-CX, 1Gb/s over shielded twisted pair. (twinax)
 [1000baseCX, 1000CX]
@@ -143,8 +147,37 @@ connector.  [100baseT4, 100T4]
 1000BASE-T, 1Gb/s over category 5 unshielded twisted pair, 802.3ab, RJ45
 connector.
 [1000baseT, 1000T]
+.It Dv IFM_1000_KX
+1000BASE-KX, 1Gb/s backplane.
+[1000BASE-KX, 1000baseKX]
+.It Dv IFM_2500_SX
+2500BASE-SX, 2.5Gb/s over multi-mode fiber optic cables.
+[2500baseSX, 2500SX]
+.It Dv IFM_2500_T
+2.5GBASE-T, 2.5Gb/s over category 5e.
+[2.5GBASE-T, 2500baseT]
+.It Dv IFM_2500_KX
+2500BASE-KX, 2.5Gb/s backplane.
+[2500BASE-KX, 2500baseKX]
+.It Dv IFM_5000_T
+5GBASE-T, 5Gb/s over category 6.
+[5GBASE-T, 5GbaseT]
+.It Dv IFM_10G_CX4
+10GBASE-CX4, 10Gb/s over XAUI 4-lane PCS and copper cables.
+[10GbaseCX4, 10GCX4, 10GBASE-CX4]
 .It Dv IFM_10G_LR
 10GBASE-LR, 10Gb/s over single-mode fiber optic cables.  [10GbaseLR, 10GLR]
+.It Dv IFM_10G_LRM
+10GBASE-LR, 10Gb/s over single-mode fiber optic cables.  [10GbaseLRM]
+.It Dv IFM_10G_SR
+10GBASE-SR, 10Gb/s over multi-mode fiber optic cables.
+[10GbaseSR, 10GSR, 10GBASE-SR]
+.It Dv IFM_10G_T
+10GBASE-T, 10Gb/s over unshielded twisted pair, RJ45 connector.
+[10Gbase-T]
+.It Dv IFM_10G_TWINAX
+SFP+ direct attach, 10Gb/s over twinaxial cable.
+[10Gbase-Twinax]
 .El
 .Pp
 The following media option is defined for Ethernet:



CVS commit: src/sys

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 04:35:20 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/kern: files.kern

Log Message:
Register kUBSan in the GENERIC amd64 kernel config

Tested with GCC.


To generate a diff of this commit:
cvs rdiff -u -r1.498 -r1.499 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/files.kern

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.498 src/sys/arch/amd64/conf/GENERIC:1.499
--- src/sys/arch/amd64/conf/GENERIC:1.498	Wed Aug  1 16:59:09 2018
+++ src/sys/arch/amd64/conf/GENERIC	Fri Aug  3 04:35:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.498 2018/08/01 16:59:09 maxv Exp $
+# $NetBSD: GENERIC,v 1.499 2018/08/03 04:35:20 kamil Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.498 $"
+#ident		"GENERIC-$Revision: 1.499 $"
 
 maxusers	64		# estimated number of users
 
@@ -111,6 +111,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB		# remote debugger
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
 makeoptions	DEBUG="-g"	# compile full symbol table for CTF
+#options	KUBSAN		# Kernel Undefined Behavior Sanitizer (kUBSan)
 #options 	SYSCALL_STATS	# per syscall counts
 #options 	SYSCALL_TIMES	# per syscall times
 #options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)

Index: src/sys/kern/files.kern
diff -u src/sys/kern/files.kern:1.20 src/sys/kern/files.kern:1.21
--- src/sys/kern/files.kern:1.20	Wed Jul 18 07:06:40 2018
+++ src/sys/kern/files.kern	Fri Aug  3 04:35:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.kern,v 1.20 2018/07/18 07:06:40 msaitoh Exp $
+#	$NetBSD: files.kern,v 1.21 2018/08/03 04:35:20 kamil Exp $
 
 #
 # kernel sources
@@ -218,3 +218,9 @@ file	miscfs/genfs/layer_vfsops.c	layerfs
 file	miscfs/genfs/layer_vnops.c	layerfs
 
 file	miscfs/specfs/spec_vnops.c	vfs
+
+defflag	KUBSAN
+prefix	../common/lib/libc/misc
+file	ubsan.ckubsan
+prefix
+makeoptions	kubsan	CFLAGS+="-fsanitize=undefined"



CVS commit: src/crypto/external/bsd/openssh/dist

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 04:32:12 UTC 2018

Modified Files:
src/crypto/external/bsd/openssh/dist: sshkey.c

Log Message:
Appease GCC in the openssh code when built with UBSan

Initialize eg to NULL in sshkey_ecdsa_key_to_nid().
The compiler warns that it might be uninitialized.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/crypto/external/bsd/openssh/dist/sshkey.c

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/sshkey.c
diff -u src/crypto/external/bsd/openssh/dist/sshkey.c:1.14 src/crypto/external/bsd/openssh/dist/sshkey.c:1.15
--- src/crypto/external/bsd/openssh/dist/sshkey.c:1.14	Fri Apr  6 18:59:00 2018
+++ src/crypto/external/bsd/openssh/dist/sshkey.c	Fri Aug  3 04:32:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sshkey.c,v 1.14 2018/04/06 18:59:00 christos Exp $	*/
+/*	$NetBSD: sshkey.c,v 1.15 2018/08/03 04:32:12 kamil Exp $	*/
 /* $OpenBSD: sshkey.c,v 1.64 2018/03/22 07:05:48 markus Exp $ */
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
@@ -26,7 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-__RCSID("$NetBSD: sshkey.c,v 1.14 2018/04/06 18:59:00 christos Exp $");
+__RCSID("$NetBSD: sshkey.c,v 1.15 2018/08/03 04:32:12 kamil Exp $");
 
 #include 
 #include 
@@ -1641,7 +1641,7 @@ dsa_generate_private_key(u_int bits, DSA
 int
 sshkey_ecdsa_key_to_nid(EC_KEY *k)
 {
-	EC_GROUP *eg;
+	EC_GROUP *eg = NULL;
 	int nids[] = {
 		NID_X9_62_prime256v1,
 		NID_secp384r1,



CVS commit: src/lib/libc/misc

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 04:29:35 UTC 2018

Modified Files:
src/lib/libc/misc: Makefile.inc

Log Message:
Add a support to build ubsan.c in libc

Under the condition of MKLIBCSANITIZER==yes link ubsan.c into libc.

This is a clean-room reimplementation from scratch of the Undefined
Behavior runtime called micro-UBSan (or uBSan - user-UBSan).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/misc/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/lib/libc/misc/Makefile.inc
diff -u src/lib/libc/misc/Makefile.inc:1.2 src/lib/libc/misc/Makefile.inc:1.3
--- src/lib/libc/misc/Makefile.inc:1.2	Tue Jan 29 19:14:02 2013
+++ src/lib/libc/misc/Makefile.inc	Fri Aug  3 04:29:35 2018
@@ -1,8 +1,13 @@
-#	$NetBSD: Makefile.inc,v 1.2 2013/01/29 19:14:02 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2018/08/03 04:29:35 kamil Exp $
 #	@(#)Makefile.inc	8.3 (Berkeley) 10/24/94
 
 .PATH: ${ARCHDIR}/misc ${.CURDIR}/misc
 
+# other sources shared with the kernel
+.if ${MKLIBCSANITIZER:Uno} == "yes"
+SRCS+= ubsan.c
+.endif
+
 # constructor
 SRCS+=	initfini.c
 



CVS commit: src

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 04:24:41 UTC 2018

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/lib/libc: Makefile

Log Message:
Register micro-UBSan ATF tests in the distribution

Populate distrib files, mtree lists and add the entry in Makefile to
include the new code.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.789 -r1.790 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.151 -r1.152 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.47 -r1.48 src/tests/lib/libc/Makefile

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.259 src/distrib/sets/lists/debug/mi:1.260
--- src/distrib/sets/lists/debug/mi:1.259	Tue Jul 31 16:44:29 2018
+++ src/distrib/sets/lists/debug/mi	Fri Aug  3 04:24:41 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.259 2018/07/31 16:44:29 khorben Exp $
+# $NetBSD: mi,v 1.260 2018/08/03 04:24:41 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
@@ -1980,6 +1980,8 @@
 ./usr/libdata/debug/usr/tests/lib/libc/locale/t_wcstod.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/locale/t_wctomb.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/locale/t_wctype.debug		tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/misc/t_ubsan.debug		tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/misc/t_ubsanxx.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo/h_gai.debug	tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/net/h_dns_server.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/net/h_hostent.debug		tests-lib-debug		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.789 src/distrib/sets/lists/tests/mi:1.790
--- src/distrib/sets/lists/tests/mi:1.789	Tue Jul 10 06:49:29 2018
+++ src/distrib/sets/lists/tests/mi	Fri Aug  3 04:24:41 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.789 2018/07/10 06:49:29 kre Exp $
+# $NetBSD: mi,v 1.790 2018/08/03 04:24:41 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -102,6 +102,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/ieeefptests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/inettests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/localetests-lib-debug		compattestfile,atf
+./usr/libdata/debug/usr/tests/lib/libc/misctests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/nettests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo			tests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/regextests-lib-debug		compattestfile,atf
@@ -2579,6 +2580,11 @@
 ./usr/tests/lib/libc/locale/t_wcstod		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/locale/t_wctomb		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/locale/t_wctype		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/misc			tests-lib-tests	compattestfile,atf
+./usr/tests/lib/libc/misc/Atffile		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/misc/Kyuafile		tests-lib-tests		compattestfile,atf,kyua
+./usr/tests/lib/libc/misc/t_ubsan		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/misc/t_ubsanxx		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/net			tests-lib-tests	compattestfile,atf
 ./usr/tests/lib/libc/net/Atffile		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/net/Kyuafile		tests-lib-tests		compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.151 src/etc/mtree/NetBSD.dist.tests:1.152
--- src/etc/mtree/NetBSD.dist.tests:1.151	Fri Jun 15 09:54:02 2018
+++ src/etc/mtree/NetBSD.dist.tests	Fri Aug  3 04:24:41 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.151 2018/06/15 09:54:02 yamaguchi Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.152 2018/08/03 04:24:41 kamil Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -83,6 +83,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/hash
 ./usr/libdata/debug/usr/tests/lib/libc/locale
 ./usr/libdata/debug/usr/tests/lib/libc/inet
+./usr/libdata/debug/usr/tests/lib/libc/misc
 ./usr/libdata/debug/usr/tests/lib/libc/net
 ./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo
 ./usr/libdata/debug/usr/tests/lib/libc/regex
@@ -266,6 +267,7 @@
 

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

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 04:18:40 UTC 2018

Added Files:
src/tests/lib/libc/misc: Makefile t_ubsan.c t_ubsanxx.cpp

Log Message:
Import micro-UBSan ATF tests

These tests are used only when a distribution is built without MKSANITIZER
and without MKLIBCSANITIZER. They build the ubsan.c micro-implementation
in userland as a standalone library (a .c file linked into tests).

The code generation part emits symbols that are handled by uUBSan.

Tested with Clang amd64 + i386 and GCC amd64 + i386.

There are two sets of tests: C code generation and C++ code generation.

There are various little differences that are handled with proper ifdefs.

Clang 7svn has significantly more checks for Undefined Behavior than GCC
5.x. Some of the tests are or might be amd64 and/or i386 specific and are
marked with proper ifdefs and comments according to the compiler
documentation.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/misc/Makefile \
src/tests/lib/libc/misc/t_ubsan.c src/tests/lib/libc/misc/t_ubsanxx.cpp

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

Added files:

Index: src/tests/lib/libc/misc/Makefile
diff -u /dev/null src/tests/lib/libc/misc/Makefile:1.1
--- /dev/null	Fri Aug  3 04:18:40 2018
+++ src/tests/lib/libc/misc/Makefile	Fri Aug  3 04:18:40 2018
@@ -0,0 +1,28 @@
+# $NetBSD: Makefile,v 1.1 2018/08/03 04:18:40 kamil Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/lib/libc/misc
+
+TESTS_C+=	t_ubsan
+TESTS_CXX+=	t_ubsanxx
+
+.PATH:		${NETBSDSRCDIR}/common/lib/libc/misc
+SRCS.t_ubsan=	t_ubsan.c ubsan.c
+SRCS.t_ubsanxx=	t_ubsanxx.cpp ubsan.c
+
+.if ${MKSANITIZER:Uno} != "yes" && ${MKLIBCSANITIZER:Uno} != "yes"
+# These tests are designed to be used against micro-UBSan only.
+# micro-UBSan is used in these tests as a standalone libary only.
+CPPFLAGS+=		-DENABLE_TESTS
+UBSAN_FLAGS=		-fsanitize=undefined
+UBSAN_FLAGS+=		${${ACTIVE_CC} == "clang" :? -fsanitize=integer :}
+UBSAN_FLAGS+=		${${ACTIVE_CC} == "clang" :? -fsanitize=nullability :}
+CFLAGS+=		${UBSAN_FLAGS}
+CXXFLAGS+=		${UBSAN_FLAGS}
+CWARNFLAGS+=		-Wno-return-type -Wno-strict-aliasing
+CWARNFLAGS.clang+=	-Wno-incompatible-pointer-types-discards-qualifiers
+CWARNFLAGS.clang+=	-Wno-nullability-completeness 
+.endif
+
+.include 
Index: src/tests/lib/libc/misc/t_ubsan.c
diff -u /dev/null src/tests/lib/libc/misc/t_ubsan.c:1.1
--- /dev/null	Fri Aug  3 04:18:40 2018
+++ src/tests/lib/libc/misc/t_ubsan.c	Fri Aug  3 04:18:40 2018
@@ -0,0 +1,913 @@
+/*	$NetBSD: t_ubsan.c,v 1.1 2018/08/03 04:18:40 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 FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__COPYRIGHT("@(#) Copyright (c) 2018\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: t_ubsan.c,v 1.1 2018/08/03 04:18:40 kamil Exp $");
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef __cplusplus
+#include 
+#define UBSAN_TC(a)			ATF_TEST_CASE(a)
+#define UBSAN_TC_HEAD(a, b)		ATF_TEST_CASE_HEAD(a)
+#define UBSAN_TC_BODY(a, b)		ATF_TEST_CASE_BODY(a)
+#define UBSAN_CASES(a)			ATF_INIT_TEST_CASES(a)
+#define UBSAN_TEST_CASE(a, b)		ATF_ADD_TEST_CASE(a, b)
+#define UBSAN_MD_VAR(a, b, c)		set_md_var(b, c)
+#define REINTERPRET_CAST(__dt, __st)	reinterpret_cast<__dt>(__st)
+#define STATIC_CAST(__dt, __st)		static_cast<__dt>(__st)
+#else
+#include 
+#define UBSAN_TC(a)			ATF_TC(a)
+#define UBSAN_TC_HEAD(a, b)		ATF_TC_HEAD(a, b)
+#define UBSAN_TC_BODY(a, b)		ATF_TC_BODY(a, b)
+#define UBSAN_CASES(a)			ATF_TP_ADD_TCS(a)
+#define 

CVS commit: src/common/lib/libc

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 03:35:17 UTC 2018

Modified Files:
src/common/lib/libc: Makefile.inc

Log Message:
Register a new directory in common/lib/libc/misc

Registe misc/ with ubsan.c.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/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/common/lib/libc/Makefile.inc
diff -u src/common/lib/libc/Makefile.inc:1.17 src/common/lib/libc/Makefile.inc:1.18
--- src/common/lib/libc/Makefile.inc:1.17	Thu Nov 30 05:47:24 2017
+++ src/common/lib/libc/Makefile.inc	Fri Aug  3 03:35:17 2018
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.17 2017/11/30 05:47:24 riastradh Exp $
+# $NetBSD: Makefile.inc,v 1.18 2018/08/03 03:35:17 kamil Exp $
 
 .include 
 
 COMMON_DIR:=${.PARSEDIR}
-COMMON_CODEDIRS=atomic gen gmon inet md net stdlib string sys
+COMMON_CODEDIRS=atomic gen gmon inet md misc net stdlib string sys
 COMMON_CODEDIRS+=hash/sha1 hash/sha2 hash/sha3 hash/rmd160 hash/murmurhash
 
 .if defined(COMMON_MACHINE_ARCH) && !empty(COMMON_MACHINE_ARCH) && \



CVS commit: src/common/lib/libc/misc

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 03:12:32 UTC 2018

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
Tidy up the comment in ubsan.c

As noted, style has no impact on the comparison of a similar code.
This version is a reimplementation from scratch with no code and no
algirithm (whenever possible) reuse.

Public symbols and struct layout must be kept in sync with the code
generation part. It casues violation of the style like with long filenames.

My previous comment was 'too perfect' and could trigger some unnecessary
attention.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/misc/ubsan.c

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

Modified files:

Index: src/common/lib/libc/misc/ubsan.c
diff -u src/common/lib/libc/misc/ubsan.c:1.1 src/common/lib/libc/misc/ubsan.c:1.2
--- src/common/lib/libc/misc/ubsan.c:1.1	Fri Aug  3 02:05:43 2018
+++ src/common/lib/libc/misc/ubsan.c	Fri Aug  3 03:12:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsan.c,v 1.1 2018/08/03 02:05:43 kamil Exp $	*/
+/*	$NetBSD: ubsan.c,v 1.2 2018/08/03 03:12:32 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,17 +32,15 @@
  * The uBSSan versions is suitable for inclusion into libc or used standalone
  * with ATF tests.
  *
- * This file due to long symbol names and licensing reasons does not fully
- * follow the KNF style with 80-column limit. Hungarian style variables
- * and function names are on the same purpose (Pascal and Snake style names,
- * are used in different implementations).
+ * This file due to long symbol names generated by a compiler during the
+ * instrumentation process does not follow the KNF style with 80-column limit.
  */
 
 #include 
 #if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.1 2018/08/03 02:05:43 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.2 2018/08/03 03:12:32 kamil Exp $");
 #else
-__RCSID("$NetBSD: ubsan.c,v 1.1 2018/08/03 02:05:43 kamil Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.2 2018/08/03 03:12:32 kamil Exp $");
 #endif
 
 #if defined(_KERNEL)



CVS commit: src/share/mk

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:34:31 UTC 2018

Modified Files:
src/share/mk: bsd.sys.mk

Log Message:
Allow to overwrite sanitizer flags for userland

Always define -fsanitize=${USE_SANITIZER} and
-fsanitize=${USE_LIBCSANITIZER} before other flags defined with
SANITIZERFLAGS and LIBCSANITIZERFLAGS.

This allows to overwrite rules that are parsed from left to right.
With the current approach it wasn't possible to disable some checks, as
they were reenabled again by the "-fsanitize=" argument.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/share/mk/bsd.sys.mk

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

Modified files:

Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.285 src/share/mk/bsd.sys.mk:1.286
--- src/share/mk/bsd.sys.mk:1.285	Wed Jul 25 23:34:25 2018
+++ src/share/mk/bsd.sys.mk	Fri Aug  3 02:34:31 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.285 2018/07/25 23:34:25 kamil Exp $
+#	$NetBSD: bsd.sys.mk,v 1.286 2018/08/03 02:34:31 kamil Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -141,13 +141,13 @@ LDFLAGS+=	-Wl,-z,now
 .endif
 
 .if ${MKSANITIZER:Uno} == "yes"
-SANITIZERFLAGS+=	-fsanitize=${USE_SANITIZER}
+SANITIZERFLAGS:=	-fsanitize=${USE_SANITIZER} ${SANITIZERFLAGS}
 .else
 SANITIZERFLAGS=		# empty
 .endif
 
 .if ${MKLIBCSANITIZER:Uno} == "yes"
-LIBCSANITIZERFLAGS+=	-fsanitize=${USE_LIBCSANITIZER}
+LIBCSANITIZERFLAGS:=	-fsanitize=${USE_LIBCSANITIZER} ${LIBCSANITIZERFLAGS}
 LIBCSANITIZERFLAGS+=	-fno-sanitize=vptr	# Unsupported in micro-UBSan
 .else
 LIBCSANITIZERFLAGS=	# empty



CVS commit: src/lib/libc

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:29:35 UTC 2018

Modified Files:
src/lib/libc: Makefile

Log Message:
Disable sanitization of -fsanitize=function in libc

Generated code for the checks (in at least libunwind) depends on the C++
runtime feature of RTTI.

Pass -fno-sanitize=function to LIBCSANITIZERFLAGS.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/lib/libc/Makefile

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/Makefile
diff -u src/lib/libc/Makefile:1.170 src/lib/libc/Makefile:1.171
--- src/lib/libc/Makefile:1.170	Sat Mar 31 14:24:54 2018
+++ src/lib/libc/Makefile	Fri Aug  3 02:29:35 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.170 2018/03/31 14:24:54 kamil Exp $
+#	$NetBSD: Makefile,v 1.171 2018/08/03 02:29:35 kamil Exp $
 #	@(#)Makefile	8.2 (Berkeley) 2/3/94
 #
 # All library objects contain sccsid strings by default; they may be
@@ -17,6 +17,8 @@
 # The Hesiod functions are always in libc. To choose that getpwent() and friends
 # actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
 
+LIBCSANITIZERFLAGS+=	-fno-sanitize=function	# generated code depends on RTTI
+
 .include "Makefile.inc"
 
 LIB=		c



CVS commit: src/external/mit/xorg/server/drivers/xf86-video-wsfb

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:26:00 UTC 2018

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-wsfb: Makefile

Log Message:
Fix xf86-video-wsfb build with Clang/LLVM

The code uses non-orthodox types in format strings.
Add a compiler flag to disable a warning that is turned into a fatal error.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/mit/xorg/server/drivers/xf86-video-wsfb/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/server/drivers/xf86-video-wsfb/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile:1.4 src/external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile:1.5
--- src/external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile:1.4	Fri Jun 12 01:59:04 2009
+++ src/external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile	Fri Aug  3 02:26:00 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2009/06/12 01:59:04 mrg Exp $
+#	$NetBSD: Makefile,v 1.5 2018/08/03 02:26:00 kamil Exp $
 
 DRIVER=		xf86-video-wsfb
 DRIVER_NAME=	wsfb_drv
@@ -8,4 +8,6 @@ MAN=		wsfb.4
 
 CPPFLAGS+=	-DHAVE_CONFIG_H -I${X11SRCDIR.${DRIVER}}/../include
 
+CWARNFLAGS.clang+=	-Wno-format
+
 .include "../Makefile.xf86-driver"



CVS commit: src/external/mit/xorg/lib/libXfont2

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:23:09 UTC 2018

Modified Files:
src/external/mit/xorg/lib/libXfont2: Makefile

Log Message:
Fix libXfont2 build with Clang/LLVM on i386

The code uses non-orthodox types in format strings.
Add a compiler flag to disable a warning that is turned into a fatal error.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mit/xorg/lib/libXfont2/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/lib/libXfont2/Makefile
diff -u src/external/mit/xorg/lib/libXfont2/Makefile:1.4 src/external/mit/xorg/lib/libXfont2/Makefile:1.5
--- src/external/mit/xorg/lib/libXfont2/Makefile:1.4	Wed May  9 08:39:54 2018
+++ src/external/mit/xorg/lib/libXfont2/Makefile	Fri Aug  3 02:23:09 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2018/05/09 08:39:54 mrg Exp $
+#	$NetBSD: Makefile,v 1.5 2018/08/03 02:23:09 kamil Exp $
 
 .include 
 
@@ -111,6 +111,8 @@ CPPFLAGS+=	-I${DESTDIR}${X11INCDIR}/X11/
 CPPFLAGS+=	-I${DESTDIR}${X11INCDIR}/freetype2
 CPPFLAGS+=	-I${DESTDIR}${X11INCDIR}/freetype2/freetype
 
+CWARNFLAGS.clang+=	-Wno-format
+
 LIBDPLIBS=\
 	Xt	${.CURDIR}/../libXt \
 	SM	${.CURDIR}/../libSM \



CVS commit: src/external/mit/xorg/lib/libGLU

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:20:21 UTC 2018

Modified Files:
src/external/mit/xorg/lib/libGLU: Makefile

Log Message:
Fix libGLU build with Clang/LLVM

The register keyword is deprecated in newer C++ standards.
Add a compiler flag to disable a warning that is turned into a fatal error.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/mit/xorg/lib/libGLU/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/lib/libGLU/Makefile
diff -u src/external/mit/xorg/lib/libGLU/Makefile:1.17 src/external/mit/xorg/lib/libGLU/Makefile:1.18
--- src/external/mit/xorg/lib/libGLU/Makefile:1.17	Wed Jul  1 15:38:56 2015
+++ src/external/mit/xorg/lib/libGLU/Makefile	Fri Aug  3 02:20:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2015/07/01 15:38:56 christos Exp $
+#	$NetBSD: Makefile,v 1.18 2018/08/03 02:20:20 kamil Exp $
 
 .include 
 
@@ -158,3 +158,4 @@ COPTS.sampleCompTop.cc+=	-O0
 .endif
 
 CWARNFLAGS.clang+=	-Wno-parentheses -Wno-tautological-compare
+CWARNFLAGS.clang+=	-Wno-deprecated-register



CVS commit: src/external/mit/xorg/lib/dri7

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:19:12 UTC 2018

Modified Files:
src/external/mit/xorg/lib/dri7: libglsl7.mk

Log Message:
Fix dri7 build with Clang/LLVM

The register keyword is deprecated in newer C++ standards.
Add a compiler flag to disable a warning that is turned into a fatal error.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/mit/xorg/lib/dri7/libglsl7.mk

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/dri7/libglsl7.mk
diff -u src/external/mit/xorg/lib/dri7/libglsl7.mk:1.1 src/external/mit/xorg/lib/dri7/libglsl7.mk:1.2
--- src/external/mit/xorg/lib/dri7/libglsl7.mk:1.1	Mon Jan  5 03:45:31 2015
+++ src/external/mit/xorg/lib/dri7/libglsl7.mk	Fri Aug  3 02:19:12 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: libglsl7.mk,v 1.1 2015/01/05 03:45:31 mrg Exp $
+#	$NetBSD: libglsl7.mk,v 1.2 2018/08/03 02:19:12 kamil Exp $
 
 # This copy for MesaLib7 old drivers.
 
@@ -14,6 +14,7 @@ CPPFLAGS+=	-I${X11SRCDIR.MesaLib7}/inclu
 CPPFLAGS+=	-I${X11SRCDIR.MesaLib7}/src/glsl
 CPPFLAGS+=	-I${X11SRCDIR.MesaLib7}/src/mapi
 CPPFLAGS+=	-I${X11SRCDIR.MesaLib7}/src/mesa
+COPTS.glsl_lexer.cpp+=	-Wno-deprecated-register
 
 SRCS.glsl.libglcpp= \
 	glcpp-lex.c \



CVS commit: src/external/bsd/dhcpcd/dist/src

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:17:33 UTC 2018

Modified Files:
src/external/bsd/dhcpcd/dist/src: dhcp.c

Log Message:
Fix build failure in dhcpcd under uUBSan

GCC with -fsanitize=undefiend detects a potential overflow in the code.
Cast the return value of ntohs(3) to size_t.

Fix merged upstream by .


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/dhcp.c

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

Modified files:

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.11 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.12
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.11	Mon Jun  4 16:45:52 2018
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Fri Aug  3 02:17:33 2018
@@ -3267,7 +3267,7 @@ get_udp_data(void *udp, size_t *len)
 	struct bootp_pkt *p;
 
 	p = (struct bootp_pkt *)udp;
-	*len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp);
+	*len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp);
 	return (char *)udp + offsetof(struct bootp_pkt, bootp);
 }
 



CVS commit: src/common/lib/libc/misc

2018-08-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Aug  3 02:05:43 UTC 2018

Added Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
Import micro-UBSan (ubsan.c)

This is a reimplementation of the Undefined Behavior Sanitizer with the
following properties:
 - pure C implementation,
 - no -fsanitize=vpts support, as it requires RTTI support and C++
   low-level routies to validate whether C++ objects are compatible
 - designed to be used inside libc and known as uUBSan or user-UBSan
 - designed to be shared with kernel and known as kUBSan or kernel-UBSan
 - designed to be usable with ATF tests as a standalone runtime,
   reachable without any MK* switches
 - designed to be safer for hardening as it does not have side effects on
   executables like writing to a selected location on demand
 - controllable with environment variable LIBC_UBSAN with options:
   * a - abort on report
   * A - do not abort on a report (unless a failure is unrecoverable)
   * e - output report to stderr
   * E - do not output report on stderr
   * l - output report on syslog (LOG_DEBUG | LOG_USER)
   * L - do not output report on syslog
   * o - output report on stdout
   * O - do not output report on stdout
   The default options are: "AeLO".
 - compatible with Clang (3.8, 7.x) and GCC (6.x) code generation
 - all handlers (except =vptr) from Clang/LLVM up to 7svn are supported

This file does not follow the regular KNF style, due to potential licensing
concerns.

Tested with Clang amd64+i386 and GCC amd64+i386.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/misc/ubsan.c

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

Added files:

Index: src/common/lib/libc/misc/ubsan.c
diff -u /dev/null src/common/lib/libc/misc/ubsan.c:1.1
--- /dev/null	Fri Aug  3 02:05:43 2018
+++ src/common/lib/libc/misc/ubsan.c	Fri Aug  3 02:05:43 2018
@@ -0,0 +1,1640 @@
+/*	$NetBSD: ubsan.c,v 1.1 2018/08/03 02:05:43 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 FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/*
+ * The micro UBSan implementation for the userland (uUBSan) and kernel (kUBSan).
+ * The uBSSan versions is suitable for inclusion into libc or used standalone
+ * with ATF tests.
+ *
+ * This file due to long symbol names and licensing reasons does not fully
+ * follow the KNF style with 80-column limit. Hungarian style variables
+ * and function names are on the same purpose (Pascal and Snake style names,
+ * are used in different implementations).
+ */
+
+#include 
+#if defined(_KERNEL)
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.1 2018/08/03 02:05:43 kamil Exp $");
+#else
+__RCSID("$NetBSD: ubsan.c,v 1.1 2018/08/03 02:05:43 kamil Exp $");
+#endif
+
+#if defined(_KERNEL)
+#include 
+#include 
+#include 
+#define ASSERT(x) KASSERT(x)
+#else
+#if defined(_LIBC)
+#include "namespace.h"
+#endif
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#if defined(_LIBC)
+#include "extern.h"
+#define ubsan_vsyslog vsyslog_ss
+#define ASSERT(x) _DIAGASSERT(x)
+#else
+#define ubsan_vsyslog vsyslog_r
+#define ASSERT(x) assert(x)
+#endif
+/* These macros are available in _KERNEL only */
+#define SET(t, f)	((t) |= (f))
+#define ISSET(t, f)	((t) & (f))
+#define CLR(t, f)	((t) &= ~(f))
+#endif
+
+#define REINTERPRET_CAST(__dt, __st)	((__dt)(__st))
+#define STATIC_CAST(__dt, __st)		((__dt)(__st))
+
+#define ACK_REPORTED	__BIT(31)
+
+#define MUL_STRING	"*"
+#define PLUS_STRING	"+"
+#define MINUS_STRING	"-"
+#define DIVREM_STRING	"divrem"
+

CVS commit: src/doc

2018-08-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug  2 17:34:51 UTC 2018

Modified Files:
src/doc: TODO.kaslr

Log Message:
Mark two entries as done.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/doc/TODO.kaslr

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

Modified files:

Index: src/doc/TODO.kaslr
diff -u src/doc/TODO.kaslr:1.1 src/doc/TODO.kaslr:1.2
--- src/doc/TODO.kaslr:1.1	Mon Jun 18 06:09:56 2018
+++ src/doc/TODO.kaslr	Thu Aug  2 17:34:51 2018
@@ -1,7 +1,7 @@
 == POINTER LEAKS ==
 
--- Change the permissions of /dev/ksyms, as discussed in:
-   http://mail-index.netbsd.org/tech-kern/2018/01/17/msg022960.html
+[DONE] -- Change the permissions of /dev/ksyms, as discussed in:
+  http://mail-index.netbsd.org/tech-kern/2018/01/17/msg022960.html
 
 -- The address of a non-public section is leaked because of Meltdown,
"jmp handler". This can easily be fixed by pushing the handlers into
@@ -29,7 +29,7 @@
 
 -- Randomize the kernel main memory (VM_MIN_KERNEL_ADDRESS).
 
--- Randomize the direct map.
+[DONE] -- Randomize the direct map.
 
 -- Randomize the PCPU area.
 



CVS commit: src/sys/arch/amd64

2018-08-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug  2 17:18:00 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: prekern.c
src/sys/arch/amd64/stand/prekern: prekern.c

Log Message:
Add a "version" field in the prekern_args structure. The kernel checks it,
and if it's not happy it returns back to the prekern.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/amd64/prekern.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amd64/stand/prekern/prekern.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/prekern.c
diff -u src/sys/arch/amd64/amd64/prekern.c:1.2 src/sys/arch/amd64/amd64/prekern.c:1.3
--- src/sys/arch/amd64/amd64/prekern.c:1.2	Thu Aug  2 16:58:00 2018
+++ src/sys/arch/amd64/amd64/prekern.c	Thu Aug  2 17:18:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.c,v 1.2 2018/08/02 16:58:00 maxv Exp $	*/
+/*	$NetBSD: prekern.c,v 1.3 2018/08/02 17:18:00 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -46,7 +46,10 @@
 #include 
 #include 
 
+#define PREKERN_API_VERSION	1
+
 struct prekern_args {
+	int version;
 	int boothowto;
 	void *bootinfo;
 	void *bootspace;
@@ -122,6 +125,10 @@ start_prekern(struct prekern_args *pkarg
 {
 	paddr_t first_avail;
 
+	if (pkargs->version != PREKERN_API_VERSION) {
+		return -1;
+	}
+
 	prekern_copy_args(pkargs);
 	first_avail = pkargs->first_avail;
 
@@ -134,5 +141,5 @@ start_prekern(struct prekern_args *pkarg
 
 	panic("main returned");
 
-	return -1;
+	return 0;
 }

Index: src/sys/arch/amd64/stand/prekern/prekern.c
diff -u src/sys/arch/amd64/stand/prekern/prekern.c:1.8 src/sys/arch/amd64/stand/prekern/prekern.c:1.9
--- src/sys/arch/amd64/stand/prekern/prekern.c:1.8	Fri May 25 15:52:11 2018
+++ src/sys/arch/amd64/stand/prekern/prekern.c	Thu Aug  2 17:18:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.c,v 1.8 2018/05/25 15:52:11 maxv Exp $	*/
+/*	$NetBSD: prekern.c,v 1.9 2018/08/02 17:18:00 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -221,7 +221,10 @@ init_idt(void)
 
 /* -- */
 
+#define PREKERN_API_VERSION	1
+
 struct prekern_args {
+	int version;
 	int boothowto;
 	void *bootinfo;
 	void *bootspace;
@@ -253,6 +256,7 @@ init_prekern_args(void)
 	extern paddr_t pa_avail;
 
 	memset(, 0, sizeof(pkargs));
+	pkargs.version = PREKERN_API_VERSION;
 	pkargs.boothowto = boothowto;
 	pkargs.bootinfo = (void *)
 	pkargs.bootspace = 
@@ -285,9 +289,9 @@ exec_kernel(vaddr_t ent)
 	ret = (*jumpfunc)();
 
 	if (ret == -1) {
-		fatal("kernel returned -1");
+		fatal("kernel returned: wrong API version");
 	} else {
-		fatal("kernel returned unknown value");
+		fatal("kernel returned: unknown value");
 	}
 }
 



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

2018-08-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug  2 16:58:00 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: prekern.c

Log Message:
Don't forget to call init_slotspace when we're booted via the prekern.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/amd64/prekern.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/prekern.c
diff -u src/sys/arch/amd64/amd64/prekern.c:1.1 src/sys/arch/amd64/amd64/prekern.c:1.2
--- src/sys/arch/amd64/amd64/prekern.c:1.1	Sun Oct  8 08:26:01 2017
+++ src/sys/arch/amd64/amd64/prekern.c	Thu Aug  2 16:58:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.c,v 1.1 2017/10/08 08:26:01 maxv Exp $	*/
+/*	$NetBSD: prekern.c,v 1.2 2018/08/02 16:58:00 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -62,6 +62,7 @@ struct prekern_args {
 };
 
 void main(void);
+void init_slotspace(void);
 void init_x86_64(paddr_t);
 
 static void prekern_copy_args(struct prekern_args *);
@@ -124,6 +125,7 @@ start_prekern(struct prekern_args *pkarg
 	prekern_copy_args(pkargs);
 	first_avail = pkargs->first_avail;
 
+	init_slotspace();
 	init_x86_64(first_avail);
 
 	prekern_unmap();



CVS commit: src/usr.sbin/npf

2018-08-02 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Aug  2 16:42:12 UTC 2018

Modified Files:
src/usr.sbin/npf: npf.7

Log Message:
Use Nm macro
Move history details to the HISTORY section
Spelling
Be less meta & clarify the website should be consulted.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npf.7

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

Modified files:

Index: src/usr.sbin/npf/npf.7
diff -u src/usr.sbin/npf/npf.7:1.4 src/usr.sbin/npf/npf.7:1.5
--- src/usr.sbin/npf/npf.7:1.4	Sun Dec 10 22:04:41 2017
+++ src/usr.sbin/npf/npf.7	Thu Aug  2 16:42:12 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: npf.7,v 1.4 2017/12/10 22:04:41 rmind Exp $
+.\"	$NetBSD: npf.7,v 1.5 2018/08/02 16:42:12 sevan Exp $
 .\"
 .\" Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 13, 2015
+.Dd August 2, 2018
 .Dt NPF 7
 .Os
 .Sh NAME
@@ -35,16 +35,15 @@
 .Nd NetBSD packet filter
 .\" -
 .Sh DESCRIPTION
-NPF is a layer 3 packet filter, supporting IPv4 and IPv6 as well as
+.Nm
+is a layer 3 packet filter, supporting IPv4 and IPv6 as well as
 layer 4 protocols such as TCP, UDP, and ICMP.
 It was designed with a focus on high performance, scalability, and
 modularity.
-.Pp
-NPF was written from scratch in 2009 and is distributed under the
-2-clause BSD license.
 .\" -
 .Sh FEATURES
-NPF offers the traditional set of features provided by packet filters.
+.Nm
+offers the traditional set of features provided by packet filters.
 Some key features are:
 .Bl -bullet -offset indent
 .It
@@ -60,17 +59,20 @@ Tables for efficient IP sets.
 .It
 Application Level Gateways (e.g., to support traceroute).
 .It
-NPF uses BPF with just-in-time (JIT) compilation.
+Use of BPF with just-in-time (JIT) compilation.
 .It
-Rule procedures and a framework for NPF extensions.
+Rule procedures and a framework for
+.Nm
+extensions.
 .It
-Traffic normalization (extension).
+Traffic normalisation (extension).
 .It
 Packet logging (extension).
 .El
 .Pp
-For a full set of features and their description, see the NPF
-documentation and other manual pages.
+For a full set of features and their description, see the
+.Nm
+documentation website and other manual pages.
 .\" -
 .Sh SEE ALSO
 .Xr libnpf 3 ,
@@ -81,10 +83,12 @@ documentation and other manual pages.
 .Xr npfctl 8 ,
 .Xr npfd 8
 .Pp
-.Lk http://www.netbsd.org/~rmind/npf/ "NPF documentation"
+.Lk http://www.netbsd.org/~rmind/npf/ "NPF documentation website"
 .Sh HISTORY
 .Nm
-first appeared in
+was written from scratch in 2009 and is distributed under the
+2-clause BSD license.
+It first appeared in
 .Nx 6.0 .
 .Sh AUTHORS
 .Nm



CVS commit: src

2018-08-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug  2 16:26:09 UTC 2018

Modified Files:
src/distrib/notes/common: contents
src/etc/etc.amd64: Makefile.inc

Log Message:
Distribute GENERIC_KASLR on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/distrib/notes/common/contents
cvs rdiff -u -r1.15 -r1.16 src/etc/etc.amd64/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/distrib/notes/common/contents
diff -u src/distrib/notes/common/contents:1.176 src/distrib/notes/common/contents:1.177
--- src/distrib/notes/common/contents:1.176	Thu Aug  2 16:22:43 2018
+++ src/distrib/notes/common/contents	Thu Aug  2 16:26:09 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.176 2018/08/02 16:22:43 maxv Exp $
+.\"	$NetBSD: contents,v 1.177 2018/08/02 16:26:09 maxv Exp $
 .\"
 .\" Copyright (c) 1999-2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,6 +57,7 @@ kernel containing code for everything su
 .if \n[amd64] \{\
 .			It Pa netbsd-INSTALL.gz
 The installation kernel.
+.			It Pa netbsd-GENERIC_KASLR.gz
 .			It Pa netbsd-INSTALL_XEN3_DOMU.gz
 .			It Pa netbsd-XEN3_DOM0.gz
 .			It Pa netbsd-XEN3_DOMU.gz

Index: src/etc/etc.amd64/Makefile.inc
diff -u src/etc/etc.amd64/Makefile.inc:1.15 src/etc/etc.amd64/Makefile.inc:1.16
--- src/etc/etc.amd64/Makefile.inc:1.15	Sun Jan 11 04:03:47 2015
+++ src/etc/etc.amd64/Makefile.inc	Thu Aug  2 16:26:09 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.15 2015/01/11 04:03:47 snj Exp $
+#	$NetBSD: Makefile.inc,v 1.16 2018/08/02 16:26:09 maxv Exp $
 #
 #	etc.amd64/Makefile.inc -- amd64-specific etc Makefile targets
 #
@@ -7,6 +7,7 @@
 # to update the release documentation in distrib/notes/common/contents
 
 KERNEL_SETS=		GENERIC
+KERNEL_SETS+=		GENERIC_KASLR
 KERNEL_SETS+=		XEN3_DOM0 XEN3_DOMU
 # KERNEL_SETS+=		GENERIC_USERMODE
 



CVS commit: src/distrib/notes/common

2018-08-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug  2 16:22:43 UTC 2018

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

Log Message:
Remove netbsd-INSTALL_XEN3_DOMU.gz (it doesn't exist anymore), and add
netbsd-XEN3PAE_DOM0.gz (has always existed, but was apparently forgotten).


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/distrib/notes/common/contents

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

Modified files:

Index: src/distrib/notes/common/contents
diff -u src/distrib/notes/common/contents:1.175 src/distrib/notes/common/contents:1.176
--- src/distrib/notes/common/contents:1.175	Thu Jul 26 16:22:49 2018
+++ src/distrib/notes/common/contents	Thu Aug  2 16:22:43 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.175 2018/07/26 16:22:49 maxv Exp $
+.\"	$NetBSD: contents,v 1.176 2018/08/02 16:22:43 maxv Exp $
 .\"
 .\" Copyright (c) 1999-2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -92,7 +92,7 @@ The monolithic kernel which doesn't use 
 .			It Pa netbsd-INSTALL.gz
 The installation kernel.
 .			It Pa netbsd-INSTALL_XEN3PAE_DOMU.gz
-.			It Pa netbsd-INSTALL_XEN3_DOMU.gz
+.			It Pa netbsd-XEN3PAE_DOM0.gz
 .			It Pa netbsd-XEN3PAE_DOMU.gz
 .\}
 .if \n[mac68k] \{\



CVS commit: src/lib/libc/net

2018-08-02 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Thu Aug  2 10:18:19 UTC 2018

Added Files:
src/lib/libc/net: sctp_recvmsg.3

Log Message:
Add missing SCTP manpage.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc/net/sctp_recvmsg.3

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

Added files:

Index: src/lib/libc/net/sctp_recvmsg.3
diff -u /dev/null src/lib/libc/net/sctp_recvmsg.3:1.1
--- /dev/null	Thu Aug  2 10:18:19 2018
+++ src/lib/libc/net/sctp_recvmsg.3	Thu Aug  2 10:18:19 2018
@@ -0,0 +1,303 @@
+.\"	$NetBSD: sctp_recvmsg.3,v 1.1 2018/08/02 10:18:19 rjs Exp $
+.\"
+.\" Copyright (c) 1983, 1991, 1993
+.\"	The Regents of the University of California.  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.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"may be used to endorse or promote products derived from this software
+.\"without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (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 August 1, 2018
+.Dt SCTP_RECVMSG 3
+.Os
+.Sh NAME
+.Nm sctp_recvmsg
+.Nd receive a message from an SCTP socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/sctp.h
+.Ft ssize_t
+.Fo sctp_recvmsg
+.Fa "int s" "void *msg" "size_t len" "struct sockaddr * restrict from"
+.Fa "socklen_t * restrict fromlen" "struct sctp_sndrcvinfo *sinfo" "int *flags"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn sctp_recvmsg
+system call
+is used to receive a message from another SCTP endpoint.
+The
+.Fn sctp_recvmsg
+call is used by one-to-one (SOCK_STREAM) type sockets after a
+successful
+.Fn connect
+call or after the application has performed a
+.Fn listen
+followed by a successful
+.Fn accept .
+For a one-to-many (SOCK_SEQPACKET) type socket, an endpoint may call
+.Fn sctp_recvmsg
+after having implicitly started an association via one
+of the send calls including
+.Fn sctp_sendmsg ,
+.Fn sendto
+and
+.Fn sendmsg .
+Or, an application may also receive a message after having
+called
+.Fn listen
+with a positive backlog to enable the reception of new associations.
+.Pp
+The address of the sender is held in the
+.Fa from
+argument with
+.Fa fromlen
+specifying its size.
+At the completion of a successful
+.Fn sctp_recvmsg
+call
+.Fa from
+will hold the address of the peer and
+.Fa fromlen
+will hold the length of that address.
+Note that
+the address is bounded by the initial value of
+.Fa fromlen
+which is used as an in/out variable.
+.Pp
+The length of the message
+.Fa msg
+to be received is bounded by
+.Fa len .
+If the message is too long to fit in the users
+receive buffer, then the
+.Fa flags
+argument will
+.Em not
+have the
+.Dv MSG_EOF
+flag applied.
+If the message is a complete message then
+the
+.Fa flags
+argument will have
+.Dv MSG_EOF
+set.
+Locally detected errors are
+indicated by a return value of -1 with
+.Va errno
+set accordingly.
+The
+.Fa flags
+argument may also hold the value
+.Dv MSG_NOTIFICATION .
+When this
+occurs it indicates that the message received is
+.Em not
+from
+the peer endpoint, but instead is a notification from the
+SCTP stack (see
+.Xr sctp 4
+for more details).
+Note that no notifications are ever
+given unless the user subscribes to such notifications using
+the
+.Dv SCTP_EVENTS
+socket option.
+.Pp
+If no messages are available at the socket then
+.Fn sctp_recvmsg
+normally blocks on the reception of a message or NOTIFICATION, unless the
+socket has been placed in non-blocking I/O mode.
+The
+.Xr select 2
+system call may be used to determine when it is possible to
+receive a message.
+.Pp
+The
+.Fa sinfo
+argument is defined as follows.
+.Bd -literal
+struct 

CVS commit: src

2018-08-02 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Thu Aug  2 08:40:48 UTC 2018

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/debug: shl.mi
src/lib/libc: shlib_version
src/lib/libc/net: Makefile.inc
Added Files:
src/lib/libc/net: sctp_bindx.3 sctp_connectx.3 sctp_freepaddrs.3
sctp_getaddrlen.3 sctp_getassocid.3 sctp_getpaddrs.3
sctp_opt_info.3 sctp_peeloff.3 sctp_send.3 sctp_sendmsg.3
sctp_sys_calls.c

Log Message:
Add userland support for SCTP and manpages.


To generate a diff of this commit:
cvs rdiff -u -r1.843 -r1.844 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2214 -r1.2215 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.202 -r1.203 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.280 -r1.281 src/lib/libc/shlib_version
cvs rdiff -u -r1.87 -r1.88 src/lib/libc/net/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/net/sctp_bindx.3 \
src/lib/libc/net/sctp_connectx.3 src/lib/libc/net/sctp_freepaddrs.3 \
src/lib/libc/net/sctp_getaddrlen.3 src/lib/libc/net/sctp_getassocid.3 \
src/lib/libc/net/sctp_getpaddrs.3 src/lib/libc/net/sctp_opt_info.3 \
src/lib/libc/net/sctp_peeloff.3 src/lib/libc/net/sctp_send.3 \
src/lib/libc/net/sctp_sendmsg.3 src/lib/libc/net/sctp_sys_calls.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/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.843 src/distrib/sets/lists/base/shl.mi:1.844
--- src/distrib/sets/lists/base/shl.mi:1.843	Tue Jul 31 13:04:09 2018
+++ src/distrib/sets/lists/base/shl.mi	Thu Aug  2 08:40:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.843 2018/07/31 13:04:09 rjs Exp $
+# $NetBSD: shl.mi,v 1.844 2018/08/02 08:40:47 rjs Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -18,7 +18,7 @@
 ./lib/libblacklist.so.0.0			base-sys-shlib		dynamicroot
 ./lib/libc.so	base-sys-shlib		dynamicroot
 ./lib/libc.so.12base-sys-shlib		dynamicroot
-./lib/libc.so.12.210base-sys-shlib		dynamicroot
+./lib/libc.so.12.211base-sys-shlib		dynamicroot
 ./lib/libcrypt.sobase-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1base-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1.0base-sys-shlib		dynamicroot
@@ -221,7 +221,7 @@
 ./usr/lib/libc++.so.1.0base-sys-shlib		compatfile,libcxx
 ./usr/lib/libc.sobase-sys-shlib		compatfile
 ./usr/lib/libc.so.12base-sys-shlib		compatfile
-./usr/lib/libc.so.12.210			base-sys-shlib		compatfile
+./usr/lib/libc.so.12.211			base-sys-shlib		compatfile
 ./usr/lib/libcdk.sobase-obsolete		compatfile,obsolete
 ./usr/lib/libcom_err.sobase-krb5-shlib		compatfile,kerberos
 ./usr/lib/libcom_err.so.8			base-krb5-shlib		compatfile,kerberos

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2214 src/distrib/sets/lists/comp/mi:1.2215
--- src/distrib/sets/lists/comp/mi:1.2214	Tue Jul 31 16:44:28 2018
+++ src/distrib/sets/lists/comp/mi	Thu Aug  2 08:40:47 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2214 2018/07/31 16:44:28 khorben Exp $
+#	$NetBSD: mi,v 1.2215 2018/08/02 08:40:47 rjs Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -16992,6 +16992,17 @@
 ./usr/share/man/html3/scrl.html			comp-c-htmlman		html
 ./usr/share/man/html3/scroll.html		comp-c-htmlman		html
 ./usr/share/man/html3/scrollok.html		comp-c-htmlman		html
+./usr/share/man/html3/sctp_bindx.html		comp-c-htmlman		html
+./usr/share/man/html3/sctp_connectx.html	comp-c-htmlman		html
+./usr/share/man/html3/sctp_freepaddrs.html	comp-c-htmlman		html
+./usr/share/man/html3/sctp_getaddrlen.html	comp-c-htmlman		html
+./usr/share/man/html3/sctp_getassocid.html	comp-c-htmlman		html
+./usr/share/man/html3/sctp_getpaddrs.html	comp-c-htmlman		html
+./usr/share/man/html3/sctp_opt_info.html	comp-c-htmlman		html
+./usr/share/man/html3/sctp_peeloff.html		comp-c-htmlman		html
+./usr/share/man/html3/sctp_recvmsg.html		comp-c-htmlman		html
+./usr/share/man/html3/sctp_send.html		comp-c-htmlman		html
+./usr/share/man/html3/sctp_sendmsg.html		comp-c-htmlman		html
 ./usr/share/man/html3/sdp.html			comp-c-htmlman		html
 ./usr/share/man/html3/sdp_attr2desc.html	comp-obsolete		obsolete
 ./usr/share/man/html3/sdp_change_service.html	comp-obsolete		obsolete
@@ -24777,6 +24788,17 @@
 ./usr/share/man/man3/scrl.3			comp-c-man		.man
 ./usr/share/man/man3/scroll.3			comp-c-man		.man
 ./usr/share/man/man3/scrollok.3			comp-c-man		.man
+./usr/share/man/man3/sctp_bindx.3		comp-c-man		.man
+./usr/share/man/man3/sctp_connectx.3		comp-c-man		.man
+./usr/share/man/man3/sctp_freepaddrs.3		comp-c-man		.man
+./usr/share/man/man3/sctp_getaddrlen.3		comp-c-man		.man
+./usr/share/man/man3/sctp_getassocid.3		comp-c-man		.man

CVS commit: src/external/gpl3/gcc.old/usr.bin/include/sanitizer

2018-08-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug  2 07:47:30 UTC 2018

Modified Files:
src/external/gpl3/gcc.old/usr.bin/include/sanitizer: Makefile

Log Message:
fix the sanitizer include path.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc.old/usr.bin/include/sanitizer/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/gpl3/gcc.old/usr.bin/include/sanitizer/Makefile
diff -u src/external/gpl3/gcc.old/usr.bin/include/sanitizer/Makefile:1.1 src/external/gpl3/gcc.old/usr.bin/include/sanitizer/Makefile:1.2
--- src/external/gpl3/gcc.old/usr.bin/include/sanitizer/Makefile:1.1	Thu Feb  1 20:50:22 2018
+++ src/external/gpl3/gcc.old/usr.bin/include/sanitizer/Makefile	Thu Aug  2 07:47:30 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2018/02/01 20:50:22 kamil Exp $
+#	$NetBSD: Makefile,v 1.2 2018/08/02 07:47:30 mrg Exp $
 
 .include "../../../Makefile.gcc_path"
 
@@ -19,6 +19,6 @@ INCS+=	tsan_interface_atomic.h
 
 .include 
 
-INCSDIR=	/usr/include/gcc-5/sanitizer
+INCSDIR=	/usr/include/gcc-6/sanitizer
 
 .include 



CVS commit: src/sys/dev/usb

2018-08-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug  2 06:09:05 UTC 2018

Modified Files:
src/sys/dev/usb: if_athn_usb.c if_atu.c if_aue.c if_axe.c if_axen.c
if_cue.c if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c if_upgt.c
if_ural.c if_url.c if_urtw.c if_urtwn.c if_zyd.c uatp.c usb.c
usb_subr.c usbdi.h

Log Message:
Fix usb_rem_task_wait API.

- Return whether it removed task from queue or not.
  . True if it was on the queue and we intercepted it before it ran.
  . False if we could not intercept it: either it wasn't queued,
or it already ran.  (Up to caller to distinguish these cases.)
- Pass an optional interlock like callout_halt.

While here, simplify.

ok mrg@


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/usb/if_athn_usb.c \
src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/usb/if_atu.c src/sys/dev/usb/if_rum.c \
src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.144 -r1.145 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/usb/if_udav.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/usb/if_upgt.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/usb/if_ural.c
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/if_urtw.c src/sys/dev/usb/uatp.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.170 -r1.171 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.225 -r1.226 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/usbdi.h

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

Modified files:

Index: src/sys/dev/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.28 src/sys/dev/usb/if_athn_usb.c:1.29
--- src/sys/dev/usb/if_athn_usb.c:1.28	Sun Jul 29 01:59:56 2018
+++ src/sys/dev/usb/if_athn_usb.c	Thu Aug  2 06:09:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.28 2018/07/29 01:59:56 riastradh Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.28 2018/07/29 01:59:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -335,7 +335,8 @@ athn_usb_attach(device_t parent, device_
 	athn_usb_free_tx_cmd(usc);
 	athn_usb_free_tx_msg(usc);
 	athn_usb_close_pipes(usc);
-	usb_rem_task_wait(usc->usc_udev, >usc_task, USB_TASKQ_DRIVER);
+	usb_rem_task_wait(usc->usc_udev, >usc_task, USB_TASKQ_DRIVER,
+	NULL);
 
 	cv_destroy(>usc_cmd_cv);
 	cv_destroy(>usc_msg_cv);
@@ -501,7 +502,8 @@ athn_usb_detach(device_t self, int flags
 
 	athn_usb_wait_async(usc);
 
-	usb_rem_task_wait(usc->usc_udev, >usc_task, USB_TASKQ_DRIVER);
+	usb_rem_task_wait(usc->usc_udev, >usc_task, USB_TASKQ_DRIVER,
+	NULL);
 
 	/* Abort Tx/Rx pipes. */
 	athn_usb_abort_pipes(usc);
Index: src/sys/dev/usb/if_run.c
diff -u src/sys/dev/usb/if_run.c:1.28 src/sys/dev/usb/if_run.c:1.29
--- src/sys/dev/usb/if_run.c:1.28	Sun Jul 29 02:01:22 2018
+++ src/sys/dev/usb/if_run.c	Thu Aug  2 06:09:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_run.c,v 1.28 2018/07/29 02:01:22 riastradh Exp $	*/
+/*	$NetBSD: if_run.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $	*/
 /*	$OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.28 2018/07/29 02:01:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -762,7 +762,8 @@ run_detach(device_t self, int flags)
 		run_stop(ifp, 0);
 		callout_halt(>scan_to, NULL);
 		callout_halt(>calib_to, NULL);
-		usb_rem_task_wait(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER);
+		usb_rem_task_wait(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER,
+		NULL);
 	}
 
 	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);

Index: src/sys/dev/usb/if_atu.c
diff -u src/sys/dev/usb/if_atu.c:1.62 src/sys/dev/usb/if_atu.c:1.63
--- src/sys/dev/usb/if_atu.c:1.62	Sun Jul 29 02:00:07 2018
+++ src/sys/dev/usb/if_atu.c	Thu Aug  2 06:09:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_atu.c,v 1.62 2018/07/29 02:00:07 riastradh Exp $ */
+/*	$NetBSD: if_atu.c,v 1.63 2018/08/02 06:09:04 riastradh Exp $ */
 /*	$OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
 /*
  * Copyright (c) 2003, 2004
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.62 2018/07/29 02:00:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.63 2018/08/02 06:09:04 riastradh Exp $");
 
 #ifdef