CVS commit: src/sys/dev/pci

2016-11-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 14 05:38:39 UTC 2016

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
Set CTRL_MEHE correctly (PCH_{LPT,SPT} only).


To generate a diff of this commit:
cvs rdiff -u -r1.443 -r1.444 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.443 src/sys/dev/pci/if_wm.c:1.444
--- src/sys/dev/pci/if_wm.c:1.443	Thu Nov 10 08:35:24 2016
+++ src/sys/dev/pci/if_wm.c	Mon Nov 14 05:38:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.443 2016/11/10 08:35:24 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.444 2016/11/14 05:38:39 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.443 2016/11/10 08:35:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.444 2016/11/14 05:38:39 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5200,9 +5200,8 @@ wm_init_locked(struct ifnet *ifp)
 		reg |= PBECCSTS_UNCORR_ECC_ENABLE;
 		CSR_WRITE(sc, WMREG_PBECCSTS, reg);
 
-		reg = CSR_READ(sc, WMREG_CTRL);
-		reg |= CTRL_MEHE;
-		CSR_WRITE(sc, WMREG_CTRL, reg);
+		sc->sc_ctrl |= CTRL_MEHE;
+		CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
 		break;
 	default:
 		break;



CVS commit: src/tests/kernel

2016-11-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Nov 14 04:55:57 UTC 2016

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
Add new tests attach6 and attach7 in t_wait_proc{4,6,id,pid}

attach6:
Assert that tracer sees its parent when attached to tracer (check
sysctl(7) and struct kinfo_proc2)

attach7:
Assert that tracer sees its parent when attached to tracer (check
/proc/curproc/status 3rd column).

Currently these tests fail as getppid() and parent id obtained in these
alternative ways differ.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/kernel/t_ptrace_wait.c

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

Modified files:

Index: src/tests/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.12 src/tests/kernel/t_ptrace_wait.c:1.13
--- src/tests/kernel/t_ptrace_wait.c:1.12	Mon Nov 14 00:18:33 2016
+++ src/tests/kernel/t_ptrace_wait.c	Mon Nov 14 04:55:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.12 2016/11/14 00:18:33 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.13 2016/11/14 04:55:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,12 +27,13 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.12 2016/11/14 00:18:33 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.13 2016/11/14 04:55:57 kamil Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1008,7 +1009,8 @@ ATF_TC(attach5);
 ATF_TC_HEAD(attach5, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
-	"Assert that tracer sees its parent when attached to tracer");
+	"Assert that tracer sees its parent when attached to tracer "
+	"(check getppid(2))");
 }
 
 ATF_TC_BODY(attach5, tc)
@@ -1024,10 +1026,335 @@ ATF_TC_BODY(attach5, tc)
 	int status;
 #endif
 
