CVS commit: src/bin

2020-05-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 17 23:34:11 UTC 2020

Modified Files:
src/bin/cp: Makefile cp.c utils.c
src/bin/ls: Makefile print.c

Log Message:
No ACL support for install media (SMALLPROG)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/bin/cp/Makefile
cvs rdiff -u -r1.60 -r1.61 src/bin/cp/cp.c
cvs rdiff -u -r1.48 -r1.49 src/bin/cp/utils.c
cvs rdiff -u -r1.14 -r1.15 src/bin/ls/Makefile
cvs rdiff -u -r1.56 -r1.57 src/bin/ls/print.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/cp/Makefile
diff -u src/bin/cp/Makefile:1.9 src/bin/cp/Makefile:1.10
--- src/bin/cp/Makefile:1.9	Sun Jul 20 18:36:37 1997
+++ src/bin/cp/Makefile	Sun May 17 19:34:11 2020
@@ -1,7 +1,11 @@
-#	$NetBSD: Makefile,v 1.9 1997/07/20 22:36:37 christos Exp $
+#	$NetBSD: Makefile,v 1.10 2020/05/17 23:34:11 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 PROG=	cp
 SRCS=	cp.c utils.c
 
+.ifdef SMALLPROG
+CPPFLAGS+=-DSMALL
+.endif
+
 .include 

Index: src/bin/cp/cp.c
diff -u src/bin/cp/cp.c:1.60 src/bin/cp/cp.c:1.61
--- src/bin/cp/cp.c:1.60	Sat May 16 14:31:45 2020
+++ src/bin/cp/cp.c	Sun May 17 19:34:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cp.c,v 1.60 2020/05/16 18:31:45 christos Exp $ */
+/* $NetBSD: cp.c,v 1.61 2020/05/17 23:34:11 christos Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -43,7 +43,7 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = "@(#)cp.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: cp.c,v 1.60 2020/05/16 18:31:45 christos Exp $");
+__RCSID("$NetBSD: cp.c,v 1.61 2020/05/17 23:34:11 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -511,9 +511,11 @@ copy(char *argv[], enum op type, int fts
 if (pflag) {
 	if (setfile(curr->fts_statp, 0))
 		this_failed = any_failed = 1;
+#ifndef SMALL
 	if (preserve_dir_acls(curr->fts_statp,
 	curr->fts_accpath, to.p_path) != 0)
 		this_failed = any_failed = 1;
+#endif
 }
 if (this_failed && (dne = popdne()))
 	(void)chmod(to.p_path, 

Index: src/bin/cp/utils.c
diff -u src/bin/cp/utils.c:1.48 src/bin/cp/utils.c:1.49
--- src/bin/cp/utils.c:1.48	Sat May 16 14:31:45 2020
+++ src/bin/cp/utils.c	Sun May 17 19:34:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.c,v 1.48 2020/05/16 18:31:45 christos Exp $ */
+/* $NetBSD: utils.c,v 1.49 2020/05/17 23:34:11 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)utils.c	8.3 (Berkeley) 4/1/94";
 #else
-__RCSID("$NetBSD: utils.c,v 1.48 2020/05/16 18:31:45 christos Exp $");
+__RCSID("$NetBSD: utils.c,v 1.49 2020/05/17 23:34:11 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -43,7 +43,9 @@ __RCSID("$NetBSD: utils.c,v 1.48 2020/05
 #include 
 #include 
 #include 
+#ifndef SMALL
 #include 
+#endif
 #include 
 
 #include 
@@ -256,8 +258,10 @@ copy_file(FTSENT *entp, int dne)
 	if (pflag && (fcpxattr(from_fd, to_fd) != 0))
 		warn("%s: error copying extended attributes", to.p_path);
 
+#ifndef SMALL
 	if (pflag && preserve_fd_acls(from_fd, to_fd) != 0)
 		rval = 1;
+#endif
 
 	(void)close(from_fd);
 
@@ -408,6 +412,7 @@ setfile(struct stat *fs, int fd)
 	return (rval);
 }
 
+#ifndef SMALL
 int
 preserve_fd_acls(int source_fd, int dest_fd)
 {
@@ -546,6 +551,7 @@ preserve_dir_acls(struct stat *fs, char 
 	acl_free(acl);
 	return (0);
 }
+#endif
 
 void
 usage(void)

Index: src/bin/ls/Makefile
diff -u src/bin/ls/Makefile:1.14 src/bin/ls/Makefile:1.15
--- src/bin/ls/Makefile:1.14	Thu Dec 14 15:09:36 2006
+++ src/bin/ls/Makefile	Sun May 17 19:34:11 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14 2006/12/14 20:09:36 he Exp $
+#	$NetBSD: Makefile,v 1.15 2020/05/17 23:34:11 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/2/93
 
 PROG=	ls
@@ -7,4 +7,8 @@ SRCS=	cmp.c ls.c main.c print.c util.c
 LDADD+=	-lutil
 DPADD+=	${LIBUTIL}
 
+.ifdef SMALLPROG
+CPPFLAGS+= -DSMALL
+.endif
+
 .include 

Index: src/bin/ls/print.c
diff -u src/bin/ls/print.c:1.56 src/bin/ls/print.c:1.57
--- src/bin/ls/print.c:1.56	Sat May 16 14:31:45 2020
+++ src/bin/ls/print.c	Sun May 17 19:34:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.56 2020/05/16 18:31:45 christos Exp $	*/
+/*	$NetBSD: print.c,v 1.57 2020/05/17 23:34:11 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -37,13 +37,15 @@
 #if 0
 static char sccsid[] = "@(#)print.c	8.5 (Berkeley) 7/28/94";
 #else
-__RCSID("$NetBSD: print.c,v 1.56 2020/05/16 18:31:45 christos Exp $");
+__RCSID("$NetBSD: print.c,v 1.57 2020/05/17 23:34:11 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include 
 #include 
+#ifndef SMALL
 #include 
+#endif
 
 #include 
 #include 
@@ -69,7 +71,9 @@ static void	printlink(FTSENT *);
 static void	printtime(time_t);
 static void	printtotal(DISPLAY *dp);
 static int	printtype(u_int);
+#ifndef SMALL
 static void	aclmode(char *, const FTSENT *);
+#endif
 
 static time_t	now;
 
@@ -156,7 +160,9 @@ printlong(DISPLAY *dp)
 	

CVS commit: src/sys/miscfs/genfs

2020-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 18 19:42:16 UTC 2020

Modified Files:
src/sys/miscfs/genfs: genfs_vnops.c

Log Message:
Fix EPERM vs EACCES return.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/sys/miscfs/genfs/genfs_vnops.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/miscfs/genfs/genfs_vnops.c
diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.204 src/sys/miscfs/genfs/genfs_vnops.c:1.205
--- src/sys/miscfs/genfs/genfs_vnops.c:1.204	Sat May 16 14:31:51 2020
+++ src/sys/miscfs/genfs/genfs_vnops.c	Mon May 18 15:42:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_vnops.c,v 1.204 2020/05/16 18:31:51 christos Exp $	*/
+/*	$NetBSD: genfs_vnops.c,v 1.205 2020/05/18 19:42:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.204 2020/05/16 18:31:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.205 2020/05/18 19:42:16 christos Exp $");
 
 #include 
 #include 
@@ -695,7 +695,13 @@ genfs_can_access(vnode_t *vp, kauth_cred
 
 	KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0);
 	KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE));
-
+#ifdef ACL_DEBUG
+	char buf[128];
+	snprintb(buf, sizeof(buf), __VNODE_PERM_BITS, accmode);
+	printf("%s: %s cred_uid=%d cred_gid=%d file_uid=%d file_gid=%d\n",
+	__func__, buf, kauth_cred_geteuid(cred), kauth_cred_getegid(cred),
+	file_uid, file_gid);
+#endif
 	/*
 	 * Look for a normal, non-privileged way to access the file/directory
 	 * as requested.  If it exists, go with that.
@@ -713,7 +719,11 @@ genfs_can_access(vnode_t *vp, kauth_cred
 		if (file_mode & S_IWUSR)
 			dac_granted |= (VWRITE | VAPPEND);
 
-		return (accmode & dac_granted) == accmode ? 0 : EPERM;
+#ifdef ACL_DEBUG
+		printf("%s: owner %o %o\n", __func__,
+		accmode & dac_granted, accmode);
+#endif
+		goto privchk;
 	}
 
 	/* Otherwise, check the groups (first match) */
@@ -729,7 +739,11 @@ genfs_can_access(vnode_t *vp, kauth_cred
 		if (file_mode & S_IWGRP)
 			dac_granted |= (VWRITE | VAPPEND);
 
-		return (accmode & dac_granted) == accmode ? 0 : EACCES;
+#ifdef ACL_DEBUG
+		printf("%s: group %o %o\n", __func__,
+		accmode & dac_granted, accmode);
+#endif
+		goto privchk;
 	}
 
 	/* Otherwise, check everyone else. */
@@ -739,8 +753,16 @@ genfs_can_access(vnode_t *vp, kauth_cred
 		dac_granted |= VREAD;
 	if (file_mode & S_IWOTH)
 		dac_granted |= (VWRITE | VAPPEND);
-	return (accmode & dac_granted) == accmode ? 0 : EACCES;
-		return (0);
+
+#ifdef ACL_DEBUG
+	printf("%s: others %o %o\n", __func__,
+	accmode & dac_granted, accmode);
+#endif
+privchk:
+	if ((accmode & dac_granted) == accmode)
+		return 0;
+
+	return (accmode & VADMIN) ? EPERM : EACCES;
 }
 
 /*
@@ -1108,7 +1130,7 @@ genfs_can_access_acl_nfs4(vnode_t *vp, k
 #ifdef ACL_DEBUG
 	char buf[128];
 	snprintb(buf, sizeof(buf), __VNODE_PERM_BITS, accmode);
-	printf("%s: %s uid=%d gid=%d\n", __func__, buf, file_uid, file_gid);
+	printf("%s: %s file_uid=%d file_gid=%d\n", __func__, buf, file_uid, file_gid);
 #endif
 
 	if (accmode & VADMIN)



CVS commit: src/sys/miscfs/genfs

2020-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 18 19:55:42 UTC 2020

Modified Files:
src/sys/miscfs/genfs: genfs_vnops.c

Log Message:
remove debugging, it is just clutter.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/miscfs/genfs/genfs_vnops.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/miscfs/genfs/genfs_vnops.c
diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.205 src/sys/miscfs/genfs/genfs_vnops.c:1.206
--- src/sys/miscfs/genfs/genfs_vnops.c:1.205	Mon May 18 15:42:16 2020
+++ src/sys/miscfs/genfs/genfs_vnops.c	Mon May 18 15:55:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_vnops.c,v 1.205 2020/05/18 19:42:16 christos Exp $	*/
+/*	$NetBSD: genfs_vnops.c,v 1.206 2020/05/18 19:55:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.205 2020/05/18 19:42:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.206 2020/05/18 19:55:42 christos Exp $");
 
 #include 
 #include 
@@ -695,13 +695,7 @@ genfs_can_access(vnode_t *vp, kauth_cred
 
 	KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0);
 	KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE));
-#ifdef ACL_DEBUG
-	char buf[128];
-	snprintb(buf, sizeof(buf), __VNODE_PERM_BITS, accmode);
-	printf("%s: %s cred_uid=%d cred_gid=%d file_uid=%d file_gid=%d\n",
-	__func__, buf, kauth_cred_geteuid(cred), kauth_cred_getegid(cred),
-	file_uid, file_gid);
-#endif
+
 	/*
 	 * Look for a normal, non-privileged way to access the file/directory
 	 * as requested.  If it exists, go with that.
@@ -719,10 +713,6 @@ genfs_can_access(vnode_t *vp, kauth_cred
 		if (file_mode & S_IWUSR)
 			dac_granted |= (VWRITE | VAPPEND);
 
-#ifdef ACL_DEBUG
-		printf("%s: owner %o %o\n", __func__,
-		accmode & dac_granted, accmode);
-#endif
 		goto privchk;
 	}
 
@@ -739,10 +729,6 @@ genfs_can_access(vnode_t *vp, kauth_cred
 		if (file_mode & S_IWGRP)
 			dac_granted |= (VWRITE | VAPPEND);
 
-#ifdef ACL_DEBUG
-		printf("%s: group %o %o\n", __func__,
-		accmode & dac_granted, accmode);
-#endif
 		goto privchk;
 	}
 
@@ -754,10 +740,6 @@ genfs_can_access(vnode_t *vp, kauth_cred
 	if (file_mode & S_IWOTH)
 		dac_granted |= (VWRITE | VAPPEND);
 
-#ifdef ACL_DEBUG
-	printf("%s: others %o %o\n", __func__,
-	accmode & dac_granted, accmode);
-#endif
 privchk:
 	if ((accmode & dac_granted) == accmode)
 		return 0;
@@ -1127,12 +1109,6 @@ genfs_can_access_acl_nfs4(vnode_t *vp, k
 	VREAD_ACL | VWRITE_ACL | VWRITE_OWNER | VSYNCHRONIZE)) == 0);
 	KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE));
 
-#ifdef ACL_DEBUG
-	char buf[128];
-	snprintb(buf, sizeof(buf), __VNODE_PERM_BITS, accmode);
-	printf("%s: %s file_uid=%d file_gid=%d\n", __func__, buf, file_uid, file_gid);
-#endif
-
 	if (accmode & VADMIN)
 		must_be_owner = 1;
 



CVS commit: src/external/bsd/blacklist/bin

2020-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 19 00:56:25 UTC 2020

Modified Files:
src/external/bsd/blacklist/bin: blacklistd.conf.5

Log Message:
Typo fixes from FreeBSD via Ed Maste


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/blacklist/bin/blacklistd.conf.5

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/blacklist/bin/blacklistd.conf.5
diff -u src/external/bsd/blacklist/bin/blacklistd.conf.5:1.9 src/external/bsd/blacklist/bin/blacklistd.conf.5:1.10
--- src/external/bsd/blacklist/bin/blacklistd.conf.5:1.9	Wed Nov  6 15:33:30 2019
+++ src/external/bsd/blacklist/bin/blacklistd.conf.5	Mon May 18 20:56:25 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: blacklistd.conf.5,v 1.9 2019/11/06 20:33:30 para Exp $
+.\" $NetBSD: blacklistd.conf.5,v 1.10 2020/05/19 00:56:25 christos Exp $
 .\"
 .\" Copyright (c) 2015 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 June 5, 2017
+.Dd May 18, 2020
 .Dt BLACKLISTD.CONF 5
 .Os
 .Sh NAME
@@ -125,18 +125,18 @@ The second field is the socket
 .Dv dgram ,
 or numeric.
 The third field is the
-.Va prococol :
+.Va protocol :
 .Dv tcp ,
 .Dv udp ,
 .Dv tcp6 ,
 .Dv udp6 ,
 or numeric.
-The fourth file is the effective user
+The fourth field is the effective user
 .Va ( owner )
 of the daemon process reporting the event,
 either as a username or a userid.
 .Pp
-The rest of the fields are controlling the behavior of the filter.
+The rest of the fields control the behavior of the filter.
 .Pp
 The
 .Va name



CVS commit: src/distrib/sets/lists/comp

2020-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 19 19:15:06 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
put back extattr.3


To generate a diff of this commit:
cvs rdiff -u -r1.2328 -r1.2329 src/distrib/sets/lists/comp/mi

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2328 src/distrib/sets/lists/comp/mi:1.2329
--- src/distrib/sets/lists/comp/mi:1.2328	Sat May 16 15:05:05 2020
+++ src/distrib/sets/lists/comp/mi	Tue May 19 15:15:06 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2328 2020/05/16 19:05:05 christos Exp $
+#	$NetBSD: mi,v 1.2329 2020/05/19 19:15:06 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -7051,7 +7051,7 @@
 ./usr/share/man/cat3/explicit_memset.0		comp-c-catman		.cat
 ./usr/share/man/cat3/expm1.0			comp-c-catman		.cat
 ./usr/share/man/cat3/expm1f.0			comp-c-catman		.cat
-./usr/share/man/cat3/extattr.0			comp-obsolete		obsolete
+./usr/share/man/cat3/extattr.0			comp-c-catman		.cat
 ./usr/share/man/cat3/extattr_copy_fd.0		comp-c-catman		.cat
 ./usr/share/man/cat3/extattr_copy_file.0	comp-c-catman		.cat
 ./usr/share/man/cat3/extattr_copy_link.0	comp-c-catman		.cat
@@ -15171,7 +15171,7 @@
 ./usr/share/man/html3/explicit_memset.html	comp-c-htmlman		html
 ./usr/share/man/html3/expm1.html		comp-c-htmlman		html
 ./usr/share/man/html3/expm1f.html		comp-c-htmlman		html
-./usr/share/man/html3/extattr.html		comp-obsolete		obsolete
+./usr/share/man/html3/extattr.html		comp-c-htmlman		html
 ./usr/share/man/html3/extattr_copy_fd.html	comp-c-htmlman		html
 ./usr/share/man/html3/extattr_copy_file.html	comp-c-htmlman		html
 ./usr/share/man/html3/extattr_copy_link.html	comp-c-htmlman		html
@@ -23227,7 +23227,7 @@
 ./usr/share/man/man3/explicit_memset.3		comp-c-man		.man
 ./usr/share/man/man3/expm1.3			comp-c-man		.man
 ./usr/share/man/man3/expm1f.3			comp-c-man		.man
-./usr/share/man/man3/extattr.3			comp-obsolete		obsolete
+./usr/share/man/man3/extattr.3			comp-c-man		.man
 ./usr/share/man/man3/extattr_copy_fd.3		comp-c-man		.man
 ./usr/share/man/man3/extattr_copy_file.3	comp-c-man		.man
 ./usr/share/man/man3/extattr_copy_link.3	comp-c-man		.man



CVS commit: src/sys/ufs/ffs

2020-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 20 13:16:30 UTC 2020

Modified Files:
src/sys/ufs/ffs: ffs_extattr.c

Log Message:
remove accmode_t typedef (not needed, breaks llvm) from maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/ffs/ffs_extattr.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/ufs/ffs/ffs_extattr.c
diff -u src/sys/ufs/ffs/ffs_extattr.c:1.5 src/sys/ufs/ffs/ffs_extattr.c:1.6
--- src/sys/ufs/ffs/ffs_extattr.c:1.5	Sat May 16 14:31:53 2020
+++ src/sys/ufs/ffs/ffs_extattr.c	Wed May 20 09:16:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_extattr.c,v 1.5 2020/05/16 18:31:53 christos Exp $	*/
+/*	$NetBSD: ffs_extattr.c,v 1.6 2020/05/20 13:16:30 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-3-Clause)
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.5 2020/05/16 18:31:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.6 2020/05/20 13:16:30 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -121,7 +121,6 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_extattr.
 #define	lblkno(fs, o)		ffs_lblkno(fs, o)
 #define	blkoff(fs, o)		ffs_blkoff(fs, o)
 #define	sblksize(fs, o, lbn)	ffs_sblksize(fs, o, lbn)
-typedef mode_t accmode_t;	/* so that it breaks soon */
 typedef daddr_t ufs_lbn_t;
 #define msleep(chan, mtx, pri, wmesg, timeo) \
 mtsleep((chan), (pri), (wmesg), (timeo), *(mtx))



CVS commit: src/sys/ufs/chfs

2020-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 20 17:04:58 UTC 2020

Modified Files:
src/sys/ufs/chfs: chfs_vnops.c

Log Message:
fix accessx confusion (thanks hannken@)


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/ufs/chfs/chfs_vnops.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/ufs/chfs/chfs_vnops.c
diff -u src/sys/ufs/chfs/chfs_vnops.c:1.39 src/sys/ufs/chfs/chfs_vnops.c:1.40
--- src/sys/ufs/chfs/chfs_vnops.c:1.39	Sat May 16 14:31:53 2020
+++ src/sys/ufs/chfs/chfs_vnops.c	Wed May 20 13:04:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: chfs_vnops.c,v 1.39 2020/05/16 18:31:53 christos Exp $	*/
+/*	$NetBSD: chfs_vnops.c,v 1.40 2020/05/20 17:04:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -1663,7 +1663,7 @@ const struct vnodeopv_entry_desc chfs_sp
 		{ &vop_open_desc, spec_open },
 		{ &vop_close_desc, ufsspec_close },
 		{ &vop_access_desc, chfs_access },
-		{ &vop_accessx_desc, genfs_access },
+		{ &vop_accessx_desc, genfs_accessx },
 		{ &vop_getattr_desc, chfs_getattr },
 		{ &vop_setattr_desc, chfs_setattr },
 		{ &vop_read_desc, chfs_read },
@@ -1720,7 +1720,7 @@ const struct vnodeopv_entry_desc chfs_fi
 		{ &vop_open_desc, vn_fifo_bypass },
 		{ &vop_close_desc, ufsfifo_close },
 		{ &vop_access_desc, chfs_access },
-		{ &vop_accessx_desc, genfs_access },
+		{ &vop_accessx_desc, genfs_accessx },
 		{ &vop_getattr_desc, chfs_getattr },
 		{ &vop_setattr_desc, chfs_setattr },
 		{ &vop_read_desc, ufsfifo_read },



CVS commit: src/sys/miscfs/genfs

2020-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 20 17:06:15 UTC 2020

Modified Files:
src/sys/miscfs/genfs: genfs_vnops.c

Log Message:
Fix EPERM vs EACCES on chtimes (thanks @hannken)


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/miscfs/genfs/genfs_vnops.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/miscfs/genfs/genfs_vnops.c
diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.206 src/sys/miscfs/genfs/genfs_vnops.c:1.207
--- src/sys/miscfs/genfs/genfs_vnops.c:1.206	Mon May 18 15:55:42 2020
+++ src/sys/miscfs/genfs/genfs_vnops.c	Wed May 20 13:06:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_vnops.c,v 1.206 2020/05/18 19:55:42 christos Exp $	*/
+/*	$NetBSD: genfs_vnops.c,v 1.207 2020/05/20 17:06:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.206 2020/05/18 19:55:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.207 2020/05/20 17:06:15 christos Exp $");
 
 #include 
 #include 
@@ -1320,7 +1320,7 @@ genfs_can_chtimes(vnode_t *vp, kauth_cre
 	 * server time.
 	 */
 	if ((error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred)) != 0)
-		return (error);
+		return (vaflags & VA_UTIMES_NULL) == 0 ? EPERM : EACCES;
 
 	/* Must be owner, or... */
 	if (kauth_cred_geteuid(cred) == owner_uid)



CVS commit: src/lib/libc/rpc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 10:03:34 UTC 2017

Modified Files:
src/lib/libc/rpc: getnetconfig.c

Log Message:
Revert previous since it causes a double free (p->nc_netid == tmp == tmp2).
>From Xin Li @ FreeBSD.
XXX: pullup 7


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/rpc/getnetconfig.c

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

Modified files:

Index: src/lib/libc/rpc/getnetconfig.c
diff -u src/lib/libc/rpc/getnetconfig.c:1.24 src/lib/libc/rpc/getnetconfig.c:1.25
--- src/lib/libc/rpc/getnetconfig.c:1.24	Wed Oct 26 11:39:30 2016
+++ src/lib/libc/rpc/getnetconfig.c	Fri Jun 30 06:03:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: getnetconfig.c,v 1.24 2016/10/26 15:39:30 christos Exp $	*/
+/*	$NetBSD: getnetconfig.c,v 1.25 2017/06/30 10:03:34 christos Exp $	*/
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -36,7 +36,7 @@
 #if 0
 staticchar sccsid[] = "@(#)getnetconfig.c	1.12 91/12/19 SMI";
 #else
-__RCSID("$NetBSD: getnetconfig.c,v 1.24 2016/10/26 15:39:30 christos Exp $");
+__RCSID("$NetBSD: getnetconfig.c,v 1.25 2017/06/30 10:03:34 christos Exp $");
 #endif
 #endif
 
