CVS commit: src/sys/kern

2018-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May  6 00:46:09 UTC 2018

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

Log Message:
don't use pathbuf here; it is intertwined with vfs and gives rump heartburn.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/kern/uipc_sem.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_sem.c
diff -u src/sys/kern/uipc_sem.c:1.50 src/sys/kern/uipc_sem.c:1.51
--- src/sys/kern/uipc_sem.c:1.50	Sat May  5 18:14:45 2018
+++ src/sys/kern/uipc_sem.c	Sat May  5 20:46:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_sem.c,v 1.50 2018/05/05 22:14:45 christos Exp $	*/
+/*	$NetBSD: uipc_sem.c,v 1.51 2018/05/06 00:46:09 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.50 2018/05/05 22:14:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.51 2018/05/06 00:46:09 christos Exp $");
 
 #include 
 #include 
@@ -72,7 +72,6 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -137,6 +136,28 @@ struct sysctllog *ksem_clog;
 int ksem_max;
 
 static int
+name_copyin(const char *uname, char **name)
+{
+	*name = kmem_alloc(SEM_MAX_NAMELEN, KM_SLEEP);
+
+	int error = copyinstr(uname, *name, SEM_MAX_NAMELEN, NULL);
+	if (error)
+		kmem_free(*name, SEM_MAX_NAMELEN);
+
+	return error;
+}
+
+static void
+name_destroy(char **name)
+{
+	if (!*name)
+		return;
+
+	kmem_free(*name, SEM_MAX_NAMELEN);
+	*name = NULL;
+}
+
+static int
 ksem_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
 void *arg0, void *arg1, void *arg2, void *arg3)
 {
@@ -446,21 +467,20 @@ int
 do_ksem_open(struct lwp *l, const char *semname, int oflag, mode_t mode,
  unsigned int value, intptr_t *idp, copyout_t docopyout)
 {
-	const char *name;
-	struct pathbuf *pb;
+	char *name;
 	proc_t *p = l->l_proc;
 	ksem_t *ksnew = NULL, *ks;
 	file_t *fp;
 	intptr_t id;
 	int fd, error;
 
-	error = pathbuf_copyin(semname, );
+	error = name_copyin(semname, );
 	if (error) {
 		return error;
 	}
 	error = fd_allocfile(, );
 	if (error) {
-		pathbuf_destroy(pb);
+		name_destroy();
 		return error;
 	}
 	fp->f_type = DTYPE_SEM;
@@ -477,12 +497,10 @@ do_ksem_open(struct lwp *l, const char *
 		goto err;
 	}
 
-	name = pathbuf_stringcopy_get(pb);
 	if (oflag & O_CREAT) {
 		/* Create a new semaphore. */
 		error = ksem_create(l, name, , mode, value);
 		if (error) {
-			pathbuf_stringcopy_put(pb, name);
 			goto err;
 		}
 		KASSERT(ksnew != NULL);