+	printf("Spawn tracee\n");
+	ATF_REQUIRE(pipe(fds_totracee) == 0);
+	ATF_REQUIRE(pipe(fds_fromtracee) == 0);
+	tracee = atf_utils_fork();
+	if (tracee == 0) {
+		FORKEE_ASSERT(close(fds_totracee[1]) == 0);
+		FORKEE_ASSERT(close(fds_fromtracee[0]) == 0);
+
+		parent = getppid();
+
+		/* Emit message to the parent */
+		rv = write(fds_fromtracee[1], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+		rv = read(fds_totracee[0], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+		rv = write(fds_fromtracee[1], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		/* Wait for message from the parent */
+		rv = read(fds_totracee[0], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		FORKEE_ASSERT_EQ(parent, getppid());
+
+		_exit(exitval_tracee);
+	}
+	ATF_REQUIRE(close(fds_totracee[0]) == 0);
+	ATF_REQUIRE(close(fds_fromtracee[1]) == 0);
+
+	printf("Wait for child to record its parent identifier (pid)\n");
+	rv = read(fds_fromtracee[0], &msg, sizeof(msg));
+	FORKEE_ASSERT(rv == sizeof(msg));
+	rv = write(fds_totracee[1], &msg, sizeof(msg));
+	FORKEE_ASSERT(rv == sizeof(msg));
+	rv = read(fds_fromtracee[0], &msg, sizeof(msg));
+	FORKEE_ASSERT(rv == sizeof(msg));
+
+	printf("Spawn debugger\n");
+	ATF_REQUIRE(pipe(fds_totracer) == 0);
+	ATF_REQUIRE(pipe(fds_fromtracer) == 0);
+	tracer = atf_utils_fork();
+	if (tracer == 0) {
+		/* No IPC to communicate with the child */
+		FORKEE_ASSERT(close(fds_totracee[1]) == 0);
+		FORKEE_ASSERT(close(fds_fromtracee[0]) == 0);
+
+		FORKEE_ASSERT(close(fds_totracer[1]) == 0);
+		FORKEE_ASSERT(close(fds_fromtracer[0]) == 0);
+
+		printf("Before calling PT_ATTACH from tracee %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1);
+
+		/* Wait for tracee and assert that it was stopped w/ SIGSTOP */
+		FORKEE_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, &status, 0), tracee);
+
+		forkee_status_stopped(status, SIGSTOP);
+
+		/* Resume tracee with PT_CONTINUE */
+		FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1);
+
+		/* Inform parent that tracer has attached to tracee */
+		rv = write(fds_fromtracer[1], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		/* Wait for parent */
+		rv = read(fds_totracer[0], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		/* Wait for tracee and assert that it exited */
+		FORKEE_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, &status, 0), tracee);
+
+		forkee_status_exited(status, exitval_tracee);
+
+		printf("Before exiting of the tracer process\n");
+		_exit(exitval_tracer);
+	}
+	ATF_REQUIRE(close(fds_totracer[0]) == 0);
+	ATF_REQUIRE(close(fds_fromtracer[1]) == 0);
+
+	printf("Wait for the tracer to attach to the tracee\n");
+	rv = read(fds_fromtracer[0], &msg, sizeof(msg));
+	ATF_REQUIRE(rv == sizeof(msg));
+
+	printf("Resume the tracee and let it exit\n");
+	rv = write(fds_totracee[1], &msg, sizeof(msg));
+	ATF_REQUIRE(rv == sizeof(msg));
+
+	printf("fds_totracee is no longer needed - close it\n");
+	ATF_REQUIRE(close(fds_totracee[1]) == 0);
+
+	printf("fd

CVS commit: src/sys/netinet6

2016-11-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Nov 14 02:34:19 UTC 2016

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

Log Message:
Add missing rtfree


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/sys/netinet6/nd6.c

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

Modified files:

Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.210 src/sys/netinet6/nd6.c:1.211
--- src/sys/netinet6/nd6.c:1.210	Wed Nov  2 03:43:27 2016
+++ src/sys/netinet6/nd6.c	Mon Nov 14 02:34:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.210 2016/11/02 03:43:27 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.c,v 1.211 2016/11/14 02:34:19 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.210 2016/11/02 03:43:27 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.211 2016/11/14 02:34:19 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -998,8 +998,10 @@ nd6_is_new_addr_neighbor(const struct so
 			 */
 			if (!IN6_ARE_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr,
 			&satocsin6(rt_getkey(rt))->sin6_addr)) {
+rtfree(rt);
 continue;
 			}
+			rtfree(rt);
 		}
 
 		if (IN6_ARE_MASKED_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr,



CVS commit: src/tests/kernel

2016-11-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Nov 14 00:18:33 UTC 2016

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
Enhance pipe(2)-based IPC barrier in attach5 of t_ptrace_wait

The write(2) call does not block and there is need to perform handshake, in
order to wait on the read(2) call.

The pipe(2) interface for IPC purposes is quite difficult to design and get
right. It might be refactored and with added new helper functions, although
it would be better to switch to some other mechanism rather. But as it
works now quite well in the current set of tests, do not touch it.

Sponsored by .


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/kernel/t_ptrace_wait.c

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

Modified files:

Index: src/tests/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.11 src/tests/kernel/t_ptrace_wait.c:1.12
--- src/tests/kernel/t_ptrace_wait.c:1.11	Sat Nov 12 20:56:49 2016
+++ src/tests/kernel/t_ptrace_wait.c	Mon Nov 14 00:18:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.11 2016/11/12 20:56:49 christos Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.12 2016/11/14 00:18:33 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.11 2016/11/12 20:56:49 christos Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.12 2016/11/14 00:18:33 kamil Exp $");
 
 #include 
 #include 
@@ -1041,6 +1041,10 @@ ATF_TC_BODY(attach5, tc)
 		/* Emit message to the parent */
 		rv = write(fds_fromtracee[1], &msg, sizeof(msg));
 		FORKEE_ASSERT(rv == sizeof(msg));
+		rv = read(fds_totracee[0], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+		rv = write(fds_fromtracee[1], &msg, sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
 
 		/* Wait for message from the parent */
 		rv = read(fds_totracee[0], &msg, sizeof(msg));
@@ -1053,7 +1057,11 @@ ATF_TC_BODY(attach5, tc)
 	ATF_REQUIRE(close(fds_totracee[0]) == 0);
 	ATF_REQUIRE(close(fds_fromtracee[1]) == 0);
 
-	printf("Wait for child to record its parent identifier (pid\n");
+	printf("Wait for child to record its parent identifier (pid)\n");
+	rv = read(fds_fromtracee[0], &msg, sizeof(msg));
+	FORKEE_ASSERT(rv == sizeof(msg));
+	rv = write(fds_totracee[1], &msg, sizeof(msg));
+	FORKEE_ASSERT(rv == sizeof(msg));
 	rv = read(fds_fromtracee[0], &msg, sizeof(msg));
 	FORKEE_ASSERT(rv == sizeof(msg));
 



CVS commit: src/tests/kernel

2016-11-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Nov 13 22:59:31 UTC 2016

Modified Files:
src/tests/kernel: t_ptrace.c

Log Message:
Add attach_pid1_securelevel in t_ptrace

Assert that a debugger cannot attach to PID 1 with securelevel >= 1 (as root).

Test requested by 

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/kernel/t_ptrace.c

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

Modified files:

Index: src/tests/kernel/t_ptrace.c
diff -u src/tests/kernel/t_ptrace.c:1.16 src/tests/kernel/t_ptrace.c:1.17
--- src/tests/kernel/t_ptrace.c:1.16	Sat Nov 12 16:23:43 2016
+++ src/tests/kernel/t_ptrace.c	Sun Nov 13 22:59:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace.c,v 1.16 2016/11/12 16:23:43 christos Exp $	*/
+/*	$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,12 +27,13 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace.c,v 1.16 2016/11/12 16:23:43 christos Exp $");
+__RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,6 +93,31 @@ ATF_TC_BODY(attach_pid1, tc)
 	ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1);
 }
 
+ATF_TC(attach_pid1_securelevel);
+ATF_TC_HEAD(attach_pid1_securelevel, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Assert that a debugger cannot attach to PID 1 with "
+	"securelevel >= 1 (as root)");
+
+	atf_tc_set_md_var(tc, "require.user", "root");
+}
+
+ATF_TC_BODY(attach_pid1_securelevel, tc)
+{
+	int level;
+	size_t len = sizeof(level);
+
+	ATF_REQUIRE(sysctlbyname("kern.securelevel", &level, &len, NULL, 0)
+	!= -1);
+
+	if (level < 1) {
+		atf_tc_skip("Test must be run with securelevel >= 1");
+	}
+
+	ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1);
+}
+
 ATF_TC(attach_self);
 ATF_TC_HEAD(attach_self, tc)
 {
@@ -174,6 +200,7 @@ ATF_TP_ADD_TCS(tp)
 	setvbuf(stderr, NULL, _IONBF, 0);
 	ATF_TP_ADD_TC(tp, attach_pid0);
 	ATF_TP_ADD_TC(tp, attach_pid1);
+	ATF_TP_ADD_TC(tp, attach_pid1_securelevel);
 	ATF_TP_ADD_TC(tp, attach_self);
 	ATF_TP_ADD_TC(tp, attach_chroot);
 



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

2016-11-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 13 22:38:22 UTC 2016

Removed Files:
src/external/bsd/blacklist/port: config.h

Log Message:
no need for config.h; it should be auto-gened.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/external/bsd/blacklist/port/config.h

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



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

2016-11-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 13 22:37:39 UTC 2016

Modified Files:
src/external/bsd/blacklist/port: Makefile.am config.h

Log Message:
add include in the vpath.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/blacklist/port/Makefile.am
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/blacklist/port/config.h

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

Modified files:

Index: src/external/bsd/blacklist/port/Makefile.am
diff -u src/external/bsd/blacklist/port/Makefile.am:1.4 src/external/bsd/blacklist/port/Makefile.am:1.5
--- src/external/bsd/blacklist/port/Makefile.am:1.4	Wed Jan 21 22:48:07 2015
+++ src/external/bsd/blacklist/port/Makefile.am	Sun Nov 13 17:37:39 2016
@@ -5,7 +5,7 @@ include_HEADERS = blacklist.h
 
 bin_PROGRAMS = blacklistd blacklistctl srvtest cltest
 
-VPATH = ../bin:../lib:../test
+VPATH = ../bin:../lib:../test:../include
 
 AM_CPPFLAGS = -I../include  -DDOT="."
 AM_CFLAGS = @WARNINGS@

Index: src/external/bsd/blacklist/port/config.h
diff -u src/external/bsd/blacklist/port/config.h:1.2 src/external/bsd/blacklist/port/config.h:1.3
--- src/external/bsd/blacklist/port/config.h:1.2	Fri Apr  8 07:56:43 2016
+++ src/external/bsd/blacklist/port/config.h	Sun Nov 13 17:37:39 2016
@@ -1,3 +1,294 @@
-#if defined(__FreeBSD__)
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the  header file. */
+/* #undef HAVE_DB_185_H */
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_DB_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_ERR_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fgetln' function. */
+#define HAVE_FGETLN 1
+
+/* Define to 1 if you have the `fparseln' function. */
+#define HAVE_FPARSELN 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getprogname' function. */
+#define HAVE_GETPROGNAME 1
+
+/* Define to 1 if the system has the type `intptr_t'. */
+#define HAVE_INTPTR_T 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `db' library (-ldb). */
+/* #undef HAVE_LIBDB */
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#define HAVE_LIBRT 1
+
+/* Define to 1 if you have the `util' library (-lutil). */
+#define HAVE_LIBUTIL 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_NETATALK_AT_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_NET_IF_DL_H 1
+
+/* Define to 1 if you have the `pidfile' function. */
+#define HAVE_PIDFILE 1
+
+/* Define to 1 if you have the `popenve' function. */
+#define HAVE_POPENVE 1
+
+/* Define to 1 if you have the `sockaddr_snprintf' function. */
+#define HAVE_SOCKADDR_SNPRINTF 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcat' function. */
+#define HAVE_STRLCAT 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strtoi' function. */
+#define HAVE_STRTOI 1
+
+/* Define to 1 if `sa_len' is a member of `struct sockaddr'. */
+#define HAVE_STRUCT_SOCKADDR_SA_LEN 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_SYS_UN_H 1
+
+/* Define to 1 if you have  that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_UT

CVS commit: src

2016-11-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Nov 13 22:14:44 UTC 2016

Modified Files:
src/distrib/evbppc/ramdisk: Makefile
src/sys/arch/evbppc/conf: INSTALL.inc

Log Message:
Give the ramdisk a bit more space, evbppc64 for clang is running out.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/distrib/evbppc/ramdisk/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/conf/INSTALL.inc

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

Modified files:

Index: src/distrib/evbppc/ramdisk/Makefile
diff -u src/distrib/evbppc/ramdisk/Makefile:1.19 src/distrib/evbppc/ramdisk/Makefile:1.20
--- src/distrib/evbppc/ramdisk/Makefile:1.19	Fri Jan 16 22:37:58 2015
+++ src/distrib/evbppc/ramdisk/Makefile	Sun Nov 13 22:14:44 2016
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.19 2015/01/16 22:37:58 joerg Exp $
+#	$NetBSD: Makefile,v 1.20 2016/11/13 22:14:44 joerg Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	3200k
+IMAGESIZE=	3240k
 MAKEFS_FLAGS=	-f 15
 
 WARNS=		1

Index: src/sys/arch/evbppc/conf/INSTALL.inc
diff -u src/sys/arch/evbppc/conf/INSTALL.inc:1.2 src/sys/arch/evbppc/conf/INSTALL.inc:1.3
--- src/sys/arch/evbppc/conf/INSTALL.inc:1.2	Thu Mar  6 23:14:16 2014
+++ src/sys/arch/evbppc/conf/INSTALL.inc	Sun Nov 13 22:14:44 2016
@@ -1,4 +1,4 @@
-# 	$NetBSD: INSTALL.inc,v 1.2 2014/03/06 23:14:16 joerg Exp $
+# 	$NetBSD: INSTALL.inc,v 1.3 2016/11/13 22:14:44 joerg Exp $
 
 # DEBUG options turned on:
 
@@ -17,5 +17,5 @@ options 	MEMORY_DISK_IS_ROOT	# force roo
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
 ## The ramdisk size must be kept in sync manually with the size of
 ## the `ramdisk' image (which is built in distrib/evbppc/ramdisk/ramdisk).
-options 	MEMORY_DISK_ROOT_SIZE=6400	# size of memory disk, in blocks
+options 	MEMORY_DISK_ROOT_SIZE=6480	# size of memory disk, in blocks
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode



CVS commit: src/share/mk

2016-11-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Nov 13 22:13:55 UTC 2016

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

Log Message:
Define the MKPICLIB default for aarch64 and powerpc64 only for native
builds, not inside src/compat.


To generate a diff of this commit:
cvs rdiff -u -r1.985 -r1.986 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.985 src/share/mk/bsd.own.mk:1.986
--- src/share/mk/bsd.own.mk:1.985	Tue Nov  1 14:21:30 2016
+++ src/share/mk/bsd.own.mk	Sun Nov 13 22:13:55 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.985 2016/11/01 14:21:30 skrll Exp $
+#	$NetBSD: bsd.own.mk,v 1.986 2016/11/13 22:13:55 joerg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -824,9 +824,11 @@ MKGDB.ia64=	no
 MKPICLIB:=	no
 .endif
 
-# PowerPC64 and AArch64 ABI's are PIC
-MKPICLIB.powerpc64=	no
+.if !defined(COMMON_MACHINE_ARCH)
+# Native AArch64 and PowerPC64 ABIs are PIC.
+MKPICLIB.powerpc64:=	no
 #MKPICLIB.aarch64=	no
+.endif
 
 #
 # On VAX using ELF, all objects are PIC, not just shared libraries,



CVS commit: src/sys/kern

2016-11-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 13 15:25:01 UTC 2016

Modified Files:
src/sys/kern: kern_exit.c kern_prot.c

Log Message:
Make p_ppid contain the original parent's pid even for traced processes.
Only change it when we are being permanently reparented to init. Since
p_ppid is only used as a cached value to retrieve the parent's process id
from userland, this change makes it correct at all times. Idea from kre@
Revert specialized logic from getpid/getppid now that it is not needed.


To generate a diff of this commit:
cvs rdiff -u -r1.266 -r1.267 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.120 -r1.121 src/sys/kern/kern_prot.c

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

Modified files:

Index: src/sys/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.266 src/sys/kern/kern_exit.c:1.267
--- src/sys/kern/kern_exit.c:1.266	Thu Nov 10 12:07:14 2016
+++ src/sys/kern/kern_exit.c	Sun Nov 13 10:25:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.266 2016/11/10 17:07:14 christos Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.267 2016/11/13 15:25:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.266 2016/11/10 17:07:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.267 2016/11/13 15:25:01 christos Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -1320,11 +1320,12 @@ proc_reparent(struct proc *child, struct
 		child->p_pptr->p_nstopchild--;
 		parent->p_nstopchild++;
 	}
-	if (parent == initproc)
+	if (parent == initproc) {
 		child->p_exitsig = SIGCHLD;
+		child->p_ppid = parent->p_pid;
+	}
 
 	LIST_REMOVE(child, p_sibling);
 	LIST_INSERT_HEAD(&parent->p_children, child, p_sibling);
 	child->p_pptr = parent;
-	child->p_ppid = parent->p_pid;
 }

Index: src/sys/kern/kern_prot.c
diff -u src/sys/kern/kern_prot.c:1.120 src/sys/kern/kern_prot.c:1.121
--- src/sys/kern/kern_prot.c:1.120	Sat Nov 12 14:42:47 2016
+++ src/sys/kern/kern_prot.c	Sun Nov 13 10:25:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_prot.c,v 1.120 2016/11/12 19:42:47 christos Exp $	*/
+/*	$NetBSD: kern_prot.c,v 1.121 2016/11/13 15:25:01 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.120 2016/11/12 19:42:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.121 2016/11/13 15:25:01 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_43.h"
@@ -80,21 +80,6 @@ sys_getpid(struct lwp *l, const void *v,
 	return (0);
 }
 
-static pid_t
-kern_getppid(struct lwp *l)
-{
-	struct proc *p = l->l_proc;
-	pid_t ppid;
-
-	mutex_enter(proc_lock);
-mutex_enter(p->p_lock);
-ppid = (p->p_slflag & PSL_TRACED) && p->p_opptr ? p->p_opptr->p_pid :
-	p->p_pptr->p_pid;
-	mutex_exit(p->p_lock);
-	mutex_exit(proc_lock);
-	return ppid;
-}
-
 /* ARGSUSED */
 int
 sys_getpid_with_ppid(struct lwp *l, const void *v, register_t *retval)
@@ -102,7 +87,7 @@ sys_getpid_with_ppid(struct lwp *l, cons
 	struct proc *p = l->l_proc;
 
 	retval[0] = p->p_pid;
-	retval[1] = kern_getppid(l);
+	retval[1] = p->p_ppid;
 	return (0);
 }
 
@@ -110,7 +95,9 @@ sys_getpid_with_ppid(struct lwp *l, cons
 int
 sys_getppid(struct lwp *l, const void *v, register_t *retval)
 {
-	*retval = kern_getppid(l);
+	struct proc *p = l->l_proc;
+
+	*retval = p->p_ppid;
 	return (0);
 }
 



CVS commit: src

2016-11-13 Thread Adrian Steinmann
Module Name:src
Committed By:   ast
Date:   Sun Nov 13 14:47:46 UTC 2016

Modified Files:
src: build.sh

Log Message:
With driver modulization of if_loop.c through introduction of
sys/net/if_module.h, build.sh rumptest of -lrumpnet_virtif now also
requires -lrumpdev -lrumpvfs for if_loop.c:config_cfdriver_attach()
and kern_pmf.c:do_sys_sync().


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.311 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.310 src/build.sh:1.311
--- src/build.sh:1.310	Fri Jun  3 00:00:01 2016
+++ src/build.sh	Sun Nov 13 14:47:46 2016
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.310 2016/06/03 00:00:01 kre Exp $
+#	$NetBSD: build.sh,v 1.311 2016/11/13 14:47:46 ast Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1876,7 +1876,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/sys/compat/netbsd32

2016-11-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov 13 13:59:45 UTC 2016

Modified Files:
src/sys/compat/netbsd32: netbsd32_conv.h

Log Message:
correct wrong casting. some are considered harmless, but
- tv_sec in netbsd32_timeval is netbsd32_time_t (aka netbsd32_int64_t)
  rather than time_t (int64_t)
- tv_sec in netbsd32_timespec is netbsd32_time_t rather than
  netbsd32_long (y2038 problem)
approved by martin


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/compat/netbsd32/netbsd32_conv.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.30 src/sys/compat/netbsd32/netbsd32_conv.h:1.31
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.30	Mon Jun 22 10:35:00 2015
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Sun Nov 13 13:59:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.30 2015/06/22 10:35:00 mrg Exp $	*/
+/*	$NetBSD: netbsd32_conv.h,v 1.31 2016/11/13 13:59:45 rin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -63,7 +63,7 @@ netbsd32_from_timeval50(const struct tim
 struct netbsd32_timeval50 *tv32)
 {
 
-	tv32->tv_sec = (netbsd32_long)tv->tv_sec;
+	tv32->tv_sec = (netbsd32_time50_t)tv->tv_sec;
 	tv32->tv_usec = (netbsd32_long)tv->tv_usec;
 }
 
@@ -72,8 +72,8 @@ netbsd32_from_timeval(const struct timev
 struct netbsd32_timeval *tv32)
 {
 
-	tv32->tv_sec = (time_t)tv->tv_sec;
-	tv32->tv_usec = (suseconds_t)tv->tv_usec;
+	tv32->tv_sec = (netbsd32_time_t)tv->tv_sec;
+	tv32->tv_usec = tv->tv_usec;
 }
 
 static __inline void
@@ -82,7 +82,7 @@ netbsd32_to_timeval50(const struct netbs
 {
 
 	tv->tv_sec = (time_t)tv32->tv_sec;
-	tv->tv_usec = (suseconds_t)tv32->tv_usec;
+	tv->tv_usec = tv32->tv_usec;
 }
 
 static __inline void
@@ -91,7 +91,7 @@ netbsd32_to_timeval(const struct netbsd3
 {
 
 	tv->tv_sec = (time_t)tv32->tv_sec;
-	tv->tv_usec = (suseconds_t)tv32->tv_usec;
+	tv->tv_usec = tv32->tv_usec;
 }
 
 static __inline void
@@ -157,7 +157,7 @@ netbsd32_from_timespec50(const struct ti
 struct netbsd32_timespec50 *s32p)
 {
 
-	s32p->tv_sec = (netbsd32_long)p->tv_sec;
+	s32p->tv_sec = (netbsd32_time50_t)p->tv_sec;
 	s32p->tv_nsec = (netbsd32_long)p->tv_nsec;
 }
 
@@ -166,7 +166,7 @@ netbsd32_from_timespec(const struct time
 struct netbsd32_timespec *s32p)
 {
 
-	s32p->tv_sec = (netbsd32_long)p->tv_sec;
+	s32p->tv_sec = (netbsd32_time_t)p->tv_sec;
 	s32p->tv_nsec = (netbsd32_long)p->tv_nsec;
 }
 



CVS commit: src/sys/compat/netbsd32

2016-11-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov 13 13:52:41 UTC 2016

Modified Files:
src/sys/compat/netbsd32: netbsd32.h

Log Message:
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/compat/netbsd32/netbsd32.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.113 src/sys/compat/netbsd32/netbsd32.h:1.114
--- src/sys/compat/netbsd32/netbsd32.h:1.113	Wed Oct 19 09:44:01 2016
+++ src/sys/compat/netbsd32/netbsd32.h	Sun Nov 13 13:52:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.113 2016/10/19 09:44:01 skrll Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.114 2016/11/13 13:52:41 rin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -210,7 +210,7 @@ struct netbsd32_timeval50 {
 typedef netbsd32_pointer_t netbsd32_timevalp_t;
 struct netbsd32_timeval {
 	netbsd32_time_t	tv_sec;		/* seconds */
-	netbsd32_long	tv_usec;	/* and microseconds */
+	suseconds_t	tv_usec;	/* and microseconds */
 };
 
 typedef netbsd32_pointer_t netbsd32_timezonep_t;



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

2016-11-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 13 12:58:40 UTC 2016

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

Log Message:
Explain why this is the right value, otherwise someone (like me) could be
tempted to increase it. The invlpg part is from rmind, the statistical from
me.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/x86/pmap_tlb.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap_tlb.c
diff -u src/sys/arch/x86/x86/pmap_tlb.c:1.7 src/sys/arch/x86/x86/pmap_tlb.c:1.8
--- src/sys/arch/x86/x86/pmap_tlb.c:1.7	Fri Jul 24 15:20:37 2015
+++ src/sys/arch/x86/x86/pmap_tlb.c	Sun Nov 13 12:58:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.7 2015/07/24 15:20:37 hannken Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.8 2016/11/13 12:58:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008-2012 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.7 2015/07/24 15:20:37 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.8 2016/11/13 12:58:40 maxv Exp $");
 
 #include 
 #include 
@@ -74,7 +74,14 @@ typedef struct {
 	kcpuset_t *		tp_cpumask;
 } pmap_tlb_packet_t;
 
-/* No more than N seperate invlpg. */
+/*
+ * No more than N separate invlpg.
+ *
+ * Statistically, a value of six is big enough to cover the requested number
+ * of pages in ~ 95% of the TLB shootdowns we are getting. We therefore rarely
+ * reach the limit, and increasing it can actually reduce the performance due
+ * to the high cost of invlpg.
+ */
 #define	TP_MAXVA		6
 
 /*



CVS commit: src/sys/arch/i386/i386

2016-11-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov 13 12:38:14 UTC 2016

Modified Files:
src/sys/arch/i386/i386: vector.S

Log Message:
The reason we are not using INTRENTRY here is because this interrupt goes
through a task gate that points to a TSS entry in the GDT, and therefore
the GPRs are saved in the TSS by the hardware itself. Explain it, otherwise
it easily looks buggy.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/i386/i386/vector.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/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.66 src/sys/arch/i386/i386/vector.S:1.67
--- src/sys/arch/i386/i386/vector.S:1.66	Sun Oct 16 10:38:49 2016
+++ src/sys/arch/i386/i386/vector.S	Sun Nov 13 12:38:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.66 2016/10/16 10:38:49 maxv Exp $	*/
+/*	$NetBSD: vector.S,v 1.67 2016/11/13 12:38:14 maxv Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.66 2016/10/16 10:38:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.67 2016/11/13 12:38:14 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -194,6 +194,10 @@ IDTVEC(intr_lapic_tlb)
 IDTVEC_END(intr_lapic_tlb)
 
 #if defined(DDB)
+/*
+ * No need to use INTRENTRY, since we were brought here through a task-gate
+ * which triggered a hardware context switch and saved the GPRs in the TSS.
+ */
 IDTVEC(intrddbipi)
 1:
 	str	%ax