@@ -649,12 +649,12 @@ static struct netconfig *
 dup_ncp(struct netconfig *ncp)
 {
 	struct netconfig	*p;
-	char	*tmp, *tmp2;
+	char	*tmp;
 	u_int	i;
 
 	_DIAGASSERT(ncp != NULL);
 
-	if ((tmp2 = tmp = malloc(MAXNETCONFIGLINE)) == NULL)
+	if ((tmp = malloc(MAXNETCONFIGLINE)) == NULL)
 		return NULL;
 	if ((p = malloc(sizeof(*p))) == NULL) {
 		free(tmp);
@@ -679,7 +679,6 @@ dup_ncp(struct netconfig *ncp)
 	p->nc_device = strcpy(tmp, ncp->nc_device);
 	p->nc_lookups = calloc((size_t)(p->nc_nlookups + 1), sizeof(char *));
 	if (p->nc_lookups == NULL) {
-		free(tmp2);
 		free(p->nc_netid);
 		free(p);
 		return NULL;



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

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:32:34 UTC 2017

Modified Files:
src/external/bsd/bind/dist: CHANGES README srcid version
src/external/bsd/bind/dist/doc/arm: Bv9ARM.ch04.html Bv9ARM.ch06.html
Bv9ARM.ch07.html Bv9ARM.ch08.html Bv9ARM.ch09.html Bv9ARM.html
Bv9ARM.pdf man.arpaname.html man.ddns-confgen.html man.delv.html
man.dig.html man.dnssec-checkds.html man.dnssec-coverage.html
man.dnssec-dsfromkey.html man.dnssec-importkey.html
man.dnssec-keyfromlabel.html man.dnssec-keygen.html
man.dnssec-revoke.html man.dnssec-settime.html
man.dnssec-signzone.html man.dnssec-verify.html man.genrandom.html
man.host.html man.isc-hmac-fixup.html man.named-checkconf.html
man.named-checkzone.html man.named-journalprint.html
man.named-rrchecker.html man.named.html man.nsec3hash.html
man.nsupdate.html man.rndc-confgen.html man.rndc.conf.html
man.rndc.html
src/external/bsd/bind/dist/lib/dns: api dnssec.c message.c rootns.c
tsig.c

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/external/bsd/bind/dist/CHANGES
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/bind/dist/README
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/bind/dist/srcid
cvs rdiff -u -r1.25 -r1.26 src/external/bsd/bind/dist/version
cvs rdiff -u -r1.15 -r1.16 \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch04.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch06.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch07.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch08.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch09.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.html \
src/external/bsd/bind/dist/doc/arm/man.arpaname.html \
src/external/bsd/bind/dist/doc/arm/man.ddns-confgen.html \
src/external/bsd/bind/dist/doc/arm/man.delv.html \
src/external/bsd/bind/dist/doc/arm/man.dig.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-checkds.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-coverage.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-dsfromkey.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-importkey.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-keyfromlabel.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-keygen.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-revoke.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-settime.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-signzone.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-verify.html \
src/external/bsd/bind/dist/doc/arm/man.genrandom.html \
src/external/bsd/bind/dist/doc/arm/man.host.html \
src/external/bsd/bind/dist/doc/arm/man.isc-hmac-fixup.html \
src/external/bsd/bind/dist/doc/arm/man.named-checkconf.html \
src/external/bsd/bind/dist/doc/arm/man.named-checkzone.html \
src/external/bsd/bind/dist/doc/arm/man.named-journalprint.html \
src/external/bsd/bind/dist/doc/arm/man.named-rrchecker.html \
src/external/bsd/bind/dist/doc/arm/man.named.html \
src/external/bsd/bind/dist/doc/arm/man.nsec3hash.html \
src/external/bsd/bind/dist/doc/arm/man.nsupdate.html \
src/external/bsd/bind/dist/doc/arm/man.rndc-confgen.html \
src/external/bsd/bind/dist/doc/arm/man.rndc.conf.html \
src/external/bsd/bind/dist/doc/arm/man.rndc.html
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/bind/dist/doc/arm/Bv9ARM.pdf
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/bind/dist/lib/dns/api
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/bind/dist/lib/dns/dnssec.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/bind/dist/lib/dns/message.c
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/bind/dist/lib/dns/rootns.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/bind/dist/lib/dns/tsig.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/bind/dist/CHANGES
diff -u src/external/bsd/bind/dist/CHANGES:1.27 src/external/bsd/bind/dist/CHANGES:1.28
--- src/external/bsd/bind/dist/CHANGES:1.27	Thu Jun 15 11:59:35 2017
+++ src/external/bsd/bind/dist/CHANGES	Fri Jun 30 07:32:33 2017
@@ -1,3 +1,11 @@
+	--- 9.10.5-P2 released ---
+
+4643.	[security]	An error in TSIG handling could permit unauthorized
+			zone transfers or zone updates. (CVE-2017-3142)
+			(CVE-2017-3143) [RT #45383]
+
+4633.	[maint]		Updated  (2001:500:200::b) for B.ROOT-SERVERS.NET.
+
 	--- 9.10.5-P1 released ---
 
 4632.	[security]	The BIND installer on Windows used an unquoted

Index: src/external/bsd/bind/dist/README
diff -u src/external/bsd/bind/dist/README:1.15 src/external/bsd/bind/dist/README:1.16
--- src/external/bsd/bind/dist/README:1.15	Thu Jun 15 11:59:36 2017
+++ src/external/bsd/bind/dist/README	Fri Jun 30 07:32:33 2017
@@ -51,6 +51,11 @@ BIND 9
 	For up-t

CVS commit: src/doc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:52:32 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new bind.


To generate a diff of this commit:
cvs rdiff -u -r1.1454 -r1.1455 src/doc/3RDPARTY
cvs rdiff -u -r1.2293 -r1.2294 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1454 src/doc/3RDPARTY:1.1455
--- src/doc/3RDPARTY:1.1454	Sat Jun 17 18:06:54 2017
+++ src/doc/3RDPARTY	Fri Jun 30 07:52:32 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1454 2017/06/17 22:06:54 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1455 2017/06/30 11:52:32 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -114,8 +114,8 @@ Notes:
 bc includes dc, both of which are in the NetBSD tree.
 
 Package:	bind [named and utils]
-Version:	9.10.5-P1/BSD	9.11.1-P1/MPL
-Current Vers:	9.10.5-P1/BSD
+Version:	9.10.5-P2/BSD	9.11.1-P1/MPL
+Current Vers:	9.10.5-P2/BSD
 Maintainer:	Paul Vixie 
 Archive Site:	ftp://ftp.isc.org/isc/bind9/
 Home Page:	http://www.isc.org/software/bind/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2293 src/doc/CHANGES:1.2294
--- src/doc/CHANGES:1.2293	Sat Jun 17 18:06:54 2017
+++ src/doc/CHANGES	Fri Jun 30 07:52:32 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2293 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2294 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -528,3 +528,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 		only those attached at pcppi [nat 20170612]
 	bind: Import version 9.10.5-P1. [christos 20170615]
 	expat: Import 2.2.1 (security fixes) [christos 20170617]
+	bind: Import version 9.10.5-P2. [christos 20170630]



CVS commit: src/doc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:55:56 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
remove merge conflict part.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2294 src/doc/CHANGES:1.2295
--- src/doc/CHANGES:1.2294	Fri Jun 30 07:52:32 2017
+++ src/doc/CHANGES	Fri Jun 30 07:55:56 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2294 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2295 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -23,509 +23,11 @@
 #
 # 
 
-<<< CHANGES
-
-Changes from NetBSD 7.0 to NetBSD 8.0:
-	libc: Update to tzcode2014f. [christos 20140815]
-	gmake:	Update to gmake-3.81 in external/gpl2/gmake and remove 
-		gnu/dist/gmake (3.80) [christos 20140818]
-	module(7): Create MODULAR_DEFAULT_AUTOLOAD config flag to control
-		whether module autoloading is on by default.
-		[jnemeth 20140824]
-	kernel: Option SYMTAB_SPACE has been replaced with COPY_SYMTAB.
-		The related changes to src/sys/conf require a rebuild of
-		config(1). [joerg 20140824]
-	zoneinfo: Import tzdata2014g. [apb 20140831]
-	wm(4): Add internal SERDES support for 82575 and newer controllers.
-		[msaitoh 20140903]
-	or1k: Add new port.  [matt 20140903]
-	awindma(4): Add support for Allwinner A10/A20 DMA controller.
-		[jmcneill 20140906]
-	awinac(4): Add support for Allwinner A10/A20 audio codec.
-		[jmcneill 20140906]
-	awinrtc(4): Add support for Allwinner A10/A20 real-time clock.
-		[jmcneill 20140907]
-	awinmmc(4): Use DMA for MMC transfers. [jmcneill 20140908]
-	axp20x(4): Add AXP20x PMU driver. [jmcneill 20140909]
-	rtsol(8): Removed in favour of dhcpcd. [roy 20140911]
-	rtsold(8): Removed in favour of dhcpcd. [roy 20140911]
-	dhcpcd(8): Import dhcpcd-6.4.5. [roy 20140918]
-	arm: Add support for i.MX6 SoC. [ryo 20140925]
-	gpt(8): Completed overhaul, including adding follwing subcommands:
-		resize, set, unset, backup, restore, and resizedisk.
-		[jnemeth 20140926]
-	dhcpcd(8): Import dhcpcd-6.4.7. [roy 20140927]
-	mpt(4): added bio(4) support. [jmcneill 20140927]
-	gpt(8): added type subcommand to modify partition type.
-		[jnemeth 20140927]
-	zoneinfo: Import tzdata2014h. [apb 20141004]
-	dhcpcd(8): Import dhcpcd-6.5.0. [roy 20141006]
-	libc: Update to tzcode2014h. [christos 20141007]
-	file(1): Upgraded to 5.20. [christos 20141010]
-	arm: Add support for Allwinner A31 SoC. [jmcneill 20141010]
-	awiniic(4): Add support for Allwinner A31 SoC. [jmcneill 20141012]
-	awinp2wi(4): Add support for Allwinner A31 Push-Pull Two Wire
-		Interface. [jmcneill 20141012]
-	axp22x(4): Add AXP22x PMU driver. [jmcneill 20141012]
-	awinrtc(4): Add support for Allwinner A31 real-time clock.
-		[jmcneill 20141012]
-	awindma(4): Add support for Allwinner A31 DMA controller.
-		[jmcneill 20141013]
-	awinac(4): Add support for Allwinner A31 audio codec.
-		[jmcneill 20141013]
-	motg(4): Add support for Allwinner A10/A20 SoC. [jmcneill 20141015]
-	wpa: Import wpa_supplicant and hostapd 2.3. [christos 20141016]
-	dhcpcd(8): Import dhcpcd-6.5.1. [roy 20141018]
-	OpenSSH: Imported 6.7. [christos 20141018]
-	resolvconf(8): Import openresolv-3.6.0 [roy 20141020]
-	gcc: Support -fsanitize=address [christos 20141022]
-	zoneinfo: Import tzdata2014i. [apb 20141023]
-	libc: Update to tzcode2014i. [christos 20141023]
-	openpam(3): update to 20140912 (ourouparia) [christos 20141024]
-	pppd(8): updated to version 2.4.7. [christos 20141025]
-	acpi(4): Updated ACPICA to 20140926. [christos 20141025]
-	dhcpcd(8): Import dhcpcd-6.6.0 [roy 20141029]
-	resolvconf(8): Import openresolv-3.6.1 [roy 20141029]
-	rtsx(4): Add support for Realtek RTS5227/RTL8402/RTL8411/RTL8411B.
-		[nonaka 20141029]
-	flex(1): Import flex-2.5.37 [christos 20141029]
-	iwn(4): Add support for Intel Centrino Wireless-N
-		100/105/130/135/2200/2230. From OpenBSD. [nonaka 20141030]
-	awge(4): Add support for gigabit ethernet found on various
-		Allwinner SOCs. [martin 20141101]
-	dhcpcd(8): Import dhcpcd-6.6.1. [roy 20141107]
-	awinhdmi(4): Add support for Allwinner A20/A31 HDMI controller.
-		[jmcneill 20141110]
-	awintcon(4): Add support for Allwinner A20/A31 TV/LCD controller.
-		[jmcneill 20141110]
-	awindebe(4): Add support for Allwinner A20/A31 Display engine
-		backend (DE-BE). [jmcneill 20141110]
-	awinhdmiaudio(4): Add support for Allwinner A20/A31 HDMI audio
-		controller. [jmcneill 2014]
-	dhcpcd(8): Import dhcpcd-6.6.2. [roy 20141114]
-	awinir(4): Add support for Allwinner A20/A31 IR receiver.
-		[jmcneill 20141115]
-	zoneinfo: Import tzdata2014j. [apb 20141116]
-	libc: Change arc4random(3) to use ChaCha20 and per-thread state.
-		[riastradh 

CVS commit: src/sys/net

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 18:28:31 UTC 2017

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

Log Message:
Avoid DIAGNOSTIC warning with previous fix and simplify it (don't require
memory alloc/free).


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/net/rtsock.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.225 src/sys/net/rtsock.c:1.226
--- src/sys/net/rtsock.c:1.225	Fri Jun 30 05:11:22 2017
+++ src/sys/net/rtsock.c	Fri Jun 30 14:28:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.225 2017/06/30 09:11:22 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.226 2017/06/30 18:28:31 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.225 2017/06/30 09:11:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.226 2017/06/30 18:28:31 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -721,6 +721,24 @@ out:
 	return error;
 }
 
+static socklen_t
+sa_addrlen(const struct sockaddr *sa)
+{
+
+	switch (sa->sa_family) {
+#ifdef INET
+	case AF_INET:
+		return sizeof(struct sockaddr_in);
+#endif
+#ifdef INET6
+	case AF_INET6:
+		return sizeof(struct sockaddr_in6);
+#endif
+	default:
+		return 0;
+	}
+}
+
 /*ARGSUSED*/
 int
 COMPATNAME(route_output)(struct mbuf *m, struct socket *so)
@@ -736,7 +754,7 @@ COMPATNAME(route_output)(struct mbuf *m,
 	struct sockaddr_dl sdl;
 	int bound = curlwp_bind();
 	bool do_rt_free = false;
-	struct sockaddr *netmask = NULL;
+	struct sockaddr_storage netmask;
 
 #define senderr(e) do { error = e; goto flush;} while (/*CONSTCOND*/ 0)
 	if (m == NULL || ((m->m_len < sizeof(int32_t)) &&
@@ -796,36 +814,18 @@ COMPATNAME(route_output)(struct mbuf *m,
 
 	/*
 	 * route(8) passes a sockaddr truncated with prefixlen.
-	 * The kernel doesn't expect such sockaddr and need to restore
-	 * the original length of the sockaddr.
+	 * The kernel doesn't expect such sockaddr and need to 
+	 * use a buffer that is big enough for the sockaddr expected
+	 * (padded with 0's). We keep the original length of the sockaddr.
 	 */
 	if (info.rti_info[RTAX_NETMASK]) {
-		size_t sa_len = 0;
-		int af = info.rti_info[RTAX_NETMASK]->sa_family;
-
-		switch (af) {
-#ifdef INET
-		case AF_INET:
-			sa_len = sizeof(struct sockaddr_in);
-			break;
-#endif
-#ifdef INET6
-		case AF_INET6:
-			sa_len = sizeof(struct sockaddr_in6);
-			break;
-#endif
-		default:
-			break;
-		}
-		if (sa_len != 0 &&
-		sa_len > info.rti_info[RTAX_NETMASK]->sa_len) {
-			netmask = sockaddr_alloc(af, sa_len, M_WAITOK|M_ZERO);
-			sockaddr_copy(netmask,
-			info.rti_info[RTAX_NETMASK]->sa_len,
-			info.rti_info[RTAX_NETMASK]);
-			/* Restore original sa_len */
-			netmask->sa_len = info.rti_info[RTAX_NETMASK]->sa_len;
-			info.rti_info[RTAX_NETMASK] = netmask;
+		socklen_t sa_len = sa_addrlen(info.rti_info[RTAX_NETMASK]);
+		socklen_t masklen = info.rti_info[RTAX_NETMASK]->sa_len;
+		if (sa_len != 0 && sa_len > masklen) {
+			KASSERT(sa_len <= sizeof(netmask));
+			memcpy(&netmask, info.rti_info[RTAX_NETMASK], masklen);
+			memset((char *)&netmask + masklen, 0, sa_len - masklen);
+			info.rti_info[RTAX_NETMASK] = sstocsa(&netmask);
 		}
 	}
 
@@ -1067,8 +1067,6 @@ flush:
 }
 out:
 	curlwp_bindx(bound);
-	if (netmask)
-		sockaddr_free(netmask);
 	return error;
 }
 



CVS commit: src/lib/libexecinfo

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 21:39:43 UTC 2017

Modified Files:
src/lib/libexecinfo: execinfo.h

Log Message:
make this standalone.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libexecinfo/execinfo.h

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

Modified files:

Index: src/lib/libexecinfo/execinfo.h
diff -u src/lib/libexecinfo/execinfo.h:1.2 src/lib/libexecinfo/execinfo.h:1.3
--- src/lib/libexecinfo/execinfo.h:1.2	Sat Jun  9 17:22:17 2012
+++ src/lib/libexecinfo/execinfo.h	Fri Jun 30 17:39:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: execinfo.h,v 1.2 2012/06/09 21:22:17 christos Exp $	*/
+/*	$NetBSD: execinfo.h,v 1.3 2017/06/30 21:39:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,14 @@
 #ifndef _EXECINFO_H_
 #define _EXECINFO_H_
 
-#include 
+#include 
+#include 
+#include 
+  
+#ifdef  _BSD_SIZE_T_
+typedef _BSD_SIZE_T_size_t;
+#undef  _BSD_SIZE_T_
+#endif
 
 __BEGIN_DECLS
 size_t backtrace(void **, size_t);



CVS commit: src/sys

2017-07-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul  1 16:59:12 UTC 2017

Modified Files:
src/sys/kern: uipc_domain.c
src/sys/net: rtsock.c
src/sys/sys: socket.h

Log Message:
put the code that returns the sizeof the socket by family in one place.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/kern/uipc_domain.c
cvs rdiff -u -r1.226 -r1.227 src/sys/net/rtsock.c
cvs rdiff -u -r1.122 -r1.123 src/sys/sys/socket.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/kern/uipc_domain.c
diff -u src/sys/kern/uipc_domain.c:1.96 src/sys/kern/uipc_domain.c:1.97
--- src/sys/kern/uipc_domain.c:1.96	Tue Dec  2 14:45:58 2014
+++ src/sys/kern/uipc_domain.c	Sat Jul  1 12:59:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_domain.c,v 1.96 2014/12/02 19:45:58 christos Exp $	*/
+/*	$NetBSD: uipc_domain.c,v 1.97 2017/07/01 16:59:12 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.96 2014/12/02 19:45:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.97 2017/07/01 16:59:12 christos Exp $");
 
 #include 
 #include 
@@ -228,7 +228,7 @@ sockaddr_const_addr(const struct sockadd
 }
 
 const struct sockaddr *
-sockaddr_any_by_family(int family)
+sockaddr_any_by_family(sa_family_t family)
 {
 	const struct domain *dom;
 
@@ -255,43 +255,41 @@ sockaddr_anyaddr(const struct sockaddr *
 	return sockaddr_const_addr(any, slenp);
 }
 
-#ifdef DIAGNOSTIC
-static void
-sockaddr_checklen(const struct sockaddr *sa)
+socklen_t
+sockaddr_getsize_by_family(sa_family_t af)
 {
-	socklen_t len = 0;
-	switch (sa->sa_family) {
+	switch (af) {
 	case AF_INET:
-		len = sizeof(struct sockaddr_in);
-		break;
+		return sizeof(struct sockaddr_in);
 	case AF_INET6:
-		len = sizeof(struct sockaddr_in6);
-		break;
+		return sizeof(struct sockaddr_in6);
 	case AF_UNIX:
-		len = sizeof(struct sockaddr_un);
-		break;
+		return sizeof(struct sockaddr_un);
 	case AF_LINK:
-		len = sizeof(struct sockaddr_dl);
-		// As long as it is not 0...
-		if (sa->sa_len != 0)
-			return;
-		break;
+		return sizeof(struct sockaddr_dl);
 	case AF_APPLETALK:
-		len = sizeof(struct sockaddr_at);
-		break;
+		return sizeof(struct sockaddr_at);
 	default:
-		printf("%s: Unhandled af=%hhu socklen=%hhu\n", __func__,
-		sa->sa_family, sa->sa_len);
-		return;
-	}
-	if (len != sa->sa_len) {
-		char buf[512];
-		sockaddr_format(sa, buf, sizeof(buf));
-		printf("%s: %p bad len af=%hhu socklen=%hhu len=%u [%s]\n",
-		__func__, sa, sa->sa_family, sa->sa_len,
-		(unsigned)len, buf);
+#ifdef DIAGNOSTIC
+		printf("%s: Unhandled address family=%hhu\n", __func__, af);
+#endif
+		return 0;
 	}
 }
+
+#ifdef DIAGNOSTIC
+static void
+sockaddr_checklen(const struct sockaddr *sa)
+{
+	socklen_t len = sockaddr_getsize_by_family(sa->sa_family);
+	if (len == 0 || len == sa->sa_len)
+		return;
+
+	char buf[512];
+	sockaddr_format(sa, buf, sizeof(buf));
+	printf("%s: %p bad len af=%hhu socklen=%hhu len=%u [%s]\n",
+	__func__, sa, sa->sa_family, sa->sa_len, (unsigned)len, buf);
+}
 #else
 #define sockaddr_checklen(sa) ((void)0)
 #endif

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.226 src/sys/net/rtsock.c:1.227
--- src/sys/net/rtsock.c:1.226	Fri Jun 30 14:28:31 2017
+++ src/sys/net/rtsock.c	Sat Jul  1 12:59:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.226 2017/06/30 18:28:31 christos Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.227 2017/07/01 16:59:12 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.226 2017/06/30 18:28:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.227 2017/07/01 16:59:12 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -721,24 +721,6 @@ out:
 	return error;
 }
 
-static socklen_t
-sa_addrlen(const struct sockaddr *sa)
-{
-
-	switch (sa->sa_family) {
-#ifdef INET
-	case AF_INET:
-		return sizeof(struct sockaddr_in);
-#endif
-#ifdef INET6
-	case AF_INET6:
-		return sizeof(struct sockaddr_in6);
-#endif
-	default:
-		return 0;
-	}
-}
-
 /*ARGSUSED*/
 int
 COMPATNAME(route_output)(struct mbuf *m, struct socket *so)
@@ -819,8 +801,10 @@ COMPATNAME(route_output)(struct mbuf *m,
 	 * (padded with 0's). We keep the original length of the sockaddr.
 	 */
 	if (info.rti_info[RTAX_NETMASK]) {
-		socklen_t sa_len = sa_addrlen(info.rti_info[RTAX_NETMASK]);
-		socklen_t masklen = info.rti_info[RTAX_NETMASK]->sa_len;
+		socklen_t sa_len = sockaddr_getsize_by_family(
+		info.rti_info[RTAX_NETMASK]->sa_family);
+		socklen_t masklen = sockaddr_getlen(
+		info.rti_info[RTAX_NETMASK]);
 		if (sa_len != 0 && sa_len > masklen) {
 			KASSERT(sa_len <= sizeof(netmask));
 			memcpy(&netmask, info.rti_info[RTAX_NETMASK], masklen);

Index: src/sys/sys/socket.h
diff -u src/sys/sys/socket.

CVS commit: src/sys/miscfs/genfs

2017-07-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul  1 20:07:00 UTC 2017

Modified Files:
src/sys/miscfs/genfs: genfs_vnops.c

Log Message:
Provide EVFILT_WRITE; this is what FreeBSD does and go wants it.
Makes go unit tests pass.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/miscfs/genfs/genfs_vnops.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/miscfs/genfs/genfs_vnops.c
diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.197 src/sys/miscfs/genfs/genfs_vnops.c:1.198
--- src/sys/miscfs/genfs/genfs_vnops.c:1.197	Sun Jun  4 04:02:26 2017
+++ src/sys/miscfs/genfs/genfs_vnops.c	Sat Jul  1 16:07:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_vnops.c,v 1.197 2017/06/04 08:02:26 hannken Exp $	*/
+/*	$NetBSD: genfs_vnops.c,v 1.198 2017/07/01 20:07:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.197 2017/06/04 08:02:26 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.198 2017/07/01 20:07:00 christos Exp $");
 
 #include 
 #include 
@@ -500,6 +500,32 @@ filt_genfsread(struct knote *kn, long hi
 }
 
 static int
+filt_genfswrite(struct knote *kn, long hint)
+{
+	struct vnode *vp = (struct vnode *)kn->kn_hook;
+
+	/*
+	 * filesystem is gone, so set the EOF flag and schedule
+	 * the knote for deletion.
+	 */
+	switch (hint) {
+	case NOTE_REVOKE:
+		KASSERT(mutex_owned(vp->v_interlock));
+		kn->kn_flags |= (EV_EOF | EV_ONESHOT);
+		return (1);
+	case 0:
+		mutex_enter(vp->v_interlock);
+		kn->kn_data = 0;
+		mutex_exit(vp->v_interlock);
+		return 1;
+	default:
+		KASSERT(mutex_owned(vp->v_interlock));
+		kn->kn_data = 0;
+		return 1;
+	}
+}
+
+static int
 filt_genfsvnode(struct knote *kn, long hint)
 {
 	struct vnode *vp = (struct vnode *)kn->kn_hook;
@@ -530,6 +556,8 @@ filt_genfsvnode(struct knote *kn, long h
 
 static const struct filterops genfsread_filtops =
 	{ 1, NULL, filt_genfsdetach, filt_genfsread };
+static const struct filterops genfswrite_filtops =
+	{ 1, NULL, filt_genfsdetach, filt_genfswrite };
 static const struct filterops genfsvnode_filtops =
 	{ 1, NULL, filt_genfsdetach, filt_genfsvnode };
 
@@ -549,6 +577,9 @@ genfs_kqfilter(void *v)
 	case EVFILT_READ:
 		kn->kn_fop = &genfsread_filtops;
 		break;
+	case EVFILT_WRITE:
+		kn->kn_fop = &genfswrite_filtops;
+		break;
 	case EVFILT_VNODE:
 		kn->kn_fop = &genfsvnode_filtops;
 		break;



CVS commit: src/sys

2017-07-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul  1 20:08:56 UTC 2017

Modified Files:
src/sys/kern: kern_event.c
src/sys/sys: event.h

Log Message:
fix file descriptor locking (from joerg).
fixes kernel crashes by running go
XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/kern/kern_event.c
cvs rdiff -u -r1.29 -r1.30 src/sys/sys/event.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/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.91 src/sys/kern/kern_event.c:1.92
--- src/sys/kern/kern_event.c:1.91	Thu May 11 19:50:17 2017
+++ src/sys/kern/kern_event.c	Sat Jul  1 16:08:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.91 2017/05/11 23:50:17 christos Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.92 2017/07/01 20:08:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.91 2017/05/11 23:50:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.92 2017/07/01 20:08:56 christos Exp $");
 
 #include 
 #include 
@@ -1021,8 +1021,9 @@ kqueue_register(struct kqueue *kq, struc
 			if (error != 0) {
 #ifdef DIAGNOSTIC
 
-printf("%s: event not supported for file type"
-" %d (error %d)\n", __func__, kn->kn_obj ?
+printf("%s: event type %d not supported for "
+"file type %d (error %d)\n", __func__,
+kn->kn_filter, kn->kn_obj ?
 ((file_t *)kn->kn_obj)->f_type : -1, error);
 #endif
 /* knote_detach() drops fdp->fd_lock */
@@ -1204,10 +1205,19 @@ kqueue_scan(file_t *fp, size_t maxevents
 	error = 0;
 			}
 		}
+		mutex_spin_exit(&kq->kq_lock);
 	} else {
 		/* mark end of knote list */
 		TAILQ_INSERT_TAIL(&kq->kq_head, marker, kn_tqe);
 
+		/*
+		 * Acquire the fdp->fd_lock interlock to avoid races with
+		 * file creation/destruction from other threads.
+		 */
+		mutex_spin_exit(&kq->kq_lock);
+		mutex_enter(&fdp->fd_lock);
+		mutex_spin_enter(&kq->kq_lock);
+
 		while (count != 0) {
 			kn = TAILQ_FIRST(&kq->kq_head);	/* get next knote */
 			while ((kn->kn_status & KN_MARKER) != 0) {
@@ -1218,6 +1228,7 @@ kqueue_scan(file_t *fp, size_t maxevents
 	(timeout = gettimeleft(&ats,
 	&sleepts)) <= 0))
 		goto done;
+	mutex_exit(&fdp->fd_lock);
 	goto retry;
 }
 /* someone else's marker. */
@@ -1239,6 +1250,7 @@ kqueue_scan(file_t *fp, size_t maxevents
 KASSERT(kn->kn_fop != NULL);
 KASSERT(kn->kn_fop->f_event != NULL);
 KERNEL_LOCK(1, NULL);		/* XXXSMP */
+KASSERT(mutex_owned(&fdp->fd_lock));
 rv = (*kn->kn_fop->f_event)(kn, 0);
 KERNEL_UNLOCK_ONE(NULL);	/* XXXSMP */
 mutex_spin_enter(&kq->kq_lock);
@@ -1261,10 +1273,10 @@ kqueue_scan(file_t *fp, size_t maxevents
 			nkev++;
 			if (kn->kn_flags & EV_ONESHOT) {
 /* delete ONESHOT events after retrieval */
-mutex_spin_exit(&kq->kq_lock);
-mutex_enter(&fdp->fd_lock);
 kn->kn_status &= ~KN_BUSY;
+mutex_spin_exit(&kq->kq_lock);
 knote_detach(kn, fdp, true);
+mutex_enter(&fdp->fd_lock);
 mutex_spin_enter(&kq->kq_lock);
 			} else if (kn->kn_flags & EV_CLEAR) {
 /* clear state after retrieval */
@@ -1286,9 +1298,11 @@ kqueue_scan(file_t *fp, size_t maxevents
 			if (nkev == kevcnt) {
 /* do copyouts in kevcnt chunks */
 mutex_spin_exit(&kq->kq_lock);
+mutex_exit(&fdp->fd_lock);
 error = (*keops->keo_put_events)
 (keops->keo_private,
 kevbuf, ulistp, nevents, nkev);
+mutex_enter(&fdp->fd_lock);
 mutex_spin_enter(&kq->kq_lock);
 nevents += nkev;
 nkev = 0;
@@ -1301,9 +1315,10 @@ kqueue_scan(file_t *fp, size_t maxevents
 break;
 			}
 		}
-	}
  done:
- 	mutex_spin_exit(&kq->kq_lock);
+		mutex_spin_exit(&kq->kq_lock);
+		mutex_exit(&fdp->fd_lock);
+	}
 	if (nkev != 0) {
 		/* copyout remaining events */
 		error = (*keops->keo_put_events)(keops->keo_private,

Index: src/sys/sys/event.h
diff -u src/sys/sys/event.h:1.29 src/sys/sys/event.h:1.30
--- src/sys/sys/event.h:1.29	Wed Jun 14 12:37:05 2017
+++ src/sys/sys/event.h	Sat Jul  1 16:08:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: event.h,v 1.29 2017/06/14 16:37:05 christos Exp $	*/
+/*	$NetBSD: event.h,v 1.30 2017/07/01 20:08:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon 
@@ -188,10 +188,10 @@ struct knote {
 	TAILQ_ENTRY(knote)	kn_tqe;		/* q: for struct kqueue */
 	struct kqueue		*kn_kq;		/* q: which queue we are on */
 	struct kevent		kn_kevent;
-	uint32_t		kn_status;
-	uint32_t		kn_sfflags;	/*   saved filter flags */
-	uintptr_t		kn_sdata;	/*   saved data field */
-	void			*kn_obj;	/*   pointer to monitored obj */
+	uint32_t		kn_status;	/* q: flags below */
+	uint32_t		kn_sfflags;	/*saved filter flags */
+	uintptr_t		kn_sdata;	/*saved data field */
+	void			*kn_obj;	/*monitored obj */
 	const struct filter

CVS commit: src/sys/kern

2017-07-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 02:39:18 UTC 2017

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

Log Message:
don't warn about AF_LINK sockets with sa_len less than the size of the sockaddr


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/kern/uipc_domain.c

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

Modified files:

Index: src/sys/kern/uipc_domain.c
diff -u src/sys/kern/uipc_domain.c:1.97 src/sys/kern/uipc_domain.c:1.98
--- src/sys/kern/uipc_domain.c:1.97	Sat Jul  1 12:59:12 2017
+++ src/sys/kern/uipc_domain.c	Sat Jul  1 22:39:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_domain.c,v 1.97 2017/07/01 16:59:12 christos Exp $	*/
+/*	$NetBSD: uipc_domain.c,v 1.98 2017/07/02 02:39:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.97 2017/07/01 16:59:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.98 2017/07/02 02:39:18 christos Exp $");
 
 #include 
 #include 
@@ -284,6 +284,8 @@ sockaddr_checklen(const struct sockaddr 
 	socklen_t len = sockaddr_getsize_by_family(sa->sa_family);
 	if (len == 0 || len == sa->sa_len)
 		return;
+	if (sa->sa_family == AF_LINK && sa->sa_len <= len)
+		return;
 
 	char buf[512];
 	sockaddr_format(sa, buf, sizeof(buf));



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

2017-07-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 14:10:23 UTC 2017

Modified Files:
src/sys/arch/m68k/include: cpuframe.h

Log Message:
remove f_pad, conflicts with new  define.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/cpuframe.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/m68k/include/cpuframe.h
diff -u src/sys/arch/m68k/include/cpuframe.h:1.5 src/sys/arch/m68k/include/cpuframe.h:1.6
--- src/sys/arch/m68k/include/cpuframe.h:1.5	Tue Feb  8 15:20:16 2011
+++ src/sys/arch/m68k/include/cpuframe.h	Sun Jul  2 10:10:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuframe.h,v 1.5 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: cpuframe.h,v 1.6 2017/07/02 14:10:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -128,7 +128,6 @@ struct frame {
 };
 
 #define	f_regs		F_t.tf_regs
-#define	f_pad		F_t.tf_pad
 #define	f_stackadj	F_t.tf_stackadj
 #define	f_sr		F_t.tf_sr
 #define	f_pc		F_t.tf_pc



CVS commit: src/sys/arch/amiga/amiga

2017-07-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 14:10:53 UTC 2017

Modified Files:
src/sys/arch/amiga/amiga: trap.c

Log Message:
remove the single use of f_pad...


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/amiga/amiga/trap.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/amiga/amiga/trap.c
diff -u src/sys/arch/amiga/amiga/trap.c:1.135 src/sys/arch/amiga/amiga/trap.c:1.136
--- src/sys/arch/amiga/amiga/trap.c:1.135	Wed Mar  4 14:56:24 2015
+++ src/sys/arch/amiga/amiga/trap.c	Sun Jul  2 10:10:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.135 2015/03/04 19:56:24 mlelstv Exp $	*/
+/*	$NetBSD: trap.c,v 1.136 2017/07/02 14:10:53 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.135 2015/03/04 19:56:24 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2017/07/02 14:10:53 christos Exp $");
 
 #include 
 #include 
@@ -538,8 +538,8 @@ trap(struct frame *fp, int type, u_int c
 #endif
 #ifdef DEBUG
 	if (mmudebug & 2)
-	printf("trap: t %x c %x v %x pad %x adj %x sr %x pc %x fmt %x vc %x\n",
-	type, code, v, fp->f_pad, fp->f_stackadj, fp->f_sr,
+	printf("%s: t %x c %x v %x adj %x sr %x pc %x fmt %x vc %x\n",
+	__func__, type, code, v, fp->f_stackadj, fp->f_sr,
 	fp->f_pc, fp->f_format, fp->f_vector);
 #endif
 	switch (type) {



CVS commit: src/sys/kern

2017-07-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul  5 17:54:46 UTC 2017

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

Log Message:
don't print diagnostic for AF_LINK


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/kern/uipc_domain.c

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

Modified files:

Index: src/sys/kern/uipc_domain.c
diff -u src/sys/kern/uipc_domain.c:1.98 src/sys/kern/uipc_domain.c:1.99
--- src/sys/kern/uipc_domain.c:1.98	Sat Jul  1 22:39:18 2017
+++ src/sys/kern/uipc_domain.c	Wed Jul  5 13:54:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_domain.c,v 1.98 2017/07/02 02:39:18 christos Exp $	*/
+/*	$NetBSD: uipc_domain.c,v 1.99 2017/07/05 17:54:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.98 2017/07/02 02:39:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.99 2017/07/05 17:54:46 christos Exp $");
 
 #include 
 #include 
@@ -281,11 +281,13 @@ sockaddr_getsize_by_family(sa_family_t a
 static void
 sockaddr_checklen(const struct sockaddr *sa)
 {
+	// Can't tell how much was allocated, if it was allocated.
+	if (sa->sa_family == AF_LINK)
+		return;
+
 	socklen_t len = sockaddr_getsize_by_family(sa->sa_family);
 	if (len == 0 || len == sa->sa_len)
 		return;
-	if (sa->sa_family == AF_LINK && sa->sa_len <= len)
-		return;
 
 	char buf[512];
 	sockaddr_format(sa, buf, sizeof(buf));



CVS commit: src/sys

2017-07-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul  6 17:08:57 UTC 2017

Modified Files:
src/sys/kern: uipc_socket2.c
src/sys/netinet: ip_input.c raw_ip.c udp_usrreq.c
src/sys/netinet6: ip6_input.c udp6_usrreq.c
src/sys/sys: socketvar.h

Log Message:
Merge the two copies SO_TIMESTAMP/SO_OTIMESTAMP processing to a single
function, and add a SOOPT_TIMESTAMP define reducing compat pollution from
5 places to 1.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/kern/uipc_socket2.c
cvs rdiff -u -r1.355 -r1.356 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.164 -r1.165 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.233 -r1.234 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.178 -r1.179 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.129 -r1.130 src/sys/netinet6/udp6_usrreq.c
cvs rdiff -u -r1.144 -r1.145 src/sys/sys/socketvar.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/kern/uipc_socket2.c
diff -u src/sys/kern/uipc_socket2.c:1.124 src/sys/kern/uipc_socket2.c:1.125
--- src/sys/kern/uipc_socket2.c:1.124	Sun Oct  2 15:26:46 2016
+++ src/sys/kern/uipc_socket2.c	Thu Jul  6 13:08:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket2.c,v 1.124 2016/10/02 19:26:46 christos Exp $	*/
+/*	$NetBSD: uipc_socket2.c,v 1.125 2017/07/06 17:08:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,11 +58,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.124 2016/10/02 19:26:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.125 2017/07/06 17:08:57 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
 #include "opt_sb_max.h"
+#include "opt_compat_netbsd.h"
 #endif
 
 #include 
@@ -1527,3 +1528,35 @@ sowait(struct socket *so, bool catch_p, 
 		solockretry(so, lock);
 	return error;
 }
+
+#ifdef COMPAT_50
+#include 
+#include 
+#endif
+
+struct mbuf **
+sbsavetimestamp(int opt, struct mbuf *m, struct mbuf **mp)
+{
+	struct timeval tv;
+	microtime(&tv);
+
+#ifdef SO_OTIMESTAMP
+	if (opt & SO_OTIMESTAMP) {
+		struct timeval50 tv50;
+
+		timeval_to_timeval50(&tv, &tv50);
+		*mp = sbcreatecontrol(&tv50, sizeof(tv50),
+		SCM_OTIMESTAMP, SOL_SOCKET);
+		if (*mp)
+			mp = &(*mp)->m_next;
+	} else
+#endif
+
+	if (opt & SO_TIMESTAMP) {
+		*mp = sbcreatecontrol(&tv, sizeof(tv),
+		SCM_TIMESTAMP, SOL_SOCKET);
+		if (*mp)
+			mp = &(*mp)->m_next;
+	}
+	return mp;
+}

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.355 src/sys/netinet/ip_input.c:1.356
--- src/sys/netinet/ip_input.c:1.355	Wed May 31 22:45:14 2017
+++ src/sys/netinet/ip_input.c	Thu Jul  6 13:08:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.355 2017/06/01 02:45:14 chs Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.356 2017/07/06 17:08:57 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,11 +91,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.355 2017/06/01 02:45:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.356 2017/07/06 17:08:57 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
-#include "opt_compat_netbsd.h"
 #include "opt_gateway.h"
 #include "opt_ipsec.h"
 #include "opt_mrouting.h"
@@ -174,11 +173,6 @@ __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v
 #define IPMTUDISCTIMEOUT (10 * 60)	/* as per RFC 1191 */
 #endif
 
-#ifdef COMPAT_50
-#include 
-#include 
-#endif
-
 /*
  * Note: DIRECTED_BROADCAST is handled this way so that previous
  * configuration using this option will Just Work.
@@ -1529,27 +1523,9 @@ ip_savecontrol(struct inpcb *inp, struct
 	if (__predict_false(ifp == NULL))
 		return; /* XXX should report error? */
 
-	if (so->so_options & SO_TIMESTAMP
-#ifdef SO_OTIMESTAMP
-	|| so->so_options & SO_OTIMESTAMP
-#endif
-	) {
-		struct timeval tv;
-
-		microtime(&tv);
-#ifdef SO_OTIMESTAMP
-		if (so->so_options & SO_OTIMESTAMP) {
-			struct timeval50 tv50;
-			timeval_to_timeval50(&tv, &tv50);
-			*mp = sbcreatecontrol((void *) &tv50, sizeof(tv50),
-			SCM_OTIMESTAMP, SOL_SOCKET);
-		} else
-#endif
-		*mp = sbcreatecontrol((void *) &tv, sizeof(tv),
-		SCM_TIMESTAMP, SOL_SOCKET);
-		if (*mp)
-			mp = &(*mp)->m_next;
-	}
+	if (SOOPT_TIMESTAMP(so->so_options))
+		mp = sbsavetimestamp(so->so_options, m, mp);
+
 	if (inpflags & INP_RECVDSTADDR) {
 		*mp = sbcreatecontrol((void *) &ip->ip_dst,
 		sizeof(struct in_addr), IP_RECVDSTADDR, IPPROTO_IP);

Index: src/sys/netinet/raw_ip.c
diff -u src/sys/netinet/raw_ip.c:1.164 src/sys/netinet/raw_ip.c:1.165
--- src/sys/netinet/raw_ip.c:1.164	Thu Apr 20 04:46:07 2017
+++ src/sys/netinet/raw_ip.c	Thu Jul  6 13:08:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip.c,v 1.164 2017/04/20 08:46:07 ozaki-r Exp $	*/
+/*	$NetBSD: raw_ip.c,v 1.165 2017/07/06 17:08:57 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,11 +65,10 @@
  */
 
 #include 
-__

CVS commit: src/sys/netinet

2017-07-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul  6 17:12:34 UTC 2017

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

Log Message:
remove unnecessary casts (no functional change)


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 src/sys/netinet/ip_input.c

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

Modified files:

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.356 src/sys/netinet/ip_input.c:1.357
--- src/sys/netinet/ip_input.c:1.356	Thu Jul  6 13:08:57 2017
+++ src/sys/netinet/ip_input.c	Thu Jul  6 13:12:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.356 2017/07/06 17:08:57 christos Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.357 2017/07/06 17:12:34 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.356 2017/07/06 17:08:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.357 2017/07/06 17:12:34 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1527,7 +1527,7 @@ ip_savecontrol(struct inpcb *inp, struct
 		mp = sbsavetimestamp(so->so_options, m, mp);
 
 	if (inpflags & INP_RECVDSTADDR) {
-		*mp = sbcreatecontrol((void *) &ip->ip_dst,
+		*mp = sbcreatecontrol(&ip->ip_dst,
 		sizeof(struct in_addr), IP_RECVDSTADDR, IPPROTO_IP);
 		if (*mp)
 			mp = &(*mp)->m_next;
@@ -1536,7 +1536,7 @@ ip_savecontrol(struct inpcb *inp, struct
 		struct in_pktinfo ipi;
 		ipi.ipi_addr = ip->ip_src;
 		ipi.ipi_ifindex = ifp->if_index;
-		*mp = sbcreatecontrol((void *) &ipi,
+		*mp = sbcreatecontrol(&ipi,
 		sizeof(ipi), IP_RECVPKTINFO, IPPROTO_IP);
 		if (*mp)
 			mp = &(*mp)->m_next;
@@ -1545,7 +1545,7 @@ ip_savecontrol(struct inpcb *inp, struct
 		struct in_pktinfo ipi;
 		ipi.ipi_addr = ip->ip_dst;
 		ipi.ipi_ifindex = ifp->if_index;
-		*mp = sbcreatecontrol((void *) &ipi,
+		*mp = sbcreatecontrol(&ipi,
 		sizeof(ipi), IP_PKTINFO, IPPROTO_IP);
 		if (*mp)
 			mp = &(*mp)->m_next;
@@ -1560,7 +1560,7 @@ ip_savecontrol(struct inpcb *inp, struct
 			mp = &(*mp)->m_next;
 	}
 	if (inpflags & INP_RECVTTL) {
-		*mp = sbcreatecontrol((void *) &ip->ip_ttl,
+		*mp = sbcreatecontrol(&ip->ip_ttl,
 		sizeof(uint8_t), IP_RECVTTL, IPPROTO_IP);
 		if (*mp)
 			mp = &(*mp)->m_next;



CVS commit: src/sys/netinet6

2017-07-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul  6 17:14:35 UTC 2017

Modified Files:
src/sys/netinet6: ip6_input.c

Log Message:
remove unnecessary casts; use sizeof(var) instead of sizeof(type).


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/netinet6/ip6_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/netinet6/ip6_input.c
diff -u src/sys/netinet6/ip6_input.c:1.179 src/sys/netinet6/ip6_input.c:1.180
--- src/sys/netinet6/ip6_input.c:1.179	Thu Jul  6 13:08:57 2017
+++ src/sys/netinet6/ip6_input.c	Thu Jul  6 13:14:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_input.c,v 1.179 2017/07/06 17:08:57 christos Exp $	*/
+/*	$NetBSD: ip6_input.c,v 1.180 2017/07/06 17:14:35 christos Exp $	*/
 /*	$KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.179 2017/07/06 17:08:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.180 2017/07/06 17:14:35 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -1100,8 +1100,7 @@ ip6_savecontrol(struct in6pcb *in6p, str
 		memcpy(&pi6.ipi6_addr, &ip6->ip6_dst, sizeof(struct in6_addr));
 		in6_clearscope(&pi6.ipi6_addr);	/* XXX */
 		pi6.ipi6_ifindex = m->m_pkthdr.rcvif_index;
-		*mp = sbcreatecontrol((void *) &pi6,
-		sizeof(struct in6_pktinfo),
+		*mp = sbcreatecontrol(&pi6, sizeof(pi6),
 		IS2292(IPV6_2292PKTINFO, IPV6_PKTINFO), IPPROTO_IPV6);
 		if (*mp)
 			mp = &(*mp)->m_next;
@@ -1110,7 +1109,7 @@ ip6_savecontrol(struct in6pcb *in6p, str
 	if (in6p->in6p_flags & IN6P_HOPLIMIT) {
 		int hlim = ip6->ip6_hlim & 0xff;
 
-		*mp = sbcreatecontrol((void *) &hlim, sizeof(int),
+		*mp = sbcreatecontrol(&hlim, sizeof(hlim),
 		IS2292(IPV6_2292HOPLIMIT, IPV6_HOPLIMIT), IPPROTO_IPV6);
 		if (*mp)
 			mp = &(*mp)->m_next;
@@ -1124,7 +1123,7 @@ ip6_savecontrol(struct in6pcb *in6p, str
 		flowinfo >>= 20;
 
 		tclass = flowinfo & 0xff;
-		*mp = sbcreatecontrol((void *)&tclass, sizeof(tclass),
+		*mp = sbcreatecontrol(&tclass, sizeof(tclass),
 		IPV6_TCLASS, IPPROTO_IPV6);
 
 		if (*mp)
@@ -1172,7 +1171,7 @@ ip6_savecontrol(struct in6pcb *in6p, str
 			 * be removed before returning in the RFC 2292.
 			 * Note: this constraint is removed in RFC3542.
 			 */
-			*mp = sbcreatecontrol((void *)hbh, hbhlen,
+			*mp = sbcreatecontrol(hbh, hbhlen,
 			IS2292(IPV6_2292HOPOPTS, IPV6_HOPOPTS),
 			IPPROTO_IPV6);
 			if (*mp)
@@ -1234,7 +1233,7 @@ ip6_savecontrol(struct in6pcb *in6p, str
 if (!(in6p->in6p_flags & IN6P_DSTOPTS))
 	break;
 
-*mp = sbcreatecontrol((void *)ip6e, elen,
+*mp = sbcreatecontrol(ip6e, elen,
 IS2292(IPV6_2292DSTOPTS, IPV6_DSTOPTS),
 IPPROTO_IPV6);
 if (*mp)
@@ -1245,7 +1244,7 @@ ip6_savecontrol(struct in6pcb *in6p, str
 if (!(in6p->in6p_flags & IN6P_RTHDR))
 	break;
 
-*mp = sbcreatecontrol((void *)ip6e, elen,
+*mp = sbcreatecontrol(ip6e, elen,
 IS2292(IPV6_2292RTHDR, IPV6_RTHDR),
 IPPROTO_IPV6);
 if (*mp)
@@ -1303,7 +1302,7 @@ ip6_notify_pmtu(struct in6pcb *in6p, con
 	if (sa6_recoverscope(&mtuctl.ip6m_addr))
 		return;
 
-	if ((m_mtu = sbcreatecontrol((void *)&mtuctl, sizeof(mtuctl),
+	if ((m_mtu = sbcreatecontrol(&mtuctl, sizeof(mtuctl),
 	IPV6_PATHMTU, IPPROTO_IPV6)) == NULL)
 		return;
 



CVS commit: src/sys/kern

2017-07-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul  6 17:42:39 UTC 2017

Modified Files:
src/sys/kern: uipc_socket.c uipc_socket2.c

Log Message:
move the timestamp stuff to uipc_socket.c because it already has the compat
includes.


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/kern/uipc_socket.c
cvs rdiff -u -r1.125 -r1.126 src/sys/kern/uipc_socket2.c

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

Modified files:

Index: src/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.255 src/sys/kern/uipc_socket.c:1.256
--- src/sys/kern/uipc_socket.c:1.255	Sat May 27 17:02:56 2017
+++ src/sys/kern/uipc_socket.c	Thu Jul  6 13:42:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.255 2017/05/27 21:02:56 bouyer Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.256 2017/07/06 17:42:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.255 2017/05/27 21:02:56 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.256 2017/07/06 17:42:39 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2410,6 +2410,33 @@ sopoll(struct socket *so, int events)
 	return revents;
 }
 
+struct mbuf **
+sbsavetimestamp(int opt, struct mbuf *m, struct mbuf **mp)
+{
+	struct timeval tv;
+	microtime(&tv);
+
+#ifdef SO_OTIMESTAMP
+	if (opt & SO_OTIMESTAMP) {
+		struct timeval50 tv50;
+
+		timeval_to_timeval50(&tv, &tv50);
+		*mp = sbcreatecontrol(&tv50, sizeof(tv50),
+		SCM_OTIMESTAMP, SOL_SOCKET);
+		if (*mp)
+			mp = &(*mp)->m_next;
+	} else
+#endif
+
+	if (opt & SO_TIMESTAMP) {
+		*mp = sbcreatecontrol(&tv, sizeof(tv),
+		SCM_TIMESTAMP, SOL_SOCKET);
+		if (*mp)
+			mp = &(*mp)->m_next;
+	}
+	return mp;
+}
+
 
 #include 
 

Index: src/sys/kern/uipc_socket2.c
diff -u src/sys/kern/uipc_socket2.c:1.125 src/sys/kern/uipc_socket2.c:1.126
--- src/sys/kern/uipc_socket2.c:1.125	Thu Jul  6 13:08:57 2017
+++ src/sys/kern/uipc_socket2.c	Thu Jul  6 13:42:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket2.c,v 1.125 2017/07/06 17:08:57 christos Exp $	*/
+/*	$NetBSD: uipc_socket2.c,v 1.126 2017/07/06 17:42:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,12 +58,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.125 2017/07/06 17:08:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.126 2017/07/06 17:42:39 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
 #include "opt_sb_max.h"
-#include "opt_compat_netbsd.h"
 #endif
 
 #include 
@@ -1528,35 +1527,3 @@ sowait(struct socket *so, bool catch_p, 
 		solockretry(so, lock);
 	return error;
 }
-
-#ifdef COMPAT_50
-#include 
-#include 
-#endif
-
-struct mbuf **
-sbsavetimestamp(int opt, struct mbuf *m, struct mbuf **mp)
-{
-	struct timeval tv;
-	microtime(&tv);
-
-#ifdef SO_OTIMESTAMP
-	if (opt & SO_OTIMESTAMP) {
-		struct timeval50 tv50;
-
-		timeval_to_timeval50(&tv, &tv50);
-		*mp = sbcreatecontrol(&tv50, sizeof(tv50),
-		SCM_OTIMESTAMP, SOL_SOCKET);
-		if (*mp)
-			mp = &(*mp)->m_next;
-	} else
-#endif
-
-	if (opt & SO_TIMESTAMP) {
-		*mp = sbcreatecontrol(&tv, sizeof(tv),
-		SCM_TIMESTAMP, SOL_SOCKET);
-		if (*mp)
-			mp = &(*mp)->m_next;
-	}
-	return mp;
-}



CVS commit: src/etc/etc.next68k

2017-07-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul  7 23:48:34 UTC 2017

Modified Files:
src/etc/etc.next68k: MAKEDEV.conf

Log Message:
PR/52377: Miod Vallat: Provide links to ttya and ttyb as mentioned in zs(4)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/etc.next68k/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.next68k/MAKEDEV.conf
diff -u src/etc/etc.next68k/MAKEDEV.conf:1.3 src/etc/etc.next68k/MAKEDEV.conf:1.4
--- src/etc/etc.next68k/MAKEDEV.conf:1.3	Mon Jan 15 18:35:12 2007
+++ src/etc/etc.next68k/MAKEDEV.conf	Fri Jul  7 19:48:34 2017
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.3 2007/01/15 23:35:12 hubertf Exp $
+# $NetBSD: MAKEDEV.conf,v 1.4 2017/07/07 23:48:34 christos Exp $
 
 all_md)
 	makedev wscons sd0 sd1 sd2 sd3 tty0 tty1
@@ -7,10 +7,14 @@ all_md)
 	makedev bpf8 bpf9 bpf10 bpf11
 	makedev scsibus0 scsibus1 scsibus2 scsibus3
 	makedev ses0 ses1 ses2 ses3
+	lndev tty00 ttya
+	lndev tty01 ttyb
 	;;
 
 raminst)
 	makedev std
 	makedev sd0 sd1 sd2 sd3 st0 st1 cd0 cd1
 	makedev tty0 tty1 opty
+	lndev tty00 ttya
+	lndev tty01 ttyb
 	;;



CVS commit: src/sys/netinet

2017-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul  8 22:56:15 UTC 2017

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

Log Message:
Reorder the controls to the ones that need an interface and the ones that
don't; process the ones that don't first. Add a DIAGNOSTIC if there is no
interface; really this should be a KASSERT/panic because it is a bug if the
interface is not set at this point.


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/netinet/ip_input.c

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

Modified files:

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.357 src/sys/netinet/ip_input.c:1.358
--- src/sys/netinet/ip_input.c:1.357	Thu Jul  6 13:12:34 2017
+++ src/sys/netinet/ip_input.c	Sat Jul  8 18:56:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.357 2017/07/06 17:12:34 christos Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.358 2017/07/08 22:56:15 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.357 2017/07/06 17:12:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.358 2017/07/08 22:56:15 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1515,13 +1515,7 @@ ip_savecontrol(struct inpcb *inp, struct
 struct mbuf *m)
 {
 	struct socket *so = inp->inp_socket;
-	ifnet_t *ifp;
 	int inpflags = inp->inp_flags;
-	struct psref psref;
-
-	ifp = m_get_rcvif_psref(m, &psref);
-	if (__predict_false(ifp == NULL))
-		return; /* XXX should report error? */
 
 	if (SOOPT_TIMESTAMP(so->so_options))
 		mp = sbsavetimestamp(so->so_options, m, mp);
@@ -1532,6 +1526,23 @@ ip_savecontrol(struct inpcb *inp, struct
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
+
+	if (inpflags & INP_RECVTTL) {
+		*mp = sbcreatecontrol(&ip->ip_ttl,
+		sizeof(uint8_t), IP_RECVTTL, IPPROTO_IP);
+		if (*mp)
+			mp = &(*mp)->m_next;
+	}
+
+	struct psref psref;
+	ifnet_t *ifp = m_get_rcvif_psref(m, &psref);
+	if (__predict_false(ifp == NULL)) {
+#ifdef DIAGNOSTIC
+		printf("%s: missing receive interface\n", __func__);
+#endif
+		return; /* XXX should report error? */
+	}
+
 	if (inpflags & INP_RECVPKTINFO) {
 		struct in_pktinfo ipi;
 		ipi.ipi_addr = ip->ip_src;
@@ -1559,12 +1570,6 @@ ip_savecontrol(struct inpcb *inp, struct
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
-	if (inpflags & INP_RECVTTL) {
-		*mp = sbcreatecontrol(&ip->ip_ttl,
-		sizeof(uint8_t), IP_RECVTTL, IPPROTO_IP);
-		if (*mp)
-			mp = &(*mp)->m_next;
-	}
 	m_put_rcvif_psref(ifp, &psref);
 }
 



CVS commit: src/sys/dev/usb

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 19:37:34 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
PR/52385: Shinichi Doyashiki: some classic Roland product-ids for usbdevs
While here, add a Ralink that I had uncommitted and fix some caps hex to
small for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.737 -r1.738 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.737 src/sys/dev/usb/usbdevs:1.738
--- src/sys/dev/usb/usbdevs:1.737	Mon Jun 26 16:28:42 2017
+++ src/sys/dev/usb/usbdevs	Sun Jul  9 15:37:33 2017
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.737 2017/06/26 20:28:42 is Exp $
+$NetBSD: usbdevs,v 1.738 2017/07/09 19:37:33 christos Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2725,6 +2725,7 @@ product RALINK RT2570		0x1706	RT2570
 product RALINK RT2070		0x2070	RT2070
 product RALINK RT2570_2		0x2570	RT2570
 product RALINK RT2573		0x2573	RT2573
+product RALINK RT73		0x2578	RT73
 product RALINK RT2671		0x2671	RT2671
 product RALINK RT2770		0x2770	RT2770
 product RALINK RT2870		0x2870	RT2870
@@ -2822,9 +2823,12 @@ product ROLAND PC50		0x008c	EDIROL PC-50
 product ROLAND UA101F		0x008d	EDIROL UA-101 USB1
 product ROLAND UA1EX		0x0096	EDIROL UA-1EX
 product ROLAND UM3		0x009A	EDIROL UM-3
-product ROLAND UA4FX 		0x00A3	EDIROL UA-4FX
-product ROLAND SONICCELL	0x00C2	SonicCell
+product ROLAND UA4FX 		0x00a3	EDIROL UA-4FX
+product ROLAND SONICCELL	0x00c2	SonicCell
+product ROLAND UA25EXA		0x00e6	EDIROL UA-25EX (advanced)
+product ROLAND UA25EX		0x00e7	EDIROL UA-25EX
 product ROLAND UMONE		0x012a	UM-ONE MIDI I/F
+product ROLAND QUADCAPTURE	0x012f	QUAD-CAPTURE
 
 /* RT Systems products */
 product RTSYS CT57A		0x9e51	CT57A Radio Cable



CVS commit: src/lib/libpthread

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 20:21:08 UTC 2017

Modified Files:
src/lib/libpthread: pthread_tsd.c

Log Message:
PR/52386: Use the number of iterations we document.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libpthread/pthread_tsd.c

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

Modified files:

Index: src/lib/libpthread/pthread_tsd.c
diff -u src/lib/libpthread/pthread_tsd.c:1.15 src/lib/libpthread/pthread_tsd.c:1.16
--- src/lib/libpthread/pthread_tsd.c:1.15	Tue Aug 25 09:46:23 2015
+++ src/lib/libpthread/pthread_tsd.c	Sun Jul  9 16:21:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_tsd.c,v 1.15 2015/08/25 13:46:23 pooka Exp $	*/
+/*	$NetBSD: pthread_tsd.c,v 1.16 2017/07/09 20:21:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_tsd.c,v 1.15 2015/08/25 13:46:23 pooka Exp $");
+__RCSID("$NetBSD: pthread_tsd.c,v 1.16 2017/07/09 20:21:08 christos Exp $");
 
 /* Functions and structures dealing with thread-specific data */
 #include 
@@ -332,7 +332,8 @@ pthread__destroy_tsd(pthread_t self)
 	 * a while.''
 	 */
 
-	iterations = 4; /* We're not required to try very hard */
+	/* We're not required to try very hard */
+	iterations = PTHREAD_DESTRUCTOR_ITERATIONS;
 	do {
 		done = 1;
 		for (i = 0; i < pthread_keys_max; i++) {
@@ -356,7 +357,7 @@ pthread__destroy_tsd(pthread_t self)
 (*destructor)(val);
 			}
 		}
-	} while (!done && iterations--);
+	} while (!done && --iterations);
 
 	self->pt_havespecific = 0;
 	pthread_mutex_lock(&self->pt_lock);



CVS commit: src/sys/uvm

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 20:53:09 UTC 2017

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

Log Message:
PR/52384: make uvm_fault_check() return EFAULT not EACCES, like our man pages
(but not OpenGroup which does not document EFAULT for read/write, and only
documents EACCES for sockets) say for read/write.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/uvm/uvm_fault.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_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.199 src/sys/uvm/uvm_fault.c:1.200
--- src/sys/uvm/uvm_fault.c:1.199	Mon Mar 20 11:51:41 2017
+++ src/sys/uvm/uvm_fault.c	Sun Jul  9 16:53:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.199 2017/03/20 15:51:41 skrll Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.200 2017/07/09 20:53:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.199 2017/03/20 15:51:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.200 2017/07/09 20:53:09 christos Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -950,7 +950,7 @@ uvm_fault_check(
 		"<- protection failure (prot=%#x, access=%#x)",
 		ufi->entry->protection, flt->access_type, 0, 0);
 		uvmfault_unlockmaps(ufi, false);
-		return EACCES;
+		return EFAULT;
 	}
 
 	/*



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

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 22:04:04 UTC 2017

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

Log Message:
check for EFAULT on reads and writes to memory with not permission.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_write.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_write.c
diff -u src/tests/lib/libc/sys/t_write.c:1.3 src/tests/lib/libc/sys/t_write.c:1.4
--- src/tests/lib/libc/sys/t_write.c:1.3	Fri Jan 13 14:27:23 2017
+++ src/tests/lib/libc/sys/t_write.c	Sun Jul  9 18:04:04 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $ */
+/* $NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $ */
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,9 +29,10 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $");
 
 #include 
+#include 
 
 #include 
 #include 
@@ -42,6 +43,7 @@ __RCSID("$NetBSD: t_write.c,v 1.3 2017/0
 #include 
 #include 
 #include 
+#include 
 
 static void		 sighandler(int);
 
@@ -213,6 +215,56 @@ ATF_TC_BODY(writev_iovmax, tc)
 	ATF_REQUIRE_EQ_MSG(errno, EINVAL, "got: %s", strerror(errno));
 }
 
+ATF_TC(write_fault);
+
+ATF_TC_HEAD(write_fault, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Check that writing to non-permitted space returns EFAULT");
+}
+
+ATF_TC_BODY(write_fault, tc)
+{
+	int fd[2];
+	ATF_REQUIRE(pipe(fd) != -1);
+	// Can't use /dev/null cause it doesn't access the buffer.
+
+	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	ATF_REQUIRE(map != MAP_FAILED);
+
+	ssize_t retval = write(fd[1], map, 8192); 
+
+	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
+	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
+
+	close(fd[0]); 
+	close(fd[1]); 
+}
+
+ATF_TC(read_fault);
+
+ATF_TC_HEAD(read_fault, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Check that reading from non-permitted space returns EFAULT");
+}
+
+ATF_TC_BODY(read_fault, tc)
+{
+	int fd = open(_PATH_DEVZERO, O_RDONLY);
+	ATF_REQUIRE(fd != -1);
+
+	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	ATF_REQUIRE(map != MAP_FAILED);
+
+	ssize_t retval = read(fd, map, 8192); 
+
+	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
+	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
+
+	close(fd); 
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -221,6 +273,8 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, write_pos);
 	ATF_TP_ADD_TC(tp, write_ret);
 	ATF_TP_ADD_TC(tp, writev_iovmax);
+	ATF_TP_ADD_TC(tp, write_fault);
+	ATF_TP_ADD_TC(tp, read_fault);
 
 	return atf_no_error();
 }



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

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 22:13:48 UTC 2017

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

Log Message:
add munmap
#define for const.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_write.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_write.c
diff -u src/tests/lib/libc/sys/t_write.c:1.4 src/tests/lib/libc/sys/t_write.c:1.5
--- src/tests/lib/libc/sys/t_write.c:1.4	Sun Jul  9 18:04:04 2017
+++ src/tests/lib/libc/sys/t_write.c	Sun Jul  9 18:13:48 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $ */
+/* $NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $ */
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $");
 
 #include 
 #include 
@@ -223,20 +223,23 @@ ATF_TC_HEAD(write_fault, tc)
 	"Check that writing to non-permitted space returns EFAULT");
 }
 
+#define SIZE 8192
+
 ATF_TC_BODY(write_fault, tc)
 {
 	int fd[2];
 	ATF_REQUIRE(pipe(fd) != -1);
 	// Can't use /dev/null cause it doesn't access the buffer.
 
-	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	void *map = mmap(NULL, SIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
 	ATF_REQUIRE(map != MAP_FAILED);
 
-	ssize_t retval = write(fd[1], map, 8192); 
+	ssize_t retval = write(fd[1], map, SIZE); 
 
 	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
 	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
 
+	munmap(map, SIZE);
 	close(fd[0]); 
 	close(fd[1]); 
 }
@@ -254,10 +257,10 @@ ATF_TC_BODY(read_fault, tc)
 	int fd = open(_PATH_DEVZERO, O_RDONLY);
 	ATF_REQUIRE(fd != -1);
 
-	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	void *map = mmap(NULL, SIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
 	ATF_REQUIRE(map != MAP_FAILED);
 
-	ssize_t retval = read(fd, map, 8192); 
+	ssize_t retval = read(fd, map, SIZE); 
 
 	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
 	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));



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

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 22:18:43 UTC 2017

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

Log Message:
add another missing munmap (Kamil)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/sys/t_write.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_write.c
diff -u src/tests/lib/libc/sys/t_write.c:1.5 src/tests/lib/libc/sys/t_write.c:1.6
--- src/tests/lib/libc/sys/t_write.c:1.5	Sun Jul  9 18:13:48 2017
+++ src/tests/lib/libc/sys/t_write.c	Sun Jul  9 18:18:43 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $ */
+/* $NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $ */
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $");
 
 #include 
 #include 
@@ -265,6 +265,7 @@ ATF_TC_BODY(read_fault, tc)
 	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
 	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
 
+	munmap(map, SIZE);
 	close(fd); 
 }
 



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/krb5

2017-07-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 11 17:45:32 UTC 2017

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5: ticket.c

Log Message:
https://orpheus-lyre.info/design/index.html
https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea

In _krb5_extract_ticket() the KDC-REP service name must be obtained from
encrypted version stored in 'enc_part' instead of the unencrypted version
stored in 'ticket'.  Use of the unecrypted version provides an
opportunity for successful server impersonation and other attacks.

Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.

XXX: pullup 6, 7, 8.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.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/heimdal/dist/lib/krb5/ticket.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.2 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.3
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.2	Sat Jan 28 16:31:49 2017
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Tue Jul 11 13:45:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.2 2017/01/28 21:31:49 christos Exp $	*/
+/*	$NetBSD: ticket.c,v 1.3 2017/07/11 17:45:31 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
@@ -707,8 +707,8 @@ _krb5_extract_ticket(krb5_context contex
 /* check server referral and save principal */
 ret = _krb5_principalname2krb5_principal (context,
 	  &tmp_principal,
-	  rep->kdc_rep.ticket.sname,
-	  rep->kdc_rep.ticket.realm);
+	  rep->enc_part.sname,
+	  rep->enc_part.realm);
 if (ret)
 	goto out;
 if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/krb5

2017-07-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 11 21:52:55 UTC 2017

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5: ticket.c

Log Message:
fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.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/heimdal/dist/lib/krb5/ticket.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.3 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.4
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.3	Tue Jul 11 13:45:31 2017
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Tue Jul 11 17:52:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.3 2017/07/11 17:45:31 christos Exp $	*/
+/*	$NetBSD: ticket.c,v 1.4 2017/07/11 21:52:54 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
@@ -708,7 +708,7 @@ _krb5_extract_ticket(krb5_context contex
 ret = _krb5_principalname2krb5_principal (context,
 	  &tmp_principal,
 	  rep->enc_part.sname,
-	  rep->enc_part.realm);
+	  rep->enc_part.srealm);
 if (ret)
 	goto out;
 if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){



CVS commit: src/usr.sbin/isdn/isdnd

2017-07-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 12 01:57:43 UTC 2017

Modified Files:
src/usr.sbin/isdn/isdnd: isdnd.8

Log Message:
PR/52396: Edgar Pettijohn: Spell daemon consistently.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/isdn/isdnd/isdnd.8

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/isdn/isdnd/isdnd.8
diff -u src/usr.sbin/isdn/isdnd/isdnd.8:1.15 src/usr.sbin/isdn/isdnd/isdnd.8:1.16
--- src/usr.sbin/isdn/isdnd/isdnd.8:1.15	Mon Jul  3 17:35:30 2017
+++ src/usr.sbin/isdn/isdnd/isdnd.8	Tue Jul 11 21:57:43 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: isdnd.8,v 1.15 2017/07/03 21:35:30 wiz Exp $
+.\" $NetBSD: isdnd.8,v 1.16 2017/07/12 01:57:43 christos Exp $
 .\"
 .\" Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
 .\"
@@ -23,13 +23,13 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"	$Id: isdnd.8,v 1.15 2017/07/03 21:35:30 wiz Exp $
+.\"	$Id: isdnd.8,v 1.16 2017/07/12 01:57:43 christos Exp $
 .\"
 .\" $FreeBSD$
 .\"
 .\"	last edit-date: [Tue May  2 13:45:12 2000]
 .\"
-.Dd April 5, 2012
+.Dd July 11, 2017
 .Dt ISDND 8
 .Os
 .Sh NAME
@@ -51,7 +51,7 @@
 .Op Fl m
 .Sh DESCRIPTION
 .Nm
-is the isdn4bsd package demon which manages all ISDN related connection
+is the isdn4bsd package daemon which manages all ISDN related connection
 and disconnection of ISDN devices supported by the package.
 .Pp
 The options are as follows:



CVS commit: src/external/bsd/nsd

2017-07-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 12 12:55:41 UTC 2017

Modified Files:
src/external/bsd/nsd: Makefile.inc

Log Message:
Oops, support IPv6 if not disabled.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/nsd/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/external/bsd/nsd/Makefile.inc
diff -u src/external/bsd/nsd/Makefile.inc:1.1 src/external/bsd/nsd/Makefile.inc:1.2
--- src/external/bsd/nsd/Makefile.inc:1.1	Sat Jan  7 14:51:21 2017
+++ src/external/bsd/nsd/Makefile.inc	Wed Jul 12 08:55:41 2017
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile.inc,v 1.1 2017/01/07 19:51:21 christos Exp $
+# $NetBSD: Makefile.inc,v 1.2 2017/07/12 12:55:41 christos Exp $
+
+.include 
 
 USE_FORT?= yes  # network client/server
 
@@ -8,6 +10,10 @@ CPPFLAGS+=-D_OPENBSD_SOURCE
 CPPFLAGS+=-I${NSD} -I${NSD}/../include
 .PATH: ${NSD}
 
+.if (${USE_INET6} != "no")
+CPPFLAGS+=  -DINET6
+.endif
+
 DPLIBS+= event ${NETBSDSRCDIR}/external/bsd/libevent/lib/libevent
 DPLIBS+= ssl ${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libssl
 DPLIBS+= crypto ${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libcrypto



CVS commit: src/libexec/ld.elf_so/arch/x86_64

2017-07-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 12 17:54:23 UTC 2017

Modified Files:
src/libexec/ld.elf_so/arch/x86_64: mdreloc.c

Log Message:
make this compile with debug again (symnum uninitialized)


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/x86_64/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.42 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.43
--- src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.42	Mon Jun 19 07:57:02 2017
+++ src/libexec/ld.elf_so/arch/x86_64/mdreloc.c	Wed Jul 12 13:54:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdreloc.c,v 1.42 2017/06/19 11:57:02 joerg Exp $	*/
+/*	$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.42 2017/06/19 11:57:02 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -91,6 +91,9 @@ caddr_t _rtld_bind(const Obj_Entry *, El
 static inline int _rtld_relocate_plt_object(const Obj_Entry *,
 const Elf_Rela *, Elf_Addr *);
 
+#define rdbg_symnum(obj, rela) \
+((obj)->strtab + (obj)->symtab[ELF_R_SYM((rela)->r_info)].st_name)
+
 void
 _rtld_setup_pltgot(const Obj_Entry *obj)
 {
@@ -180,7 +183,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("32/32S %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)(uintptr_t)*where32,
 			defobj->path));
 			break;
@@ -191,7 +194,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(PC32):	/* word32 S + A - P */
@@ -201,7 +204,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("PC32 %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)(unsigned long)*where32,
 			defobj->path));
 			break;
@@ -211,7 +214,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(RELATIVE):  /* word64 B + A */
@@ -231,7 +234,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			defobj->tlsoffset + rela->r_addend);
 
 			rdbg(("TPOFF64 %s in %s --> %p",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -240,7 +243,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)defobj->tlsindex;
 
 			rdbg(("DTPMOD64 %s in %s --> %p",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -249,7 +252,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)(def->st_value + rela->r_addend);
 
 			rdbg(("DTPOFF64 %s in %s --> %p",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -264,8 +267,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			(u_long)ELF_R_SYM(rela->r_info),
 			(u_long)ELF_R_TYPE(rela->r_info),
 			(void *)rela->r_offset, (void *)rela->r_addend,
-			(void *)*where64,
-			obj->strtab + obj->symtab[symnum].st_name));
+			(void *)*where64, rdbg_symnum(obj, rela)));
 			_rtld_error("%s: Unsupported relocation type %ld "
 			"in non-PLT relocations",
 			obj->path, (u_long) ELF_R_TYPE(rela->r_info));



CVS commit: src/libexec/ld.elf_so/arch/x86_64

2017-07-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 12 17:55:24 UTC 2017

Modified Files:
src/libexec/ld.elf_so/arch/x86_64: mdreloc.c

Log Message:
rename the macro


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/x86_64/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.43 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.44
--- src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.43	Wed Jul 12 13:54:23 2017
+++ src/libexec/ld.elf_so/arch/x86_64/mdreloc.c	Wed Jul 12 13:55:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $	*/
+/*	$NetBSD: mdreloc.c,v 1.44 2017/07/12 17:55:24 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.44 2017/07/12 17:55:24 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -91,7 +91,7 @@ caddr_t _rtld_bind(const Obj_Entry *, El
 static inline int _rtld_relocate_plt_object(const Obj_Entry *,
 const Elf_Rela *, Elf_Addr *);
 
-#define rdbg_symnum(obj, rela) \
+#define rdbg_symname(obj, rela) \
 ((obj)->strtab + (obj)->symtab[ELF_R_SYM((rela)->r_info)].st_name)
 
 void
@@ -183,7 +183,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("32/32S %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)(uintptr_t)*where32,
 			defobj->path));
 			break;
@@ -194,7 +194,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(PC32):	/* word32 S + A - P */
@@ -204,7 +204,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("PC32 %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)(unsigned long)*where32,
 			defobj->path));
 			break;
@@ -214,7 +214,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(RELATIVE):  /* word64 B + A */
@@ -234,7 +234,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			defobj->tlsoffset + rela->r_addend);
 
 			rdbg(("TPOFF64 %s in %s --> %p",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -243,7 +243,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)defobj->tlsindex;
 
 			rdbg(("DTPMOD64 %s in %s --> %p",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -252,7 +252,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)(def->st_value + rela->r_addend);
 
 			rdbg(("DTPOFF64 %s in %s --> %p",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -267,7 +267,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			(u_long)ELF_R_SYM(rela->r_info),
 			(u_long)ELF_R_TYPE(rela->r_info),
 			(void *)rela->r_offset, (void *)rela->r_addend,
-			(void *)*where64, rdbg_symnum(obj, rela)));
+			(void *)*where64, rdbg_symname(obj, rela)));
 			_rtld_error("%s: Unsupported relocation type %ld "
 			"in non-PLT relocations",
 			obj->path, (u_long) ELF_R_TYPE(rela->r_info));



CVS commit: src/lib/libc/citrus

2017-07-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 13 16:00:30 UTC 2017

Modified Files:
src/lib/libc/citrus: citrus_none.c

Log Message:
s == NULL is illegal.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/citrus/citrus_none.c

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

Modified files:

Index: src/lib/libc/citrus/citrus_none.c
diff -u src/lib/libc/citrus/citrus_none.c:1.21 src/lib/libc/citrus/citrus_none.c:1.22
--- src/lib/libc/citrus/citrus_none.c:1.21	Thu Jul 13 11:46:26 2017
+++ src/lib/libc/citrus/citrus_none.c	Thu Jul 13 12:00:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $	*/
+/*	$NetBSD: citrus_none.c,v 1.22 2017/07/13 16:00:30 christos Exp $	*/
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $");
+__RCSID("$NetBSD: citrus_none.c,v 1.22 2017/07/13 16:00:30 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -513,7 +513,10 @@ _citrus_NONE_stdenc_mbtowc(struct _citru
 			   void * __restrict pspriv,
 			   size_t * __restrict nresult)
 {
-	if (s == NULL || *s == NULL) {
+
+	_DIAGASSERT(s != NULL);
+
+	if (*s == NULL) {
 		*nresult = 0;
 		return (0);
 	}



CVS commit: src/etc/etc.hpcmips

2017-07-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 13 16:03:36 UTC 2017

Modified Files:
src/etc/etc.hpcmips: ttys

Log Message:
turn on "console" which can be either the serial console or the glass tty
instead of ttyE0, to facilitate anita tests. From uanand.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/etc/etc.hpcmips/ttys

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

Modified files:

Index: src/etc/etc.hpcmips/ttys
diff -u src/etc/etc.hpcmips/ttys:1.10 src/etc/etc.hpcmips/ttys:1.11
--- src/etc/etc.hpcmips/ttys:1.10	Wed Jun 13 16:49:13 2012
+++ src/etc/etc.hpcmips/ttys	Thu Jul 13 12:03:36 2017
@@ -1,11 +1,11 @@
 #
-#	$NetBSD: ttys,v 1.10 2012/06/13 20:49:13 martin Exp $
+#	$NetBSD: ttys,v 1.11 2017/07/13 16:03:36 christos Exp $
 #
 # name	gettytype	status		comments
 
 # serial port
-console	"/usr/libexec/getty std.9600"	vt100	off secure
+console	"/usr/libexec/getty std.9600"	vt100	on secure
 constty	"/usr/libexec/getty std.9600"	vt100	off secure
 
 # Workstation console (framebuffer) ttys
-ttyE0	"/usr/libexec/getty std.9600"	wsvt25	on secure
+ttyE0	"/usr/libexec/getty std.9600"	wsvt25	off secure



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

2017-07-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 13 21:14:41 UTC 2017

Modified Files:
src/sys/arch/pmax/conf: RAMDISK

Log Message:
ramdisk ate too much ice cream, compensate.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/pmax/conf/RAMDISK

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/pmax/conf/RAMDISK
diff -u src/sys/arch/pmax/conf/RAMDISK:1.12 src/sys/arch/pmax/conf/RAMDISK:1.13
--- src/sys/arch/pmax/conf/RAMDISK:1.12	Tue Nov 23 06:14:04 2010
+++ src/sys/arch/pmax/conf/RAMDISK	Thu Jul 13 17:14:41 2017
@@ -1,4 +1,4 @@
-# 	$NetBSD: RAMDISK,v 1.12 2010/11/23 11:14:04 hannken Exp $
+# 	$NetBSD: RAMDISK,v 1.13 2017/07/13 21:14:41 christos Exp $
 #
 # Install kernel with ramdisk added.
 # The ramdisk is be too big to netboot directly via ECOFF on some machines,
@@ -13,7 +13,7 @@ include	"arch/pmax/conf/INSTALL"
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=6800	# size of memory disk, in blocks (3400kB)
+options 	MEMORY_DISK_ROOT_SIZE=7000	# size of memory disk, in blocks (3400kB)
 #options 	MEMORY_DISK_ROOT_SIZE=2880	# 1.44M, same as a floppy
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 



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

2017-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul 14 12:27:55 UTC 2017

Modified Files:
src/sys/arch/pmax/conf: RAMDISK

Log Message:
make the comment match


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/pmax/conf/RAMDISK

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/pmax/conf/RAMDISK
diff -u src/sys/arch/pmax/conf/RAMDISK:1.13 src/sys/arch/pmax/conf/RAMDISK:1.14
--- src/sys/arch/pmax/conf/RAMDISK:1.13	Thu Jul 13 17:14:41 2017
+++ src/sys/arch/pmax/conf/RAMDISK	Fri Jul 14 08:27:55 2017
@@ -1,4 +1,4 @@
-# 	$NetBSD: RAMDISK,v 1.13 2017/07/13 21:14:41 christos Exp $
+# 	$NetBSD: RAMDISK,v 1.14 2017/07/14 12:27:55 christos Exp $
 #
 # Install kernel with ramdisk added.
 # The ramdisk is be too big to netboot directly via ECOFF on some machines,
@@ -13,7 +13,7 @@ include	"arch/pmax/conf/INSTALL"
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=7000	# size of memory disk, in blocks (3400kB)
+options 	MEMORY_DISK_ROOT_SIZE=7000	# size of memory disk, in blocks (3500kB)
 #options 	MEMORY_DISK_ROOT_SIZE=2880	# 1.44M, same as a floppy
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 



CVS commit: src/sys/dev/scsipi

2017-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul 14 17:50:11 UTC 2017

Modified Files:
src/sys/dev/scsipi: scsipi_base.c

Log Message:
Async event can be called before the adapter is running (pmax tc asc)


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/dev/scsipi/scsipi_base.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/scsipi/scsipi_base.c
diff -u src/sys/dev/scsipi/scsipi_base.c:1.177 src/sys/dev/scsipi/scsipi_base.c:1.178
--- src/sys/dev/scsipi/scsipi_base.c:1.177	Mon Jun 19 16:52:20 2017
+++ src/sys/dev/scsipi/scsipi_base.c	Fri Jul 14 13:50:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipi_base.c,v 1.177 2017/06/19 20:52:20 mlelstv Exp $	*/
+/*	$NetBSD: scsipi_base.c,v 1.178 2017/07/14 17:50:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.177 2017/06/19 20:52:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.178 2017/07/14 17:50:11 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -2238,8 +2238,10 @@ void
 scsipi_async_event(struct scsipi_channel *chan, scsipi_async_event_t event,
 void *arg)
 {
+	bool lock = chan_running(chan) > 0;
 
-	mutex_enter(chan_mtx(chan));
+	if (lock)
+		mutex_enter(chan_mtx(chan));
 	switch (event) {
 	case ASYNC_EVENT_MAX_OPENINGS:
 		scsipi_async_event_max_openings(chan,
@@ -2256,7 +2258,8 @@ scsipi_async_event(struct scsipi_channel
 		scsipi_async_event_channel_reset(chan);
 		break;
 	}
-	mutex_exit(chan_mtx(chan));
+	if (lock)
+		mutex_exit(chan_mtx(chan));
 }
 
 /*



CVS commit: src/sys/arch/mips/mips

2017-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul 14 17:54:00 UTC 2017

Modified Files:
src/sys/arch/mips/mips: vm_machdep.c

Log Message:
KASSERT Fires for MIPS1, disable.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/mips/mips/vm_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.158 src/sys/arch/mips/mips/vm_machdep.c:1.159
--- src/sys/arch/mips/mips/vm_machdep.c:1.158	Thu May 11 05:09:54 2017
+++ src/sys/arch/mips/mips/vm_machdep.c	Fri Jul 14 13:54:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.158 2017/05/11 09:09:54 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.159 2017/07/14 17:54:00 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.158 2017/05/11 09:09:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.159 2017/07/14 17:54:00 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -154,10 +154,12 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	KASSERT(tf->tf_regs[_R_SR] & MIPS_SR_KX);
 	KASSERT(pcb2->pcb_context.val[_L_SR] & MIPS_SR_KX);
 #endif
+#ifndef MIPS1	/* XXX: broken */
 	KASSERTMSG(pcb2->pcb_context.val[_L_SR] & MIPS_SR_INT_IE,
 	"%d.%d %#"PRIxREGISTER,
 	l1->l_proc->p_pid, l1->l_lid,
 	pcb2->pcb_context.val[_L_SR]);
+#endif
 }
 
 /*



CVS commit: src/sys/arch/mips/mips

2017-07-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul 14 20:32:32 UTC 2017

Modified Files:
src/sys/arch/mips/mips: trap.c

Log Message:
Advance the PC on breakpoint instruction to avoid infinite loop DoS!


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.243 src/sys/arch/mips/mips/trap.c:1.244
--- src/sys/arch/mips/mips/trap.c:1.243	Sat Sep 10 09:42:11 2016
+++ src/sys/arch/mips/mips/trap.c	Fri Jul 14 16:32:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.243 2016/09/10 13:42:11 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.244 2017/07/14 20:32:32 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.243 2016/09/10 13:42:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.244 2017/07/14 20:32:32 christos Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -546,6 +546,9 @@ trap(uint32_t status, uint32_t cause, va
 			ksi.ksi_signo = SIGTRAP;
 			ksi.ksi_addr = (void *)va;
 			ksi.ksi_code = TRAP_TRACE;
+			/* we broke, skip it to avoid infinite loop */
+			if (instr == MIPS_BREAK_INSTR)
+tf->tf_regs[_R_PC] += 4;
 			break;
 		}
 		/*



CVS commit: src/sys/sys

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 13:46:02 UTC 2017

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

Log Message:
Ignore __thread for lint for now


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/sys/cdefs.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/cdefs.h
diff -u src/sys/sys/cdefs.h:1.132 src/sys/sys/cdefs.h:1.133
--- src/sys/sys/cdefs.h:1.132	Wed Feb  8 12:59:35 2017
+++ src/sys/sys/cdefs.h	Sat Jul 15 09:46:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.132 2017/02/08 17:59:35 christos Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.133 2017/07/15 13:46:02 christos Exp $	*/
 
 /* * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -374,6 +374,7 @@
 #endif
 
 #if defined(__lint__)
+#define __thread	/* delete */
 #define	__packed	__packed
 #define	__aligned(x)	/* delete */
 #define	__section(x)	/* delete */



CVS commit: src/usr.bin/time

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 14:34:08 UTC 2017

Modified Files:
src/usr.bin/time: ext.h time.1 time.c

Log Message:
Allow the user to specify the output format on the command line.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/time/ext.h
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/time/time.1
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/time/time.c

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

Modified files:

Index: src/usr.bin/time/ext.h
diff -u src/usr.bin/time/ext.h:1.2 src/usr.bin/time/ext.h:1.3
--- src/usr.bin/time/ext.h:1.2	Wed Nov  9 14:10:10 2011
+++ src/usr.bin/time/ext.h	Sat Jul 15 10:34:08 2017
@@ -1,5 +1,5 @@
-/*	$NetBSD: ext.h,v 1.2 2011/11/09 19:10:10 christos Exp $	*/
+/*	$NetBSD: ext.h,v 1.3 2017/07/15 14:34:08 christos Exp $	*/
 
 /* borrowed from ../../bin/csh/extern.h */
-void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *,
-struct timespec *);
+void prusage1(FILE *, const char *fmt, struct rusage *, struct rusage *,
+struct timespec *, struct timespec *);

Index: src/usr.bin/time/time.1
diff -u src/usr.bin/time/time.1:1.26 src/usr.bin/time/time.1:1.27
--- src/usr.bin/time/time.1:1.26	Wed Dec 21 13:01:21 2016
+++ src/usr.bin/time/time.1	Sat Jul 15 10:34:08 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time.1,v 1.26 2016/12/21 18:01:21 abhinav Exp $
+.\"	$NetBSD: time.1,v 1.27 2017/07/15 14:34:08 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)time.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd November 9, 2011
+.Dd July 15, 2017
 .Dt TIME 1
 .Os
 .Sh NAME
@@ -38,6 +38,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl clp
+.Op Fl f Ar fmt
 .Ar command
 .Op Ar argument ...
 .Sh DESCRIPTION
@@ -63,10 +64,55 @@ Times are reported in seconds.
 Available options:
 .Bl -tag -width Ds
 .It Fl c
-Displays information in the format used by the
+Displays information in the format used by default the
 .Nm
 builtin of
-.Xr csh 1 .
+.Xr csh 1 uses (\&%Uu \&%Ss \&%E \&%P \&%X+\&%Dk \&%I+\&%Oio \&%Fpf+\&%Ww).
+.It Fl f
+Specify a time format using the
+.Xr csh 1
+.Nm
+builtin syntax.
+The following sequences may be used in the format string:
+.Pp
+.Bl -tag -width 4n -compact
+.It \&%U
+The time the process spent in user mode in cpu seconds.
+.It \&%S
+The time the process spent in kernel mode in cpu seconds.
+.It \&%E
+The elapsed (wall clock) time in seconds.
+.It \&%P
+The CPU percentage computed as (\&%U + \&%S) / \&%E.
+.It \&%W
+Number of times the process was swapped.
+.It \&%X
+The average amount in (shared) text space used in Kbytes.
+.It \&%D
+The average amount in (unshared) data/stack space used in Kbytes.
+.It \&%K
+The total space used (\&%X + \&%D) in Kbytes.
+.It \&%M
+The maximum memory the process had in use at any time in Kbytes.
+.It \&%F
+The number of major page faults (page needed to be brought from disk).
+.It \&%R
+The number of minor page faults.
+.It \&%I
+The number of input operations.
+.It \&%O
+The number of output operations.
+.It \&%r
+The number of socket messages received.
+.It \&%s
+The number of socket messages sent.
+.It \&%k
+The number of signals received.
+.It \&%w
+The number of voluntary context switches (waits).
+.It \&%c
+The number of involuntary context switches.
+.El
 .It Fl l
 Lists resource utilization information.
 The contents of the

Index: src/usr.bin/time/time.c
diff -u src/usr.bin/time/time.c:1.22 src/usr.bin/time/time.c:1.23
--- src/usr.bin/time/time.c:1.22	Wed Nov  9 14:10:10 2011
+++ src/usr.bin/time/time.c	Sat Jul 15 10:34:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: time.c,v 1.22 2011/11/09 19:10:10 christos Exp $	*/
+/*	$NetBSD: time.c,v 1.23 2017/07/15 14:34:08 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: time.c,v 1.22 2011/11/09 19:10:10 christos Exp $");
+__RCSID("$NetBSD: time.c,v 1.23 2017/07/15 14:34:08 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -70,31 +70,37 @@ main(int argc, char ** volatile argv)
 	int ch, status;
 	int volatile portableflag;
 	int volatile lflag;
-	int volatile cshflag;
 	const char *decpt;
+	const char *fmt;
 	const struct lconv *lconv;
 	struct timespec before, after;
 	struct rusage ru;
 
 	(void)setlocale(LC_ALL, "");
 
-	cshflag = lflag = portableflag = 0;
-	while ((ch = getopt(argc, argv, "clp")) != -1) {
+	lflag = portableflag = 0;
+	fmt = NULL;
+	while ((ch = getopt(argc, argv, "cf:lp")) != -1) {
 		switch (ch) {
+		case 'f':
+			fmt = optarg;
+			portableflag = 0;
+			lflag = 0;
+			break;
 		case 'c':
-			cshflag = 1;
+			fmt = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
 			portableflag = 0;
 			lflag = 0;
 			break;
 		case 'p':
 			portableflag = 1;
-			cshflag = 0;
+			fmt = NULL;
 			lflag = 0;
 	

CVS commit: src/bin/csh

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 14:35:55 UTC 2017

Modified Files:
src/bin/csh: extern.h time.c

Log Message:
Add a variant that passes the format, so that time(1) can use it.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/extern.h
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/time.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/csh/extern.h
diff -u src/bin/csh/extern.h:1.29 src/bin/csh/extern.h:1.30
--- src/bin/csh/extern.h:1.29	Tue Jul 16 13:47:43 2013
+++ src/bin/csh/extern.h	Sat Jul 15 10:35:55 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.29 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: extern.h,v 1.30 2017/07/15 14:35:55 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -297,6 +297,8 @@ void plist(struct varent *);
  */
 void donice(Char **, struct command *);
 void dotime(Char **, struct command *);
+void prusage1(FILE *, const char *, struct rusage *, struct rusage *,
+	 struct timespec *, struct timespec *);
 void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *,
  struct timespec *);
 void ruadd(struct rusage *, struct rusage *);

Index: src/bin/csh/time.c
diff -u src/bin/csh/time.c:1.20 src/bin/csh/time.c:1.21
--- src/bin/csh/time.c:1.20	Tue Jul 16 13:47:43 2013
+++ src/bin/csh/time.c	Sat Jul 15 10:35:55 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: time.c,v 1.20 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: time.c,v 1.21 2017/07/15 14:35:55 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: time.c,v 1.20 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: time.c,v 1.21 2017/07/15 14:35:55 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -124,32 +124,37 @@ ruadd(struct rusage *ru, struct rusage *
 ru->ru_nvcsw += ru2->ru_nvcsw;
 ru->ru_nivcsw += ru2->ru_nivcsw;
 }
-#endif /* NOT_CSH */
 
 void
 prusage(FILE *fp, struct rusage *r0, struct rusage *r1, struct timespec *e,
 struct timespec *b)
 {
-#ifndef NOT_CSH
 struct varent *vp;
-#endif
 const char *cp;
+
+vp = adrof(STRtime);
+
+if (vp && vp->vec[0] && vp->vec[1])
+	cp = short2str(vp->vec[1]);
+else
+	cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
+prusage1(fp, cp, r0, r1, e, b);
+}
+#endif
+
+void
+prusage1(FILE *fp, const char *cp, struct rusage *r0, struct rusage *r1,
+struct timespec *e, struct timespec *b)
+{
 long i;
 time_t t;
 time_t ms;
 
-cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
 ms = (e->tv_sec - b->tv_sec) * 100 + (e->tv_nsec - b->tv_nsec) / 1000;
 t = (r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
 (r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 1 +
 (r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 +
 (r1->ru_stime.tv_usec - r0->ru_stime.tv_usec) / 1;
-#ifndef NOT_CSH
-vp = adrof(STRtime);
-
-if (vp && vp->vec[0] && vp->vec[1])
-	cp = short2str(vp->vec[1]);
-#endif
 
 for (; *cp; cp++)
 	if (*cp != '%')



CVS commit: src/sys/conf

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 15:20:52 UTC 2017

Modified Files:
src/sys/conf: Makefile.kern.inc
Added Files:
src/sys/conf: dts.mk

Log Message:
Move the dts rule to a separate file and add dependencies handling.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/conf/Makefile.kern.inc
cvs rdiff -u -r0 -r1.1 src/sys/conf/dts.mk

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/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.259 src/sys/conf/Makefile.kern.inc:1.260
--- src/sys/conf/Makefile.kern.inc:1.259	Wed Jul 12 21:17:03 2017
+++ src/sys/conf/Makefile.kern.inc	Sat Jul 15 11:20:52 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.259 2017/07/13 01:17:03 jmcneill Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.260 2017/07/15 15:20:52 christos Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -321,6 +321,7 @@ ${_s:T:R}.o: ${_s}
 .include "${S}/conf/cscope.mk"
 .include "${S}/conf/gdbinit.mk"
 .include "${S}/conf/ssp.mk"
+.include "${S}/conf/dts.mk"
 
 ##
 ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
@@ -534,27 +535,6 @@ build_kernel: .USE
 	@${KCOMPILE.s} -pg
 .endif # ___USE_SUFFIX_RULES___
 
-# Begin DTS handling
-
-DTSINC?=$S/external/gpl2/dts/dist/include
-DTSGNUPATH?=$S/external/gpl2/dts/dist/arch/${MACHINE_CPU}/boot/dts
-DTSPATH?=$S/arch/${MACHINE_CPU}/dts
-DTSPADDING?=1024
-
-.SUFFIXES: .dtb .dts
-.dts.dtb:
-	${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} -I ${DTSGNUPATH} \
-	-include ${.IMPSRC} /dev/null | \
-	${TOOL_DTC} -i ${DTSINC} -i ${DTSPATH} -i ${DTSGNUPATH} -I dts -O dtb \
-	-p ${DTSPADDING} -b 0 -o ${.TARGET}
-
-.PATH.dts: ${DTSPATH} ${DTSGNUPATH}
-
-DTB= ${DTS:.dts=.dtb}
-all: ${DTB}
-
-# End DTS handling
-
 ##
 ## the end
 ##

Added files:

Index: src/sys/conf/dts.mk
diff -u /dev/null src/sys/conf/dts.mk:1.1
--- /dev/null	Sat Jul 15 11:20:52 2017
+++ src/sys/conf/dts.mk	Sat Jul 15 11:20:52 2017
@@ -0,0 +1,26 @@
+# $NetBSD: dts.mk,v 1.1 2017/07/15 15:20:52 christos Exp $
+
+DTSINC?=$S/external/gpl2/dts/dist/include
+DTSGNUPATH?=$S/external/gpl2/dts/dist/arch/${MACHINE_CPU}/boot/dts
+DTSPATH?=$S/arch/${MACHINE_CPU}/dts
+DTSPADDING?=1024
+
+.SUFFIXES: .dtd .dtb .dts
+
+.dts.dtd:
+	${TOOL_DTC} -i ${DTSINC} -i ${DTSPATH} -i ${DTSGNUPATH} -I dts -O dtb \
+	-p ${DTSPADDING} -b 0 -o /dev/null -d /dev/stdout ${.IMPSRC} | \
+	${TOOL_SED} -e 's@/dev/null@${.TARGET:.dtd=.dtb}@' > ${.TARGET}
+
+.dts.dtb:
+	${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} \
+	-I ${DTSGNUPATH} -include ${.IMPSRC} /dev/null | \
+	${TOOL_DTC} -i ${DTSINC} -i ${DTSPATH} -i ${DTSGNUPATH} -I dts -O dtb \
+	-p ${DTSPADDING} -b 0 -o ${.TARGET}
+
+.PATH.dts: ${DTSPATH} ${DTSGNUPATH}
+
+DEPS+= ${DTS:.dts=.dtd}
+DTB= ${DTS:.dts=.dtb}
+
+all: ${DTB}



CVS commit: src/sys/conf

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 15:53:48 UTC 2017

Modified Files:
src/sys/conf: dts.mk

Log Message:
do dts depend processing in two passes, one for /include/ and one for #include


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/conf/dts.mk

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/dts.mk
diff -u src/sys/conf/dts.mk:1.1 src/sys/conf/dts.mk:1.2
--- src/sys/conf/dts.mk:1.1	Sat Jul 15 11:20:52 2017
+++ src/sys/conf/dts.mk	Sat Jul 15 11:53:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: dts.mk,v 1.1 2017/07/15 15:20:52 christos Exp $
+# $NetBSD: dts.mk,v 1.2 2017/07/15 15:53:48 christos Exp $
 
 DTSINC?=$S/external/gpl2/dts/dist/include
 DTSGNUPATH?=$S/external/gpl2/dts/dist/arch/${MACHINE_CPU}/boot/dts
@@ -8,9 +8,17 @@ DTSPADDING?=1024
 .SUFFIXES: .dtd .dtb .dts
 
 .dts.dtd:
+	(${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} \
+	-I ${DTSGNUPATH} -include ${.IMPSRC} /dev/null | \
 	${TOOL_DTC} -i ${DTSINC} -i ${DTSPATH} -i ${DTSGNUPATH} -I dts -O dtb \
-	-p ${DTSPADDING} -b 0 -o /dev/null -d /dev/stdout ${.IMPSRC} | \
-	${TOOL_SED} -e 's@/dev/null@${.TARGET:.dtd=.dtb}@' > ${.TARGET}
+	-p ${DTSPADDING} -b 0 -o /dev/null -d /dev/stdout | \
+	${TOOL_SED} -e 's@/dev/null@${.TARGET:.dtd=.dtb}@' \
+	-e 's@@${.IMPSRC}@' && \
+	${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} \
+	-I ${DTSGNUPATH} -include ${.IMPSRC} -M /dev/null | \
+	${TOOL_SED} -e 's@null.o@${.TARGET:.dtd=.dtb}@' \
+	-e 's@/dev/null@@') > ${.TARGET}
+
 
 .dts.dtb:
 	${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} \



CVS commit: src/sys/netipsec

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 22:48:32 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
fix printf format.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/netipsec/key.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/key.c
diff -u src/sys/netipsec/key.c:1.184 src/sys/netipsec/key.c:1.185
--- src/sys/netipsec/key.c:1.184	Fri Jul 14 08:26:26 2017
+++ src/sys/netipsec/key.c	Sat Jul 15 18:48:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.184 2017/07/14 12:26:26 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.185 2017/07/15 22:48:32 christos Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.184 2017/07/14 12:26:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.185 2017/07/15 22:48:32 christos Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -1199,7 +1199,7 @@ key_validate_savlist(const struct secash
 			KDASSERTMSG(sav->lft_c->sadb_lifetime_addtime <=
 			next->lft_c->sadb_lifetime_addtime,
 			"savlist is not sorted: sah=%p, state=%d, "
-			"sav=%lu, next=%lu", sah, state,
+			"sav=%" PRIu64 ", next=%" PRIu64, sah, state,
 			sav->lft_c->sadb_lifetime_addtime,
 			next->lft_c->sadb_lifetime_addtime);
 		}



CVS commit: src/sys/arch/macppc/stand/bootxx

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 23:26:46 UTC 2017

Modified Files:
src/sys/arch/macppc/stand/bootxx: Makefile

Log Message:
Avoid missing _restgpr_30_x


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/stand/bootxx/Makefile

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

Modified files:

Index: src/sys/arch/macppc/stand/bootxx/Makefile
diff -u src/sys/arch/macppc/stand/bootxx/Makefile:1.16 src/sys/arch/macppc/stand/bootxx/Makefile:1.17
--- src/sys/arch/macppc/stand/bootxx/Makefile:1.16	Thu Apr 20 15:09:29 2017
+++ src/sys/arch/macppc/stand/bootxx/Makefile	Sat Jul 15 19:26:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2017/04/20 19:09:29 uwe Exp $
+#	$NetBSD: Makefile,v 1.17 2017/07/15 23:26:46 christos Exp $
 
 S!=	cd ${.CURDIR}/../../../..; pwd
 
@@ -23,7 +23,7 @@ CLEANFILES+=	${PROG}.sym
 
 ${PROG}: ${OBJS}
 	${_MKTARGET_LINK}
-	${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
+	${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS} ${DESTDIR}/usr/lib/libgcc.a
 	${OBJCOPY} -O binary ${.TARGET}.sym ${.TARGET}
 
 .include 



CVS commit: src/external/gpl3/gcc/dist/gcc/config

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 23:52:30 UTC 2017

Modified Files:
src/external/gpl3/gcc/dist/gcc/config: netbsd.h

Log Message:
fix the powerpc build, by undefining the EH_SPEC entry first.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/gpl3/gcc/dist/gcc/config/netbsd.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/netbsd.h
diff -u src/external/gpl3/gcc/dist/gcc/config/netbsd.h:1.19 src/external/gpl3/gcc/dist/gcc/config/netbsd.h:1.20
--- src/external/gpl3/gcc/dist/gcc/config/netbsd.h:1.19	Fri Jul 14 19:05:27 2017
+++ src/external/gpl3/gcc/dist/gcc/config/netbsd.h	Sat Jul 15 19:52:30 2017
@@ -197,6 +197,7 @@ along with GCC; see the file COPYING3.  
 #undef WINT_TYPE
 #define WINT_TYPE "int"
 
+#undef LINK_EH_SPEC
 #define LINK_EH_SPEC "--eh-frame-hdr "
 
 /* Use --as-needed -lgcc_s for eh support.  */



CVS commit: src/distrib/pmax/ramdisk

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 14:24:30 UTC 2017

Modified Files:
src/distrib/pmax/ramdisk: Makefile

Log Message:
Give us a little room, too much potato chips.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/distrib/pmax/ramdisk/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/pmax/ramdisk/Makefile
diff -u src/distrib/pmax/ramdisk/Makefile:1.47 src/distrib/pmax/ramdisk/Makefile:1.48
--- src/distrib/pmax/ramdisk/Makefile:1.47	Tue Jan 24 13:04:04 2017
+++ src/distrib/pmax/ramdisk/Makefile	Sun Jul 16 10:24:29 2017
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile,v 1.47 2017/01/24 18:04:04 christos Exp $
+#	$NetBSD: Makefile,v 1.48 2017/07/16 14:24:29 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
 IMAGETAR=	diskimage.tgz
-IMAGESIZE=	3400k
+IMAGESIZE=	3500k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1



CVS commit: src/sys/arch/pmax/pmax

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 17:35:20 UTC 2017

Modified Files:
src/sys/arch/pmax/pmax: bus.c

Log Message:
fix printf formats.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/pmax/pmax/bus.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/pmax/pmax/bus.c
diff -u src/sys/arch/pmax/pmax/bus.c:1.2 src/sys/arch/pmax/pmax/bus.c:1.3
--- src/sys/arch/pmax/pmax/bus.c:1.2	Thu May 18 12:34:56 2017
+++ src/sys/arch/pmax/pmax/bus.c	Sun Jul 16 13:35:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.2 2017/05/18 16:34:56 christos Exp $	*/
+/*	$NetBSD: bus.c,v 1.3 2017/07/16 17:35:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.2 2017/05/18 16:34:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.3 2017/07/16 17:35:20 christos Exp $");
 
 #include "opt_cputype.h"
 
@@ -117,10 +117,10 @@ _bus_dmamap_sync_r3k(bus_dma_tag_t t, bu
 
 #ifdef DIAGNOSTIC
 	if (offset >= map->dm_mapsize)
-		panic("_bus_dmamap_sync_r3k: bad offset %lu (map size is %lu)",
-		  offset, map->dm_mapsize);
+		panic("%s: bad offset %ju (map size is %ju)", __func__,
+		  (uintmax_t)offset, (uintmax_t)map->dm_mapsize);
 	if (len == 0 || (offset + len) > map->dm_mapsize)
-		panic("_bus_dmamap_sync_r3k: bad length");
+		panic("%s: bad length", __func__);
 #endif
 
 	/*
@@ -222,10 +222,10 @@ _bus_dmamap_sync_r4k(bus_dma_tag_t t, bu
 
 #ifdef DIAGNOSTIC
 	if (offset >= map->dm_mapsize)
-		panic("_bus_dmamap_sync_r4k: bad offset %lu (map size is %lu)",
-		  offset, map->dm_mapsize);
+		panic("%s: bad offset %ju (map size is %ju)", __func__,
+		  (uintmax_t)offset, (uintmax_t)map->dm_mapsize);
 	if (len == 0 || (offset + len) > map->dm_mapsize)
-		panic("_bus_dmamap_sync_r4k: bad length");
+		panic("%s: bad length", __func__);
 #endif
 
 	/*



CVS commit: src/usr.sbin/inetd

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 21:05:19 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
PR/52412: Edgar Pettijohn: Describe the service/port syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/inetd/inetd.8

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/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.57 src/usr.sbin/inetd/inetd.8:1.58
--- src/usr.sbin/inetd/inetd.8:1.57	Mon Apr 25 18:12:05 2011
+++ src/usr.sbin/inetd/inetd.8	Sun Jul 16 17:05:19 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.57 2011/04/25 22:12:05 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.58 2017/07/16 21:05:19 christos Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,7 +57,7 @@
 .\"
 .\" from: @(#)inetd.8   8.4 (Berkeley) 6/1/94
 .\"
-.Dd August 27, 2008
+.Dd July 16, 2017
 .Dt INETD 8
 .Os
 .Sh NAME
@@ -115,7 +115,7 @@ special case, described below).
 The fields of the configuration file are as follows:
 .Pp
 .Bd -unfilled -offset indent -compact
-[addr:]service-name
+[addr:]service-name/port-number
 socket-type[:accept_filter]
 protocol[,sndbuf=size][,rcvbuf=size]
 wait/nowait[:max]
@@ -152,9 +152,9 @@ server program arguments
 .Ed
 .Pp
 For Internet services, the first field of the line may also have a host
-address specifier prefixed to it, separated from the service name by a colon.
-If this is done, the string before the colon in the first field
-indicates what local address
+address specifier prefixed to it, separated from the service name or port
+number by a colon. If this is done, the string before the colon in the
+first field indicates what local address
 .Nm
 should use when listening for that service, or the single character
 .Dq \&*
@@ -175,11 +175,11 @@ interpreted in the traditional manner, w
 on all local addresses.
 .Pp
 The
-.Em service-name
+.Em service-name/port-number
 entry is the name of a valid service in
 the file
 .Pa /etc/services .
-For
+Or an alternate port number. For
 .Dq internal
 services (discussed below), the service
 name



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

2017-07-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 17 18:43:45 UTC 2017

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

Log Message:
don't complain if the mbr was all 0's.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/installboot/arch/landisk.c

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

Modified files:

Index: src/usr.sbin/installboot/arch/landisk.c
diff -u src/usr.sbin/installboot/arch/landisk.c:1.6 src/usr.sbin/installboot/arch/landisk.c:1.7
--- src/usr.sbin/installboot/arch/landisk.c:1.6	Sat Oct 19 13:08:15 2013
+++ src/usr.sbin/installboot/arch/landisk.c	Mon Jul 17 14:43:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: landisk.c,v 1.6 2013/10/19 17:08:15 christos Exp $	*/
+/*	$NetBSD: landisk.c,v 1.7 2017/07/17 18:43:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if !defined(__lint)
-__RCSID("$NetBSD: landisk.c,v 1.6 2013/10/19 17:08:15 christos Exp $");
+__RCSID("$NetBSD: landisk.c,v 1.7 2017/07/17 18:43:45 christos Exp $");
 #endif /* !__lint */
 
 #include 
@@ -100,12 +100,18 @@ landisk_setboot(ib_params *params)
 		goto done;
 	}
 	if (mbr.mbr_magic != le16toh(MBR_MAGIC)) {
-		if (params->flags & IB_VERBOSE) {
-			printf(
-		"Ignoring MBR with invalid magic in sector 0 of `%s'\n",
-			params->filesystem);
+		const char *p = (const char *)&mbr;
+		const char *e = p + sizeof(mbr);
+		while (p < e && !*p)
+			p++;
+		if (p != e) {
+			if (params->flags & IB_VERBOSE) {
+printf(
+			"Ignoring MBR with invalid magic in sector 0 of `%s'\n",
+params->filesystem);
+			}
+			memset(&mbr, 0, sizeof(mbr));
 		}
-		memset(&mbr, 0, sizeof(mbr));
 	}
 
 	/*



CVS commit: src/sbin/modload

2017-07-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 18 13:00:00 UTC 2017

Modified Files:
src/sbin/modload: modload.8

Log Message:
PR/52417: Edgar Pettijohn: modules.conf(5) not mentioned in related manuals


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sbin/modload/modload.8

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

Modified files:

Index: src/sbin/modload/modload.8
diff -u src/sbin/modload/modload.8:1.45 src/sbin/modload/modload.8:1.46
--- src/sbin/modload/modload.8:1.45	Mon Sep 12 02:52:59 2016
+++ src/sbin/modload/modload.8	Tue Jul 18 09:00:00 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: modload.8,v 1.45 2016/09/12 06:52:59 wiz Exp $
+.\" $NetBSD: modload.8,v 1.46 2017/07/18 13:00:00 christos Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <>
 .\"
-.Dd September 12, 2016
+.Dd JUly 18, 2017
 .Dt MODLOAD 8
 .Os
 .Sh NAME
@@ -129,6 +129,7 @@ utility exits with a status of 0 on succ
 and with a nonzero status if an error occurs.
 .Sh SEE ALSO
 .Xr modctl 2 ,
+.Xr modules.conf 5 ,
 .Xr module 7 ,
 .Xr modstat 8 ,
 .Xr modunload 8



CVS commit: src/distrib/newsmips/floppies/ramdisk

2017-07-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 18 23:07:20 UTC 2017

Modified Files:
src/distrib/newsmips/floppies/ramdisk: Makefile

Log Message:
bump


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/distrib/newsmips/floppies/ramdisk/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/newsmips/floppies/ramdisk/Makefile
diff -u src/distrib/newsmips/floppies/ramdisk/Makefile:1.33 src/distrib/newsmips/floppies/ramdisk/Makefile:1.34
--- src/distrib/newsmips/floppies/ramdisk/Makefile:1.33	Tue Jan 24 13:04:03 2017
+++ src/distrib/newsmips/floppies/ramdisk/Makefile	Tue Jul 18 19:07:20 2017
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.33 2017/01/24 18:04:03 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2017/07/18 23:07:20 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	2660k
+IMAGESIZE=	2800k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1



CVS commit: src/sys/dev/usb

2017-07-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 18 23:11:01 UTC 2017

Modified Files:
src/sys/dev/usb: ualea.c

Log Message:
don't subtract uninitialized pktsize in error path.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/ualea.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/usb/ualea.c
diff -u src/sys/dev/usb/ualea.c:1.7 src/sys/dev/usb/ualea.c:1.8
--- src/sys/dev/usb/ualea.c:1.7	Sat Jul 15 01:46:09 2017
+++ src/sys/dev/usb/ualea.c	Tue Jul 18 19:11:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ualea.c,v 1.7 2017/07/15 05:46:09 riastradh Exp $	*/
+/*	$NetBSD: ualea.c,v 1.8 2017/07/18 23:11:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.7 2017/07/15 05:46:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.8 2017/07/18 23:11:01 christos Exp $");
 
 #include 
 #include 
@@ -248,7 +248,7 @@ ualea_xfer_done(struct usbd_xfer *xfer, 
 	/* Check the transfer status.  */
 	if (status) {
 		aprint_error_dev(sc->sc_dev, "xfer failed: %d\n", status);
-		goto out;
+		return;
 	}
 
 	/* Get and sanity-check the transferred size.  */



CVS commit: src/distrib/cobalt/ramdisk

2017-07-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 18 23:12:24 UTC 2017

Modified Files:
src/distrib/cobalt/ramdisk: Makefile

Log Message:
bump


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/distrib/cobalt/ramdisk/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/cobalt/ramdisk/Makefile
diff -u src/distrib/cobalt/ramdisk/Makefile:1.11 src/distrib/cobalt/ramdisk/Makefile:1.12
--- src/distrib/cobalt/ramdisk/Makefile:1.11	Tue Jan 24 13:04:01 2017
+++ src/distrib/cobalt/ramdisk/Makefile	Tue Jul 18 19:12:24 2017
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.11 2017/01/24 18:04:01 christos Exp $
+#	$NetBSD: Makefile,v 1.12 2017/07/18 23:12:24 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	3500k
+IMAGESIZE=	3600k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1



CVS commit: src/sys/external/bsd/ipf/netinet

2017-07-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 20 18:12:51 UTC 2017

Modified Files:
src/sys/external/bsd/ipf/netinet: ip_fil_netbsd.c

Log Message:
Fix ipf failing to sent TCP RST's on link-local interfaces by stuffing
the scope KAME style before calling the routing routines instead of after.
>From Edgar Fuss.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.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/external/bsd/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.23 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.24
--- src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.23	Fri May 12 04:03:26 2017
+++ src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c	Thu Jul 20 14:12:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_netbsd.c,v 1.23 2017/05/12 08:03:26 christos Exp $	*/
+/*	$NetBSD: ip_fil_netbsd.c,v 1.24 2017/07/20 18:12:51 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.23 2017/05/12 08:03:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.24 2017/07/20 18:12:51 christos Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -1420,6 +1420,9 @@ ipf_fastroute6(struct mbuf *m0, struct m
 		sockaddr_in6_init(&u.dst6, &fdp->fd_ip6.in6, 0, 0, 0);
 	else
 		sockaddr_in6_init(&u.dst6, &fin->fin_fi.fi_dst.in6, 0, 0, 0);
+	/* KAME */
+	if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
+		u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
 	dst = &u.dst;
 	rtcache_setdst(ro, dst);
 
@@ -1431,6 +1434,9 @@ ipf_fastroute6(struct mbuf *m0, struct m
 	dst6->sin6_family = AF_INET6;
 	dst6->sin6_len = sizeof(struct sockaddr_in6);
 	dst6->sin6_addr = fin->fin_fi.fi_dst.in6;
+	/* KAME */
+	if (IN6_IS_ADDR_LINKLOCAL(&dst6->sin6_addr))
+		dst6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
 
 	if (fdp != NULL) {
 		if (IP6_NOTZERO(&fdp->fd_ip6))
@@ -1449,15 +1455,6 @@ ipf_fastroute6(struct mbuf *m0, struct m
 		goto bad;
 	}
 
-	/* KAME */
-# if __NetBSD_Version__ >= 499001100
-	if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
-		u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
-# else
-	if (IN6_IS_ADDR_LINKLOCAL(&dst6->sin6_addr))
-		dst6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
-# endif
-
 	{
 # if (__NetBSD_Version__ >= 10601) && !defined(IN6_LINKMTU)
 		struct in6_ifextra *ife;



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

2017-07-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 22 19:26:41 UTC 2017

Modified Files:
src/sys/arch/cobalt/conf: RAMDISK

Log Message:
we need to get on a diet


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/cobalt/conf/RAMDISK

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/cobalt/conf/RAMDISK
diff -u src/sys/arch/cobalt/conf/RAMDISK:1.7 src/sys/arch/cobalt/conf/RAMDISK:1.8
--- src/sys/arch/cobalt/conf/RAMDISK:1.7	Sat Feb 20 20:33:56 2016
+++ src/sys/arch/cobalt/conf/RAMDISK	Sat Jul 22 15:26:41 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RAMDISK,v 1.7 2016/02/21 01:33:56 christos Exp $
+#	$NetBSD: RAMDISK,v 1.8 2017/07/22 19:26:41 christos Exp $
 #
 #	memory disk based configuration file
 #
@@ -9,7 +9,7 @@ include		"arch/cobalt/conf/GENERIC"
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT		# force root on memory disk
 options 	MEMORY_DISK_SERVER=0		# no userspace md(4) support
-options 	MEMORY_DISK_ROOT_SIZE=7000	# size of memory disk, in blocks
+options 	MEMORY_DISK_ROOT_SIZE=7400	# size of memory disk, in blocks
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 makeoptions	COPTS="-Os -mmemcpy"	# generates smaller code than -O2, -O1



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

2017-07-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 22 20:21:09 UTC 2017

Modified Files:
src/sys/arch/newsmips/conf: INSTALL

Log Message:
surf the bloat


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/newsmips/conf/INSTALL

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/newsmips/conf/INSTALL
diff -u src/sys/arch/newsmips/conf/INSTALL:1.44 src/sys/arch/newsmips/conf/INSTALL:1.45
--- src/sys/arch/newsmips/conf/INSTALL:1.44	Sat Aug 23 16:26:59 2014
+++ src/sys/arch/newsmips/conf/INSTALL	Sat Jul 22 16:21:09 2017
@@ -1,4 +1,4 @@
-# 	$NetBSD: INSTALL,v 1.44 2014/08/23 20:26:59 dholland Exp $
+# 	$NetBSD: INSTALL,v 1.45 2017/07/22 20:21:09 christos Exp $
 #
 #	INSTALL kernel for RISC-NEWS
 
@@ -14,7 +14,7 @@ maxusers	8
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT		# Force root on ram-disk
 options 	MEMORY_DISK_SERVER=0		# no userspace md(4) support
-options 	MEMORY_DISK_ROOT_SIZE=5320	# 2.6 Megabytes
+options 	MEMORY_DISK_ROOT_SIZE=5700	# 2.85 Megabytes
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 options 	news3400



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2017-07-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 23 05:40:28 UTC 2017

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: isakmp_frag.c

Log Message:
PR/51682: Antoine Beaupr�: Simplify and comment previous patch.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.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/dist/ipsec-tools/src/racoon/isakmp_frag.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c:1.6 src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c:1.7
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c:1.6	Tue Jan 24 14:23:31 2017
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c	Sun Jul 23 01:40:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp_frag.c,v 1.6 2017/01/24 19:23:31 christos Exp $	*/
+/*	$NetBSD: isakmp_frag.c,v 1.7 2017/07/23 05:40:27 christos Exp $	*/
 
 /* Id: isakmp_frag.c,v 1.4 2004/11/13 17:31:36 manubsd Exp */
 
@@ -179,20 +179,26 @@ isakmp_frag_insert(struct ph1handle *iph
 	struct isakmp_frag_item *pitem = NULL;
 	struct isakmp_frag_item *citem = iph1->frag_chain;
 
+	/* no frag yet, just insert at beginning of list */
 	if (iph1->frag_chain == NULL) {
 		iph1->frag_chain = item;
 		return 0;
 	}
 
 	do {
+		/* duplicate fragment number, abort (CVE-2016-10396) */
 		if (citem->frag_num == item->frag_num)
 			return -1;
 
+		/* need to insert before current item */
 		if (citem->frag_num > item->frag_num) {
-			if (pitem)
+			if (pitem != NULL)
 pitem->frag_next = item;
+			else
+/* insert at the beginning of the list  */
+iph1->frag_chain = item;
 			item->frag_next = citem;
-			break;
+			return 0;
 		}
 
 		pitem = citem;
@@ -200,8 +206,7 @@ isakmp_frag_insert(struct ph1handle *iph
 	} while (citem != NULL);
 
 	/* we reached the end of the list, insert */
-	if (citem == NULL)
-	  pitem->frag_next = item;
+	pitem->frag_next = item;
 	return 0;
 }
 



CVS commit: src/sys/external/bsd/ipf/netinet

2017-07-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 23 06:12:02 UTC 2017

Modified Files:
src/sys/external/bsd/ipf/netinet: ip_fil_netbsd.c

Log Message:
>From Edgar Fuss:
ipf's return-icmp doesn't work when the packet matched by the rule is
directed at a link local address. The problem is that
ipf_send_icmp_err() calls ipf_ifpaddr() to find an address of the
interface in question, but that routine discards link local addresses.
I guess the best fix is to simply use the destination address instead if
it is link local, i.e. treat the rule as if return-icmp-as-dest was
given in this case.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.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/external/bsd/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.24 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.25
--- src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.24	Thu Jul 20 14:12:51 2017
+++ src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c	Sun Jul 23 02:12:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_netbsd.c,v 1.24 2017/07/20 18:12:51 christos Exp $	*/
+/*	$NetBSD: ip_fil_netbsd.c,v 1.25 2017/07/23 06:12:02 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.24 2017/07/20 18:12:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.25 2017/07/23 06:12:02 christos Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -987,7 +987,7 @@ ipf_send_icmp_err(int type, fr_info_t *f
 		}
 		xtra = MIN(fin->fin_plen, avail - iclen - max_linkhdr);
 		xtra = MIN(xtra, IPV6_MMTU - iclen);
-		if (dst == 0) {
+		if (dst == 0 && !IN6_IS_ADDR_LINKLOCAL(&fin->fin_dst6.in6)) {
 			if (ipf_ifpaddr(&ipfmain, 6, FRI_NORMAL, ifp,
    &dst6, NULL) == -1) {
 FREE_MB_T(m);



CVS commit: src/sys/external/bsd/ipf/netinet

2017-07-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 23 06:19:00 UTC 2017

Modified Files:
src/sys/external/bsd/ipf/netinet: ip_fil_netbsd.c

Log Message:
use the scoping functions (JINMEI, Tatuya)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.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/external/bsd/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.25 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.26
--- src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.25	Sun Jul 23 02:12:02 2017
+++ src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c	Sun Jul 23 02:19:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_netbsd.c,v 1.25 2017/07/23 06:12:02 christos Exp $	*/
+/*	$NetBSD: ip_fil_netbsd.c,v 1.26 2017/07/23 06:19:00 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.25 2017/07/23 06:12:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.26 2017/07/23 06:19:00 christos Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -79,6 +79,9 @@ static const char rcsid[] = "@(#)Id: ip_
 # if (__NetBSD_Version__ >= 10600)
 #  include 
 # endif
+# if __NetBSD_Version__ >= 499001100
+#  include 
+# endif
 #endif
 #include "netinet/ip_fil.h"
 #include "netinet/ip_nat.h"
@@ -1420,9 +1423,12 @@ ipf_fastroute6(struct mbuf *m0, struct m
 		sockaddr_in6_init(&u.dst6, &fdp->fd_ip6.in6, 0, 0, 0);
 	else
 		sockaddr_in6_init(&u.dst6, &fin->fin_fi.fi_dst.in6, 0, 0, 0);
-	/* KAME */
-	if (IN6_IS_ADDR_LINKLOCAL(&u.dst6.sin6_addr))
-		u.dst6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
+	if ((error = in6_setscope(&u.dst6.sin6_addr, ifp,
+	&u.dst6.sin6_scope_id)) != 0)
+		return error;
+	if ((error = sa6_embedscope(&u.dst6, 0)) != 0)
+		return error;
+
 	dst = &u.dst;
 	rtcache_setdst(ro, dst);
 



CVS commit: src/sys/compat/svr4_32

2017-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 30 12:31:47 UTC 2017

Modified Files:
src/sys/compat/svr4_32: svr4_32_signal.c

Log Message:
make it compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/compat/svr4_32/svr4_32_signal.c

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

Modified files:

Index: src/sys/compat/svr4_32/svr4_32_signal.c
diff -u src/sys/compat/svr4_32/svr4_32_signal.c:1.29 src/sys/compat/svr4_32/svr4_32_signal.c:1.30
--- src/sys/compat/svr4_32/svr4_32_signal.c:1.29	Fri Jul 28 13:38:36 2017
+++ src/sys/compat/svr4_32/svr4_32_signal.c	Sun Jul 30 08:31:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_signal.c,v 1.29 2017/07/28 17:38:36 riastradh Exp $	 */
+/*	$NetBSD: svr4_32_signal.c,v 1.30 2017/07/30 12:31:46 christos Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.29 2017/07/28 17:38:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.30 2017/07/30 12:31:46 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_svr4.h"
@@ -397,16 +397,16 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = (sig_t)SCARG(uap, handler);
 		sigemptyset(&nbsa.sa_mask);
 		nbsa.sa_flags = 0;
-		error = sigaction1(l, signum, &nbsa, &obsa, NULL, 0);
+		error = sigaction1(l, native_signo, &nbsa, &obsa, NULL, 0);
 		if (error)
-			return (error);
+			return error;
 		*retval = (u_int)(u_long)obsa.sa_handler;
-		return (0);
+		return 0;
 
 	case SVR4_SIGHOLD_MASK:
 	sighold:
 		sigemptyset(&ss);
-		sigaddset(&ss, signum);
+		sigaddset(&ss, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_BLOCK, &ss, 0);
 		mutex_exit(p->p_lock);
@@ -414,7 +414,7 @@ svr4_32_sys_signal(struct lwp *l, const 
 
 	case SVR4_SIGRELSE_MASK:
 		sigemptyset(&ss);
-		sigaddset(&ss, signum);
+		sigaddset(&ss, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_UNBLOCK, &ss, 0);
 		mutex_exit(p->p_lock);
@@ -424,17 +424,17 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = SIG_IGN;
 		sigemptyset(&nbsa.sa_mask);
 		nbsa.sa_flags = 0;
-		return (sigaction1(l, signum, &nbsa, 0, NULL, 0));
+		return sigaction1(l, native_signo, &nbsa, 0, NULL, 0);
 
 	case SVR4_SIGPAUSE_MASK:
 		mutex_enter(p->p_lock);
 		ss = l->l_sigmask;
 		mutex_exit(p->p_lock);
-		sigdelset(&ss, signum);
-		return (sigsuspend1(l, &ss));
+		sigdelset(&ss, native_signo);
+		return sigsuspend1(l, &ss);
 
 	default:
-		return (ENOSYS);
+		return ENOSYS;
 	}
 }
 



CVS commit: src/sys/arch/hpcmips/stand/pbsdboot

2017-08-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  1 11:56:58 UTC 2017

Modified Files:
src/sys/arch/hpcmips/stand/pbsdboot: main.c

Log Message:
PR/52445: David Binderman: Fix wcstombs error checking


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/hpcmips/stand/pbsdboot/main.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/hpcmips/stand/pbsdboot/main.c
diff -u src/sys/arch/hpcmips/stand/pbsdboot/main.c:1.62 src/sys/arch/hpcmips/stand/pbsdboot/main.c:1.63
--- src/sys/arch/hpcmips/stand/pbsdboot/main.c:1.62	Fri Dec 14 16:15:52 2007
+++ src/sys/arch/hpcmips/stand/pbsdboot/main.c	Tue Aug  1 07:56:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.62 2007/12/14 21:15:52 pavel Exp $	*/
+/*	$NetBSD: main.c,v 1.63 2017/08/01 11:56:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000 Shin Takemura.
@@ -1114,13 +1114,11 @@ BOOL BootKernel(int directboot)
 			szAppName, MB_OK);
 		return FALSE;
 	}
-	GetDlgItemText(hDlgMain, IDC_OPTIONS,
-		woptions, sizeof(woptions));
-	if (wcstombs(options, woptions, sizeof(options)) < 0 ||
-		wcstombs(kernel_name, wkernel_name,
-			 sizeof(kernel_name)) < 0) {
-		MessageBox (NULL, TEXT("invalid character"),
-			szAppName, MB_OK);
+	GetDlgItemText(hDlgMain, IDC_OPTIONS, woptions, sizeof(woptions));
+	if (wcstombs(options, woptions, sizeof(options)) == (size_t)-1 ||
+	wcstombs(kernel_name, wkernel_name, sizeof(kernel_name))
+	== (size_t)-1) {
+		MessageBox(NULL, TEXT("invalid character"), szAppName, MB_OK);
 		return FALSE;
 	}
 	
@@ -1209,8 +1207,8 @@ BOOL BootKernel(int directboot)
 		platid.dw.dw0 = bi.platid_cpu;
 		platid.dw.dw1 = bi.platid_machine;
 		if (set_system_info(&platid)) {
-		/*
-		*  boot !
+			/*
+			*  boot !
 			*/
 			pbsdboot(wkernel_name, argc, argv, &bi);
 		}



CVS commit: src/sys/arch/hpcmips/stand/libsa

2017-08-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  1 11:58:45 UTC 2017

Modified Files:
src/sys/arch/hpcmips/stand/libsa: devopen.c

Log Message:
PR/52446: Devid Binderman: Fix error checking for wcstombs


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hpcmips/stand/libsa/devopen.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/hpcmips/stand/libsa/devopen.c
diff -u src/sys/arch/hpcmips/stand/libsa/devopen.c:1.6 src/sys/arch/hpcmips/stand/libsa/devopen.c:1.7
--- src/sys/arch/hpcmips/stand/libsa/devopen.c:1.6	Sat Mar 14 17:04:09 2009
+++ src/sys/arch/hpcmips/stand/libsa/devopen.c	Tue Aug  1 07:58:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.6 2009/03/14 21:04:09 dsl Exp $	*/
+/*	$NetBSD: devopen.c,v 1.7 2017/08/01 11:58:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999 Shin Takemura.
@@ -80,7 +80,7 @@ parsebootfile(const char *fnamexx, char 
 	} else {
 		static char name[1024]; /* XXX */
 
-		if (wcstombs(name, (TCHAR*)fname, sizeof(name)) < 0) {
+		if (wcstombs(name, (TCHAR*)fname, sizeof(name)) == (size_t)-1) {
 			return (ENOENT);
 		}
 		if ('1' <= name[0] && name[0] <= '9' && name[1] == ':') {



CVS commit: src/sys/dev/pcmcia

2017-08-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  1 12:15:21 UTC 2017

Modified Files:
src/sys/dev/pcmcia: aic_pcmcia.c

Log Message:
>From bjoern johannesson, in netbsd-general... Reset the mask to 0, used to
be 0xa. Is it wrong in the cfe? Should this better be done via a quirk?


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pcmcia/aic_pcmcia.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/pcmcia/aic_pcmcia.c
diff -u src/sys/dev/pcmcia/aic_pcmcia.c:1.43 src/sys/dev/pcmcia/aic_pcmcia.c:1.44
--- src/sys/dev/pcmcia/aic_pcmcia.c:1.43	Thu Nov 12 14:24:06 2009
+++ src/sys/dev/pcmcia/aic_pcmcia.c	Tue Aug  1 08:15:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic_pcmcia.c,v 1.43 2009/11/12 19:24:06 dyoung Exp $	*/
+/*	$NetBSD: aic_pcmcia.c,v 1.44 2017/08/01 12:15:21 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.43 2009/11/12 19:24:06 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.44 2017/08/01 12:15:21 christos Exp $");
 
 #include 
 #include 
@@ -101,6 +101,8 @@ aic_pcmcia_validate_config(struct pcmcia
 	cfe->num_memspace != 0 ||
 	cfe->num_iospace != 1)
 		return (EINVAL);
+
+	cfe->iomask = 0;		/* XXX: wrong from cfe?, quirk? */
 	return (0);
 }
 



CVS commit: src/sys/kern

2017-08-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug  6 09:14:14 UTC 2017

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

Log Message:
use the same string for the log and uprintf.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/kern/kern_synch.c

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

Modified files:

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.311 src/sys/kern/kern_synch.c:1.312
--- src/sys/kern/kern_synch.c:1.311	Sun Jul  3 10:24:58 2016
+++ src/sys/kern/kern_synch.c	Sun Aug  6 05:14:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.311 2016/07/03 14:24:58 christos Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.312 2017/08/06 09:14:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.311 2016/07/03 14:24:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.312 2017/08/06 09:14:14 christos Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -1208,11 +1208,11 @@ sched_pstats(void)
 		if (__predict_false(runtm >= rlim->rlim_cur)) {
 			if (runtm >= rlim->rlim_max) {
 sig = SIGKILL;
-log(LOG_NOTICE, "pid %d is killed: %s\n",
-	p->p_pid, "exceeded RLIMIT_CPU");
+log(LOG_NOTICE,
+"pid %d, command %s, is killed: %s\n",
+p->p_pid, p->p_comm, "exceeded RLIMIT_CPU");
 uprintf("pid %d, command %s, is killed: %s\n",
-	p->p_pid, p->p_comm,
-	"exceeded RLIMIT_CPU");
+p->p_pid, p->p_comm, "exceeded RLIMIT_CPU");
 			} else {
 sig = SIGXCPU;
 if (rlim->rlim_cur < rlim->rlim_max)



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

2017-08-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug  6 11:50:21 UTC 2017

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

Log Message:
Turn on DIAGNOSTIC and DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/pmax/conf/GENERIC

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/pmax/conf/GENERIC
diff -u src/sys/arch/pmax/conf/GENERIC:1.191 src/sys/arch/pmax/conf/GENERIC:1.192
--- src/sys/arch/pmax/conf/GENERIC:1.191	Fri Jul 28 15:26:16 2017
+++ src/sys/arch/pmax/conf/GENERIC	Sun Aug  6 07:50:21 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.191 2017/07/28 19:26:16 maxv Exp $
+# $NetBSD: GENERIC,v 1.192 2017/08/06 11:50:21 christos Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/pmax/conf/std.pmax"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.191 $"
+#ident		"GENERIC-$Revision: 1.192 $"
 
 maxusers	64
 
@@ -47,8 +47,11 @@ makeoptions	DEBUG="-g"
 options 	DDB			# in-kernel debugger
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 options 	DDB_ONPANIC=0		# don't enter debugger on panic
-#options 	DIAGNOSTIC		# extra kernel debugging checks
-#options 	DEBUG			# extra kernel debugging support
+options 	DIAGNOSTIC		# extra kernel debugging checks
+options 	DEBUG			# extra kernel debugging support
+options		LOCKDEBUG
+#options	VMFAULT_TRACE
+#options	PMAP_FAULTINFO
 options 	COMPAT_43		# compatibility with 4.3BSD binaries
 options 	KTRACE			# system call tracing support
 



CVS commit: src/sys/netinet6

2017-08-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug  9 17:20:44 UTC 2017

Modified Files:
src/sys/netinet6: scope6_var.h

Log Message:
PR/52472: Edgar Fuss: Document handling of scoped IPv6 addresses by embedding
ASCII art from:
IPv6 Core Protocols Implementation
By Qing Li, Tatuya Jinmei, Keiichi Shima
Page 56, Figure 2.12


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet6/scope6_var.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/netinet6/scope6_var.h
diff -u src/sys/netinet6/scope6_var.h:1.3 src/sys/netinet6/scope6_var.h:1.4
--- src/sys/netinet6/scope6_var.h:1.3	Tue Dec  9 20:10:37 2014
+++ src/sys/netinet6/scope6_var.h	Wed Aug  9 13:20:44 2017
@@ -34,6 +34,65 @@
 #define _NETINET6_SCOPE6_VAR_H_
 
 #ifdef _KERNEL
+
+/*
+ * IPv6 Core Protocols Implementation
+ * By Qing Li, Tatuya Jinmei, Keiichi Shima
+ *
+ * Some information from Chapter 2.9 (Handling Scope Zones) Figure 2.12, p.56
+ *
+ * User Space
+ *
+ * Normal App Statistics/Mgmt AppRouting App
+ *  /---\/---\   /--\
+ *  | sin6_scope_id ||   embedded form   |   |  embedded form   |
+ *  |  only || (+ sin6_scope_id) |   | or sin6_scope_id |
+ *  \---/\---/   \--/
+ *  ^  ^^  |
+ *  |  ||  |
+ *no conversion  parseparse  embed
+ *  |   embeddedembbeded  ID
+ *  |  ID  ID(if necessary)
+ *  |  ||  |
+ *  v  ||  v
+ *  /---\/---\   /--\
+ * --   |AF_INET6   ||kvm|   | Routing  |
+ * Kernel   | socket|| interface |   | socket   |
+ *  \---/\---/   \--/
+ * ^   |  ^^
+ * |   |  ||
+ *   clear   embed   no conversion |
+ *  embedded  ID  |   no conversion
+ *ID   |  --   |
+ * |   V  ||   v
+ *  /---\/\
+ *  |   | clear sin_scope_id --->| embedded form only |
+ *  |   |<---  set sin_scope_id  ||
+ *  |   |\/
+ *  | embedded form |  ^
+ *  |   +   |  |
+ *  | sin_scope_id  |no conversion
+ *  |   |  |
+ *  |   |  V
+ *  |   |/\
+ *  |   | clear sin_scope_id --->| embedded form only |
+ *  |   |<---  set sin_scope_id  ||
+ *  \---/\/
+ *    ^   |
+ * Physical   | clear 
+ * Network  embed ID,  embedded
+ *   set ID
+ *sin_scope_id|
+ *|   v
+ *  /---\
+ *  | 128-bit IPv6  |
+ *  | address   |
+ *  | (ID not   |
+ *  |  included)|
+ *  \---/
+ */
+
+
 struct scope6_id {
 	/*
 	 * 16 is correspondent to 4bit multicast scope field.



CVS commit: src/sys/arch

2017-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 08:48:30 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC
src/sys/arch/evbmips/conf: LOONGSON
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
Add ALPS pms support


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.463 -r1.464 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbmips/conf/LOONGSON
cvs rdiff -u -r1.426 -r1.427 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1165 -r1.1166 src/sys/arch/i386/conf/GENERIC

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/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.66 src/sys/arch/amd64/conf/ALL:1.67
--- src/sys/arch/amd64/conf/ALL:1.66	Sat Aug 12 02:46:13 2017
+++ src/sys/arch/amd64/conf/ALL	Sun Aug 13 04:48:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.66 2017/08/12 06:46:13 maxv Exp $
+# $NetBSD: ALL,v 1.67 2017/08/13 08:48:30 christos Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.66 $"
+#ident		"ALL-$Revision: 1.67 $"
 
 maxusers	64		# estimated number of users
 
@@ -502,6 +502,7 @@ pckbd*		at pckbc?		# PC keyboard
 pms*		at pckbc?		# PS/2 mouse for wsmouse
 options 	PMS_SYNAPTICS_TOUCHPAD	# Enable support for Synaptics Touchpads
 options 	PMS_ELANTECH_TOUCHPAD	# Enable support for Elantech Touchpads
+options 	PMS_ALPS_TOUCHPAD	# Enable support for Alps Touchpads
 vga0		at isa?
 vga*		at pci? dev ? function ?
 genfb*		at pci? dev ? function ?

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.463 src/sys/arch/amd64/conf/GENERIC:1.464
--- src/sys/arch/amd64/conf/GENERIC:1.463	Fri Aug  4 05:30:19 2017
+++ src/sys/arch/amd64/conf/GENERIC	Sun Aug 13 04:48:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.463 2017/08/04 09:30:19 maxv Exp $
+# $NetBSD: GENERIC,v 1.464 2017/08/13 08:48:30 christos 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.463 $"
+#ident		"GENERIC-$Revision: 1.464 $"
 
 maxusers	64		# estimated number of users
 
@@ -394,6 +394,7 @@ pms*		at pckbc?		# PS/2 mouse for wsmous
 #options 	PMS_DISABLE_POWERHOOK	# Disable PS/2 reset on resume
 options 	PMS_SYNAPTICS_TOUCHPAD	# Enable support for Synaptics Touchpads
 options 	PMS_ELANTECH_TOUCHPAD	# Enable support for Elantech Touchpads
+options 	PMS_ALPS_TOUCHPAD	# Enable support for Alps Touchpads
 vga*		at pci? dev ? function ?
 genfb*		at pci? dev ? function ?
 options 	VCONS_DRAW_INTR

Index: src/sys/arch/evbmips/conf/LOONGSON
diff -u src/sys/arch/evbmips/conf/LOONGSON:1.31 src/sys/arch/evbmips/conf/LOONGSON:1.32
--- src/sys/arch/evbmips/conf/LOONGSON:1.31	Thu May 11 03:56:43 2017
+++ src/sys/arch/evbmips/conf/LOONGSON	Sun Aug 13 04:48:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: LOONGSON,v 1.31 2017/05/11 07:56:43 maya Exp $
+# $NetBSD: LOONGSON,v 1.32 2017/08/13 08:48:30 christos Exp $
 #
 # LOONGSON machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/evbmips/conf/std.loongson
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"LOONGSON-$Revision: 1.31 $"
+#ident 		"LOONGSON-$Revision: 1.32 $"
 
 maxusers	16
 
@@ -200,8 +200,10 @@ isa0		at pcib?
 pckbc0		at isa?# PC keyboard controller
 pckbd*		at pckbc?			# PC keyboard
 pms*		at pckbc?			# PS/2 mouse for wsmouse
+#options 	PMS_DISABLE_POWERHOOK	# Disable PS/2 reset on resume
 options 	PMS_SYNAPTICS_TOUCHPAD	# Enable support for Synaptics Touchpads
 options 	PMS_ELANTECH_TOUCHPAD	# Enable support for Elantech Touchpads
+options 	PMS_ALPS_TOUCHPAD	# Enable support for Alps Touchpads
 wskbd*		at pckbd? console ?
 wsmouse*	at pms? mux 0
 

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.426 src/sys/arch/i386/conf/ALL:1.427
--- src/sys/arch/i386/conf/ALL:1.426	Sat Aug 12 02:46:13 2017
+++ src/sys/arch/i386/conf/ALL	Sun Aug 13 04:48:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.426 2017/08/12 06:46:13 maxv Exp $
+# $NetBSD: ALL,v 1.427 2017/08/13 08:48:30 christos Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.426 $"
+#ident		"ALL-$Revision: 1.427 $"
 
 maxusers	64		# estimated number of users
 
@@ -574,6 +574,7 @@ pckbd*		at pckbc?		# PC keyboard
 pms*		at pckbc?		# PS/2 mouse for wsmouse
 options 	PMS_SYNAPTICS_TOUCHPAD	# Enable support for Synaptics Touchpads
 options 	PMS_ELANTECH_TOUCHPAD	# Enable support for

CVS commit: src/sys/dev/pckbport

2017-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 13 08:49:27 UTC 2017

Modified Files:
src/sys/dev/pckbport: files.pckbport pms.c pmsvar.h
Added Files:
src/sys/dev/pckbport: alps.c alpsreg.h alpsvar.h

Log Message:
PR/52483: Ryo ONODERA: Add support for ALPS PS/2 pointing devices


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/pckbport/alps.c \
src/sys/dev/pckbport/alpsreg.h src/sys/dev/pckbport/alpsvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pckbport/files.pckbport
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pckbport/pms.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pckbport/pmsvar.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/pckbport/files.pckbport
diff -u src/sys/dev/pckbport/files.pckbport:1.8 src/sys/dev/pckbport/files.pckbport:1.9
--- src/sys/dev/pckbport/files.pckbport:1.8	Wed Sep  7 15:05:13 2011
+++ src/sys/dev/pckbport/files.pckbport	Sun Aug 13 04:49:27 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.pckbport,v 1.8 2011/09/07 19:05:13 jakllsch Exp $
+# $NetBSD: files.pckbport,v 1.9 2017/08/13 08:49:27 christos Exp $
 # devices attached at pckbport, for use with wscons
 
 defflag	opt_wskbdmap.h			WSKBD_USONLY
@@ -16,8 +16,10 @@ defflag	PCKBD_CNATTACH_MAY_FAIL
 obsolete defflag opt_pms.h		PMS_DISABLE_POWERHOOK
 defflag	opt_pms.h			PMS_SYNAPTICS_TOUCHPAD
 defflag opt_pms.h			PMS_ELANTECH_TOUCHPAD
+defflag opt_pms.h			PMS_ALPS_TOUCHPAD
 device	pms: wsmousedev
 attach	pms at pckbport
 file	dev/pckbport/pms.c		pms
 file	dev/pckbport/synaptics.c	pms & pms_synaptics_touchpad
 file	dev/pckbport/elantech.c		pms & pms_elantech_touchpad
+file	dev/pckbport/alps.c		pms & pms_alps_touchpad

Index: src/sys/dev/pckbport/pms.c
diff -u src/sys/dev/pckbport/pms.c:1.35 src/sys/dev/pckbport/pms.c:1.36
--- src/sys/dev/pckbport/pms.c:1.35	Fri Sep  9 10:29:47 2011
+++ src/sys/dev/pckbport/pms.c	Sun Aug 13 04:49:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pms.c,v 1.35 2011/09/09 14:29:47 jakllsch Exp $ */
+/* $NetBSD: pms.c,v 1.36 2017/08/13 08:49:27 christos Exp $ */
 
 /*-
  * Copyright (c) 2004 Kentaro Kurahone.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.35 2011/09/09 14:29:47 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.36 2017/08/13 08:49:27 christos Exp $");
 
 #include "opt_pms.h"
 
@@ -46,6 +46,9 @@ __KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.35
 #ifdef PMS_ELANTECH_TOUCHPAD
 #include 
 #endif
+#ifdef PMS_ALPS_TOUCHPAD
+#include 
+#endif
 
 #include 
 #include 
@@ -207,6 +210,11 @@ pmsattach(device_t parent, device_t self
 		sc->protocol = PMS_ELANTECH;
 	} else
 #endif
+#ifdef PMS_ALPS_TOUCHPAD
+	if (pms_alps_probe_init(sc) == 0) {
+		sc->protocol = PMS_ALPS;
+	} else
+#endif
 		/* Install generic handler. */
 		pckbport_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot,
 		pmsinput, sc, device_xname(sc->sc_dev));
@@ -255,6 +263,10 @@ do_enable(struct pms_softc *sc)
 	if (sc->protocol == PMS_ELANTECH)
 		pms_elantech_enable(sc);
 #endif
+#ifdef PMS_ALPS_TOUCHPAD
+	if (sc->protocol == PMS_ALPS)
+		pms_alps_enable(sc);
+#endif
 
 	cmd[0] = PMS_DEV_ENABLE;
 	res = pckbport_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot, cmd,
@@ -371,6 +383,14 @@ pms_resume(device_t dv, const pmf_qual_t
 		}
 	} else
 #endif
+#ifdef PMS_ALPS_TOUCHPAD
+	if (sc->protocol == PMS_ALPS) {
+		pms_alps_resume(sc);
+		if (sc->sc_enabled) {
+			do_enable(sc);
+		}
+	} else
+#endif
 	if (sc->sc_enabled) {
 		/* recheck protocol & init mouse */
 		sc->protocol = PMS_UNKNOWN;
@@ -445,7 +465,8 @@ pms_reset_thread(void *arg)
 		}
 
 		/* For the synaptics and elantech case, leave the protocol alone. */
-		if (sc->protocol != PMS_SYNAPTICS && sc->protocol != PMS_ELANTECH)
+		if (sc->protocol != PMS_SYNAPTICS && sc->protocol != PMS_ELANTECH
+			&& sc->protocol != PMS_ALPS)
 			sc->protocol = PMS_UNKNOWN;
 
 		pms_enable(sc);

Index: src/sys/dev/pckbport/pmsvar.h
diff -u src/sys/dev/pckbport/pmsvar.h:1.11 src/sys/dev/pckbport/pmsvar.h:1.12
--- src/sys/dev/pckbport/pmsvar.h:1.11	Fri Sep  9 10:29:47 2011
+++ src/sys/dev/pckbport/pmsvar.h	Sun Aug 13 04:49:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmsvar.h,v 1.11 2011/09/09 14:29:47 jakllsch Exp $	*/
+/*	$NetBSD: pmsvar.h,v 1.12 2017/08/13 08:49:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004 Kentaro Kurahone.
@@ -30,6 +30,7 @@
 
 #include 
 #include 
+#include 
 
 enum pms_type {
 	PMS_UNKNOWN,
@@ -37,7 +38,8 @@ enum pms_type {
 	PMS_SCROLL3,
 	PMS_SCROLL5,
 	PMS_SYNAPTICS,
-	PMS_ELANTECH
+	PMS_ELANTECH,
+	PMS_ALPS
 };
 
 struct pms_protocol {
@@ -62,7 +64,8 @@ struct pms_softc {		/* driver status inf
 	device_t sc_wsmousedev;
 	struct lwp *sc_event_thread;
 
-#if defined(PMS_SYNAPTICS_TOUCHPAD) || defined(PMS_ELANTECH_TOUCHPAD)
+#if defined(PMS_SYNAPTICS_TOUCHPAD) || defined(PMS_ELANTECH_TOUCHPAD) \
+	 || defined(PMS_ALPS_TOUCHPAD)
 	union {
 #ifdef PMS_SYNAPTICS_TOUCHPAD
 		struct synaptics_softc synaptics;
@@ -70,6 +73,9 @@ stru

CVS commit: src/sys/netinet

2017-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 15 09:21:48 UTC 2017

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

Log Message:
add some more getsockopt(2) params


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/netinet/tcp_usrreq.c

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

Modified files:

Index: src/sys/netinet/tcp_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.215 src/sys/netinet/tcp_usrreq.c:1.216
--- src/sys/netinet/tcp_usrreq.c:1.215	Fri Jul 28 15:16:41 2017
+++ src/sys/netinet/tcp_usrreq.c	Tue Aug 15 05:21:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_usrreq.c,v 1.215 2017/07/28 19:16:41 maxv Exp $	*/
+/*	$NetBSD: tcp_usrreq.c,v 1.216 2017/08/15 09:21:48 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.215 2017/07/28 19:16:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.216 2017/08/15 09:21:48 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -464,17 +464,14 @@ tcp_ctloutput(int op, struct socket *so,
 #ifdef TCP_SIGNATURE
 		case TCP_MD5SIG:
 			optval = (tp->t_flags & TF_SIGNATURE) ? 1 : 0;
-			error = sockopt_set(sopt, &optval, sizeof(optval));
-			break;
+			goto setval;
 #endif
 		case TCP_NODELAY:
 			optval = tp->t_flags & TF_NODELAY;
-			error = sockopt_set(sopt, &optval, sizeof(optval));
-			break;
+			goto setval;
 		case TCP_MAXSEG:
 			optval = tp->t_peermss;
-			error = sockopt_set(sopt, &optval, sizeof(optval));
-			break;
+			goto setval;
 		case TCP_INFO:
 			tcp_fill_info(tp, &ti);
 			error = sockopt_set(sopt, &ti, sizeof ti);
@@ -483,6 +480,19 @@ tcp_ctloutput(int op, struct socket *so,
 		case TCP_CONGCTL:
 			break;
 #endif
+		case TCP_KEEPIDLE:
+			optval = tp->t_keepidle;
+			goto setval;
+		case TCP_KEEPINTVL:
+			optval = tp->t_keepintvl;
+			goto setval;
+		case TCP_KEEPCNT:
+			optval = tp->t_keepcnt;
+			goto setval;
+		case TCP_KEEPINIT:
+			optval = tp->t_keepcnt;
+setval:			error = sockopt_set(sopt, &optval, sizeof(optval));
+			break;
 		default:
 			error = ENOPROTOOPT;
 			break;



CVS commit: src/include/rpc

2017-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 16 08:35:48 UTC 2017

Modified Files:
src/include/rpc: xdr.h

Log Message:
s/not sure why// and make these work :-)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/include/rpc/xdr.h

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

Modified files:

Index: src/include/rpc/xdr.h
diff -u src/include/rpc/xdr.h:1.29 src/include/rpc/xdr.h:1.30
--- src/include/rpc/xdr.h:1.29	Fri Jan 22 21:34:09 2016
+++ src/include/rpc/xdr.h	Wed Aug 16 04:35:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xdr.h,v 1.29 2016/01/23 02:34:09 dholland Exp $	*/
+/*	$NetBSD: xdr.h,v 1.30 2017/08/16 08:35:48 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -213,15 +213,11 @@ xdr_putint32(XDR *xdrs, int32_t *ip)
 		(*(xdrs)->x_ops->x_control)(xdrs, req, op)
 #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op)
 
-/*
- * Solaris strips the '_t' from these types -- not sure why.
- * But, let's be compatible.
- */
-#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp)
-#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp)
-#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp)
-#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp)
-#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp)
+#define xdr_rpcvers(xdrs, versp) xdr_u_int32_t(xdrs, versp)
+#define xdr_rpcprog(xdrs, progp) xdr_u_int32_t(xdrs, progp)
+#define xdr_rpcproc(xdrs, procp) xdr_u_int32_t(xdrs, procp)
+#define xdr_rpcprot(xdrs, protp) xdr_u_int32_t(xdrs, protp)
+#define xdr_rpcport(xdrs, portp) xdr_u_int32_t(xdrs, portp)
 
 /*
  * Support struct for discriminated unions.



CVS commit: src/usr.sbin/rpcbind

2017-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 16 08:44:40 UTC 2017

Modified Files:
src/usr.sbin/rpcbind: check_bound.c pmap_svc.c rpcb_stat.c rpcb_svc.c
rpcb_svc_4.c rpcb_svc_com.c rpcbind.8 rpcbind.c rpcbind.h
security.c util.c warmstart.c

Log Message:
merge FreeBSD changes:
- fixes CVE-2015-7236
- adds -h hostip to bind, -6 for only ipv6 access, -a for abort gracefully
- documents -w (warmstart)
XXX: should fix warmstart file to go to /var/run instead of /tmp


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/rpcbind/check_bound.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/rpcbind/pmap_svc.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/rpcbind/rpcb_stat.c \
src/usr.sbin/rpcbind/rpcbind.h src/usr.sbin/rpcbind/warmstart.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/rpcbind/rpcb_svc.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/rpcbind/rpcb_svc_4.c
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/rpcbind/rpcb_svc_com.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/rpcbind/rpcbind.8 \
src/usr.sbin/rpcbind/security.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/rpcbind/rpcbind.c
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/rpcbind/util.c

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

Modified files:

Index: src/usr.sbin/rpcbind/check_bound.c
diff -u src/usr.sbin/rpcbind/check_bound.c:1.6 src/usr.sbin/rpcbind/check_bound.c:1.7
--- src/usr.sbin/rpcbind/check_bound.c:1.6	Sun Nov  8 11:36:28 2015
+++ src/usr.sbin/rpcbind/check_bound.c	Wed Aug 16 04:44:40 2017
@@ -1,32 +1,32 @@
-/*	$NetBSD: check_bound.c,v 1.6 2015/11/08 16:36:28 christos Exp $	*/
+/*	$NetBSD: check_bound.c,v 1.7 2017/08/16 08:44:40 christos Exp $	*/
+/*	$FreeBSD: head/usr.sbin/rpcbind/check_bound.c 300942 2016-05-29 06:01:18Z ngie $ */
 
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part.  Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- * 
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- * 
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- * 
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- * 
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- * 
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California  94043
+/*-
+ * Copyright (c) 2009, Sun Microsystems, 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:
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - 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.
+ * - Neither the name of Sun Microsystems, Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
  */
 /*
  * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
@@ -43,7 +43,7 @@ static	char sccsid[] = "@(#)check_bound.
 /*
  * check_bound.c
  * Checks to see whether the program is still bound to the
- * claimed address and returns the univeral merged address
+ * cl

CVS commit: src/usr.sbin/rpcbind

2017-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 16 14:22:58 UTC 2017

Modified Files:
src/usr.sbin/rpcbind: rpcbind.8

Log Message:
fix typo, date, document -L


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/rpcbind/rpcbind.8

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/rpcbind/rpcbind.8
diff -u src/usr.sbin/rpcbind/rpcbind.8:1.12 src/usr.sbin/rpcbind/rpcbind.8:1.13
--- src/usr.sbin/rpcbind/rpcbind.8:1.12	Wed Aug 16 04:44:40 2017
+++ src/usr.sbin/rpcbind/rpcbind.8	Wed Aug 16 10:22:58 2017
@@ -1,9 +1,9 @@
-.\" $NetBSD: rpcbind.8,v 1.12 2017/08/16 08:44:40 christos Exp $
+.\" $NetBSD: rpcbind.8,v 1.13 2017/08/16 14:22:58 christos Exp $
 .\" @(#)rpcbind.1m 1.19 92/09/14 SMI; from SVr4
 .\" Copyright 1989 AT&T
 .\" Copyright 1991 Sun Microsystems, Inc.
 .\" $FreeBSD: head/usr.sbin/rpcbind/rpcbind.8 317163 2017-04-19 20:23:27Z ngie $
-.Dd October 19, 2008
+.Dd August 18, 2017
 .Dt RPCBIND 8
 .Os
 .Sh NAME
@@ -16,7 +16,7 @@
 .Sh DESCRIPTION
 The
 .Nm
-utiltity is a server that converts
+utility is a server that converts
 .Tn RPC
 program numbers into
 universal addresses.
@@ -127,6 +127,10 @@ accepts these requests only from the loo
 This change is necessary for programs that were compiled with earlier
 versions of the rpc library and do not make those requests using the
 loopback interface.
+.It Fl L
+Allows old-style local connections over the loopback interface.
+Without this flag, local connections are only allowed over a local socket,
+.Pa /var/run/rpcbind.sock .
 .It Fl l
 Turns on libwrap connection logging.
 .It Fl s



CVS commit: src/usr.sbin/rpcbind

2017-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 17 07:45:24 UTC 2017

Modified Files:
src/usr.sbin/rpcbind: rpcbind.8

Log Message:
fix path to the warmstart file.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/rpcbind/rpcbind.8

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/rpcbind/rpcbind.8
diff -u src/usr.sbin/rpcbind/rpcbind.8:1.14 src/usr.sbin/rpcbind/rpcbind.8:1.15
--- src/usr.sbin/rpcbind/rpcbind.8:1.14	Wed Aug 16 14:23:03 2017
+++ src/usr.sbin/rpcbind/rpcbind.8	Thu Aug 17 03:45:24 2017
@@ -1,9 +1,9 @@
-.\" $NetBSD: rpcbind.8,v 1.14 2017/08/16 18:23:03 wiz Exp $
+.\" $NetBSD: rpcbind.8,v 1.15 2017/08/17 07:45:24 christos Exp $
 .\" @(#)rpcbind.1m 1.19 92/09/14 SMI; from SVr4
 .\" Copyright 1989 AT&T
 .\" Copyright 1991 Sun Microsystems, Inc.
 .\" $FreeBSD: head/usr.sbin/rpcbind/rpcbind.8 317163 2017-04-19 20:23:27Z ngie $
-.Dd August 16, 2017
+.Dd August 17, 2017
 .Dt RPCBIND 8
 .Os
 .Sh NAME
@@ -152,9 +152,9 @@ All RPC servers must be restarted if
 is restarted.
 .Sh FILES
 .Bl -tag -width "/var/run/rpcbind.sock" -compact
-.It Pa /tmp/portmap.file
+.It Pa /var/run/portmap.file
 saved portmap registrations file.
-.It Pa /tmp/rpcbind.file
+.It Pa /var/run/rpcbind.file
 saved
 .Nm
 registrations file.



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

2017-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 17 08:53:01 UTC 2017

Modified Files:
src/external/bsd/cron/dist: do_command.c funcs.h misc.c

Log Message:
- since we use log_it for cron_pclose() use log_it for cron_popen() too
  so we can see the reason it failed.
- add log_itx() that takes a format and use it.
- simplify with asprintf()


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/cron/dist/do_command.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/cron/dist/funcs.h \
src/external/bsd/cron/dist/misc.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/cron/dist/do_command.c
diff -u src/external/bsd/cron/dist/do_command.c:1.8 src/external/bsd/cron/dist/do_command.c:1.9
--- src/external/bsd/cron/dist/do_command.c:1.8	Fri Jun  9 13:36:30 2017
+++ src/external/bsd/cron/dist/do_command.c	Thu Aug 17 04:53:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: do_command.c,v 1.8 2017/06/09 17:36:30 christos Exp $	*/
+/*	$NetBSD: do_command.c,v 1.9 2017/08/17 08:53:00 christos Exp $	*/
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: do_command.c,v 1.9 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: do_command.c,v 1.8 2017/06/09 17:36:30 christos Exp $");
+__RCSID("$NetBSD: do_command.c,v 1.9 2017/08/17 08:53:00 christos Exp $");
 #endif
 #endif
 
@@ -484,14 +484,16 @@ child_process(entry *e) {
 (void)gethostname(hostname, MAXHOSTNAMELEN);
 if (strlens(MAILFMT, MAILARG, NULL) + 1
 >= sizeof mailcmd) {
-	warnx("mailcmd too long");
+	log_it(usernm, getpid(), "MAIL",
+	"mailcmd too long");
 	retval = ERROR_EXIT;
 	goto child_process_end;
 }
 (void)snprintf(mailcmd, sizeof(mailcmd), 
 MAILFMT, MAILARG);
 if (!(mail = cron_popen(mailcmd, "w", e->pwd))) {
-	warn("cannot run `%s'", mailcmd);
+	log_itx(usernm, getpid(), "MAIL",
+	"cannot run `%s'", mailcmd);
 	retval = ERROR_EXIT;
 	goto child_process_end;
 }
@@ -549,13 +551,10 @@ child_process(entry *e) {
 			 * what's going on.
 			 */
 			if (mailto && status) {
-char buf[MAX_TEMPSTR];
-
-(void)snprintf(buf, sizeof(buf),
-			"mailed %d byte%s of output but got status 0x%04x\n",
-	bytes, (bytes==1)?"":"s",
-	status);
-log_it(usernm, getpid(), "MAIL", buf);
+log_itx(usernm, getpid(), "MAIL",
+"mailed %d byte%s of output but got status"
+" %#04x", bytes, bytes == 1 ? "" : "s",
+status);
 			}
 
 		} /*if data from grandchild*/

Index: src/external/bsd/cron/dist/funcs.h
diff -u src/external/bsd/cron/dist/funcs.h:1.4 src/external/bsd/cron/dist/funcs.h:1.5
--- src/external/bsd/cron/dist/funcs.h:1.4	Fri Jun  9 13:36:30 2017
+++ src/external/bsd/cron/dist/funcs.h	Thu Aug 17 04:53:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: funcs.h,v 1.4 2017/06/09 17:36:30 christos Exp $	*/
+/*	$NetBSD: funcs.h,v 1.5 2017/08/17 08:53:00 christos Exp $	*/
 
 /*
  * Id: funcs.h,v 1.9 2004/01/23 18:56:42 vixie Exp
@@ -44,6 +44,11 @@ void		set_cron_uid(void),
 		log_it(const char *, int, const char *, const char *),
 		log_close(void);
 
+
+void
+		log_itx(const char *, int, const char *, const char *, ...)
+		__printflike(4, 5);
+
 int		job_runqueue(void),
 		set_debug_flags(const char *),
 		get_char(FILE *),
Index: src/external/bsd/cron/dist/misc.c
diff -u src/external/bsd/cron/dist/misc.c:1.4 src/external/bsd/cron/dist/misc.c:1.5
--- src/external/bsd/cron/dist/misc.c:1.4	Fri Jun  9 13:36:30 2017
+++ src/external/bsd/cron/dist/misc.c	Thu Aug 17 04:53:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.4 2017/06/09 17:36:30 christos Exp $	*/
+/*	$NetBSD: misc.c,v 1.5 2017/08/17 08:53:00 christos Exp $	*/
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: misc.c,v 1.16 2004/01/23 18:56:43 vixie Exp";
 #else
-__RCSID("$NetBSD: misc.c,v 1.4 2017/06/09 17:36:30 christos Exp $");
+__RCSID("$NetBSD: misc.c,v 1.5 2017/08/17 08:53:00 christos Exp $");
 #endif
 #endif
 
@@ -312,18 +312,16 @@ acquire_daemonlock(int closeflag) {
 		pidfile = _PATH_CRON_PID;
 		/* Initial mode is 0600 to prevent flock() race/DoS. */
 		if ((fd = open(pidfile, O_RDWR|O_CREAT, 0600)) == -1) {
-			(void)snprintf(buf, sizeof(buf),
-"can't open or create %s: %s",
-pidfile, strerror(errno));
-			log_it("CRON", getpid(), "DEATH", buf);
-			errx(ERROR_EXIT, "%s", buf);
+			log_itx("CRON", getpid(), "DEATH",
+			"can't open or create %s: %s",
+			pidfile, strerror(errno));
+			exit(ERROR_EXIT);
 		}
 		/* fd must be > STDERR since we dup fd 0-2 to /dev/null */
 		if (fd <= STDERR) {
 			if (dup2(fd, STDERR + 1) < 0) {
-snprintf(buf, sizeof buf,
+log_itx("CRON", getpid(), "DEATH",
 "can't dup pid fd: %s", strerror(errno));
-log_it("CRON", getpid(), "DEATH", buf);

CVS commit: src/tests/lib/libm

2017-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 20 08:25:47 UTC 2017

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
fix build (missing nexttoward on mips64 and aarch64)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libm/t_fe_round.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/libm/t_fe_round.c
diff -u src/tests/lib/libm/t_fe_round.c:1.7 src/tests/lib/libm/t_fe_round.c:1.8
--- src/tests/lib/libm/t_fe_round.c:1.7	Thu Aug 17 05:14:28 2017
+++ src/tests/lib/libm/t_fe_round.c	Sun Aug 20 04:25:47 2017
@@ -168,6 +168,9 @@ ATF_TC_BODY(fe_nexttoward, tc)
 	double received;
 	int res;
 
+#if defined(_LP64) && (defined(__mips__) || defined(__arm__))
+	ATF_CHECK_MSG(0, "nexttoward not supported yet on mips64 or aarch64");
+#else
 	for (unsigned int i = 0; i < __arraycount(values2); i++) {
 		received = nexttoward(values2[i].input, values2[i].toward);
 		if (values2[i].input < values2[i].toward) {
@@ -181,6 +184,7 @@ ATF_TC_BODY(fe_nexttoward, tc)
 			"input: %f (index %d): got %f, expected %f, res %d\n",
 			values2[i].input, i, received, values2[i].expected, res);
 	}
+#endif
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/etc/etc.evbarm

2017-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 20 15:35:31 UTC 2017

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Creating installation/ramdisk here does not work; it happens too late.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/etc/etc.evbarm/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/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.89 src/etc/etc.evbarm/Makefile.inc:1.90
--- src/etc/etc.evbarm/Makefile.inc:1.89	Wed Jul  5 20:35:28 2017
+++ src/etc/etc.evbarm/Makefile.inc	Sun Aug 20 11:35:31 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.89 2017/07/06 00:35:28 jmcneill Exp $
+#	$NetBSD: Makefile.inc,v 1.90 2017/08/20 15:35:31 christos Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -200,5 +200,4 @@ snap_md_post: check_DESTDIR check_RELEAS
 KERNEL_SUFFIXES=	bin srec ub
 
 INSTALLATION_DIRS+=	binary/gzimg		\
-			installation/instkernel	\
-			installation/ramdisk
+			installation/instkernel



CVS commit: src/distrib/evbarm/instkernel/ramdisk

2017-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 20 15:38:22 UTC 2017

Modified Files:
src/distrib/evbarm/instkernel/ramdisk: Makefile

Log Message:
Create the ramdisk destination dir here.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/distrib/evbarm/instkernel/ramdisk/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/evbarm/instkernel/ramdisk/Makefile
diff -u src/distrib/evbarm/instkernel/ramdisk/Makefile:1.17 src/distrib/evbarm/instkernel/ramdisk/Makefile:1.18
--- src/distrib/evbarm/instkernel/ramdisk/Makefile:1.17	Wed Jul  5 15:50:49 2017
+++ src/distrib/evbarm/instkernel/ramdisk/Makefile	Sun Aug 20 11:38:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2017/07/05 19:50:49 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.18 2017/08/20 15:38:22 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -38,11 +38,13 @@ ${CRUNCHBIN}:	libhack.o
 .include "${DISTRIBDIR}/common/Makefile.makedev"
 .include "${DISTRIBDIR}/common/Makefile.image"
 
+RAMDISKDIR=${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/ramdisk
+
 release:	${IMAGE}
-	${RELEASE_INSTALL} ${IMAGE} \
-	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/ramdisk/
+	${INSTALL} -d -m 755 ${RAMDISKDIR}
+	${RELEASE_INSTALL} ${IMAGE}  ${RAMDISKDIR}
 	${TOOL_MKUBOOTIMAGE} -A arm -C none -O linux -T ramdisk \
 	-a 0 -n "NetBSD/${MACHINE_ARCH} ramdisk" ${IMAGE} \
-	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/ramdisk/${IMAGE:S/.fs/.ub/}
+	${RAMDISKDIR}/${IMAGE:S/.fs/.ub/}
 
 .include 



CVS commit: src/sys/arch/evbmips/stand/sbmips

2017-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 21 16:36:00 UTC 2017

Modified Files:
src/sys/arch/evbmips/stand/sbmips: Makefile.bootprogs

Log Message:
no ssp and pie


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/stand/sbmips/Makefile.bootprogs

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/evbmips/stand/sbmips/Makefile.bootprogs
diff -u src/sys/arch/evbmips/stand/sbmips/Makefile.bootprogs:1.2 src/sys/arch/evbmips/stand/sbmips/Makefile.bootprogs:1.3
--- src/sys/arch/evbmips/stand/sbmips/Makefile.bootprogs:1.2	Mon Jul 24 06:34:54 2017
+++ src/sys/arch/evbmips/stand/sbmips/Makefile.bootprogs	Mon Aug 21 12:36:00 2017
@@ -1,4 +1,7 @@
-# $NetBSD: Makefile.bootprogs,v 1.2 2017/07/24 10:34:54 mrg Exp $
+# $NetBSD: Makefile.bootprogs,v 1.3 2017/08/21 16:36:00 christos Exp $
+
+NOSSP=yes
+NOPIE=yes
 
 .include 
 .include 



CVS commit: src/usr.sbin/rpcbind

2017-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 21 17:01:04 UTC 2017

Modified Files:
src/usr.sbin/rpcbind: rpcbind.c

Log Message:
don't lock for RUMP


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/rpcbind/rpcbind.c

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

Modified files:

Index: src/usr.sbin/rpcbind/rpcbind.c
diff -u src/usr.sbin/rpcbind/rpcbind.c:1.24 src/usr.sbin/rpcbind/rpcbind.c:1.25
--- src/usr.sbin/rpcbind/rpcbind.c:1.24	Wed Aug 16 04:44:40 2017
+++ src/usr.sbin/rpcbind/rpcbind.c	Mon Aug 21 13:01:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcbind.c,v 1.24 2017/08/16 08:44:40 christos Exp $	*/
+/*	$NetBSD: rpcbind.c,v 1.25 2017/08/21 17:01:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009, Sun Microsystems, Inc.
@@ -111,7 +111,9 @@ static struct sockaddr **bound_sa;
 static int ipv6_only = 0;
 static int nhosts = 0;
 static int on = 1;
+#ifndef RPCBIND_RUMP
 static int rpcbindlockfd;
+#endif
 
 #ifdef WARMSTART
 /* Local Variable */
@@ -170,6 +172,7 @@ rpcbind_main(void *arg)
 	}
 	update_bound_sa();
  
+#ifndef RPCBIND_RUMP
 	/* Check that another rpcbind isn't already running. */
 	if ((rpcbindlockfd = open(RPCBINDDLOCK, O_RDONLY|O_CREAT, 0444)) == -1)
 		err(1, "%s", RPCBINDDLOCK);
@@ -177,7 +180,6 @@ rpcbind_main(void *arg)
 	if (flock(rpcbindlockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
 		errx(1, "another rpcbind is already running. Aborting");
 
-#ifndef RPCBIND_RUMP
 	if (geteuid()) /* This command allowed only to root */
 		errx(EXIT_FAILURE, "Sorry. You are not superuser\n");
 #endif
@@ -820,7 +822,9 @@ rbllist_add(rpcprog_t prog, rpcvers_t ve
 static void
 terminate(int signum __unused)
 {
+#ifndef RPCBIND_RUMP
 	close(rpcbindlockfd);
+#endif
 #ifdef WARMSTART
 	syslog(LOG_ERR,
 	"rpcbind terminating on signal %d. Restart with \"rpcbind -w\"",



CVS commit: src/lib/libm

2017-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 21 17:10:34 UTC 2017

Modified Files:
src/lib/libm: Makefile

Log Message:
add nexttoward for mips64 and aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/lib/libm/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/libm/Makefile
diff -u src/lib/libm/Makefile:1.201 src/lib/libm/Makefile:1.202
--- src/lib/libm/Makefile:1.201	Thu Aug 17 09:58:39 2017
+++ src/lib/libm/Makefile	Mon Aug 21 13:10:34 2017
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.201 2017/08/17 13:58:39 he Exp $
+#  $NetBSD: Makefile,v 1.202 2017/08/21 17:10:34 christos Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -60,7 +60,7 @@ ARCH_SRCS+= s_fma.S s_fmaf.S s_fmax.S s_
 .if ${MKSOFTFLOAT} == "no"
 COMMON_SRCS+= fenv.c
 .endif
-COMMON_SRCS+= s_rintl.c
+COMMON_SRCS+= s_nexttoward.c s_rintl.c
 COMMON_SRCS+= e_sqrtl.c
 COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 
@@ -195,6 +195,10 @@ COMMON_SRCS += fenv.c
 COMMON_SRCS += fenv.c
 .endif
 COMMON_SRCS+= s_rintl.c
+.if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el") \
+&& (!defined(CPUFLAGS) || empty(CPUFLAGS:M-mabi=32))
+COMMON_SRCS+= s_nexttoward.c
+.endif
 
 .elif (${LIBC_MACHINE_CPU} == "sh3")
 .PATH:	${.CURDIR}/arch/sh3



CVS commit: src/tests/lib/libm

2017-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 21 17:11:18 UTC 2017

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
don't skip nexttoward for aarch64 and mips64


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libm/t_fe_round.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/libm/t_fe_round.c
diff -u src/tests/lib/libm/t_fe_round.c:1.8 src/tests/lib/libm/t_fe_round.c:1.9
--- src/tests/lib/libm/t_fe_round.c:1.8	Sun Aug 20 04:25:47 2017
+++ src/tests/lib/libm/t_fe_round.c	Mon Aug 21 13:11:18 2017
@@ -168,9 +168,6 @@ ATF_TC_BODY(fe_nexttoward, tc)
 	double received;
 	int res;
 
-#if defined(_LP64) && (defined(__mips__) || defined(__arm__))
-	ATF_CHECK_MSG(0, "nexttoward not supported yet on mips64 or aarch64");
-#else
 	for (unsigned int i = 0; i < __arraycount(values2); i++) {
 		received = nexttoward(values2[i].input, values2[i].toward);
 		if (values2[i].input < values2[i].toward) {
@@ -184,7 +181,6 @@ ATF_TC_BODY(fe_nexttoward, tc)
 			"input: %f (index %d): got %f, expected %f, res %d\n",
 			values2[i].input, i, received, values2[i].expected, res);
 	}
-#endif
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/external/gpl2/xcvs/dist/src

2017-08-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 22 10:06:57 UTC 2017

Modified Files:
src/external/gpl2/xcvs/dist/src: rsh-client.c

Log Message:
Fix for CVE-2017-12836; (cvs command injection) from MirBSD.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl2/xcvs/dist/src/rsh-client.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/gpl2/xcvs/dist/src/rsh-client.c
diff -u src/external/gpl2/xcvs/dist/src/rsh-client.c:1.2 src/external/gpl2/xcvs/dist/src/rsh-client.c:1.3
--- src/external/gpl2/xcvs/dist/src/rsh-client.c:1.2	Tue May 17 10:00:09 2016
+++ src/external/gpl2/xcvs/dist/src/rsh-client.c	Tue Aug 22 06:06:57 2017
@@ -10,7 +10,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.  */
 #include 
-__RCSID("$NetBSD: rsh-client.c,v 1.2 2016/05/17 14:00:09 christos Exp $");
+__RCSID("$NetBSD: rsh-client.c,v 1.3 2017/08/22 10:06:57 christos Exp $");
 
 #include 
 
@@ -55,11 +55,11 @@ start_rsh_server (cvsroot_t *root, struc
 char *cvs_server = (root->cvs_server != NULL
 			? root->cvs_server : getenv ("CVS_SERVER"));
 int i = 0;
-/* This needs to fit "rsh", "-b", "-l", "USER", "host",
+/* This needs to fit "rsh", "-b", "-l", "USER", "--", "host",
"cmd (w/ args)", and NULL.  We leave some room to grow. */
-char *rsh_argv[10];
+char *rsh_argv[16];
 
-if (!cvs_rsh)
+if (!cvs_rsh || !*cvs_rsh)
 	/* People sometimes suggest or assume that this should default
 	   to "remsh" on systems like HPUX in which that is the
 	   system-supplied name for the rsh program.  However, that
@@ -99,6 +99,9 @@ start_rsh_server (cvsroot_t *root, struc
 	rsh_argv[i++] = root->username;
 }
 
+/* Only non-option arguments from here. (CVE-2017-12836) */
+rsh_argv[i++] = "--";
+
 rsh_argv[i++] = root->hostname;
 rsh_argv[i++] = cvs_server;
 rsh_argv[i++] = "server";
@@ -159,7 +162,7 @@ start_rsh_server (cvsroot_t *root, struc
 command = Xasprintf ("%s server", cvs_server);
 
 {
-char *argv[10];
+char *argv[16];
 	char **p = argv;
 
 	*p++ = cvs_rsh;
@@ -173,6 +176,8 @@ start_rsh_server (cvsroot_t *root, struc
 	*p++ = root->username;
 	}
 
+	*p++ = "--";
+
 	*p++ = root->hostname;
 	*p++ = command;
 	*p++ = NULL;



CVS commit: src/lib/libc/string

2017-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 23 10:27:41 UTC 2017

Modified Files:
src/lib/libc/string: stresep.c

Log Message:
PR/52499: Justin: stresep uses memmove with of-by-one length


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/string/stresep.c

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

Modified files:

Index: src/lib/libc/string/stresep.c
diff -u src/lib/libc/string/stresep.c:1.3 src/lib/libc/string/stresep.c:1.4
--- src/lib/libc/string/stresep.c:1.3	Sun Feb 12 12:19:00 2017
+++ src/lib/libc/string/stresep.c	Wed Aug 23 06:27:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $	*/
+/*	$NetBSD: stresep.c,v 1.4 2017/08/23 10:27:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strsep.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $");
+__RCSID("$NetBSD: stresep.c,v 1.4 2017/08/23 10:27:41 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -66,6 +66,7 @@ stresep(char **stringp, const char *deli
 	char *s;
 	const char *spanp;
 	int c, sc;
+	size_t l;
 	char *tok;
 
 	_DIAGASSERT(stringp != NULL);
@@ -73,22 +74,25 @@ stresep(char **stringp, const char *deli
 
 	if ((s = *stringp) == NULL)
 		return NULL;
+	l = strlen(s) + 1;
 	for (tok = s;;) {
 		c = *s++;
+		l--;
 		while (esc != '\0' && c == esc) {
-			memmove(s - 1, s, strlen(s));
+			memmove(s - 1, s, l);
 			c = *s++;
+			l--;
 		}
 		spanp = delim;
 		do {
 			if ((sc = *spanp++) == c) {
-if (c == 0)
+if (c == '\0')
 	s = NULL;
 else
-	s[-1] = 0;
+	s[-1] = '\0';
 *stringp = s;
 return tok;
 			}
-		} while (sc != 0);
+		} while (sc != '\0');
 	}
 }



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

2017-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 23 10:29:51 UTC 2017

Modified Files:
src/tests/lib/libc/string: t_stresep.c

Log Message:
Add test from PR/52499


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/string/t_stresep.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/string/t_stresep.c
diff -u src/tests/lib/libc/string/t_stresep.c:1.3 src/tests/lib/libc/string/t_stresep.c:1.4
--- src/tests/lib/libc/string/t_stresep.c:1.3	Fri Feb 15 18:56:32 2013
+++ src/tests/lib/libc/string/t_stresep.c	Wed Aug 23 06:29:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_stresep.c,v 1.3 2013/02/15 23:56:32 christos Exp $ */
+/*	$NetBSD: t_stresep.c,v 1.4 2017/08/23 10:29:51 christos Exp $ */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -61,6 +61,12 @@ ATF_TC_BODY(stresep_basic, tc)
 	expect("bar  foo");
 	expect("   baz");
 	expect("bar  ");
+
+	char brkstr2[] = "aa bb cc\\ \\ \\ \\ dd-";
+	q = brkstr2;
+	expect("aa");
+	expect("bb");
+	expect("ccdd-");
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/usr.bin/gzip

2017-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 23 13:04:17 UTC 2017

Modified Files:
src/usr.bin/gzip: gzip.c

Log Message:
now that we are processing SIGINFO write can be interrupted and return
partial results (well, it could before too but it was harder to trigger);
provide write_fully like we have read_fully already.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/usr.bin/gzip/gzip.c

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

Modified files:

Index: src/usr.bin/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.111 src/usr.bin/gzip/gzip.c:1.112
--- src/usr.bin/gzip/gzip.c:1.111	Fri Aug  4 03:27:08 2017
+++ src/usr.bin/gzip/gzip.c	Wed Aug 23 09:04:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.111 2017/08/04 07:27:08 mrg Exp $	*/
+/*	$NetBSD: gzip.c,v 1.112 2017/08/23 13:04:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\
  2009, 2010, 2011, 2015, 2017 Matthew R. Green.  All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.111 2017/08/04 07:27:08 mrg Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.112 2017/08/23 13:04:17 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -212,6 +212,7 @@ __dead static	void	usage(void);
 __dead static	void	display_version(void);
 static	const suffixes_t *check_suffix(char *, int);
 static	ssize_t	read_retry(int, void *, size_t);
+static	ssize_t	write_retry(int, const void *, size_t);
 
 #ifdef SMALL
 #define infile_set(f,t) infile_set(f)
@@ -605,7 +606,7 @@ gz_compress(int in, int out, off_t *gsiz
 	crc = crc32(0L, Z_NULL, 0);
 	for (;;) {
 		if (z.avail_out == 0) {
-			if (write(out, outbufp, BUFLEN) != BUFLEN) {
+			if (write_retry(out, outbufp, BUFLEN) != BUFLEN) {
 maybe_warn("write");
 out_tot = -1;
 goto out;
@@ -655,7 +656,7 @@ gz_compress(int in, int out, off_t *gsiz
 
 		len = (char *)z.next_out - outbufp;
 
-		w = write(out, outbufp, len);
+		w = write_retry(out, outbufp, len);
 		if (w == -1 || (size_t)w != len) {
 			maybe_warn("write");
 			out_tot = -1;
@@ -690,7 +691,7 @@ gz_compress(int in, int out, off_t *gsiz
 	if (in_tot > 0x)
 		maybe_warn("input file size >= 4GB cannot be saved");
 #endif
-	if (write(out, outbufp, i) != i) {
+	if (write_retry(out, outbufp, i) != i) {
 		maybe_warn("write");
 		in_tot = -1;
 	} else
@@ -957,7 +958,7 @@ gz_uncompress(int in, int out, char *pre
 /* don't write anything with -t */
 tflag == 0 &&
 #endif
-write(out, outbufp, wr) != wr) {
+write_retry(out, outbufp, wr) != wr) {
 	maybe_warn("error writing to output");
 	goto stop_and_fail;
 }
@@ -1699,7 +1700,7 @@ cat_fd(unsigned char * prepend, size_t c
 	ssize_t w;
 
 	in_tot = count;
-	w = write(STDOUT_FILENO, prepend, count);
+	w = write_retry(STDOUT_FILENO, prepend, count);
 	if (w == -1 || (size_t)w != count) {
 		maybe_warn("write to stdout");
 		return -1;
@@ -1716,7 +1717,7 @@ cat_fd(unsigned char * prepend, size_t c
 		}
 		infile_newdata(rv);
 
-		if (write(STDOUT_FILENO, buf, rv) != rv) {
+		if (write_retry(STDOUT_FILENO, buf, rv) != rv) {
 			maybe_warn("write to stdout");
 			break;
 		}
@@ -2226,3 +2227,25 @@ read_retry(int fd, void *buf, size_t sz)
 
 	return sz - left;
 }
+
+static ssize_t
+write_retry(int fd, const void *buf, size_t sz)
+{
+	const char *cp = buf;
+	size_t left = MIN(sz, (size_t) SSIZE_MAX);
+
+	while (left > 0) {
+		ssize_t ret;
+
+		ret = write(fd, cp, left);
+		if (ret == -1) {
+			return ret;
+		} else if (ret == 0) {
+			abort();	/* Can't happen */
+		}
+		cp += ret;
+		left -= ret;
+	}
+
+	return sz - left;
+}



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

2017-08-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 25 17:43:33 UTC 2017

Modified Files:
src/sys/arch/arm/include: cpufunc_proto.h

Log Message:
fix the build (rump does not have opt_foo.h)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/include/cpufunc_proto.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/arm/include/cpufunc_proto.h
diff -u src/sys/arch/arm/include/cpufunc_proto.h:1.6 src/sys/arch/arm/include/cpufunc_proto.h:1.7
--- src/sys/arch/arm/include/cpufunc_proto.h:1.6	Thu Aug 24 10:19:36 2017
+++ src/sys/arch/arm/include/cpufunc_proto.h	Fri Aug 25 13:43:33 2017
@@ -44,7 +44,9 @@
 
 #ifdef _KERNEL
 
-#include "opt_multiprocessor.h"
+#if !defined(_MODULE) && defined(_KERNEL_OPT)
+# include "opt_multiprocessor.h"
+#endif
 
 #include 
 #include 



CVS commit: src/sys/netinet6

2017-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 27 12:34:21 UTC 2017

Modified Files:
src/sys/netinet6: in6_src.c

Log Message:
PR/52382: BERTRAND Joel: Fix mapped IPv4 source selection; this got broken
in the last code refactoring. in6_selectif failing is not fatal.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/netinet6/in6_src.c

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

Modified files:

Index: src/sys/netinet6/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.79 src/sys/netinet6/in6_src.c:1.80
--- src/sys/netinet6/in6_src.c:1.79	Thu Feb 16 22:57:17 2017
+++ src/sys/netinet6/in6_src.c	Sun Aug 27 08:34:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 ozaki-r Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.80 2017/08/27 12:34:21 christos Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.80 2017/08/27 12:34:21 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -461,7 +461,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso
 	struct in6_ifaddr *ia = NULL;
 	struct in6_pktinfo *pi = NULL;
 	u_int32_t odstzone;
-	int error;
+	int error = 0, iferror;
 #if defined(MIP6) && NMIP > 0
 	u_int8_t ip6po_usecoa = 0;
 #endif /* MIP6 && NMIP > 0 */
@@ -484,7 +484,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso
 	 * to this function (e.g., for identifying the appropriate scope zone
 	 * ID).
 	 */
-	error = in6_selectif(dstsock, opts, mopts, ro, &ifp, PSREF);
+	iferror = in6_selectif(dstsock, opts, mopts, ro, &ifp, PSREF);
 	if (ifpp != NULL)
 		*ifpp = ifp;
 
@@ -549,8 +549,10 @@ in6_selectsrc(struct sockaddr_in6 *dstso
 	 * The outgoing interface is crucial in the general selection procedure
 	 * below.  If it is not known at this point, we fail.
 	 */
-	if (ifp == NULL)
+	if (ifp == NULL) {
+		error = iferror;
 		goto exit;
+	}
 
 	/*
 	 * If the address is not yet determined, choose the best one based on



CVS commit: src/tests/net/net

2017-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 28 09:30:29 UTC 2017

Modified Files:
src/tests/net/net: t_tcp.c

Log Message:
add v6 tests


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/net/t_tcp.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/net/net/t_tcp.c
diff -u src/tests/net/net/t_tcp.c:1.4 src/tests/net/net/t_tcp.c:1.5
--- src/tests/net/net/t_tcp.c:1.4	Fri Mar  4 13:52:01 2016
+++ src/tests/net/net/t_tcp.c	Mon Aug 28 05:30:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tcp.c,v 1.4 2016/03/04 18:52:01 christos Exp $	*/
+/*	$NetBSD: t_tcp.c,v 1.5 2017/08/28 09:30:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_tcp.c,v 1.4 2016/03/04 18:52:01 christos Exp $");
+__RCSID("$Id: t_tcp.c,v 1.5 2017/08/28 09:30:29 christos Exp $");
 #endif
 
 /* Example code. Should block; does with accept not paccept. */
@@ -71,32 +71,50 @@ ding(int al)
 }
 
 static void 
-paccept_block(bool pacceptblock, bool fcntlblock)
+paccept_block(sa_family_t family, bool pacceptblock, bool fcntlblock)
 {
 	int srvr = -1, clnt = -1, as = -1;
 	int ok, fl;
 	ssize_t n;
 	char buf[10];
-	struct sockaddr_in sin, ba;
+	struct sockaddr_storage ss, bs;
+	struct sockaddr_in *sin;
+	struct sockaddr_in6 *sin6;
 	struct sigaction sa;
+	socklen_t slen;
 
-	srvr = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
+	srvr = socket(family, SOCK_STREAM | SOCK_NONBLOCK, 0);
 	if (srvr == -1)
 		FAIL("socket");
 
-	memset(&sin, 0, sizeof(sin));
-	sin.sin_family = AF_INET;
+	memset(&ss, 0, sizeof(ss));
+	switch (ss.ss_family = family) {
+	case AF_INET:
+		sin = (void *)&ss;
+		slen = sizeof(*sin);
+		sin->sin_port = htons(0);
+		sin->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+		break;
+	case AF_INET6:
+		sin6 = (void *)&ss;
+		slen = sizeof(*sin6);
+		sin6->sin6_port = htons(0);
+		sin6->sin6_addr = in6addr_loopback;
+		break;
+	default:
+		errno = EINVAL;
+		FAIL("bad family");
+	}
 #ifdef BSD4_4
-	sin.sin_len = sizeof(sin);
+	ss.ss_len = slen;
 #endif
-	sin.sin_port = htons(0);
-	sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-	ok = bind(srvr, (const struct sockaddr *)&sin, (socklen_t)sizeof(sin));
+
+	ok = bind(srvr, (const struct sockaddr *)&ss, slen);
 	if (ok == -1)
 		FAIL("bind");
 
-	socklen_t addrlen = sizeof(struct sockaddr_in);
-	ok = getsockname(srvr, (struct sockaddr *)&ba, &addrlen);
+	socklen_t addrlen = slen;
+	ok = getsockname(srvr, (struct sockaddr *)&bs, &addrlen);
 	if (ok == -1)
 		FAIL("getsockname");
 
@@ -104,16 +122,16 @@ paccept_block(bool pacceptblock, bool fc
 	if (ok == -1)
 		FAIL("listen");
 
-	clnt = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
+	clnt = socket(family, SOCK_STREAM | SOCK_NONBLOCK, 0);
 	if (clnt == -1)
 		FAIL("socket");
 
 	/* may not connect first time */
-	ok = connect(clnt, (struct sockaddr *) &ba, addrlen);
+	ok = connect(clnt, (struct sockaddr *) &bs, addrlen);
 	if (ok != -1 || errno != EINPROGRESS)
 		FAIL("expected connect to fail");
 	as = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);
-	ok = connect(clnt, (struct sockaddr *) &ba, addrlen);
+	ok = connect(clnt, (struct sockaddr *) &bs, addrlen);
 	if (ok == -1 && errno != EISCONN)
 		FAIL("connect failed");
 
@@ -169,59 +187,101 @@ fail:
 
 #ifndef TEST
 
-ATF_TC(paccept_reset_nonblock);
-ATF_TC_HEAD(paccept_reset_nonblock, tc)
+ATF_TC(paccept4_reset_nonblock);
+ATF_TC_HEAD(paccept4_reset_nonblock, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "Check that paccept(2) resets "
+	"the non-blocking flag on non-blocking sockets (ipv4)");
+}
+
+ATF_TC_BODY(paccept4_reset_nonblock, tc)
+{
+	paccept_block(AF_INET, true, false);
+}
+
+ATF_TC(fcntl4_reset_nonblock);
+ATF_TC_HEAD(fcntl4_reset_nonblock, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "Check that fcntl(2) resets "
+	"the non-blocking flag on non-blocking sockets (ipv4)");
+}
+
+ATF_TC_BODY(fcntl4_reset_nonblock, tc)
+{
+	paccept_block(AF_INET, false, true);
+}
+
+ATF_TC(paccept4_nonblock);
+ATF_TC_HEAD(paccept4_nonblock, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "Check that fcntl(2) resets "
+	"the non-blocking flag on non-blocking sockets (ipv4)");
+}
+
+ATF_TC_BODY(paccept4_nonblock, tc)
+{
+	paccept_block(AF_INET, false, false);
+}
+
+ATF_TC(paccept6_reset_nonblock);
+ATF_TC_HEAD(paccept6_reset_nonblock, tc)
 {
 
 	atf_tc_set_md_var(tc, "descr", "Check that paccept(2) resets "
-	"the non-blocking flag on non-blocking sockets");
+	"the non-blocking flag on non-blocking sockets (ipv6)");
 }
 
-ATF_TC_BODY(paccept_reset_nonblock, tc)
+ATF_TC_BODY(paccept6_reset_nonblock, tc)
 {
-	paccept_block(true, false);
+	paccept_block(AF_INET6, true, false);
 }
 
-ATF_TC(fcntl_reset_nonblock);
-ATF_TC_HEAD(fcntl_reset_nonblock, tc)
+ATF_TC(fcntl6_reset_nonblock);
+ATF_TC_HEAD(fcntl6_reset_nonblock, tc)
 {
 
 	atf_tc_set_md_var(tc

CVS commit: src/tests/net/net

2017-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 28 10:19:57 UTC 2017

Modified Files:
src/tests/net/net: t_tcp.c

Log Message:
add tests for 4->6 connections.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/net/t_tcp.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/net/net/t_tcp.c
diff -u src/tests/net/net/t_tcp.c:1.5 src/tests/net/net/t_tcp.c:1.6
--- src/tests/net/net/t_tcp.c:1.5	Mon Aug 28 05:30:29 2017
+++ src/tests/net/net/t_tcp.c	Mon Aug 28 06:19:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tcp.c,v 1.5 2017/08/28 09:30:29 christos Exp $	*/
+/*	$NetBSD: t_tcp.c,v 1.6 2017/08/28 10:19:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_tcp.c,v 1.5 2017/08/28 09:30:29 christos Exp $");
+__RCSID("$Id: t_tcp.c,v 1.6 2017/08/28 10:19:57 christos Exp $");
 #endif
 
 /* Example code. Should block; does with accept not paccept. */
@@ -46,6 +46,7 @@ __RCSID("$Id: t_tcp.c,v 1.5 2017/08/28 0
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,10 +56,18 @@ __RCSID("$Id: t_tcp.c,v 1.5 2017/08/28 0
 #include 
 
 #ifdef TEST
-#define FAIL(msg, ...)  err(EXIT_FAILURE, msg, ## __VA_ARGS__)
+#define FAIL(msg)  err(EXIT_FAILURE, msg)
+#define FAILX(msg, ...)  err(EXIT_FAILURE, msg, ## __VA_ARGS__)
 #else 
 #include  
-#define FAIL(msg, ...)  ATF_CHECK_MSG(0, msg, ## __VA_ARGS__); goto fail
+#define FAIL(msg)  do { \
+		ATF_CHECK_MSG(0, msg " (%s)", strerror(errno)); \
+		goto fail; \
+	} while (/*CONSTCOND*/0)
+#define FAILX(msg, ...)  do { \
+	ATF_CHECK_MSG(0, msg, ## __VA_ARGS__); \
+	goto fail; \
+	} while (/*CONSTCOND*/0)
 #endif
 
 #ifdef __linux__
@@ -71,10 +80,12 @@ ding(int al)
 }
 
 static void 
-paccept_block(sa_family_t family, bool pacceptblock, bool fcntlblock)
+paccept_block(sa_family_t sfamily, sa_family_t cfamily,
+bool pacceptblock, bool fcntlblock)
 {
 	int srvr = -1, clnt = -1, as = -1;
 	int ok, fl;
+	int count = 5;
 	ssize_t n;
 	char buf[10];
 	struct sockaddr_storage ss, bs;
@@ -83,12 +94,12 @@ paccept_block(sa_family_t family, bool p
 	struct sigaction sa;
 	socklen_t slen;
 
-	srvr = socket(family, SOCK_STREAM | SOCK_NONBLOCK, 0);
+	srvr = socket(sfamily, SOCK_STREAM | SOCK_NONBLOCK, 0);
 	if (srvr == -1)
 		FAIL("socket");
 
 	memset(&ss, 0, sizeof(ss));
-	switch (ss.ss_family = family) {
+	switch (ss.ss_family = sfamily) {
 	case AF_INET:
 		sin = (void *)&ss;
 		slen = sizeof(*sin);
@@ -99,7 +110,11 @@ paccept_block(sa_family_t family, bool p
 		sin6 = (void *)&ss;
 		slen = sizeof(*sin6);
 		sin6->sin6_port = htons(0);
-		sin6->sin6_addr = in6addr_loopback;
+		if (sfamily == AF_INET6 && cfamily == AF_INET) {
+			sin6->sin6_addr = in6addr_any;
+		} else {
+			sin6->sin6_addr = in6addr_loopback;
+		}
 		break;
 	default:
 		errno = EINVAL;
@@ -108,6 +123,12 @@ paccept_block(sa_family_t family, bool p
 #ifdef BSD4_4
 	ss.ss_len = slen;
 #endif
+	if (sfamily == AF_INET6 && cfamily == AF_INET) {
+		int off = 0;
+		if (setsockopt(srvr, IPPROTO_IPV6, IPV6_V6ONLY,
+		(void *)&off, sizeof(off)) == -1)
+			FAIL("setsockopt IPV6_V6ONLY");
+	}
 
 	ok = bind(srvr, (const struct sockaddr *)&ss, slen);
 	if (ok == -1)
@@ -122,18 +143,44 @@ paccept_block(sa_family_t family, bool p
 	if (ok == -1)
 		FAIL("listen");
 
-	clnt = socket(family, SOCK_STREAM | SOCK_NONBLOCK, 0);
+	clnt = socket(cfamily, SOCK_STREAM | SOCK_NONBLOCK, 0);
 	if (clnt == -1)
 		FAIL("socket");
 
+	if (sfamily == AF_INET6 && cfamily == AF_INET) {
+		ss = bs;
+		sin6 = (void *)&ss;
+		sin = (void *)&bs;
+		addrlen = sizeof(*sin);
+#ifdef BSD4_4
+		sin->sin_len = sizeof(*sin);
+#endif
+		sin->sin_family = AF_INET;
+		sin->sin_port = sin6->sin6_port;
+		sin->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+	}
+
 	/* may not connect first time */
 	ok = connect(clnt, (struct sockaddr *) &bs, addrlen);
 	if (ok != -1 || errno != EINPROGRESS)
 		FAIL("expected connect to fail");
 	as = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);
+again:
 	ok = connect(clnt, (struct sockaddr *) &bs, addrlen);
-	if (ok == -1 && errno != EISCONN)
+	if (ok == -1 && errno != EISCONN) {
+		if (count-- && errno == EALREADY) {
+			fprintf(stderr, "retry\n");
+			struct timespec ts;
+			ts.tv_sec = 0;
+			ts.tv_nsec = 100;
+			nanosleep(&ts, NULL);
+#if 0
+			sched_yield();
+#endif
+			goto again;
+		}
 		FAIL("connect failed");
+	}
 
 #if 0
 	fl = fcntl(srvr, F_GETFL, 0);
@@ -155,7 +202,7 @@ paccept_block(sa_family_t family, bool p
 		if (fl == -1)
 			FAIL("fnctl");
 		if (fl != (O_RDWR|O_NONBLOCK))
-			FAIL("fl 0x%x != 0x%x\n", fl, O_RDWR|O_NONBLOCK);
+			FAILX("fl 0x%x != 0x%x\n", fl, O_RDWR|O_NONBLOCK);
 		ok = fcntl(as, F_SETFL, fl & ~O_NONBLOCK);
 		if (ok == -1)
 			FAIL("fnctl setfl");
@@ -187,101 +234,143 @@ fail:
 
 #ifndef TEST
 
-ATF_TC(paccept4_rese

CVS commit: src/sys/arch/hppa/stand

2017-08-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 29 09:17:43 UTC 2017

Modified Files:
src/sys/arch/hppa/stand: Makefile.buildboot Makefile.inc

Log Message:
disable PIE and SSP


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/stand/Makefile.buildboot \
src/sys/arch/hppa/stand/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/arch/hppa/stand/Makefile.buildboot
diff -u src/sys/arch/hppa/stand/Makefile.buildboot:1.3 src/sys/arch/hppa/stand/Makefile.buildboot:1.4
--- src/sys/arch/hppa/stand/Makefile.buildboot:1.3	Sat Apr  8 15:53:20 2017
+++ src/sys/arch/hppa/stand/Makefile.buildboot	Tue Aug 29 05:17:43 2017
@@ -1,5 +1,7 @@
-#	$NetBSD: Makefile.buildboot,v 1.3 2017/04/08 19:53:20 christos Exp $
+#	$NetBSD: Makefile.buildboot,v 1.4 2017/08/29 09:17:43 christos Exp $
 
+NOPIE=yes
+NOSSP=yes
 NODEBUG=yes
 RELOC=	12
 HEAP_LIMIT=0x1c
Index: src/sys/arch/hppa/stand/Makefile.inc
diff -u src/sys/arch/hppa/stand/Makefile.inc:1.3 src/sys/arch/hppa/stand/Makefile.inc:1.4
--- src/sys/arch/hppa/stand/Makefile.inc:1.3	Sun Feb 21 09:50:05 2016
+++ src/sys/arch/hppa/stand/Makefile.inc	Tue Aug 29 05:17:43 2017
@@ -1,5 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.3 2016/02/21 14:50:05 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.4 2017/08/29 09:17:43 christos Exp $
 
+NOSSP=yes
 NOPIE=yes
 NOCTF=yes
 BINDIR=		/usr/mdec



CVS commit: xsrc/external/mit/fontconfig/dist/src

2017-08-31 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Thu Aug 31 19:44:02 UTC 2017

Modified Files:
xsrc/external/mit/fontconfig/dist/src: fcobjshash.h

Log Message:
use static inline


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
xsrc/external/mit/fontconfig/dist/src/fcobjshash.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/fontconfig/dist/src/fcobjshash.h
diff -u xsrc/external/mit/fontconfig/dist/src/fcobjshash.h:1.1.1.2 xsrc/external/mit/fontconfig/dist/src/fcobjshash.h:1.2
--- xsrc/external/mit/fontconfig/dist/src/fcobjshash.h:1.1.1.2	Tue Aug 29 04:32:28 2017
+++ xsrc/external/mit/fontconfig/dist/src/fcobjshash.h	Thu Aug 31 15:44:01 2017
@@ -190,7 +190,7 @@ __inline
 __attribute__ ((__gnu_inline__))
 #endif
 #endif
-const struct FcObjectTypeInfo *
+static const struct FcObjectTypeInfo *
 FcObjectTypeLookup (register const char *str, register unsigned int len)
 {
   enum



<    6   7   8   9   10   11   12   13   14   15   >