@@ -491,7 +509,7 @@ do_ksem_open(struct lwp *l, const char *
 	/* Lookup for a semaphore with such name. */
 	mutex_enter(_lock);
 	ks = ksem_lookup(name);
-	pathbuf_stringcopy_put(pb, name);
+	name_destroy();
 	if (ks) {
 		KASSERT(mutex_owned(>ks_lock));
 		mutex_exit(_lock);
@@ -545,7 +563,7 @@ do_ksem_open(struct lwp *l, const char *
 	fp->f_ksem = ks;
 	fd_affix(p, fp, fd);
 err:
-	pathbuf_destroy(pb);
+	name_destroy();
 	if (error) {
 		fd_abort(p, fp, fd);
 	}
@@ -647,21 +665,18 @@ sys__ksem_unlink(struct lwp *l, const st
 	/* {
 		const char *name;
 	} */
-	const char *name;
-	struct pathbuf *pb;
+	char *name;
 	ksem_t *ks;
 	u_int refcnt;
 	int error;
 
-	error = pathbuf_copyin(SCARG(uap, name), );
+	error = name_copyin(SCARG(uap, name), );
 	if (error)
 		return error;
 
 	mutex_enter(_lock);
-	name = pathbuf_stringcopy_get(pb);
 	ks = ksem_lookup(name);
-	pathbuf_stringcopy_put(pb, name);
-	pathbuf_destroy(pb);
+	name_destroy();
 	if (ks == NULL) {
 		mutex_exit(_lock);
 		return ENOENT;



CVS commit: src/sys/rump/librump/rumpnet

2018-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  5 23:42:00 UTC 2018

Modified Files:
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
add an empty stub


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/rump/librump/rumpnet/net_stub.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/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.33 src/sys/rump/librump/rumpnet/net_stub.c:1.34
--- src/sys/rump/librump/rumpnet/net_stub.c:1.33	Sat Apr 28 10:21:03 2018
+++ src/sys/rump/librump/rumpnet/net_stub.c	Sat May  5 19:42:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.33 2018/04/28 14:21:03 maxv Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.34 2018/05/05 23:42:00 christos Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.33 2018/04/28 14:21:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.34 2018/05/05 23:42:00 christos Exp $");
 
 #include 
 #include 
@@ -34,6 +34,8 @@ __KERNEL_RCSID(0, "$NetBSD: net_stub.c,v
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -83,6 +85,12 @@ int ipsec_used;
 percpu_t *ipsecstat_percpu;
 u_int ipsec_spdgen;
 
+/* sysctl */
+void
+unp_sysctl_create(struct sysctllog **clog)
+{
+}
+
 __weak_alias(ah4_ctlinput,rumpnet_stub);
 __weak_alias(ah6_ctlinput,rumpnet_stub);
 __weak_alias(esp4_ctlinput,rumpnet_stub);



CVS commit: src/sys/kern

2018-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  5 22:14:45 UTC 2018

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

Log Message:
don't use stack for name (requested by joerg)


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/uipc_sem.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_sem.c
diff -u src/sys/kern/uipc_sem.c:1.49 src/sys/kern/uipc_sem.c:1.50
--- src/sys/kern/uipc_sem.c:1.49	Fri May  4 15:56:58 2018
+++ src/sys/kern/uipc_sem.c	Sat May  5 18:14:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_sem.c,v 1.49 2018/05/04 19:56:58 christos Exp $	*/
+/*	$NetBSD: uipc_sem.c,v 1.50 2018/05/05 22:14:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.49 2018/05/04 19:56:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.50 2018/05/05 22:14:45 christos Exp $");
 
 #include 
 #include 
@@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -445,19 +446,21 @@ int
 do_ksem_open(struct lwp *l, const char *semname, int oflag, mode_t mode,
  unsigned int value, intptr_t *idp, copyout_t docopyout)
 {
-	char name[SEM_MAX_NAMELEN + 1];
+	const char *name;
+	struct pathbuf *pb;
 	proc_t *p = l->l_proc;
 	ksem_t *ksnew = NULL, *ks;
 	file_t *fp;
 	intptr_t id;
 	int fd, error;
 
-	error = copyinstr(semname, name, sizeof(name), NULL);
+	error = pathbuf_copyin(semname, );
 	if (error) {
 		return error;
 	}
 	error = fd_allocfile(, );
 	if (error) {
+		pathbuf_destroy(pb);
 		return error;
 	}
 	fp->f_type = DTYPE_SEM;
@@ -474,10 +477,12 @@ do_ksem_open(struct lwp *l, const char *
 		goto err;
 	}
 
+	name = pathbuf_stringcopy_get(pb);
 	if (oflag & O_CREAT) {
 		/* Create a new semaphore. */
 		error = ksem_create(l, name, , mode, value);
 		if (error) {
+			pathbuf_stringcopy_put(pb, name);
 			goto err;
 		}
 		KASSERT(ksnew != NULL);
@@ -486,6 +491,7 @@ do_ksem_open(struct lwp *l, const char *
 	/* Lookup for a semaphore with such name. */
 	mutex_enter(_lock);
 	ks = ksem_lookup(name);
+	pathbuf_stringcopy_put(pb, name);
 	if (ks) {
 		KASSERT(mutex_owned(>ks_lock));
 		mutex_exit(_lock);
@@ -539,6 +545,7 @@ do_ksem_open(struct lwp *l, const char *
 	fp->f_ksem = ks;
 	fd_affix(p, fp, fd);
 err:
+	pathbuf_destroy(pb);
 	if (error) {
 		fd_abort(p, fp, fd);
 	}
@@ -640,17 +647,21 @@ sys__ksem_unlink(struct lwp *l, const st
 	/* {
 		const char *name;
 	} */
-	char name[SEM_MAX_NAMELEN + 1];
+	const char *name;
+	struct pathbuf *pb;
 	ksem_t *ks;
 	u_int refcnt;
 	int error;
 
-	error = copyinstr(SCARG(uap, name), name, sizeof(name), NULL);
+	error = pathbuf_copyin(SCARG(uap, name), );
 	if (error)
 		return error;
 
 	mutex_enter(_lock);
+	name = pathbuf_stringcopy_get(pb);
 	ks = ksem_lookup(name);
+	pathbuf_stringcopy_put(pb, name);
+	pathbuf_destroy(pb);
 	if (ks == NULL) {
 		mutex_exit(_lock);
 		return ENOENT;



CVS commit: src/share/man/man7

2018-05-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat May  5 21:33:53 UTC 2018

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Fix tab/macro order.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/share/man/man7/sysctl.7

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.126 src/share/man/man7/sysctl.7:1.127
--- src/share/man/man7/sysctl.7:1.126	Sat May  5 20:20:43 2018
+++ src/share/man/man7/sysctl.7	Sat May  5 21:33:53 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.126 2018/05/05 20:20:43 christos Exp $
+.\"	$NetBSD: sysctl.7,v 1.127 2018/05/05 21:33:53 wiz Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -2112,7 +2112,7 @@ deferred for cleanup by a kernel task.
 .Pp
 Other variables are specific to a socket type:
 .Bl -column "seqpacket" "sendspace" "integer" "Changeable" -offset indent
-.It Sy "Socket Type" Sy 	Variable	Type Ta Sy Changeable
+.It Sy "Socket Type"  	Sy Variable	Type Ta Sy Changeable
 .It dgram	pcblist	struct	no
 .It dgram	recvspace	integer	yes
 .It dgram	sendspace	integer	yes



CVS commit: src/sys/dev/acpi

2018-05-05 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sat May  5 21:16:31 UTC 2018

Modified Files:
src/sys/dev/acpi: com_acpi.c

Log Message:
Insert a whitespace after comma


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/acpi/com_acpi.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/acpi/com_acpi.c
diff -u src/sys/dev/acpi/com_acpi.c:1.34 src/sys/dev/acpi/com_acpi.c:1.35
--- src/sys/dev/acpi/com_acpi.c:1.34	Wed Mar 29 20:08:40 2017
+++ src/sys/dev/acpi/com_acpi.c	Sat May  5 21:16:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: com_acpi.c,v 1.34 2017/03/29 20:08:40 jdolecek Exp $ */
+/* $NetBSD: com_acpi.c,v 1.35 2018/05/05 21:16:31 ryoon Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.34 2017/03/29 20:08:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.35 2018/05/05 21:16:31 ryoon Exp $");
 
 #include 
 #include 
@@ -77,7 +77,7 @@ com_acpi_match(device_t parent, cfdata_t
 	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
 		return 0;
 
-	return acpi_match_hid(aa->aa_node->ad_devinfo,com_acpi_ids);
+	return acpi_match_hid(aa->aa_node->ad_devinfo, com_acpi_ids);
 }
 
 /*



CVS commit: src/share/man/man7

2018-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  5 20:20:43 UTC 2018

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Document new PF_LOCAL sysctls.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/share/man/man7/sysctl.7

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.125 src/share/man/man7/sysctl.7:1.126
--- src/share/man/man7/sysctl.7:1.125	Sat Apr 21 08:38:17 2018
+++ src/share/man/man7/sysctl.7	Sat May  5 16:20:43 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.125 2018/04/21 12:38:17 wiz Exp $
+.\"	$NetBSD: sysctl.7,v 1.126 2018/05/05 20:20:43 christos Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\"
-.Dd February 22, 2018
+.Dd May 5, 2018
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -2041,7 +2041,6 @@ The currently defined variable and names
 .It esp_auth	integer	yes
 .It ah_keymin	integer	yes
 .El
-.Pp
 The variables are as follows:
 .Bl -tag -width "123456"
 .It Li debug
@@ -2091,6 +2090,66 @@ Minimum AH key length, in bits,
 The value is used when the kernel creates proposal payload
 on ACQUIRE PF_KEY message.
 .El
+.It Li net.local ( Dv PF_LOCAL )
+Get or set various global information about
+.Dv AF_LOCAL
+type sockets.
+For some variables, the third level name is the variable name:
+.Bl -column "Variable" "integer" "Changeable" -offset indent
+.It Sy Variable	Type Ta Sy Changeable
+.It inflight	integer	no
+.It deferred	integer	no
+.El
+The variables are as follows:
+.Bl -tag -width "123456"
+.It Li inflight
+The number of file descriptors currently passed between processes,
+.Qq in flight .
+.It Li deferred
+The number of file descriptors passed between processes that have been
+deferred for cleanup by a kernel task.
+.El
+.Pp
+Other variables are specific to a socket type:
+.Bl -column "seqpacket" "sendspace" "integer" "Changeable" -offset indent
+.It Sy "Socket Type" Sy 	Variable	Type Ta Sy Changeable
+.It dgram	pcblist	struct	no
+.It dgram	recvspace	integer	yes
+.It dgram	sendspace	integer	yes
+.It seqpacket	pcblist	struct	no
+.It stream	pcblist	struct	no
+.It stream	recvspace	integer	yes
+.It stream	sendspace	integer	yes
+.El
+The variables are as follows:
+.Bl -tag -width "123456"
+.It Li dgram.pcblist
+The Protocol Control Block list structure for datagram sockets.
+Parsed by
+.Xr netstat 8
+or
+.Xr sockstat 8 .
+.It Li dgram.recvspace
+The default datagram receive buffer size.
+.It Li dgram.sendspace
+The default datagram send buffer size.
+.It Li seqpacket.pcblist
+The Protocol Control Block list structure for Sequential Packet sockets.
+Parsed by
+.Xr netstat 8
+or
+.Xr sockstat 8 .
+.It Li stream.pcblist
+The Protocol Control Block list structure for stream sockets.
+Parsed by
+.Xr netstat 8
+or
+.Xr sockstat 8 .
+.It Li stream.recvspace
+The default stream receive buffer size.
+.It Li stream.sendspace
+The default stream send buffer size.
+.El
 .El
 .Ss The proc.* subtree
 The string and integer information available for the



CVS commit: src/sys

2018-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  5 19:58:08 UTC 2018

Modified Files:
src/sys/kern: uipc_domain.c uipc_usrreq.c
src/sys/sys: un.h

Log Message:
bump PIPSIZ from 4 to 8K like FreeBSD and provide the same sysctls


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/kern/uipc_domain.c
cvs rdiff -u -r1.184 -r1.185 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.57 -r1.58 src/sys/sys/un.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.102 src/sys/kern/uipc_domain.c:1.103
--- src/sys/kern/uipc_domain.c:1.102	Wed Feb 28 04:44:25 2018
+++ src/sys/kern/uipc_domain.c	Sat May  5 15:58:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_domain.c,v 1.102 2018/02/28 09:44:25 mrg Exp $	*/
+/*	$NetBSD: uipc_domain.c,v 1.103 2018/05/05 19:58:08 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.102 2018/02/28 09:44:25 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.103 2018/05/05 19:58:08 christos Exp $");
 
 #include 
 #include 
@@ -682,6 +682,7 @@ sysctl_net_setup(void)
 		   SYSCTL_DESCR("SOCK_DGRAM protocol control block list"),
 		   sysctl_unpcblist, 0, NULL, 0,
 		   CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
+	unp_sysctl_create(_sysctllog);
 }
 
 void

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.184 src/sys/kern/uipc_usrreq.c:1.185
--- src/sys/kern/uipc_usrreq.c:1.184	Mon Mar 19 12:26:26 2018
+++ src/sys/kern/uipc_usrreq.c	Sat May  5 15:58:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.184 2018/03/19 16:26:26 roy Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.185 2018/05/05 19:58:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.184 2018/03/19 16:26:26 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.185 2018/05/05 19:58:08 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -674,7 +674,9 @@ uipc_ctloutput(int op, struct socket *so
  * and don't really want to reserve the sendspace.  Their recvspace should
  * be large enough for at least one max-size datagram plus address.
  */
-#define	PIPSIZ	4096
+#ifndef PIPSIZ
+#define	PIPSIZ	8192
+#endif
 u_long	unpst_sendspace = PIPSIZ;
 u_long	unpst_recvspace = PIPSIZ;
 u_long	unpdg_sendspace = 2*1024;	/* really max datagram size */
@@ -1965,6 +1967,47 @@ unp_discard_later(file_t *fp)
 	mutex_exit(_lock);
 }
 
+void
+unp_sysctl_create(struct sysctllog **clog)
+{
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_LONG, "sendspace",
+		   SYSCTL_DESCR("Default stream send space"),
+		   NULL, 0, _sendspace, 0,
+		   CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_LONG, "recvspace",
+		   SYSCTL_DESCR("Default stream recv space"),
+		   NULL, 0, _recvspace, 0,
+		   CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_LONG, "sendspace",
+		   SYSCTL_DESCR("Default datagram send space"),
+		   NULL, 0, _sendspace, 0,
+		   CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_LONG, "recvspace",
+		   SYSCTL_DESCR("Default datagram recv space"),
+		   NULL, 0, _recvspace, 0,
+		   CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READONLY,
+		   CTLTYPE_INT, "inflight",
+		   SYSCTL_DESCR("File descriptors in flight"),
+		   NULL, 0, _rights, 0,
+		   CTL_NET, PF_LOCAL, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READONLY,
+		   CTLTYPE_INT, "deferred",
+		   SYSCTL_DESCR("File descriptors deferred for close"),
+		   NULL, 0, _defer, 0,
+		   CTL_NET, PF_LOCAL, CTL_CREATE, CTL_EOL);
+}
+
 const struct pr_usrreqs unp_usrreqs = {
 	.pr_attach	= unp_attach,
 	.pr_detach	= unp_detach,

Index: src/sys/sys/un.h
diff -u src/sys/sys/un.h:1.57 src/sys/sys/un.h:1.58
--- src/sys/sys/un.h:1.57	Wed Apr  6 15:45:46 2016
+++ src/sys/sys/un.h	Sat May  5 15:58:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: un.h,v 1.57 2016/04/06 19:45:46 roy Exp $	*/
+/*	$NetBSD: un.h,v 1.58 2018/05/05 19:58:08 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -90,6 +90,7 @@ int	unp_connect(struct socket *, struct 
 int	unp_connect2(struct socket *, struct socket *);
 void 	unp_dispose(struct mbuf *);
 int 	

CVS commit: [netbsd-8] src/doc

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:34:43 UTC 2018

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

Log Message:
Tickets #786 - #792, #795, #796, #799, #800


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.190 src/doc/CHANGES-8.0:1.1.2.191
--- src/doc/CHANGES-8.0:1.1.2.190	Fri May  4 16:26:29 2018
+++ src/doc/CHANGES-8.0	Sat May  5 19:34:43 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.190 2018/05/04 16:26:29 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.191 2018/05/05 19:34:43 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13162,3 +13162,91 @@ sbin/gpt/map.c	1.14
 	If a new map entry doesn't fit, be more verbose about the sizes.
 	[mrg, ticket #785]
 
+sys/arch/amd64/amd64/locore.S			1.164,1.165
+
+	Do not use movq for loading arbitrary 64bit immediates.
+	[maxv, ticket #786]
+
+sys/dev/usb/xhci.c1.88-1.90
+sys/dev/usb/xhcireg.h1.10
+
+	Add KASSERT() that sc_child* is set to NULL after child detach.
+	Trigger the softint processing on that child bus which is not detached
+	yet.
+	Enable code to only trigger usb processing when EINT is set, to
+	avoid misinterpreting shared interrupt for another device.
+	Fix clearing of bits in the USBSTS register.
+	[jdolecek, ticket #787]
+
+sys/net/rtsock.c1.241
+
+	Fix a deadlock (rt_free vs. route_intr on rt_so_mtx).
+	[ozaki-r, ticket #788]
+
+sys/dev/isa/wbsio.c1.24
+
+	Use spin mutex to fix a panic.
+	[yamaguchi, ticket #789]
+
+share/man/man9/secmodel_securelevel.9		1.16
+sys/arch/x86/x86/svs.c1.18
+sys/secmodel/securelevel/secmodel_securelevel.c	1.31
+sys/secmodel/suser/secmodel_suser.c		1.44
+sys/sys/kauth.h	1.76
+
+	Disabling SVS is denied at securelevel 1 and above.
+	[alnsn, ticket #790]
+
+etc/namedb/bind.keys1.2
+
+	Update the keys file to the latest version.
+	[nakayama, ticket #791]
+
+sys/kern/sys_ptrace_common.c			1.38
+
+	Harden the NetBSD PT_TRACE_ME operation.
+	[kamil, ticket #792]
+
+sys/net/npf/npf_nat.c1.42
+
+	Fix bitwise vs. logical and typo.
+	[prlw1, ticket #795]
+
+tools/Makefile.host1.32
+tools/Makefile.inc1.14
+tools/binstall/Makefile1.12
+tools/binutils/Makefile1.27
+tools/compat/Makefile1.82
+tools/ctfconvert/Makefile			1.7
+tools/ctfmerge/Makefile1.8
+tools/cvslatest/Makefile			1.2
+tools/dbsym/Makefile1.13
+tools/dtc/Makefile1.3
+tools/gcc/Makefile1.85
+tools/gdb/Makefile1.35
+tools/genassym/Makefile1.7
+tools/gettext/Makefile1.7
+tools/libctf/Makefile1.7
+tools/libdwarf/Makefile1.8
+tools/libelf/Makefile1.9
+tools/libfdt/Makefile1.3
+tools/lorder/Makefile1.13
+tools/makekeys/Makefile1.2
+tools/mandoc/Makefile1.11
+tools/mdsetimage/Makefile			1.15
+
+	Disable MKREPRO in tools; the host compiler might
+	not support the necessary options.
+	[christos, ticket #796]
+
+sys/netipsec/ipsec_output.c			1.67,1.75 (patch)
+
+	compute_ipsec_pos: strengthen checks to avoid overruns,
+	allow the function to fail (and drop the misformed packet).
+	[maxv, ticket #799]
+
+crypto/external/bsd/heimdal/dist/kdc/connect.c	1.3
+
+	Avoid busy-waiting on a dead child.
+	[spz, ticket #800]
+



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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:31:33 UTC 2018

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

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

sys/netipsec/ipsec_output.c: revision 1.75
sys/netipsec/ipsec_output.c: revision 1.67

Strengthen this check, to make sure there is room for an ip6_ext structure.
Seems possible to crash m_copydata here (but I didn't test more than that).

Fix the checks in compute_ipsec_pos, otherwise m_copydata could crash. I
already fixed half of the problem two months ago in rev1.67, back then I
thought it was not triggerable because each packet we emit is guaranteed
to have correctly formed IPv6 options; but it is actually triggerable via
IPv6 forwarding, we emit a packet we just received, and we don't sanitize
its options before invoking IPsec.

Since it would be wrong to just stop the iteration and continue the IPsec
processing, allow compute_ipsec_pos to fail, and when it does, drop the
packet entirely.


To generate a diff of this commit:
cvs rdiff -u -r1.48.2.2 -r1.48.2.3 src/sys/netipsec/ipsec_output.c

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

Modified files:

Index: src/sys/netipsec/ipsec_output.c
diff -u src/sys/netipsec/ipsec_output.c:1.48.2.2 src/sys/netipsec/ipsec_output.c:1.48.2.3
--- src/sys/netipsec/ipsec_output.c:1.48.2.2	Tue Jan  2 10:20:34 2018
+++ src/sys/netipsec/ipsec_output.c	Sat May  5 19:31:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_output.c,v 1.48.2.2 2018/01/02 10:20:34 snj Exp $	*/
+/*	$NetBSD: ipsec_output.c,v 1.48.2.3 2018/05/05 19:31:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.48.2.2 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.48.2.3 2018/05/05 19:31:33 martin Exp $");
 
 /*
  * IPsec output processing.
@@ -633,7 +633,7 @@ bad:
 #endif
 
 #ifdef INET6
-static void
+static int
 compute_ipsec_pos(struct mbuf *m, int *i, int *off)
 {
 	int nxt;
@@ -650,7 +650,11 @@ compute_ipsec_pos(struct mbuf *m, int *i
 	 * put AH/ESP/IPcomp header.
 	 *  IPv6 hbh dest1 rthdr ah* [esp* dest2 payload]
 	 */
-	do {
+	while (1) {
+		if (*i + sizeof(ip6e) > m->m_pkthdr.len) {
+			return EINVAL;
+		}
+
 		switch (nxt) {
 		case IPPROTO_AH:
 		case IPPROTO_ESP:
@@ -659,7 +663,7 @@ compute_ipsec_pos(struct mbuf *m, int *i
 		 * we should not skip security header added
 		 * beforehand.
 		 */
-			return;
+			return 0;
 
 		case IPPROTO_HOPOPTS:
 		case IPPROTO_DSTOPTS:
@@ -669,7 +673,7 @@ compute_ipsec_pos(struct mbuf *m, int *i
 		 * we should stop there.
 		 */
 			if (nxt == IPPROTO_DSTOPTS && dstopt)
-return;
+return 0;
 
 			if (nxt == IPPROTO_DSTOPTS) {
 /*
@@ -689,16 +693,14 @@ compute_ipsec_pos(struct mbuf *m, int *i
 			m_copydata(m, *i, sizeof(ip6e), );
 			nxt = ip6e.ip6e_nxt;
 			*off = *i + offsetof(struct ip6_ext, ip6e_nxt);
-			/*
-			 * we will never see nxt == IPPROTO_AH
-			 * so it is safe to omit AH case.
-			 */
 			*i += (ip6e.ip6e_len + 1) << 3;
 			break;
 		default:
-			return;
+			return 0;
 		}
-	} while (*i < m->m_pkthdr.len);
+	}
+
+	return 0;
 }
 
 static int
@@ -802,7 +804,9 @@ ipsec6_process_packet(
 		i = ip->ip_hl << 2;
 		off = offsetof(struct ip, ip_p);
 	} else {	
-		compute_ipsec_pos(m, , );
+		error = compute_ipsec_pos(m, , );
+		if (error)
+			goto unrefsav;
 	}
 	error = (*sav->tdb_xform->xf_output)(m, isr, sav, NULL, i, off);
 	KEY_SA_UNREF();



CVS commit: [netbsd-8] src/tools

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:25:57 UTC 2018

Modified Files:
src/tools [netbsd-8]: Makefile.host
src/tools/binstall [netbsd-8]: Makefile
src/tools/binutils [netbsd-8]: Makefile
src/tools/compat [netbsd-8]: Makefile
src/tools/ctfconvert [netbsd-8]: Makefile
src/tools/ctfmerge [netbsd-8]: Makefile
src/tools/cvslatest [netbsd-8]: Makefile
src/tools/dbsym [netbsd-8]: Makefile
src/tools/dtc [netbsd-8]: Makefile
src/tools/gcc [netbsd-8]: Makefile
src/tools/gdb [netbsd-8]: Makefile
src/tools/genassym [netbsd-8]: Makefile
src/tools/gettext [netbsd-8]: Makefile
src/tools/libctf [netbsd-8]: Makefile
src/tools/libdwarf [netbsd-8]: Makefile
src/tools/libelf [netbsd-8]: Makefile
src/tools/libfdt [netbsd-8]: Makefile
src/tools/lorder [netbsd-8]: Makefile
src/tools/makekeys [netbsd-8]: Makefile
src/tools/mandoc [netbsd-8]: Makefile
src/tools/mdsetimage [netbsd-8]: Makefile
Added Files:
src/tools [netbsd-8]: Makefile.inc

Log Message:
Pull up following revision(s) (requested by christos in ticket #796):

tools/mdsetimage/Makefile: revision 1.15
tools/compat/Makefile: revision 1.82
tools/gdb/Makefile: revision 1.35
tools/lorder/Makefile: revision 1.13
tools/gcc/Makefile: revision 1.85
tools/dtc/Makefile: revision 1.3
tools/cvslatest/Makefile: revision 1.2
tools/ctfmerge/Makefile: revision 1.8
tools/libelf/Makefile: revision 1.9
tools/libdwarf/Makefile: revision 1.8
tools/ctfconvert/Makefile: revision 1.7
tools/makekeys/Makefile: revision 1.2
tools/gettext/Makefile: revision 1.7
tools/binstall/Makefile: revision 1.12
tools/libfdt/Makefile: revision 1.3
tools/libctf/Makefile: revision 1.7
tools/binutils/Makefile: revision 1.27
tools/mandoc/Makefile: revision 1.11
tools/Makefile.host: revision 1.32
tools/dbsym/Makefile: revision 1.13
tools/genassym/Makefile: revision 1.7
tools/Makefile.inc: revision 1.14

PR/53238: Robert Elz: Disable MKREPRO in tools; the host compiler might
not support the necessary options. This is done thusly:

1. Set MKREPRO=no in Makefile.host. This handles all the Makefiles that
   use it and don't include bsd.own.mk.
2. Create Makefile.inc and set MKREPRO=no in it. Change the Makefiles that
   include bsd.own.mk, to include bsd.init.mk which includes Makefile.inc
   first. This will also allow us to control other tools options from a
   single location if we need to.

XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.20.1 src/tools/Makefile.host
cvs rdiff -u -r0 -r1.16.2.2 src/tools/Makefile.inc
cvs rdiff -u -r1.11 -r1.11.22.1 src/tools/binstall/Makefile
cvs rdiff -u -r1.26 -r1.26.6.1 src/tools/binutils/Makefile
cvs rdiff -u -r1.81 -r1.81.8.1 src/tools/compat/Makefile
cvs rdiff -u -r1.6 -r1.6.8.1 src/tools/ctfconvert/Makefile
cvs rdiff -u -r1.7 -r1.7.8.1 src/tools/ctfmerge/Makefile
cvs rdiff -u -r1.1 -r1.1.8.1 src/tools/cvslatest/Makefile
cvs rdiff -u -r1.11 -r1.11.6.1 src/tools/dbsym/Makefile
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/tools/dtc/Makefile
cvs rdiff -u -r1.81.4.1 -r1.81.4.2 src/tools/gcc/Makefile
cvs rdiff -u -r1.30 -r1.30.6.1 src/tools/gdb/Makefile
cvs rdiff -u -r1.6 -r1.6.22.1 src/tools/genassym/Makefile
cvs rdiff -u -r1.6 -r1.6.22.1 src/tools/gettext/Makefile
cvs rdiff -u -r1.6 -r1.6.8.1 src/tools/libctf/Makefile
cvs rdiff -u -r1.7 -r1.7.18.1 src/tools/libdwarf/Makefile
cvs rdiff -u -r1.8 -r1.8.18.1 src/tools/libelf/Makefile
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/tools/libfdt/Makefile
cvs rdiff -u -r1.12 -r1.12.22.1 src/tools/lorder/Makefile
cvs rdiff -u -r1.1 -r1.1.8.1 src/tools/makekeys/Makefile
cvs rdiff -u -r1.9.8.1 -r1.9.8.2 src/tools/mandoc/Makefile
cvs rdiff -u -r1.13 -r1.13.6.1 src/tools/mdsetimage/Makefile

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

Modified files:

Index: src/tools/Makefile.host
diff -u src/tools/Makefile.host:1.31 src/tools/Makefile.host:1.31.20.1
--- src/tools/Makefile.host:1.31	Fri Jun 14 16:10:02 2013
+++ src/tools/Makefile.host	Sat May  5 19:25:56 2018
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile.host,v 1.31 2013/06/14 16:10:02 tsutsui Exp $
+#	$NetBSD: Makefile.host,v 1.31.20.1 2018/05/05 19:25:56 martin Exp $
 
 NOINFO=		# defined
 NOLINT=		# defined
 NOMAN=		# defined
+MKREPRO=no	# Native toolchain might be unable to do it
 
 .include 
 

Index: src/tools/binstall/Makefile
diff -u src/tools/binstall/Makefile:1.11 src/tools/binstall/Makefile:1.11.22.1
--- src/tools/binstall/Makefile:1.11	Sat Mar 16 22:32:50 2013
+++ src/tools/binstall/Makefile	Sat May  5 19:25:56 2018
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.11 2013/03/16 22:32:50 christos Exp $
+#	$NetBSD: Makefile,v 1.11.22.1 

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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:15:55 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by prlw1 in ticket #795):

sys/net/npf/npf_nat.c: revision 1.42

PR/53207: David Binderman: Use logical and


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

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

Modified files:

Index: src/sys/net/npf/npf_nat.c
diff -u src/sys/net/npf/npf_nat.c:1.41 src/sys/net/npf/npf_nat.c:1.41.8.1
--- src/sys/net/npf/npf_nat.c:1.41	Mon Dec 26 23:05:06 2016
+++ src/sys/net/npf/npf_nat.c	Sat May  5 19:15:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_nat.c,v 1.41 2016/12/26 23:05:06 christos Exp $	*/
+/*	$NetBSD: npf_nat.c,v 1.41.8.1 2018/05/05 19:15:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 Mindaugas Rasiukevicius 
@@ -72,7 +72,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.41 2016/12/26 23:05:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.41.8.1 2018/05/05 19:15:55 martin Exp $");
 
 #include 
 #include 
@@ -890,7 +890,7 @@ npf_nat_import(npf_t *npf, prop_dictiona
 	prop_dictionary_get_uint16(natdict, "tport", >nt_tport);
 
 	/* Take a specific port from port-map. */
-	if ((np->n_flags & NPF_NAT_PORTMAP) != 0 && nt->nt_tport &
+	if ((np->n_flags & NPF_NAT_PORTMAP) != 0 && nt->nt_tport &&
 	!npf_nat_takeport(np, nt->nt_tport)) {
 		pool_cache_put(nat_cache, nt);
 		return NULL;



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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:13:21 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: sys_ptrace_common.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #792):

sys/kern/sys_ptrace_common.c: revision 1.38

Harden the NetBSD PT_TRACE_ME operation

You can't say to the parent of a process to start tracing if:
(1) the parent is initproc,
(2) the child is already traced.

Rationale:
 (1) - It has a side effect of being an anti-debugger functionality,
   as we cannot kill initproc (PID1) and reset the traced flag.
 - initproc is not a debugger, raising debugging events from a child
   to initproc can result in at least a stopped/hanging process
   in the system.
 (2) - It does not make sense to be simultanously traced by two debuggers
 - It does not make sense to be traced twice by the same debugger.

Permit enable tracing for a parent that has been chroot(8)ed, as this is
harmless and the parent is already monitoring for child signals.
The same semantics exist in FreeBSD.

If you are looking for an antidebugging trick for old NetBSD (pre 8.0)
or other popular kernels, here is an example:

$ cat antidebug.c
int
main(int argc, char **argv)
{
pid_t child;
int rv;
int n =3D 0;
child =3D fork();
if (child =3D=3D 0) {
while (getppid() !=3D 1)
continue;
rv =3D ptrace(PT_TRACE_ME, 0, 0, 0);
if (rv !=3D 0)
abort();
printf("Try to detach to me with a debugger!! ");
printf("haha My PID is %d\n", getpid());
while (1) {
printf("%d\n", n++);
sleep(1);
}
}
exit(0);
}

A developer is no longer able to attach GDB, strace or LLDB to this program
without killing the initproc (your favourite system daemon).. this action
would be fatal for the operation of the whole Operating System stability.

Examples from a current non-NetBSD popular kernel:
$ ps -o ppid=3D -p 17904
1
$ strace -p 17904
strace: attach: ptrace(PTRACE_SEIZE, 17904): Operation not permitted
$ gdb -p 17904
[...]
Attaching to process 17904
warning: process 17904 is already traced by process 1
ptrace: Operation not permitted.
(gdb)
$ lldb-3.9 -p 17904
(lldb) process attach --pid 17904
error: attach failed: unable to attach

On NetBSD 8.0 and newer it is now guaranteed to have an option to kill
a malevolent (fake?) debugger and attach with a new tracer to the process

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.2 -r1.22.2.3 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.22.2.2 src/sys/kern/sys_ptrace_common.c:1.22.2.3
--- src/sys/kern/sys_ptrace_common.c:1.22.2.2	Thu Apr 12 13:42:48 2018
+++ src/sys/kern/sys_ptrace_common.c	Sat May  5 19:13:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.22.2.2 2018/04/12 13:42:48 martin Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.22.2.3 2018/05/05 19:13:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22.2.2 2018/04/12 13:42:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22.2.3 2018/05/05 19:13:21 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -377,7 +377,19 @@ ptrace_allowed(struct lwp *l, int req, s
 	/* Make sure we can operate on it. */
 	switch (req) {
 	case PT_TRACE_ME:
-		/* Saying that you're being traced is always legal. */
+		/*
+		 * You can't say to the parent of a process to start tracing if:
+		 *	(1) the parent is initproc,
+		 */
+		if (p->p_pptr == initproc)
+			return EPERM;
+
+		/*
+		 *	(2) the child is already traced.
+		 */
+		if (ISSET(p->p_slflag, PSL_TRACED))
+			return EBUSY;
+
 		return 0;
 
 	case PT_ATTACH:
@@ -389,7 +401,7 @@ ptrace_allowed(struct lwp *l, int req, s
 			return EINVAL;
 
 		/*
-		 *  (2) it's a system process
+		 *	(2) it's a system process
 		 */
 		if (t->p_flag & PK_SYSTEM)
 			return EPERM;



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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:07:52 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #788):

sys/net/rtsock.c: revision 1.241

Fix a deadlock (rt_free vs. route_intr on rt_so_mtx)
It occurs only if NET_MPSAFE is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.213.2.9 -r1.213.2.10 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.213.2.9 src/sys/net/rtsock.c:1.213.2.10
--- src/sys/net/rtsock.c:1.213.2.9	Sat Apr 14 10:16:19 2018
+++ src/sys/net/rtsock.c	Sat May  5 19:07:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.213.2.9 2018/04/14 10:16:19 martin Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.213.2.10 2018/05/05 19:07:51 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.213.2.9 2018/04/14 10:16:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.213.2.10 2018/05/05 19:07:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -928,9 +928,19 @@ flush:
 	if (old_rtm != NULL)
 		Free(old_rtm);
 	if (rt) {
-		if (do_rt_free)
+		if (do_rt_free) {
+#ifdef NET_MPSAFE
+			/*
+			 * Release rt_so_mtx to avoid a deadlock with
+			 * route_intr.
+			 */
+			mutex_exit(rt_so_mtx);
 			rt_free(rt);
-		else
+			mutex_enter(rt_so_mtx);
+#else
+			rt_free(rt);
+#endif
+		} else
 			rt_unref(rt);
 	}
 {



CVS commit: src/sys/dev/acpi

2018-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  5 17:16:23 UTC 2018

Modified Files:
src/sys/dev/acpi: acpi.c acpi_i2c.c acpi_pci.c acpivar.h

Log Message:
introduce acpi_device_present() to replace the previous _STA checks.


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_i2c.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/acpi/acpi_pci.c
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/acpi/acpivar.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/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.269 src/sys/dev/acpi/acpi.c:1.270
--- src/sys/dev/acpi/acpi.c:1.269	Sat Apr  7 11:49:52 2018
+++ src/sys/dev/acpi/acpi.c	Sat May  5 13:16:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.269 2018/04/07 15:49:52 christos Exp $	*/
+/*	$NetBSD: acpi.c,v 1.270 2018/05/05 17:16:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.269 2018/04/07 15:49:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.270 2018/05/05 17:16:23 christos Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -898,6 +898,17 @@ acpi_rescan_nodes(struct acpi_softc *sc)
 
 		di = ad->ad_devinfo;
 
+		/*
+		 * We only attach devices which are present, enabled, and
+		 * functioning properly. However, if a device is enabled,
+		 * it is decoding resources and we should claim these,
+		 * if possible. This requires changes to bus_space(9).
+		 */
+		if (di->Type == ACPI_TYPE_DEVICE &&
+		!acpi_device_present(ad->ad_handle)) {
+			continue;
+		}
+
 		if (di->Type == ACPI_TYPE_POWER)
 			continue;
 
@@ -1749,6 +1760,22 @@ acpi_is_scope(struct acpi_devnode *ad)
 	return false;
 }
 
+bool
+acpi_device_present(ACPI_HANDLE handle)
+{
+	ACPI_STATUS rv;
+	ACPI_INTEGER sta;
+
+	rv = acpi_eval_integer(handle, "_STA", );
+
+	if (ACPI_FAILURE(rv)) {
+		/* No _STA method -> must be there */
+		return rv == AE_NOT_FOUND;
+	}
+
+	return (sta & ACPI_STA_OK) == ACPI_STA_OK;
+}
+
 /*
  * ACPIVERBOSE.
  */
@@ -1797,6 +1824,7 @@ acpi_activate_device(ACPI_HANDLE handle,
 	ACPI_DEVICE_INFO *newdi;
 	ACPI_STATUS rv;
 
+
 	/*
 	 * If the device is valid and present,
 	 * but not enabled, try to activate it.
@@ -1804,6 +1832,9 @@ acpi_activate_device(ACPI_HANDLE handle,
 	if (((*di)->Valid & valid) != valid)
 		return;
 
+	if (!acpi_device_present(handle))
+		return;
+
 	rv = acpi_allocate_resources(handle);
 
 	if (ACPI_FAILURE(rv))

Index: src/sys/dev/acpi/acpi_i2c.c
diff -u src/sys/dev/acpi/acpi_i2c.c:1.3 src/sys/dev/acpi/acpi_i2c.c:1.4
--- src/sys/dev/acpi/acpi_i2c.c:1.3	Sat Apr  7 11:49:52 2018
+++ src/sys/dev/acpi/acpi_i2c.c	Sat May  5 13:16:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_i2c.c,v 1.3 2018/04/07 15:49:52 christos Exp $ */
+/* $NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.3 2018/04/07 15:49:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $");
 
 #include 
 #include 
@@ -228,6 +228,8 @@ acpi_enter_i2c_devs(struct acpi_devnode 
 	SIMPLEQ_FOREACH(ad, >ad_child_head, ad_child_list) {
 		if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
 			continue;
+		if (!acpi_device_present(ad->ad_handle))
+			continue;
 		acpi_enter_i2c_device(ad, array);
 	}
 	return array;

Index: src/sys/dev/acpi/acpi_pci.c
diff -u src/sys/dev/acpi/acpi_pci.c:1.21 src/sys/dev/acpi/acpi_pci.c:1.22
--- src/sys/dev/acpi/acpi_pci.c:1.21	Sat Apr  7 11:49:52 2018
+++ src/sys/dev/acpi/acpi_pci.c	Sat May  5 13:16:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.21 2018/04/07 15:49:52 christos Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.22 2018/05/05 17:16:23 christos Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.21 2018/04/07 15:49:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.22 2018/05/05 17:16:23 christos Exp $");
 
 #include 
 #include 
@@ -185,6 +185,9 @@ acpi_pcidev_scan(struct acpi_devnode *ad
 	if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
 		goto rec;
 
+	if (!acpi_device_present(ad->ad_handle))
+		goto rec;
+
 	if (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) {
 
 		ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);

Index: src/sys/dev/acpi/acpivar.h
diff -u src/sys/dev/acpi/acpivar.h:1.74 src/sys/dev/acpi/acpivar.h:1.75
--- src/sys/dev/acpi/acpivar.h:1.74	Tue Jun 21 07:33:33 2016
+++ src/sys/dev/acpi/acpivar.h	Sat May  5 13:16:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpivar.h,v 1.74 2016/06/21 11:33:33 nonaka Exp $	*/
+/*	$NetBSD: acpivar.h,v 1.75 2018/05/05 17:16:23 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -303,6 +303,8 @@ int		

CVS commit: src/share/man/man3lua

2018-05-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat May  5 16:24:26 UTC 2018

Modified Files:
src/share/man/man3lua: bozohttpd.3lua

Log Message:
Remove unnecessary macro. Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man3lua/bozohttpd.3lua

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

Modified files:

Index: src/share/man/man3lua/bozohttpd.3lua
diff -u src/share/man/man3lua/bozohttpd.3lua:1.1 src/share/man/man3lua/bozohttpd.3lua:1.2
--- src/share/man/man3lua/bozohttpd.3lua:1.1	Sat May  5 13:31:48 2018
+++ src/share/man/man3lua/bozohttpd.3lua	Sat May  5 16:24:26 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: bozohttpd.3lua,v 1.1 2018/05/05 13:31:48 sevan Exp $
+.\" $NetBSD: bozohttpd.3lua,v 1.2 2018/05/05 16:24:26 wiz Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@ functionality from Lua
 .Sh DESCRIPTION
 The
 .Nm
-Lua binding provides access to functionality availabile in
+Lua binding provides access to functionality available in
 .Xr libbozohttpd 3 .
 .Sh EXAMPLES
 The following example code demonstrates the process of instantiating an instance
@@ -65,9 +65,7 @@ of
 as a background daemon.
 The instance is set to serve files from
 .Pa /var/www
-for the hostname www.example.com on
-.Tn TCP
-port 8080.
+for the hostname www.example.com on TCP port 8080.
 .Bd -literal
 local bozo = require 'bozohttpd'
 myhttpd = bozo.new()



CVS commit: [netbsd-8] src/etc/namedb

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:14:30 UTC 2018

Modified Files:
src/etc/namedb [netbsd-8]: bind.keys

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #791):

etc/namedb/bind.keys: revision 1.2

Update the keys file to the latest version from:

https://ftp.isc.org/isc/bind9/keys/9.11/bind.keys.v9_11

This includes the new KSK2017 key which is planned to replace the KSK2010
in October 11th, 2018. It is important to have software that ships with
both before September 11th 2018. Anything that bootstraps after that could
have trouble switching.

XXX: pullup-8, pullup-7, pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.26.1 src/etc/namedb/bind.keys

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

Modified files:

Index: src/etc/namedb/bind.keys
diff -u src/etc/namedb/bind.keys:1.1 src/etc/namedb/bind.keys:1.1.26.1
--- src/etc/namedb/bind.keys:1.1	Thu Apr 25 17:02:29 2013
+++ src/etc/namedb/bind.keys	Sat May  5 15:14:30 2018
@@ -1,5 +1,4 @@
-/*	$NetBSD: bind.keys,v 1.1 2013/04/25 17:02:29 christos Exp $	*/
-/* Id: bind.keys,v 1.7 2011-01-03 23:45:07 each Exp  */
+/*	$NetBSD: bind.keys,v 1.1.26.1 2018/05/05 15:14:30 martin Exp $	*/
 # The bind.keys file is used to override the built-in DNSSEC trust anchors
 # which are included as part of BIND 9.  As of the current release, the only
 # trust anchors it contains are those for the DNS root zone ("."), and for
@@ -16,15 +15,18 @@
 #
 # This file is NOT expected to be user-configured.
 #
-# These keys are current as of January 2011.  If any key fails to
+# These keys are current as of February 2017.  If any key fails to
 # initialize correctly, it may have expired.  In that event you should
 # replace this file with a current version.  The latest version of
 # bind.keys can always be obtained from ISC at https://www.isc.org/bind-keys.
 
 managed-keys {
 	# ISC DLV: See https://www.isc.org/solutions/dlv for details.
-# NOTE: This key is activated by setting "dnssec-lookaside auto;"
-# in named.conf.
+	#
+	# NOTE: The ISC DLV zone is being phased out as of February 2017;
+	# the key will remain in place but the zone will be otherwise empty.
+	# Configuring "dnssec-lookaside auto;" to activate this key is
+	# harmless, but is no longer useful and is not recommended.
 	dlv.isc.org. initial-key 257 3 5 "BEPHMu/5onzrEE7z1egmhg/WPO0+juoZrW3euWEn4MxDCE1+lLy2
 		brhQv5rN32RKtMzX6Mj70jdzeND4XknW58dnJNPCxn8+jAGl2FZLK8t+
 		1uq4W+nnA3qO2+DL+k6BD4mewMLbIYFwe0PG73Te9fZ2kJb56dhgMde5
@@ -33,10 +35,16 @@ managed-keys {
 		QKtUdvNXDrYJDSHZws3xiRXF1Rf+al9UmZfSav/4NWLKjHzpT59k/VSt
 		TDN0YUuWrBNh";
 
-	# ROOT KEY: See https://data.iana.org/root-anchors/root-anchors.xml
+	# ROOT KEYS: See https://data.iana.org/root-anchors/root-anchors.xml
 	# for current trust anchor information.
-# NOTE: This key is activated by setting "dnssec-validation auto;"
-# in named.conf.
+	#
+	# These keys are activated by setting "dnssec-validation auto;"
+	# in named.conf.
+	#
+	# This key (19036) is to be phased out starting in 2017. It will
+	# remain in the root zone for some time after its successor key
+	# has been added. It will remain this file until it is removed from
+	# the root zone.
 	. initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
 		FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
 		bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
@@ -44,4 +52,19 @@ managed-keys {
 		W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
 		Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
 		QxA+Uk1ihz0=";
+
+	# This key (20326) is to be published in the root zone in 2017.
+	# Servers which were already using the old key (19036) should
+	# roll seamlessly to this new one via RFC 5011 rollover. Servers
+	# being set up for the first time can use the contents of this
+	# file as initializing keys; thereafter, the keys in the
+	# managed key database will be trusted and maintained
+	# automatically.
+	. initial-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
+		+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
+		ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
+		0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
+		oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
+		RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
+		R1AkUTV74bU=";
 };



CVS commit: [netbsd-8] src

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:11:53 UTC 2018

Modified Files:
src/share/man/man9 [netbsd-8]: secmodel_securelevel.9
src/sys/arch/x86/x86 [netbsd-8]: svs.c
src/sys/secmodel/securelevel [netbsd-8]: secmodel_securelevel.c
src/sys/secmodel/suser [netbsd-8]: secmodel_suser.c
src/sys/sys [netbsd-8]: kauth.h

Log Message:
Pull up following revision(s) (requested by alnsn in ticket #790):

share/man/man9/secmodel_securelevel.9: revision 1.16
sys/secmodel/suser/secmodel_suser.c: revision 1.44
sys/secmodel/securelevel/secmodel_securelevel.c: revision 1.31
sys/sys/kauth.h: revision 1.76
sys/arch/x86/x86/svs.c: revision 1.18

Add KAUTH_MACHDEP_SVS_DISABLE and add support to secmodel_securelevel(9).
Disabling SVS is denied at securelevel 1 and above.

Add SVS. It may not be disabled at securelevel 1 and above.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.18.1 src/share/man/man9/secmodel_securelevel.9
cvs rdiff -u -r1.14.2.3 -r1.14.2.4 src/sys/arch/x86/x86/svs.c
cvs rdiff -u -r1.30 -r1.30.22.1 \
src/sys/secmodel/securelevel/secmodel_securelevel.c
cvs rdiff -u -r1.42.10.1 -r1.42.10.2 src/sys/secmodel/suser/secmodel_suser.c
cvs rdiff -u -r1.73.10.2 -r1.73.10.3 src/sys/sys/kauth.h

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

Modified files:

Index: src/share/man/man9/secmodel_securelevel.9
diff -u src/share/man/man9/secmodel_securelevel.9:1.15 src/share/man/man9/secmodel_securelevel.9:1.15.18.1
--- src/share/man/man9/secmodel_securelevel.9:1.15	Tue Mar 18 18:20:40 2014
+++ src/share/man/man9/secmodel_securelevel.9	Sat May  5 15:11:53 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: secmodel_securelevel.9,v 1.15 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: secmodel_securelevel.9,v 1.15.18.1 2018/05/05 15:11:53 martin Exp $
 .\"
 .\" Copyright (c) 2006 Elad Efrat 
 .\" Copyright (c) 2000 Hugh Graham
@@ -26,7 +26,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 22, 2012
+.Dd April 26, 2018
 .Dt SECMODEL_SECURELEVEL 9
 .Os
 .Sh NAME
@@ -136,6 +136,8 @@ Access to unmanaged memory is denied.
 Only GPIO pins that have been set at
 .Em securelevel
 0 can be accessed.
+.It
+SVS (Separate Virtual Space) may not be disabled on platforms that support it.
 .El
 .It \ 2 Em Highly secure mode
 .Bl -bullet

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.14.2.3 src/sys/arch/x86/x86/svs.c:1.14.2.4
--- src/sys/arch/x86/x86/svs.c:1.14.2.3	Mon Apr  2 08:43:58 2018
+++ src/sys/arch/x86/x86/svs.c	Sat May  5 15:11:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.14.2.3 2018/04/02 08:43:58 martin Exp $	*/
+/*	$NetBSD: svs.c,v 1.14.2.4 2018/05/05 15:11:53 martin Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14.2.3 2018/04/02 08:43:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14.2.4 2018/05/05 15:11:53 martin Exp $");
 
 #include "opt_svs.h"
 
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -737,11 +738,13 @@ sysctl_machdep_svs_enabled(SYSCTLFN_ARGS
 			error = 0;
 		else
 			error = EOPNOTSUPP;
-	} else {
-		if (svs_enabled)
+	} else if (svs_enabled) {
+		error = kauth_authorize_machdep(kauth_cred_get(),
+		KAUTH_MACHDEP_SVS_DISABLE, NULL, NULL, NULL, NULL);
+		if (!error)
 			error = svs_disable();
-		else
-			error = 0;
+	} else {
+		error = 0;
 	}
 
 	return error;

Index: src/sys/secmodel/securelevel/secmodel_securelevel.c
diff -u src/sys/secmodel/securelevel/secmodel_securelevel.c:1.30 src/sys/secmodel/securelevel/secmodel_securelevel.c:1.30.22.1
--- src/sys/secmodel/securelevel/secmodel_securelevel.c:1.30	Tue Feb 25 18:30:13 2014
+++ src/sys/secmodel/securelevel/secmodel_securelevel.c	Sat May  5 15:11:53 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_securelevel.c,v 1.30 2014/02/25 18:30:13 pooka Exp $ */
+/* $NetBSD: secmodel_securelevel.c,v 1.30.22.1 2018/05/05 15:11:53 martin Exp $ */
 /*-
  * Copyright (c) 2006 Elad Efrat 
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.30 2014/02/25 18:30:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.30.22.1 2018/05/05 15:11:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_insecure.h"
@@ -494,6 +494,11 @@ secmodel_securelevel_machdep_cb(kauth_cr
 			result = KAUTH_RESULT_DENY;
 		break;
 
+	case KAUTH_MACHDEP_SVS_DISABLE:
+		if (securelevel > 0)
+			result = KAUTH_RESULT_DENY;
+		break;
+
 	case KAUTH_MACHDEP_CPU_UCODE_APPLY:
 		if (securelevel > 1)
 			result = KAUTH_RESULT_DENY;

Index: src/sys/secmodel/suser/secmodel_suser.c
diff -u 

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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:08:15 UTC 2018

Modified Files:
src/sys/dev/isa [netbsd-8]: wbsio.c

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #789):

sys/dev/isa/wbsio.c: revision 1.24

Use spin mutex to fix a panic

The GPIO part of wbsio(4) has a lock to keep the register access
order. In addition to the lock, gpio(4) has a look to prevent
multiple control through gpio_pin_ctl(). Those locks hold at
once when gpio_pin_ctl() is called, and the lock of gpio(4) hold
before that of wbsio(4).

Therefore, the wbsio(4) has to use spin lock if gpio(4) uses
spin lock.


To generate a diff of this commit:
cvs rdiff -u -r1.10.10.3 -r1.10.10.4 src/sys/dev/isa/wbsio.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/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.10.10.3 src/sys/dev/isa/wbsio.c:1.10.10.4
--- src/sys/dev/isa/wbsio.c:1.10.10.3	Mon Apr 16 14:28:23 2018
+++ src/sys/dev/isa/wbsio.c	Sat May  5 15:08:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.10.10.3 2018/04/16 14:28:23 martin Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.10.10.4 2018/05/05 15:08:14 martin Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -546,7 +546,7 @@ wbsio_gpio_rt_init(struct wbsio_softc *s
 	aprint_normal_dev(sc->sc_dev, "GPIO: port 0x%x-0x%x\n",
 	iobase, iobase + WBSIO_GPIO_IOSIZE);
 
-	mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_VM);
 
 	return 0;
 }



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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:05:39 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-8]: xhci.c xhcireg.h

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #787):

sys/dev/usb/xhci.c: revision 1.88-1.90
sys/dev/usb/xhcireg.h: revision 1.10

add KASSERT() that sc_child* is set to NULL after child detach; just for
readability, it's not immediatelly obvious this is done in xhci_childdet()
no functional changes

trigger the softint processing on that child bus which is not detached yet
fixes PR kern/53066 by Martin Husemann

enable code to only trigger usb processing when EINT is set, to
avoid misinterpreting shared interrupt for another device

when clearing USBSTS, actually preserve the bits which spec requires to
preserve, and actually clear bit 1, which should be actually always
cleared to zero by spec

also #ifdef XHCI_DEBUG some unnecessary register reads
this should finally resolve PR kern/53066 also for Martin


To generate a diff of this commit:
cvs rdiff -u -r1.72.2.5 -r1.72.2.6 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/dev/usb/xhcireg.h

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.72.2.5 src/sys/dev/usb/xhci.c:1.72.2.6
--- src/sys/dev/usb/xhci.c:1.72.2.5	Thu Dec 21 21:53:31 2017
+++ src/sys/dev/usb/xhci.c	Sat May  5 15:05:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.72.2.5 2017/12/21 21:53:31 snj Exp $	*/
+/*	$NetBSD: xhci.c,v 1.72.2.6 2018/05/05 15:05:39 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.72.2.5 2017/12/21 21:53:31 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.72.2.6 2018/05/05 15:05:39 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -582,12 +582,14 @@ xhci_detach(struct xhci_softc *sc, int f
 		rv = config_detach(sc->sc_child2, flags);
 		if (rv != 0)
 			return rv;
+		KASSERT(sc->sc_child2 == NULL);
 	}
 
 	if (sc->sc_child != NULL) {
 		rv = config_detach(sc->sc_child, flags);
 		if (rv != 0)
 			return rv;
+		KASSERT(sc->sc_child == NULL);
 	}
 
 	/* XXX unconfigure/free slots */
@@ -1247,7 +1249,16 @@ xhci_intr(void *v)
 
 	ret = xhci_intr1(sc);
 	if (ret) {
-		usb_schedsoftintr(>sc_bus);
+		KASSERT(sc->sc_child || sc->sc_child2);
+
+		/*
+		 * One of child busses could be already detached. It doesn't
+		 * matter on which of the two the softintr is scheduled.
+		 */
+		if (sc->sc_child)
+			usb_schedsoftintr(>sc_bus);
+		else
+			usb_schedsoftintr(>sc_bus2);
 	}
 done:
 	mutex_spin_exit(>sc_intr_lock);
@@ -1264,24 +1275,36 @@ xhci_intr1(struct xhci_softc * const sc)
 
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
-#if 0
-	if ((usbsts & (XHCI_STS_EINT|XHCI_STS_PCD)) == 0) {
+	if ((usbsts & (XHCI_STS_HSE | XHCI_STS_EINT | XHCI_STS_PCD |
+	XHCI_STS_HCE)) == 0) {
+		DPRINTFN(16, "ignored intr not for %s",
+		device_xname(sc->sc_dev), 0, 0, 0);
 		return 0;
 	}
-#endif
-	xhci_op_write_4(sc, XHCI_USBSTS,
-	usbsts & (2|XHCI_STS_EINT|XHCI_STS_PCD)); /* XXX */
+
+	/*
+	 * Clear EINT and other transient flags, to not misenterpret
+	 * next shared interrupt. Also, to avoid race, EINT must be cleared
+	 * before XHCI_IMAN_INTR_PEND is cleared.
+	 */
+	xhci_op_write_4(sc, XHCI_USBSTS, usbsts & XHCI_STS_RSVDP0);
+
+#ifdef XHCI_DEBUG
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+#endif
 
 	iman = xhci_rt_read_4(sc, XHCI_IMAN(0));
 	DPRINTFN(16, "IMAN0 %08jx", iman, 0, 0, 0);
 	iman |= XHCI_IMAN_INTR_PEND;
 	xhci_rt_write_4(sc, XHCI_IMAN(0), iman);
+
+#ifdef XHCI_DEBUG
 	iman = xhci_rt_read_4(sc, XHCI_IMAN(0));
 	DPRINTFN(16, "IMAN0 %08jx", iman, 0, 0, 0);
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+#endif
 
 	return 1;
 }

Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.9 src/sys/dev/usb/xhcireg.h:1.9.6.1
--- src/sys/dev/usb/xhcireg.h:1.9	Thu Jan 19 16:05:00 2017
+++ src/sys/dev/usb/xhcireg.h	Sat May  5 15:05:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.9 2017/01/19 16:05:00 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.9.6.1 2018/05/05 15:05:39 martin Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -106,14 +106,17 @@
 
 #define	XHCI_USBSTS		0x04	/* XHCI status */
 #define	 XHCI_STS_HCH		0x0001	/* RO - Host Controller Halted */
+#define	 XHCI_STS_RSVDZ0	0x0002	/* RsvdZ - 2:2 */
 #define	 XHCI_STS_HSE		0x0004	/* RW - Host System Error */
 #define	 XHCI_STS_EINT		0x0008	/* RW - Event Interrupt */
 #define	 XHCI_STS_PCD		0x0010	/* RW - Port Change Detect */
+#define	 XHCI_STS_RSVDZ1	__BITS(5, 7)	/* RsvdZ - 5:7 */
 #define	 XHCI_STS_SSS		0x0100	/* RO - Save State Status */
 #define	 

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

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:00:29 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: locore.S

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

sys/arch/amd64/amd64/locore.S: revision 1.164,1.165

Adjust Xsyscall_svs to not use movq for 64bit immediates either.

Do not use movq for loading arbitrary 64bit immediates. The ISA
restricts it to 32bit immediates.


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

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.5 src/sys/arch/amd64/amd64/locore.S:1.123.6.6
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.5	Thu Mar 22 16:59:03 2018
+++ src/sys/arch/amd64/amd64/locore.S	Sat May  5 15:00:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.5 2018/03/22 16:59:03 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.6 2018/05/05 15:00:29 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1368,8 +1368,8 @@ IDTVEC(\name)
 
 	/* Get the LWP's kernel stack pointer in %rax */
 	.if	\is_svs
-		movq	%rax,SVS_UTLS+UTLS_SCRATCH
-		movq	SVS_UTLS+UTLS_RSP0,%rax
+		movabs	%rax,SVS_UTLS+UTLS_SCRATCH
+		movabs	SVS_UTLS+UTLS_RSP0,%rax
 	.else
 		movq	%rax,CPUVAR(SCRATCH)
 		movq	CPUVAR(CURLWP),%rax
@@ -1387,7 +1387,7 @@ IDTVEC(\name)
 
 	/* Restore %rax */
 	.if	\is_svs
-		movq	SVS_UTLS+UTLS_SCRATCH,%rax
+		movabs	SVS_UTLS+UTLS_SCRATCH,%rax
 	.else
 		movq	CPUVAR(SCRATCH),%rax
 	.endif
@@ -1579,7 +1579,7 @@ END(intrfastexit)
 	.globl	nosvs_leave_altstack, nosvs_leave_altstack_end
 
 LABEL(svs_enter)
-	movq	SVS_UTLS+UTLS_KPDIRPA,%rax
+	movabs	SVS_UTLS+UTLS_KPDIRPA,%rax
 	movq	%rax,%cr3
 	movq	CPUVAR(KRSP0),%rsp
 LABEL(svs_enter_end)
@@ -1587,7 +1587,7 @@ LABEL(svs_enter_end)
 LABEL(svs_enter_altstack)
 	testb	$SEL_UPL,TF_CS(%rsp)
 	jz	1234f
-	movq	SVS_UTLS+UTLS_KPDIRPA,%rax
+	movabs	SVS_UTLS+UTLS_KPDIRPA,%rax
 	movq	%rax,%cr3
 1234:
 LABEL(svs_enter_altstack_end)



CVS commit: src/share/man/man3lua

2018-05-05 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May  5 13:49:24 UTC 2018

Modified Files:
src/share/man/man3lua: intro.3lua

Log Message:
Add bozohttpd(3lua)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man3lua/intro.3lua

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

Modified files:

Index: src/share/man/man3lua/intro.3lua
diff -u src/share/man/man3lua/intro.3lua:1.8 src/share/man/man3lua/intro.3lua:1.9
--- src/share/man/man3lua/intro.3lua:1.8	Mon Apr 30 01:10:13 2018
+++ src/share/man/man3lua/intro.3lua	Sat May  5 13:49:24 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: intro.3lua,v 1.8 2018/04/30 01:10:13 sevan Exp $
+.\"	$NetBSD: intro.3lua,v 1.9 2018/05/05 13:49:24 sevan Exp $
 .\"
 .\" Copyright (c) 2013, 2016 Marc Balmer .
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd April 30, 2018
+.Dd May 5, 2018
 .Dt INTRO 3lua
 .Os
 .Sh NAME
@@ -43,6 +43,10 @@ The Lua modules provided by
 are:
 .Pp
 .Bl -tag -width syslog -compact
+.It Em bozohttpd
+Access
+.Xr libbozohttpd 3
+functionality.
 .It Em gpio
 Access
 .Xr gpio 4
@@ -63,6 +67,7 @@ functionality.
 .Sh SEE ALSO
 .Xr lua 1 ,
 .Xr luac 1 ,
+.Xr bozohttpd 3lua ,
 .Xr gpio 3lua ,
 .Xr netpgp 3lua ,
 .Xr sqlite 3lua ,



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

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 13:31:35 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun50i-a64.dtsi

Log Message:
Add A64 thermal sensor node


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/dts/sun50i-a64.dtsi

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/dts/sun50i-a64.dtsi
diff -u src/sys/arch/arm/dts/sun50i-a64.dtsi:1.5 src/sys/arch/arm/dts/sun50i-a64.dtsi:1.6
--- src/sys/arch/arm/dts/sun50i-a64.dtsi:1.5	Fri May  4 23:03:41 2018
+++ src/sys/arch/arm/dts/sun50i-a64.dtsi	Sat May  5 13:31:35 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64.dtsi,v 1.5 2018/05/04 23:03:41 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64.dtsi,v 1.6 2018/05/05 13:31:35 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -39,4 +39,16 @@
 			status = "disabled";
 		};
 	};
+
+	soc {
+		rtp: rtp@1c25000 {
+			compatible = "allwinner,sun50i-a64-ts";
+			reg = <0x01c25000 0x400>;
+			interrupts = ;
+			clocks = < CLK_BUS_THS>, < CLK_THS>;
+			clock-names = "ahb", "ths";
+			resets = < RST_BUS_THS>;
+			#thermal-sensor-cells = <0>;
+		};
+	};
 };



CVS commit: src

2018-05-05 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May  5 13:31:48 UTC 2018

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man3lua: Makefile
Added Files:
src/share/man/man3lua: bozohttpd.3lua

Log Message:
Add a manual for bozohttpd(3lua)


To generate a diff of this commit:
cvs rdiff -u -r1.1583 -r1.1584 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.6 -r1.7 src/share/man/man3lua/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man3lua/bozohttpd.3lua

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1583 src/distrib/sets/lists/man/mi:1.1584
--- src/distrib/sets/lists/man/mi:1.1583	Fri May  4 14:23:19 2018
+++ src/distrib/sets/lists/man/mi	Sat May  5 13:31:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1583 2018/05/04 14:23:19 kamil Exp $
+# $NetBSD: mi,v 1.1584 2018/05/05 13:31:48 sevan Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -661,6 +661,7 @@
 ./usr/share/man/cat3/i386/keycap.0		man-obsolete		obsolete
 ./usr/share/man/cat3/libbozohttpd.0		man-sys-catman		.cat
 ./usr/share/man/cat3/libunbound.0		man-netutil-catman	.cat,unbound
+./usr/share/man/cat3lua/bozohttpd.0		man-sys-catman		.cat
 ./usr/share/man/cat3lua/gpio.0			man-sys-catman		.cat
 ./usr/share/man/cat3lua/gpio.attach.0		man-sys-catman		.cat
 ./usr/share/man/cat3lua/gpio.close.0		man-sys-catman		.cat
@@ -3847,6 +3848,7 @@
 ./usr/share/man/html1/znew.html			man-util-htmlman	html
 ./usr/share/man/html3/libbozohttpd.html		man-sys-htmlman		html
 ./usr/share/man/html3/libunbound.html		man-netutil-htmlman	html,unbound
+./usr/share/man/html3lua/bozohttpd.html		man-sys-htmlman		html
 ./usr/share/man/html3lua/gpio.attach.html	man-sys-htmlman		html
 ./usr/share/man/html3lua/gpio.close.html	man-sys-htmlman		html
 ./usr/share/man/html3lua/gpio.html		man-sys-htmlman		html
@@ -6709,6 +6711,7 @@
 ./usr/share/man/man3/i386/keycap.3		man-obsolete		obsolete
 ./usr/share/man/man3/libbozohttpd.3		man-sys-man		.man
 ./usr/share/man/man3/libunbound.3		man-netutil-man		.man,unbound
+./usr/share/man/man3lua/bozohttpd.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/gpio.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/gpio.attach.3lua	man-sys-man		.man
 ./usr/share/man/man3lua/gpio.close.3lua		man-sys-man		.man

Index: src/share/man/man3lua/Makefile
diff -u src/share/man/man3lua/Makefile:1.6 src/share/man/man3lua/Makefile:1.7
--- src/share/man/man3lua/Makefile:1.6	Mon Apr 30 05:23:08 2018
+++ src/share/man/man3lua/Makefile	Sat May  5 13:31:48 2018
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.6 2018/04/30 05:23:08 htodd Exp $
+#	$NetBSD: Makefile,v 1.7 2018/05/05 13:31:48 sevan Exp $
 
-MAN=	gpio.3lua intro.3lua netpgp.3lua sqlite.3lua syslog.3lua
+MAN=	bozohttpd.3lua gpio.3lua intro.3lua netpgp.3lua sqlite.3lua syslog.3lua
 
 MLINKS+=gpio.3lua gpio.open.3lua \
 	gpio.3lua gpio.info.3lua \

Added files:

Index: src/share/man/man3lua/bozohttpd.3lua
diff -u /dev/null src/share/man/man3lua/bozohttpd.3lua:1.1
--- /dev/null	Sat May  5 13:31:48 2018
+++ src/share/man/man3lua/bozohttpd.3lua	Sat May  5 13:31:48 2018
@@ -0,0 +1,104 @@
+.\" $NetBSD: bozohttpd.3lua,v 1.1 2018/05/05 13:31:48 sevan Exp $
+.\"
+.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Sevan Janiyan .
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd May 5, 2018
+.Dt BOZOHTTPD 3lua
+.Os
+.Sh NAME
+.Nm bozohttpd
+.Nd provides access to
+.Xr 

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

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 13:28:23 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sun50i_a64_ccu.c

Log Message:
Add support for A64 thermal sensor clocks


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sun50i_a64_ccu.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/arm/sunxi/sun50i_a64_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.3 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.4
--- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.3	Thu Sep  7 23:19:45 2017
+++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c	Sat May  5 13:28:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_ccu.c,v 1.3 2017/09/07 23:19:45 jmcneill Exp $ */
+/* $NetBSD: sun50i_a64_ccu.c,v 1.4 2018/05/05 13:28:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.3 2017/09/07 23:19:45 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.4 2018/05/05 13:28:23 jmcneill Exp $");
 
 #include 
 #include 
@@ -52,6 +52,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_a64_c
 #define	BUS_CLK_GATING_REG2	0x068
 #define	BUS_CLK_GATING_REG3	0x06c
 #define	BUS_CLK_GATING_REG4	0x070
+#define	THS_CLK_REG		0x074
 #define	SDMMC0_CLK_REG		0x088
 #define	SDMMC1_CLK_REG		0x08c
 #define	SDMMC2_CLK_REG		0x090
@@ -141,6 +142,7 @@ static const char *ahb2_parents[] = { "a
 static const char *apb1_parents[] = { "ahb1" };
 static const char *apb2_parents[] = { "losc", "hosc", "pll_periph0" };
 static const char *mod_parents[] = { "hosc", "pll_periph0", "pll_periph1" };
+static const char *ths_parents[] = { "hosc", NULL, NULL, NULL };
 
 static struct sunxi_ccu_clk sun50i_a64_ccu_clks[] = {
 	SUNXI_CCU_NKMP(A64_CLK_PLL_PERIPH0, "pll_periph0", "hosc",
@@ -192,6 +194,13 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	SDMMC2_CLK_REG, __BITS(17, 16), __BITS(3,0), __BITS(25, 24), __BIT(31),
 	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
 
+	SUNXI_CCU_DIV_GATE(A64_CLK_THS, "ths", ths_parents,
+	THS_CLK_REG,	/* reg */
+	__BITS(1,0),	/* div */
+	__BITS(25,24),	/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_DIV_TIMES_TWO),
+
 	SUNXI_CCU_GATE(A64_CLK_BUS_MIPI_DSI, "bus-mipi-dsi", "ahb1",
 	BUS_CLK_GATING_REG0, 1),
 	SUNXI_CCU_GATE(A64_CLK_BUS_CE, "bus-ce", "ahb1",
@@ -250,6 +259,8 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	SUNXI_CCU_GATE(A64_CLK_BUS_SPINLOCK, "bus-spinlock", "ahb1",
 	BUS_CLK_GATING_REG1, 22),
 
+	SUNXI_CCU_GATE(A64_CLK_BUS_THS, "bus-ths", "apb1",
+	BUS_CLK_GATING_REG2, 8),
 
 	SUNXI_CCU_GATE(A64_CLK_BUS_CODEC, "bus-codec", "apb1",
 	BUS_CLK_GATING_REG3, 0),
@@ -257,8 +268,6 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	BUS_CLK_GATING_REG3, 1),
 	SUNXI_CCU_GATE(A64_CLK_BUS_PIO, "bus-pio", "apb1",
 	BUS_CLK_GATING_REG3, 5),
-	SUNXI_CCU_GATE(A64_CLK_BUS_THS, "bus-ths", "apb1",
-	BUS_CLK_GATING_REG3, 8),
 	SUNXI_CCU_GATE(A64_CLK_BUS_I2S0, "bus-i2s0", "apb1",
 	BUS_CLK_GATING_REG3, 12),
 	SUNXI_CCU_GATE(A64_CLK_BUS_I2S1, "bus-i2s1", "apb1",



CVS commit: src/sbin/cgdconfig

2018-05-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat May  5 11:28:44 UTC 2018

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

Log Message:
Check whether the cgd device selected is available to be
configured,that is, not already in use, before requesting
passwords from the user (or elsewhere).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sbin/cgdconfig/cgdconfig.c

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

Modified files:

Index: src/sbin/cgdconfig/cgdconfig.c
diff -u src/sbin/cgdconfig/cgdconfig.c:1.41 src/sbin/cgdconfig/cgdconfig.c:1.42
--- src/sbin/cgdconfig/cgdconfig.c:1.41	Tue Jan 10 20:45:19 2017
+++ src/sbin/cgdconfig/cgdconfig.c	Sat May  5 11:28:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cgdconfig.c,v 1.41 2017/01/10 20:45:19 christos Exp $ */
+/* $NetBSD: cgdconfig.c,v 1.42 2018/05/05 11:28:44 kre Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2002, 2003\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: cgdconfig.c,v 1.41 2017/01/10 20:45:19 christos Exp $");
+__RCSID("$NetBSD: cgdconfig.c,v 1.42 2018/05/05 11:28:44 kre Exp $");
 #endif
 
 #include 
@@ -515,6 +515,20 @@ configure(int argc, char **argv, struct 
 	char		 devicename[PATH_MAX];
 	const char	*dev = NULL;	/* XXX: gcc */
 
+	if ((
+	  fd = opendisk1(*argv, O_RDWR, cgdname, sizeof(cgdname), 1, prog_open)
+	) != -1) {
+		struct cgd_user cgu;
+
+		cgu.cgu_unit = -1;
+		if (prog_ioctl(fd, CGDIOCGET, ) != -1 && cgu.cgu_dev != 0) {
+			warnx("device %s already in use", *argv);
+			close(fd);
+			return -1;
+		}
+		close(fd);
+	}
+
 	if (argc == 2 || argc == 3) {
 		dev = getfsspecname(devicename, sizeof(devicename), argv[1]);
 		if (dev == NULL) {



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

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 11:16:30 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun50i-a64-pinebook.dts

Log Message:
Enable ehci0/ohci0 (attached to left USB port)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts

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/dts/sun50i-a64-pinebook.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.6 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.7
--- src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.6	Sat May  5 11:12:46 2018
+++ src/sys/arch/arm/dts/sun50i-a64-pinebook.dts	Sat May  5 11:16:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-pinebook.dts,v 1.6 2018/05/05 11:12:46 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-pinebook.dts,v 1.7 2018/05/05 11:16:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -71,10 +71,18 @@
 	};
 };
 
+ {
+	status = "okay";
+};
+
  {
 	status = "okay";
 };
 
+ {
+	status = "okay";
+};
+
  {
 	status = "okay";
 };
@@ -82,7 +90,6 @@
 _otg {
 	dr_mode = "host";
 	status = "okay";
-
 };
 
  {



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

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 11:12:46 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun50i-a64-pinebook.dts

Log Message:
Enable mmc1 (SDIO Wi-Fi is attached here)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts

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/dts/sun50i-a64-pinebook.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.5 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.6
--- src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.5	Fri May  4 23:04:09 2018
+++ src/sys/arch/arm/dts/sun50i-a64-pinebook.dts	Sat May  5 11:12:46 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-pinebook.dts,v 1.5 2018/05/04 23:04:09 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-pinebook.dts,v 1.6 2018/05/05 11:12:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -99,6 +99,20 @@
 	status = "okay";
 };
 
+ {
+	pinctrl-names = "default";
+	pinctrl-0 = <_pins>;
+	vmmc-supply = <_dldo4>;
+	vqmmc-supply = <_eldo1>;
+	bus-width = <4>;
+	non-removable;
+	status = "okay";
+
+	rtl8723cs: wifi@1 {
+		reg = <1>;
+	};
+};
+
  {
 	pinctrl-names = "default";
 	pinctrl-0 = <_pins>;



CVS commit: src/sys/dev/i2c

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 10:56:40 UTC 2018

Modified Files:
src/sys/dev/i2c: axppmic.c

Log Message:
No need to read battery capacity warning levels each time the sensor is 
refreshed


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/axppmic.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/i2c/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.3 src/sys/dev/i2c/axppmic.c:1.4
--- src/sys/dev/i2c/axppmic.c:1.3	Sat May  5 10:25:59 2018
+++ src/sys/dev/i2c/axppmic.c	Sat May  5 10:56:40 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.3 2018/05/05 10:25:59 jmcneill Exp $ */
+/* $NetBSD: axppmic.c,v 1.4 2018/05/05 10:56:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.3 2018/05/05 10:25:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.4 2018/05/05 10:56:40 jmcneill Exp $");
 
 #include 
 #include 
@@ -207,6 +207,9 @@ struct axppmic_softc {
 	struct sysmon_envsys *sc_sme;
 
 	envsys_data_t	sc_sensor[AXP_NSENSORS];
+
+	u_int		sc_warn_thres;
+	u_int		sc_shut_thres;
 };
 
 struct axpreg_softc {
@@ -374,7 +377,7 @@ axppmic_sensor_refresh(struct sysmon_env
 {
 	struct axppmic_softc *sc = sme->sme_cookie;
 	const int flags = I2C_F_POLL;
-	uint8_t val, warn_val;
+	uint8_t val;
 
 	e->state = ENVSYS_SINVALID;
 
@@ -411,16 +414,12 @@ axppmic_sensor_refresh(struct sysmon_env
 		(val & AXP_POWER_MODE_BATT_VALID) != 0 &&
 		(val & AXP_POWER_MODE_BATT_PRESENT) != 0 &&
 		axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_BATT_CAP_REG, , flags) == 0 &&
-		(val & AXP_BATT_CAP_VALID) != 0 &&
-		axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_BATT_CAP_WARN_REG, _val, flags) == 0) {
-			const u_int warn_thres = __SHIFTOUT(warn_val, AXP_BATT_CAP_WARN_LV1) + 5;
-			const u_int shut_thres = __SHIFTOUT(warn_val, AXP_BATT_CAP_WARN_LV2);
-
+		(val & AXP_BATT_CAP_VALID) != 0) {
 			const u_int batt_val = __SHIFTOUT(val, AXP_BATT_CAP_PERCENT);
-			if (batt_val <= shut_thres) {
+			if (batt_val <= sc->sc_shut_thres) {
 e->state = ENVSYS_SCRITICAL;
 e->value_cur = ENVSYS_BATTERY_CAPACITY_CRITICAL;
-			} else if (batt_val <= warn_thres) {
+			} else if (batt_val <= sc->sc_warn_thres) {
 e->state = ENVSYS_SWARNUNDER;
 e->value_cur = ENVSYS_BATTERY_CAPACITY_WARNING;
 			} else {
@@ -467,6 +466,14 @@ static void
 axppmic_attach_battery(struct axppmic_softc *sc)
 {
 	envsys_data_t *e;
+	uint8_t val;
+
+	iic_acquire_bus(sc->sc_i2c, I2C_F_POLL);
+	if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_BATT_CAP_WARN_REG, , I2C_F_POLL) == 0) {
+		sc->sc_warn_thres = __SHIFTOUT(val, AXP_BATT_CAP_WARN_LV1) + 5;
+		sc->sc_shut_thres = __SHIFTOUT(val, AXP_BATT_CAP_WARN_LV2);
+	}
+	iic_release_bus(sc->sc_i2c, I2C_F_POLL);
 
 	e = >sc_sensor[AXP_SENSOR_BATT_PRESENT];
 	e->private = AXP_SENSOR_BATT_PRESENT;



CVS commit: src/sys/dev/i2c

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 10:25:59 UTC 2018

Modified Files:
src/sys/dev/i2c: axppmic.c

Log Message:
Add ACIN and VBUS present sensors


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/axppmic.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/i2c/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.2 src/sys/dev/i2c/axppmic.c:1.3
--- src/sys/dev/i2c/axppmic.c:1.2	Sat May  5 00:39:59 2018
+++ src/sys/dev/i2c/axppmic.c	Sat May  5 10:25:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.2 2018/05/05 00:39:59 jmcneill Exp $ */
+/* $NetBSD: axppmic.c,v 1.3 2018/05/05 10:25:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.2 2018/05/05 00:39:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.3 2018/05/05 10:25:59 jmcneill Exp $");
 
 #include 
 #include 
@@ -44,6 +44,10 @@ __KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 
 
 #include 
 
+#define	AXP_POWER_SOURCE_REG	0x00
+#define	 AXP_POWER_SOURCE_ACIN_PRESENT	__BIT(7)
+#define	 AXP_POWER_SOURCE_VBUS_PRESENT	__BIT(5)
+
 #define	AXP_POWER_MODE_REG	0x01
 #define	 AXP_POWER_MODE_BATT_VALID	__BIT(4)
 #define	 AXP_POWER_MODE_BATT_PRESENT	__BIT(5)
@@ -180,6 +184,8 @@ struct axppmic_config {
 };
 
 enum axppmic_sensor {
+	AXP_SENSOR_ACIN_PRESENT,
+	AXP_SENSOR_VBUS_PRESENT,
 	AXP_SENSOR_BATT_PRESENT,
 	AXP_SENSOR_BATT_CHARGING,
 	AXP_SENSOR_BATT_CHARGE_STATE,
@@ -199,6 +205,7 @@ struct axppmic_softc {
 	struct sysmon_pswitch sc_smpsw;
 
 	struct sysmon_envsys *sc_sme;
+
 	envsys_data_t	sc_sensor[AXP_NSENSORS];
 };
 
@@ -373,12 +380,23 @@ axppmic_sensor_refresh(struct sysmon_env
 
 	iic_acquire_bus(sc->sc_i2c, flags);
 	switch (e->private) {
+	case AXP_SENSOR_ACIN_PRESENT:
+		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_SOURCE_REG, , flags) == 0) {
+			e->state = ENVSYS_SVALID;
+			e->value_cur = !!(val & AXP_POWER_SOURCE_ACIN_PRESENT);
+		}
+		break;
+	case AXP_SENSOR_VBUS_PRESENT:
+		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_SOURCE_REG, , flags) == 0) {
+			e->state = ENVSYS_SVALID;
+			e->value_cur = !!(val & AXP_POWER_SOURCE_VBUS_PRESENT);
+		}
+		break;
 	case AXP_SENSOR_BATT_PRESENT:
 		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_MODE_REG, , flags) == 0) {
 			if (val & AXP_POWER_MODE_BATT_VALID) {
 e->state = ENVSYS_SVALID;
 e->value_cur = !!(val & AXP_POWER_MODE_BATT_PRESENT);
-break;
 			}
 		}
 		break;
@@ -426,6 +444,26 @@ axppmic_sensor_refresh(struct sysmon_env
 }
 
 static void
+axppmic_attach_acadapter(struct axppmic_softc *sc)
+{
+	envsys_data_t *e;
+
+	e = >sc_sensor[AXP_SENSOR_ACIN_PRESENT];
+	e->private = AXP_SENSOR_ACIN_PRESENT;
+	e->units = ENVSYS_INDICATOR;
+	e->state = ENVSYS_SINVALID;
+	strlcpy(e->desc, "ACIN present", sizeof(e->desc));
+	sysmon_envsys_sensor_attach(sc->sc_sme, e);
+
+	e = >sc_sensor[AXP_SENSOR_VBUS_PRESENT];
+	e->private = AXP_SENSOR_VBUS_PRESENT;
+	e->units = ENVSYS_INDICATOR;
+	e->state = ENVSYS_SINVALID;
+	strlcpy(e->desc, "VBUS present", sizeof(e->desc));
+	sysmon_envsys_sensor_attach(sc->sc_sme, e);
+}
+
+static void
 axppmic_attach_battery(struct axppmic_softc *sc)
 {
 	envsys_data_t *e;
@@ -475,6 +513,7 @@ axppmic_attach_sensors(struct axppmic_so
 		sc->sc_sme->sme_class = SME_CLASS_BATTERY;
 		sc->sc_sme->sme_flags = SME_POLL_ONLY | SME_INIT_REFRESH;
 
+		axppmic_attach_acadapter(sc);
 		axppmic_attach_battery(sc);
 
 		sysmon_envsys_register(sc->sc_sme);



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

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 09:55:38 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64 SUNXI

Log Message:
Add sun50ia64rccu


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/evbarm/conf/SUNXI

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.11 src/sys/arch/evbarm/conf/GENERIC64:1.12
--- src/sys/arch/evbarm/conf/GENERIC64:1.11	Fri May  4 21:09:55 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat May  5 09:55:38 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.11 2018/05/04 21:09:55 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.12 2018/05/05 09:55:38 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -132,6 +132,7 @@ bcmaux*		at fdt? pass 1		# Broadcom BCM2
 sun8ih3ccu*	at fdt? pass 2		# Allwinner H3/H5 CCU
 sun8ih3rccu*	at fdt? pass 2		# Allwinner H3/H5 CCU (PRCM)
 sun50ia64ccu*	at fdt? pass 2		# Allwinner A64 CCU
+sun50ia64rccu*	at fdt? pass 2		# Allwinner A64 CCU (PRCM)
 sun50ih6ccu*	at fdt? pass 2		# Allwinner H6 CCU
 sun50ih6rccu*	at fdt? pass 2		# Allwinner H6 CCU (PRCM)
 sunxiresets*	at fdt? pass 1		# Allwinner misc. resets

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.70 src/sys/arch/evbarm/conf/SUNXI:1.71
--- src/sys/arch/evbarm/conf/SUNXI:1.70	Fri May  4 21:09:55 2018
+++ src/sys/arch/evbarm/conf/SUNXI	Sat May  5 09:55:38 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.70 2018/05/04 21:09:55 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.71 2018/05/05 09:55:38 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -184,6 +184,7 @@ sun8ih3ccu*	at fdt? pass 2		# H3 CCU
 sun8ih3rccu*	at fdt? pass 2		# H3 CCU (PRCM)
 sun9ia80ccu*	at fdt? pass 2		# A80 CCU
 sun50ia64ccu*	at fdt? pass 2		# A64 CCU
+sun50ia64rccu*	at fdt? pass 2		# A64 CCU (PRCM)
 sun50ih6ccu*	at fdt? pass 2		# H6 CCU
 sun50ih6rccu*	at fdt? pass 2		# H6 CCU (PRCM)
 sunxiresets*	at fdt? pass 1		# Misc. clock resets



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

2018-05-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May  5 09:54:53 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
Added Files:
src/sys/arch/arm/sunxi: sun50i_a64_r_ccu.c sun50i_a64_r_ccu.h

Log Message:
Add driver for Allwinner A64 PRCM CCU


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sun50i_a64_r_ccu.c \
src/sys/arch/arm/sunxi/sun50i_a64_r_ccu.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/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.52 src/sys/arch/arm/sunxi/files.sunxi:1.53
--- src/sys/arch/arm/sunxi/files.sunxi:1.52	Wed May  2 21:20:20 2018
+++ src/sys/arch/arm/sunxi/files.sunxi	Sat May  5 09:54:53 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.52 2018/05/02 21:20:20 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.53 2018/05/05 09:54:53 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -59,6 +59,11 @@ device	sun50ia64ccu: sunxi_ccu
 attach	sun50ia64ccu at fdt with sunxi_a64_ccu
 file	arch/arm/sunxi/sun50i_a64_ccu.c		sunxi_a64_ccu
 
+# CCU (A64 PRCM)
+device	sun50ia64rccu: sunxi_ccu
+attach	sun50ia64rccu at fdt with sunxi_a64_r_ccu
+file	arch/arm/sunxi/sun50i_a64_r_ccu.c	sunxi_a64_r_ccu
+
 # CCU (H6)
 device	sun50ih6ccu: sunxi_ccu
 attach	sun50ih6ccu at fdt with sunxi_h6_ccu

Added files:

Index: src/sys/arch/arm/sunxi/sun50i_a64_r_ccu.c
diff -u /dev/null src/sys/arch/arm/sunxi/sun50i_a64_r_ccu.c:1.1
--- /dev/null	Sat May  5 09:54:53 2018
+++ src/sys/arch/arm/sunxi/sun50i_a64_r_ccu.c	Sat May  5 09:54:53 2018
@@ -0,0 +1,143 @@
+/* $NetBSD: sun50i_a64_r_ccu.c,v 1.1 2018/05/05 09:54:53 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017-2018 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_r_ccu.c,v 1.1 2018/05/05 09:54:53 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#define	AR100_CFG_REG		0x00
+#define	APB0_CFG_REG		0x0c
+#define	APB0_GATE_REG		0x28
+#define	IR_CFG_REG		0x54
+#define	APB0_RESET_REG		0xb0
+
+static int sun50i_a64_r_ccu_match(device_t, cfdata_t, void *);
+static void sun50i_a64_r_ccu_attach(device_t, device_t, void *);
+
+static const char * const compatible[] = {
+	"allwinner,sun50i-a64-r-ccu",
+	NULL
+};
+
+CFATTACH_DECL_NEW(sunxi_a64_r_ccu, sizeof(struct sunxi_ccu_softc),
+	sun50i_a64_r_ccu_match, sun50i_a64_r_ccu_attach, NULL, NULL);
+
+static struct sunxi_ccu_reset sun50i_a64_r_ccu_resets[] = {
+	SUNXI_CCU_RESET(A64_R_RST_APB0_IR, APB0_RESET_REG, 1),
+	SUNXI_CCU_RESET(A64_R_RST_APB0_TIMER, APB0_RESET_REG, 2),
+	SUNXI_CCU_RESET(A64_R_RST_APB0_RSB, APB0_RESET_REG, 3),
+	SUNXI_CCU_RESET(A64_R_RST_APB0_UART, APB0_RESET_REG, 4),
+	SUNXI_CCU_RESET(A64_R_RST_APB0_I2C, APB0_RESET_REG, 6),
+};
+
+static const char *ar100_parents[] = { "losc", "hosc", "pll_periph0", "losc" };
+static const char *apb0_parents[] = { "ahb0" };
+static const char *mod_parents[] = { "losc", "hosc" };
+
+static struct sunxi_ccu_clk sun50i_a64_r_ccu_clks[] = {
+	SUNXI_CCU_PREDIV(A64_R_CLK_AR100, "ar100", ar100_parents,
+	AR100_CFG_REG,	/* reg */
+	__BITS(12,8),	/* prediv */
+	__BIT(2),		/* prediv_sel */
+	__BITS(5,4),	/* div */
+	__BITS(17,16),	/* sel */
+	SUNXI_CCU_PREDIV_POWER_OF_TWO),
+
+	SUNXI_CCU_FIXED_FACTOR(A64_R_CLK_AHB0, "ahb0", "ar100", 1, 1),
+
+	SUNXI_CCU_DIV(A64_R_CLK_APB0, "apb0", apb0_parents,
+	APB0_CFG_REG,	/* reg */
+	__BITS(1,0),	/* div */
+	0,			/* sel */
+	SUNXI_CCU_DIV_POWER_OF_TWO),
+

CVS commit: src/lib/librt

2018-05-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat May  5 06:39:10 UTC 2018

Modified Files:
src/lib/librt: sem_open.3

Log Message:
file system police; remove trailing whitespace; merge two error sections
for same error.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/librt/sem_open.3

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

Modified files:

Index: src/lib/librt/sem_open.3
diff -u src/lib/librt/sem_open.3:1.7 src/lib/librt/sem_open.3:1.8
--- src/lib/librt/sem_open.3:1.7	Fri May  4 20:28:51 2018
+++ src/lib/librt/sem_open.3	Sat May  5 06:39:10 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: sem_open.3,v 1.7 2018/05/04 20:28:51 christos Exp $
+.\" $NetBSD: sem_open.3,v 1.8 2018/05/05 06:39:10 wiz Exp $
 .\"
 .\" Copyright (C) 2000 Jason Evans .
 .\" All rights reserved.
@@ -150,15 +150,14 @@ are set but the semaphore already exists
 .It Bq Er EINTR
 The call was interrupted by a signal.
 .It Bq Er EINVAL
-The 
-.Fa name 
+The
+.Fa name
 argument does not begin with a
 .Sq /
 or contains more slashes.
 This is implementation-specific behavior and allowed by
 .St -p1003.1-96 .
-.It Bq Er EINVAL
-The
+Or, the
 .Fa value
 argument is greater than
 .Dv SEM_VALUE_MAX .
@@ -170,7 +169,7 @@ The specified
 .Fa name
 is longer than
 .Dv NAME_MAX ,
-or longer than the implementing filesystem will allow.
+or longer than the implementing file system will allow.
 .It Bq Er ENFILE
 The system limit on semaphores has been reached.
 .It Bq Er ENOENT
@@ -201,7 +200,7 @@ The specified
 .Fa name
 is longer than
 .Dv NAME_MAX ,
-or longer than the implementing filesystem will allow.
+or longer than the implementing file system will allow.
 .It Bq Er ENOENT
 The named semaphore does not exist.
 .El