CVS commit: src/doc/roadmaps

2016-05-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 14 21:32:50 UTC 2016

Modified Files:
src/doc/roadmaps: storage

Log Message:
updated nvme entry


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/doc/roadmaps/storage

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



CVS commit: src/doc/roadmaps

2016-05-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 14 21:32:50 UTC 2016

Modified Files:
src/doc/roadmaps: storage

Log Message:
updated nvme entry


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/doc/roadmaps/storage

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

Modified files:

Index: src/doc/roadmaps/storage
diff -u src/doc/roadmaps/storage:1.13 src/doc/roadmaps/storage:1.14
--- src/doc/roadmaps/storage:1.13	Thu May  5 06:17:45 2016
+++ src/doc/roadmaps/storage	Sat May 14 21:32:50 2016
@@ -1,4 +1,4 @@
-$NetBSD: storage,v 1.13 2016/05/05 06:17:45 dholland Exp $
+$NetBSD: storage,v 1.14 2016/05/14 21:32:50 mlelstv Exp $
 
 NetBSD Storage Roadmap
 ==
@@ -221,8 +221,9 @@ Semi-relatedly, it is also time for scsi
 
  - As of May 2016 a port of OpenBSD's driver has been commited. This
will be in -8.
- - However, the driver still needs to be made MPSAFE, and we still
-   need to attend to scsipi and various other I/O path bottlenecks.
+ - The nvme driver is a backend to ld(4) which is MPSAFE, but we still
+   need to attend to I/O path bottlenecks. Better instrumentation
+   is needed.
  - There is no clear timeframe or release target for these points.
  - Contact msaitoh or agc for further information.
 



CVS commit: src/external/cddl/osnet

2016-05-14 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat May 14 21:19:06 UTC 2016

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_isa.c
src/external/cddl/osnet/dev/dtrace/i386: dtrace_asm.S dtrace_isa.c
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
apply the ustack() parts of freebsd r211608:

r211608 | rpaulo | 2010-08-22 03:53:32 -0700 (Sun, 22 Aug 2010) | 8 
lines

Kernel DTrace support for:
o uregs  (sson@)
o ustack (sson@)
o /dev/dtrace/helper device (needed for USDT probes)

The work done by me was:
Sponsored by:   The FreeBSD Foundation

plus a few netbsd-specific tweaks from me.
fixes PR 50790.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dev/dtrace/i386/dtrace_asm.S \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_isa.c
cvs rdiff -u -r1.30 -r1.31 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

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

Modified files:

Index: src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.4 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.5
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.4	Mon Jun 11 15:18:05 2012
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c	Sat May 14 21:19:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_isa.c,v 1.4 2012/06/11 15:18:05 chs Exp $	*/
+/*	$NetBSD: dtrace_isa.c,v 1.5 2016/05/14 21:19:05 chs Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -32,20 +32,11 @@
 #include 
 #include 
 #include 
-//#include 
-//#include 
 
 #include 
-//#include 
 #include 
-//#include 
 
-//#include 
-//#include 
-//#include 
 #include 
-#include 
-
 
 uint8_t dtrace_fuword8_nocheck(void *);
 uint16_t dtrace_fuword16_nocheck(void *);
@@ -113,19 +104,17 @@ dtrace_getpcstack(pc_t *pcstack, int pcs
 	}
 }
 
-#ifdef notyet
 static int
 dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc,
 uintptr_t sp)
 {
 	volatile uint16_t *flags =
 	(volatile uint16_t *)_core[cpu_number()].cpuc_dtrace_flags;
-	struct amd64_frame *frame;
 	int ret = 0;
 
 	ASSERT(pcstack == NULL || pcstack_limit > 0);
 
-	while (pc != 0 && sp != 0) {
+	while (pc != 0) {
 		ret++;
 		if (pcstack != NULL) {
 			*pcstack++ = (uint64_t)pc;
@@ -134,10 +123,12 @@ dtrace_getustack_common(uint64_t *pcstac
 break;
 		}
 
-		frame = (struct amd64_frame *) sp;
+		if (sp == 0)
+			break;
 
-		pc = dtrace_fulword(>f_retaddr);
-		sp = dtrace_fulword(>f_frame);
+		pc = dtrace_fuword64((void *)(sp +
+			offsetof(struct amd64_frame, f_retaddr)));
+		sp = dtrace_fuword64((void *)sp);
 
 		/*
 		 * This is totally bogus:  if we faulted, we're going to clear
@@ -156,10 +147,9 @@ dtrace_getustack_common(uint64_t *pcstac
 void
 dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit)
 {
-	klwp_t *lwp = ttolwp(curthread);
 	proc_t *p = curproc;
-	struct regs *rp;
-	uintptr_t pc, sp;
+	struct trapframe *tf;
+	uintptr_t pc, sp, fp;
 	volatile uint16_t *flags =
 	(volatile uint16_t *)_core[cpu_number()].cpuc_dtrace_flags;
 	int n;
@@ -173,7 +163,7 @@ dtrace_getupcstack(uint64_t *pcstack, in
 	/*
 	 * If there's no user context we still need to zero the stack.
 	 */
-	if (lwp == NULL || p == NULL || (rp = lwp->lwp_regs) == NULL)
+	if (p == NULL || (tf = curlwp->l_md.md_regs) == NULL)
 		goto zero;
 
 	*pcstack++ = (uint64_t)p->p_pid;
@@ -182,19 +172,29 @@ dtrace_getupcstack(uint64_t *pcstack, in
 	if (pcstack_limit <= 0)
 		return;
 
-	pc = rp->r_rip;
-	sp = rp->r_rsp;
+	pc = tf->tf_rip;
+	fp = tf->tf_rbp;
+	sp = tf->tf_rsp;
 
 	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) {
+		/* 
+		 * In an entry probe.  The frame pointer has not yet been
+		 * pushed (that happens in the function prologue).  The
+		 * best approach is to add the current pc as a missing top
+		 * of stack and back the pc up to the caller, which is stored
+		 * at the current stack pointer address since the call 
+		 * instruction puts it there right before the branch.
+		 */
+
 		*pcstack++ = (uint64_t)pc;
 		pcstack_limit--;
 		if (pcstack_limit <= 0)
 			return;
 
-		pc = dtrace_fulword((void *) sp);
+		pc = dtrace_fuword64((void *) sp);
 	}
 
-	n = dtrace_getustack_common(pcstack, pcstack_limit, pc, sp);
+	n = dtrace_getustack_common(pcstack, pcstack_limit, pc, fp);
 	ASSERT(n >= 0);
 	ASSERT(n <= pcstack_limit);
 
@@ -209,18 +209,52 @@ zero:
 int
 dtrace_getustackdepth(void)
 {
+	proc_t *p = curproc;
+	struct trapframe *tf;
+	uintptr_t pc, fp, sp;
+	int n = 0;
+
+	if (p == NULL || (tf = curlwp->l_md.md_regs) == NULL)
+		return (0);
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT))
+		return (-1);
+
+	pc = tf->tf_rip;
+	fp = tf->tf_rbp;
+	sp = tf->tf_rsp;
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) {

CVS commit: src/external/cddl/osnet

2016-05-14 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat May 14 21:19:06 UTC 2016

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_isa.c
src/external/cddl/osnet/dev/dtrace/i386: dtrace_asm.S dtrace_isa.c
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
apply the ustack() parts of freebsd r211608:

r211608 | rpaulo | 2010-08-22 03:53:32 -0700 (Sun, 22 Aug 2010) | 8 
lines

Kernel DTrace support for:
o uregs  (sson@)
o ustack (sson@)
o /dev/dtrace/helper device (needed for USDT probes)

The work done by me was:
Sponsored by:   The FreeBSD Foundation

plus a few netbsd-specific tweaks from me.
fixes PR 50790.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dev/dtrace/i386/dtrace_asm.S \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_isa.c
cvs rdiff -u -r1.30 -r1.31 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

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



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

2016-05-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 14 17:11:30 UTC 2016

Modified Files:
src/sys/arch/amd64/conf: GENERIC XEN3_DOM0 XEN3_DOMU

Log Message:
Turn on MPROTECT on GENERIC and both MPROTECT and ASLR on XEN*


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/conf/XEN3_DOMU

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



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

2016-05-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 14 17:11:30 UTC 2016

Modified Files:
src/sys/arch/amd64/conf: GENERIC XEN3_DOM0 XEN3_DOMU

Log Message:
Turn on MPROTECT on GENERIC and both MPROTECT and ASLR on XEN*


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/conf/XEN3_DOMU

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.432 src/sys/arch/amd64/conf/GENERIC:1.433
--- src/sys/arch/amd64/conf/GENERIC:1.432	Sun May  1 06:21:01 2016
+++ src/sys/arch/amd64/conf/GENERIC	Sat May 14 13:11:30 2016
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.432 2016/05/01 10:21:01 nonaka Exp $
+# $NetBSD: GENERIC,v 1.433 2016/05/14 17:11:30 christos Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.432 $"
+#ident 		"GENERIC-$Revision: 1.433 $"
 
 maxusers	64		# estimated number of users
 
@@ -1319,6 +1319,6 @@ options VERIFIED_EXEC_FP_MD5
 
 options 	PAX_ASLR_DEBUG=1	# PaX ASLR debug
 options 	PAX_SEGVGUARD=0		# PaX Segmentation fault guard
-options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
+options 	PAX_MPROTECT=1		# PaX mprotect(2) restrictions
 options 	PAX_MPROTECT_DEBUG=1	# PaX mprotect debug
 options 	PAX_ASLR=1		# PaX Address Space Layout Randomization

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.118 src/sys/arch/amd64/conf/XEN3_DOM0:1.119
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.118	Sun May  1 06:21:01 2016
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat May 14 13:11:30 2016
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.118 2016/05/01 10:21:01 nonaka Exp $
+# $NetBSD: XEN3_DOM0,v 1.119 2016/05/14 17:11:30 christos Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -854,8 +854,8 @@ pseudo-device	xenevt
 pseudo-device	xvif
 pseudo-device	xbdback
 
-options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
-options 	PAX_ASLR=0		# PaX Address Space Layout Randomization
+options 	PAX_MPROTECT=1		# PaX mprotect(2) restrictions
+options 	PAX_ASLR=1		# PaX Address Space Layout Randomization
 
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.64 src/sys/arch/amd64/conf/XEN3_DOMU:1.65
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.64	Tue Nov 10 08:01:41 2015
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Sat May 14 13:11:30 2016
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.64 2015/11/10 13:01:41 tnn Exp $
+# $NetBSD: XEN3_DOMU,v 1.65 2016/05/14 17:11:30 christos Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -231,8 +231,8 @@ pseudo-device	bridge			# simple inter-ne
 #pseudo-device	pfsync			# PF sync if
 #pseudo-device	npf			# NPF packet filter
 
-options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
-options 	PAX_ASLR=0		# PaX Address Space Layout Randomization
+options 	PAX_MPROTECT=1		# PaX mprotect(2) restrictions
+options 	PAX_ASLR=1		# PaX Address Space Layout Randomization
 
 # miscellaneous pseudo-devices
 pseudo-device	pty			# pseudo-terminals



CVS commit: src/sys/kern

2016-05-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 14 17:04:10 UTC 2016

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

Log Message:
only print debugging info if we are actually going to change the permission.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/kern_pax.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_pax.c
diff -u src/sys/kern/kern_pax.c:1.44 src/sys/kern/kern_pax.c:1.45
--- src/sys/kern/kern_pax.c:1.44	Fri May 13 13:33:43 2016
+++ src/sys/kern/kern_pax.c	Sat May 14 13:04:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.44 2016/05/13 17:33:43 christos Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.45 2016/05/14 17:04:09 christos Exp $	*/
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.44 2016/05/13 17:33:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.45 2016/05/14 17:04:09 christos Exp $");
 
 #include "opt_pax.h"
 
@@ -411,7 +411,7 @@ pax_mprotect_adjust(
 	if ((*prot & (VM_PROT_WRITE|VM_PROT_EXECUTE)) != VM_PROT_EXECUTE) {
 #ifdef PAX_MPROTECT_DEBUG
 		struct proc *p = l->l_proc;
-		if (pax_mprotect_debug) {
+		if ((*prot & VM_PROT_EXECUTE) && pax_mprotect_debug) {
 			printf("%s: %s,%zu: %d.%d (%s): -x\n",
 			__func__, file, line,
 			p->p_pid, l->l_lid, p->p_comm);
@@ -422,7 +422,7 @@ pax_mprotect_adjust(
 	} else {
 #ifdef PAX_MPROTECT_DEBUG
 		struct proc *p = l->l_proc;
-		if (pax_mprotect_debug) {
+		if ((*prot & VM_PROT_WRITE) && pax_mprotect_debug) {
 			printf("%s: %s,%zu: %d.%d (%s): -w\n",
 			__func__, file, line,
 			p->p_pid, l->l_lid, p->p_comm);



CVS commit: src/sys/kern

2016-05-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 14 17:04:10 UTC 2016

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

Log Message:
only print debugging info if we are actually going to change the permission.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/kern_pax.c

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



CVS commit: src/doc

2016-05-14 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sat May 14 14:46:55 UTC 2016

Modified Files:
src/doc: 3RDPARTY

Log Message:
.. and don't forget to update doc/3RDPARTY when updating external/* stuff


To generate a diff of this commit:
cvs rdiff -u -r1.1329 -r1.1330 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1329 src/doc/3RDPARTY:1.1330
--- src/doc/3RDPARTY:1.1329	Mon May  9 10:21:42 2016
+++ src/doc/3RDPARTY	Sat May 14 14:46:55 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1329 2016/05/09 10:21:42 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.1330 2016/05/14 14:46:55 spz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -385,13 +385,13 @@ Location:	external/bsd/ekermit
 Notes:
 
 Package:	expat
-Version:	2.1.0
+Version:	2.1.1
 Current Vers:	2.1.1
-Maintainer:	mrg
+Maintainer:	Expat Project
 Archive Site:	http://sourceforge.net/projects/expat/files/expat/
 Home Page:	http://www.libexpat.org/
 Mailing List:	expat-disc...@libexpat.org
-Responsible:
+Responsible:	mrg
 License:	MIT
 Location:	src/external/mit/expat/dist
 Notes:



CVS commit: src/doc

2016-05-14 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sat May 14 14:46:55 UTC 2016

Modified Files:
src/doc: 3RDPARTY

Log Message:
.. and don't forget to update doc/3RDPARTY when updating external/* stuff


To generate a diff of this commit:
cvs rdiff -u -r1.1329 -r1.1330 src/doc/3RDPARTY

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



CVS commit: src

2016-05-14 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sat May 14 14:39:39 UTC 2016

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/debug: shl.mi
src/external/mit/expat/dist/conftools: ac_c_bigendian_cross.m4
mkinstalldirs
src/external/mit/expat/dist/lib: xmlparse.c
src/external/mit/expat/lib/libexpat: Makefile expat_config.h
shlib_version
Added Files:
src/external/mit/expat/lib/libexpat: expat.pc.in

Log Message:
merge conflicts, bump shlib version, add expat.pc


To generate a diff of this commit:
cvs rdiff -u -r1.770 -r1.771 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2034 -r1.2035 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.132 -r1.133 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.3 -r1.4 \
src/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4 \
src/external/mit/expat/dist/conftools/mkinstalldirs
cvs rdiff -u -r1.3 -r1.4 src/external/mit/expat/dist/lib/xmlparse.c
cvs rdiff -u -r1.1 -r1.2 src/external/mit/expat/lib/libexpat/Makefile
cvs rdiff -u -r0 -r1.1 src/external/mit/expat/lib/libexpat/expat.pc.in
cvs rdiff -u -r1.2 -r1.3 src/external/mit/expat/lib/libexpat/expat_config.h \
src/external/mit/expat/lib/libexpat/shlib_version

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.770 src/distrib/sets/lists/base/shl.mi:1.771
--- src/distrib/sets/lists/base/shl.mi:1.770	Sat Apr 23 23:28:13 2016
+++ src/distrib/sets/lists/base/shl.mi	Sat May 14 14:39:39 2016
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.770 2016/04/23 23:28:13 christos Exp $
+# $NetBSD: shl.mi,v 1.771 2016/05/14 14:39:39 spz Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -276,7 +276,7 @@
 ./usr/lib/libexecinfo.so.0.0			base-sys-shlib		compatfile
 ./usr/lib/libexpat.sobase-sys-shlib		compatfile
 ./usr/lib/libexpat.so.2base-sys-shlib		compatfile
-./usr/lib/libexpat.so.2.1			base-sys-shlib		compatfile
+./usr/lib/libexpat.so.2.2			base-sys-shlib		compatfile
 ./usr/lib/libfetch.sobase-sys-shlib		compatfile
 ./usr/lib/libfetch.so.3base-sys-shlib		compatfile
 ./usr/lib/libfetch.so.3.0			base-sys-shlib		compatfile

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2034 src/distrib/sets/lists/comp/mi:1.2035
--- src/distrib/sets/lists/comp/mi:1.2034	Fri May  6 09:30:05 2016
+++ src/distrib/sets/lists/comp/mi	Sat May 14 14:39:39 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2034 2016/05/06 09:30:05 snj Exp $
+#	$NetBSD: mi,v 1.2035 2016/05/14 14:39:39 spz Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -3635,6 +3635,7 @@
 ./usr/lib/pkgconfig/atf-c.pc			comp-atf-lib		atf,share
 ./usr/lib/pkgconfig/atf-sh.pc			comp-atf-lib		atf,share
 ./usr/lib/pkgconfig/atf.pc			comp-obsolete		obsolete
+./usr/lib/pkgconfig/expat.pc			comp-c-lib
 ./usr/lib/pkgconfig/kyua-testers.pc		comp-kyua-lib		kyua,share
 ./usr/lib/pkgconfig/libcrypto.pc		comp-crypto-lib		crypto,share
 ./usr/lib/pkgconfig/libssl.pc			comp-crypto-lib		crypto,share

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.132 src/distrib/sets/lists/debug/shl.mi:1.133
--- src/distrib/sets/lists/debug/shl.mi:1.132	Sat Apr 23 23:28:13 2016
+++ src/distrib/sets/lists/debug/shl.mi	Sat May 14 14:39:39 2016
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.132 2016/04/23 23:28:13 christos Exp $
+# $NetBSD: shl.mi,v 1.133 2016/05/14 14:39:39 spz Exp $
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libc.so.12.202.debug			comp-sys-debug	debug,dynamicroot
@@ -90,7 +90,7 @@
 ./usr/libdata/debug/usr/lib/libevent_openssl.so.4.0.debug	comp-sys-debug	debug,compatfile,crypto
 ./usr/libdata/debug/usr/lib/libevent_pthreads.so.4.0.debug	comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libexecinfo.so.0.0.debug		comp-sys-debug	debug,compatfile
-./usr/libdata/debug/usr/lib/libexpat.so.2.1.debug		comp-sys-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libexpat.so.2.2.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libfetch.so.3.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libform.so.6.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libg2c.so.2.0.debug			comp-sys-debug	obsolete

Index: src/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4
diff -u src/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4:1.3 src/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4:1.4
--- src/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4:1.3	Fri Apr  6 10:46:13 

CVS commit: src

2016-05-14 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sat May 14 14:39:39 UTC 2016

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/debug: shl.mi
src/external/mit/expat/dist/conftools: ac_c_bigendian_cross.m4
mkinstalldirs
src/external/mit/expat/dist/lib: xmlparse.c
src/external/mit/expat/lib/libexpat: Makefile expat_config.h
shlib_version
Added Files:
src/external/mit/expat/lib/libexpat: expat.pc.in

Log Message:
merge conflicts, bump shlib version, add expat.pc


To generate a diff of this commit:
cvs rdiff -u -r1.770 -r1.771 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2034 -r1.2035 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.132 -r1.133 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.3 -r1.4 \
src/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4 \
src/external/mit/expat/dist/conftools/mkinstalldirs
cvs rdiff -u -r1.3 -r1.4 src/external/mit/expat/dist/lib/xmlparse.c
cvs rdiff -u -r1.1 -r1.2 src/external/mit/expat/lib/libexpat/Makefile
cvs rdiff -u -r0 -r1.1 src/external/mit/expat/lib/libexpat/expat.pc.in
cvs rdiff -u -r1.2 -r1.3 src/external/mit/expat/lib/libexpat/expat_config.h \
src/external/mit/expat/lib/libexpat/shlib_version

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



CVS import: src/external/mit/expat/dist

2016-05-14 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sat May 14 14:30:54 UTC 2016

Update of /cvsroot/src/external/mit/expat/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv22133

Log Message:
Import of a new expat version. Upstream Changes:

Release 2.1.1 Sat March 12 2016
Security fixes:
#582: CVE-2015-1283 - Multiple integer overflows in XML_GetBuffer

Bug fixes:
#502: Fix potential null pointer dereference
#520: Symbol XML_SetHashSalt was not exported
Output of "xmlwf -h" was incomplete

Other changes
#503: Document behavior of calling XML_SetHashSalt with salt 0
Minor improvements to man page xmlwf(1)
Improvements to the experimental CMake build system
libtool now invoked with --verbose


Status:

Vendor Tag: expat
Release Tags:   expat-2-1-1

U src/external/mit/expat/dist/expat_config.h.cmake
U src/external/mit/expat/dist/ConfigureChecks.cmake
U src/external/mit/expat/dist/COPYING
U src/external/mit/expat/dist/expat_config.h.in
U src/external/mit/expat/dist/Makefile.in
N src/external/mit/expat/dist/configure.ac
U src/external/mit/expat/dist/CMakeLists.txt
U src/external/mit/expat/dist/aclocal.m4
U src/external/mit/expat/dist/expat.pc.in
U src/external/mit/expat/dist/MANIFEST
U src/external/mit/expat/dist/README
U src/external/mit/expat/dist/expat.dsw
U src/external/mit/expat/dist/configure
U src/external/mit/expat/dist/Changes
U src/external/mit/expat/dist/CMake.README
U src/external/mit/expat/dist/doc/style.css
U src/external/mit/expat/dist/doc/valid-xhtml10.png
U src/external/mit/expat/dist/doc/xmlwf.sgml
U src/external/mit/expat/dist/doc/reference.html
U src/external/mit/expat/dist/doc/xmlwf.1
U src/external/mit/expat/dist/doc/expat.png
U src/external/mit/expat/dist/tests/xmltest.sh
U src/external/mit/expat/dist/tests/chardata.h
U src/external/mit/expat/dist/tests/minicheck.h
U src/external/mit/expat/dist/tests/README.txt
U src/external/mit/expat/dist/tests/chardata.c
U src/external/mit/expat/dist/tests/minicheck.c
U src/external/mit/expat/dist/tests/runtests.c
U src/external/mit/expat/dist/tests/runtestspp.cpp
U src/external/mit/expat/dist/tests/benchmark/benchmark.dsp
U src/external/mit/expat/dist/tests/benchmark/benchmark.c
U src/external/mit/expat/dist/tests/benchmark/README.txt
U src/external/mit/expat/dist/tests/benchmark/benchmark.dsw
U src/external/mit/expat/dist/examples/elements.c
U src/external/mit/expat/dist/examples/outline.c
U src/external/mit/expat/dist/examples/outline.dsp
U src/external/mit/expat/dist/examples/elements.dsp
U src/external/mit/expat/dist/xmlwf/xmlfile.c
U src/external/mit/expat/dist/xmlwf/xmlmime.h
U src/external/mit/expat/dist/xmlwf/codepage.c
U src/external/mit/expat/dist/xmlwf/xmlfile.h
U src/external/mit/expat/dist/xmlwf/xmlwf.dsp
U src/external/mit/expat/dist/xmlwf/readfilemap.c
U src/external/mit/expat/dist/xmlwf/xmlurl.h
U src/external/mit/expat/dist/xmlwf/codepage.h
U src/external/mit/expat/dist/xmlwf/ct.c
U src/external/mit/expat/dist/xmlwf/xmltchar.h
U src/external/mit/expat/dist/xmlwf/filemap.h
U src/external/mit/expat/dist/xmlwf/win32filemap.c
U src/external/mit/expat/dist/xmlwf/xmlwf.c
U src/external/mit/expat/dist/xmlwf/xmlwin32url.cxx
U src/external/mit/expat/dist/xmlwf/unixfilemap.c
U src/external/mit/expat/dist/xmlwf/xmlmime.c
U src/external/mit/expat/dist/m4/ltversion.m4
U src/external/mit/expat/dist/m4/ltoptions.m4
U src/external/mit/expat/dist/m4/lt~obsolete.m4
U src/external/mit/expat/dist/m4/libtool.m4
U src/external/mit/expat/dist/m4/ltsugar.m4
U src/external/mit/expat/dist/bcb5/expat.bpf
U src/external/mit/expat/dist/bcb5/expat.mak
U src/external/mit/expat/dist/bcb5/xmlwf.mak
U src/external/mit/expat/dist/bcb5/expat_static.bpr
U src/external/mit/expat/dist/bcb5/outline.bpf
U src/external/mit/expat/dist/bcb5/outline.mak
U src/external/mit/expat/dist/bcb5/elements.bpr
U src/external/mit/expat/dist/bcb5/expat_static.mak
U src/external/mit/expat/dist/bcb5/expatw_static.bpr
U src/external/mit/expat/dist/bcb5/outline.bpr
U src/external/mit/expat/dist/bcb5/expatw_static.mak
U src/external/mit/expat/dist/bcb5/expat_static.bpf
U src/external/mit/expat/dist/bcb5/README.txt
U src/external/mit/expat/dist/bcb5/expatw.mak
U src/external/mit/expat/dist/bcb5/expat.bpr
U src/external/mit/expat/dist/bcb5/libexpatw_mtd.def
U src/external/mit/expat/dist/bcb5/elements.bpf
U src/external/mit/expat/dist/bcb5/setup.bat
U src/external/mit/expat/dist/bcb5/expatw_static.bpf
U src/external/mit/expat/dist/bcb5/all_projects.bpg
U src/external/mit/expat/dist/bcb5/expatw.bpf
U src/external/mit/expat/dist/bcb5/xmlwf.bpr
U src/external/mit/expat/dist/bcb5/libexpat_mtd.def
U src/external/mit/expat/dist/bcb5/expatw.bpr
U src/external/mit/expat/dist/bcb5/elements.mak
U src/external/mit/expat/dist/bcb5/xmlwf.bpf
U src/external/mit/expat/dist/bcb5/makefile.mak
U src/external/mit/expat/dist/amiga/expat_68k.h
U 

CVS import: src/external/mit/expat/dist

2016-05-14 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sat May 14 14:30:54 UTC 2016

Update of /cvsroot/src/external/mit/expat/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv22133

Log Message:
Import of a new expat version. Upstream Changes:

Release 2.1.1 Sat March 12 2016
Security fixes:
#582: CVE-2015-1283 - Multiple integer overflows in XML_GetBuffer

Bug fixes:
#502: Fix potential null pointer dereference
#520: Symbol XML_SetHashSalt was not exported
Output of "xmlwf -h" was incomplete

Other changes
#503: Document behavior of calling XML_SetHashSalt with salt 0
Minor improvements to man page xmlwf(1)
Improvements to the experimental CMake build system
libtool now invoked with --verbose


Status:

Vendor Tag: expat
Release Tags:   expat-2-1-1

U src/external/mit/expat/dist/expat_config.h.cmake
U src/external/mit/expat/dist/ConfigureChecks.cmake
U src/external/mit/expat/dist/COPYING
U src/external/mit/expat/dist/expat_config.h.in
U src/external/mit/expat/dist/Makefile.in
N src/external/mit/expat/dist/configure.ac
U src/external/mit/expat/dist/CMakeLists.txt
U src/external/mit/expat/dist/aclocal.m4
U src/external/mit/expat/dist/expat.pc.in
U src/external/mit/expat/dist/MANIFEST
U src/external/mit/expat/dist/README
U src/external/mit/expat/dist/expat.dsw
U src/external/mit/expat/dist/configure
U src/external/mit/expat/dist/Changes
U src/external/mit/expat/dist/CMake.README
U src/external/mit/expat/dist/doc/style.css
U src/external/mit/expat/dist/doc/valid-xhtml10.png
U src/external/mit/expat/dist/doc/xmlwf.sgml
U src/external/mit/expat/dist/doc/reference.html
U src/external/mit/expat/dist/doc/xmlwf.1
U src/external/mit/expat/dist/doc/expat.png
U src/external/mit/expat/dist/tests/xmltest.sh
U src/external/mit/expat/dist/tests/chardata.h
U src/external/mit/expat/dist/tests/minicheck.h
U src/external/mit/expat/dist/tests/README.txt
U src/external/mit/expat/dist/tests/chardata.c
U src/external/mit/expat/dist/tests/minicheck.c
U src/external/mit/expat/dist/tests/runtests.c
U src/external/mit/expat/dist/tests/runtestspp.cpp
U src/external/mit/expat/dist/tests/benchmark/benchmark.dsp
U src/external/mit/expat/dist/tests/benchmark/benchmark.c
U src/external/mit/expat/dist/tests/benchmark/README.txt
U src/external/mit/expat/dist/tests/benchmark/benchmark.dsw
U src/external/mit/expat/dist/examples/elements.c
U src/external/mit/expat/dist/examples/outline.c
U src/external/mit/expat/dist/examples/outline.dsp
U src/external/mit/expat/dist/examples/elements.dsp
U src/external/mit/expat/dist/xmlwf/xmlfile.c
U src/external/mit/expat/dist/xmlwf/xmlmime.h
U src/external/mit/expat/dist/xmlwf/codepage.c
U src/external/mit/expat/dist/xmlwf/xmlfile.h
U src/external/mit/expat/dist/xmlwf/xmlwf.dsp
U src/external/mit/expat/dist/xmlwf/readfilemap.c
U src/external/mit/expat/dist/xmlwf/xmlurl.h
U src/external/mit/expat/dist/xmlwf/codepage.h
U src/external/mit/expat/dist/xmlwf/ct.c
U src/external/mit/expat/dist/xmlwf/xmltchar.h
U src/external/mit/expat/dist/xmlwf/filemap.h
U src/external/mit/expat/dist/xmlwf/win32filemap.c
U src/external/mit/expat/dist/xmlwf/xmlwf.c
U src/external/mit/expat/dist/xmlwf/xmlwin32url.cxx
U src/external/mit/expat/dist/xmlwf/unixfilemap.c
U src/external/mit/expat/dist/xmlwf/xmlmime.c
U src/external/mit/expat/dist/m4/ltversion.m4
U src/external/mit/expat/dist/m4/ltoptions.m4
U src/external/mit/expat/dist/m4/lt~obsolete.m4
U src/external/mit/expat/dist/m4/libtool.m4
U src/external/mit/expat/dist/m4/ltsugar.m4
U src/external/mit/expat/dist/bcb5/expat.bpf
U src/external/mit/expat/dist/bcb5/expat.mak
U src/external/mit/expat/dist/bcb5/xmlwf.mak
U src/external/mit/expat/dist/bcb5/expat_static.bpr
U src/external/mit/expat/dist/bcb5/outline.bpf
U src/external/mit/expat/dist/bcb5/outline.mak
U src/external/mit/expat/dist/bcb5/elements.bpr
U src/external/mit/expat/dist/bcb5/expat_static.mak
U src/external/mit/expat/dist/bcb5/expatw_static.bpr
U src/external/mit/expat/dist/bcb5/outline.bpr
U src/external/mit/expat/dist/bcb5/expatw_static.mak
U src/external/mit/expat/dist/bcb5/expat_static.bpf
U src/external/mit/expat/dist/bcb5/README.txt
U src/external/mit/expat/dist/bcb5/expatw.mak
U src/external/mit/expat/dist/bcb5/expat.bpr
U src/external/mit/expat/dist/bcb5/libexpatw_mtd.def
U src/external/mit/expat/dist/bcb5/elements.bpf
U src/external/mit/expat/dist/bcb5/setup.bat
U src/external/mit/expat/dist/bcb5/expatw_static.bpf
U src/external/mit/expat/dist/bcb5/all_projects.bpg
U src/external/mit/expat/dist/bcb5/expatw.bpf
U src/external/mit/expat/dist/bcb5/xmlwf.bpr
U src/external/mit/expat/dist/bcb5/libexpat_mtd.def
U src/external/mit/expat/dist/bcb5/expatw.bpr
U src/external/mit/expat/dist/bcb5/elements.mak
U src/external/mit/expat/dist/bcb5/xmlwf.bpf
U src/external/mit/expat/dist/bcb5/makefile.mak
U src/external/mit/expat/dist/amiga/expat_68k.h
U 

CVS commit: src/sys/net80211

2016-05-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 14 13:35:40 UTC 2016

Modified Files:
src/sys/net80211: ieee80211_input.c

Log Message:
In station mode filter packets that or not for us in case the
interface is in promiscous mode or doesn't filter packets itself.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/net80211/ieee80211_input.c

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

Modified files:

Index: src/sys/net80211/ieee80211_input.c
diff -u src/sys/net80211/ieee80211_input.c:1.83 src/sys/net80211/ieee80211_input.c:1.84
--- src/sys/net80211/ieee80211_input.c:1.83	Sat May  7 12:36:50 2016
+++ src/sys/net80211/ieee80211_input.c	Sat May 14 13:35:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_input.c,v 1.83 2016/05/07 12:36:50 mlelstv Exp $	*/
+/*	$NetBSD: ieee80211_input.c,v 1.84 2016/05/14 13:35:40 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.83 2016/05/07 12:36:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.84 2016/05/14 13:35:40 mlelstv Exp $");
 #endif
 
 #ifdef _KERNEL_OPT
@@ -226,6 +226,18 @@ ieee80211_input(struct ieee80211com *ic,
 ic->ic_stats.is_rx_wrongbss++;
 goto out;
 			}
+
+			/* Filter out packets not directed to us in case the
+			 * device is in promiscous mode
+			 */
+			if ((! IEEE80211_IS_MULTICAST(wh->i_addr1))
+			&& (! IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr))) {
+IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT,
+bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D",
+ic->ic_myaddr, ":", wh->i_addr1, ":");
+ic->ic_stats.is_rx_wrongbss++;
+goto out;
+			}
 			break;
 		case IEEE80211_M_IBSS:
 		case IEEE80211_M_AHDEMO:



CVS commit: src/sys/net80211

2016-05-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 14 13:35:40 UTC 2016

Modified Files:
src/sys/net80211: ieee80211_input.c

Log Message:
In station mode filter packets that or not for us in case the
interface is in promiscous mode or doesn't filter packets itself.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/net80211/ieee80211_input.c

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 12:48:31 UTC 2016

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
KNF so it appears aligned on NXR, and fix a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/include/pmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.35 src/sys/arch/amd64/include/pmap.h:1.36
--- src/sys/arch/amd64/include/pmap.h:1.35	Fri Jan  9 01:08:49 2015
+++ src/sys/arch/amd64/include/pmap.h	Sat May 14 12:48:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.35 2015/01/09 01:08:49 riastradh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.36 2016/05/14 12:48:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -161,21 +161,20 @@
 #define PDIR_SLOT_PTE	L4_SLOT_PTE
 
 /*
- * the following defines give the virtual addresses of various MMU
+ * The following defines give the virtual addresses of various MMU
  * data structures:
  * PTE_BASE: the base VA of the linear PTE mappings
- * PTD_BASE: the base VA of the recursive mapping of the PTD
+ * PDP_BASE: the base VA of the recursive mapping of the PTD
  * PDP_PDE: the VA of the PDE that points back to the PDP
- *
  */
 
-#define PTE_BASE  ((pt_entry_t *) (L4_SLOT_PTE * NBPD_L4))
-#define KERN_BASE  ((pt_entry_t *) (L4_SLOT_KERN * NBPD_L4))
+#define PTE_BASE	((pt_entry_t *)(L4_SLOT_PTE * NBPD_L4))
+#define KERN_BASE	((pt_entry_t *)(L4_SLOT_KERN * NBPD_L4))
 
-#define L1_BASE		PTE_BASE
-#define L2_BASE ((pd_entry_t *)((char *)L1_BASE + L4_SLOT_PTE * NBPD_L3))
-#define L3_BASE ((pd_entry_t *)((char *)L2_BASE + L4_SLOT_PTE * NBPD_L2))
-#define L4_BASE ((pd_entry_t *)((char *)L3_BASE + L4_SLOT_PTE * NBPD_L1))
+#define L1_BASE	PTE_BASE
+#define L2_BASE	((pd_entry_t *)((char *)L1_BASE + L4_SLOT_PTE * NBPD_L3))
+#define L3_BASE	((pd_entry_t *)((char *)L2_BASE + L4_SLOT_PTE * NBPD_L2))
+#define L4_BASE	((pd_entry_t *)((char *)L3_BASE + L4_SLOT_PTE * NBPD_L1))
 
 #define PDP_PDE		(L4_BASE + PDIR_SLOT_PTE)
 
@@ -307,7 +306,7 @@ pmap_pte_setbits(volatile pt_entry_t *pt
 
 static __inline void
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
-{	
+{
 	mutex_enter(_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
 	(*pte) & ~bits);



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 12:48:31 UTC 2016

Modified Files:
src/sys/arch/amd64/include: pmap.h

Log Message:
KNF so it appears aligned on NXR, and fix a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amd64/include/pmap.h

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



CVS commit: src/sys/dev/usb

2016-05-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 14 10:52:29 UTC 2016

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

Log Message:
All com devices have an issue that they sleep in the final close
when they signal a hangup while still using the device. This allows
a concurrent open to succeed without proper locking because it
only checks the state of the tty layer.

This issue triggers an assertion in ucom due to a reused USB xfer,
but it can also cause misbehaviour in other com devices.

For now in ucom:
- make open block while close is in progress
- also serialize close operations


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/ucom.c

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

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.112 src/sys/dev/usb/ucom.c:1.113
--- src/sys/dev/usb/ucom.c:1.112	Tue May 10 10:40:33 2016
+++ src/sys/dev/usb/ucom.c	Sat May 14 10:52:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.112 2016/05/10 10:40:33 skrll Exp $	*/
+/*	$NetBSD: ucom.c,v 1.113 2016/05/14 10:52:29 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.112 2016/05/10 10:40:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.113 2016/05/14 10:52:29 mlelstv Exp $");
 
 #include 
 #include 
@@ -174,6 +174,7 @@ struct ucom_softc {
 	int			sc_swflags;
 
 	u_char			sc_opening;	/* lock during open */
+	u_char			sc_closing;	/* lock during close */
 	int			sc_refcnt;
 	u_char			sc_dying;	/* disconnecting */
 
@@ -282,6 +283,7 @@ ucom_attach(device_t parent, device_t se
 	sc->sc_tx_stopped = 0;
 	sc->sc_swflags = 0;
 	sc->sc_opening = 0;
+	sc->sc_closing = 0;
 	sc->sc_refcnt = 0;
 	sc->sc_dying = 0;
 
@@ -542,9 +544,10 @@ ucomopen(dev_t dev, int flag, int mode, 
 	}
 
 	/*
-	 * Do the following iff this is a first open.
+	 * Wait while the device is initialized by the
+	 * first opener or cleaned up by the last closer.
 	 */
-	while (sc->sc_opening) {
+	while (sc->sc_opening || sc->sc_closing) {
 		error = cv_wait_sig(>sc_opencv, >sc_lock);
 
 		if (error) {
@@ -681,6 +684,10 @@ ucomclose(dev_t dev, int flag, int mode,
 	mutex_enter(>sc_lock);
 	tp = sc->sc_tty;
 
+	while (sc->sc_closing)
+		cv_wait(>sc_opencv, >sc_lock);
+	sc->sc_closing = 1;
+
 	if (!ISSET(tp->t_state, TS_ISOPEN)) {
 		goto out;
 	}
@@ -706,6 +713,9 @@ ucomclose(dev_t dev, int flag, int mode,
 		usb_detach_broadcast(sc->sc_dev, >sc_detachcv);
 
 out:
+	sc->sc_closing = 0;
+	cv_signal(>sc_opencv);
+
 	mutex_exit(>sc_lock);
 
 	return 0;



CVS commit: src/sys/dev/usb

2016-05-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 14 10:52:29 UTC 2016

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

Log Message:
All com devices have an issue that they sleep in the final close
when they signal a hangup while still using the device. This allows
a concurrent open to succeed without proper locking because it
only checks the state of the tty layer.

This issue triggers an assertion in ucom due to a reused USB xfer,
but it can also cause misbehaviour in other com devices.

For now in ucom:
- make open block while close is in progress
- also serialize close operations


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/ucom.c

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



CVS commit: src/sys/dev/ic

2016-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 10:07:52 UTC 2016

Modified Files:
src/sys/dev/ic: sl811hs.c

Log Message:
#if 0 an assert around rootintr that's no longer correct.  root hub
interrupt transfers could do with reworking.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/ic/sl811hs.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/ic/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.69 src/sys/dev/ic/sl811hs.c:1.70
--- src/sys/dev/ic/sl811hs.c:1.69	Sat May 14 08:52:20 2016
+++ src/sys/dev/ic/sl811hs.c	Sat May 14 10:07:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $	*/
+/*	$NetBSD: sl811hs.c,v 1.70 2016/05/14 10:07:52 skrll Exp $	*/
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.70 2016/05/14 10:07:52 skrll Exp $");
 
 #include "opt_slhci.h"
 
@@ -3096,8 +3096,10 @@ slhci_root(struct slhci_softc *sc, struc
 	KASSERT(mutex_owned(>sc_intr_lock));
 
 	KASSERT(spipe->ptype == PT_ROOT_INTR);
+#if 0
 	LK_SLASSERT(t->rootintr == NULL, sc, spipe, xfer, return
 	USBD_CANCELLED);
+#endif
 	t->rootintr = xfer;
 	if (t->flags & F_CHANGE)
 		t->flags |= F_ROOTINTR;



CVS commit: src/sys/dev/ic

2016-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 10:07:52 UTC 2016

Modified Files:
src/sys/dev/ic: sl811hs.c

Log Message:
#if 0 an assert around rootintr that's no longer correct.  root hub
interrupt transfers could do with reworking.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/ic/sl811hs.c

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 09:51:56 UTC 2016

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

Log Message:
Actually, put the NOX identification above. Old CPUs do not support the
cpuid instruction.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/i386/i386/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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.121 src/sys/arch/i386/i386/locore.S:1.122
--- src/sys/arch/i386/i386/locore.S:1.121	Sat May 14 08:49:16 2016
+++ src/sys/arch/i386/i386/locore.S	Sat May 14 09:51:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.121 2016/05/14 08:49:16 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.122 2016/05/14 09:51:56 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.121 2016/05/14 08:49:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.122 2016/05/14 09:51:56 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -555,6 +555,16 @@ try586:	/* Use the `cpuid' instruction. 
 	cpuid
 	movl	%eax,RELOC(cpuid_level)
 
+	/*
+	 * Retrieve the NX/XD flag. We use the 32bit version of PG_NX.
+	 */
+	movl	$0x8001,%eax
+	cpuid
+	andl	$CPUID_NOX,%edx
+	jz	no_NOX
+	movl	$PG_NX32,RELOC(nox_flag)
+no_NOX:
+
 2:
 	/*
 	 * Finished with old stack; load new %esp now instead of later so we
@@ -571,16 +581,6 @@ try586:	/* Use the `cpuid' instruction. 
 	 */
 	movl	$_RELOC(tmpstk),%esp
 
-	/*
-	 * Retrieve the NX/XD flag. We use the 32bit version of PG_NX.
-	 */
-	movl	$0x8001,%eax
-	cpuid
-	andl	$CPUID_NOX,%edx
-	jz	no_NOX
-	movl	$PG_NX32,RELOC(nox_flag)
-no_NOX:
-
 /*
  * There are two different layouts possible, depending on whether PAE is
  * enabled or not.



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 09:51:56 UTC 2016

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

Log Message:
Actually, put the NOX identification above. Old CPUs do not support the
cpuid instruction.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/i386/i386/locore.S

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 09:37:21 UTC 2016

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

Log Message:
The NOX bit on large pages does not need to be amd64-specific anymore.
The i386 secondary CPUs can now properly handle it.


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/x86/x86/pmap.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.c
diff -u src/sys/arch/x86/x86/pmap.c:1.193 src/sys/arch/x86/x86/pmap.c:1.194
--- src/sys/arch/x86/x86/pmap.c:1.193	Fri May 13 11:47:02 2016
+++ src/sys/arch/x86/x86/pmap.c	Sat May 14 09:37:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.193 2016/05/13 11:47:02 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.194 2016/05/14 09:37:21 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.193 2016/05/13 11:47:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.194 2016/05/14 09:37:21 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1343,12 +1343,7 @@ pmap_bootstrap(vaddr_t kva_start)
 		for (/* */; kva + NBPD_L2 <= kva_end; kva += NBPD_L2,
 		pa += NBPD_L2) {
 			pde = _BASE[pl2_i(kva)];
-#ifdef __x86_64__
 			*pde = pa | pmap_pg_g | PG_PS | pg_nx | PG_KR | PG_V;
-#else
-			*pde = pa | pmap_pg_g | PG_PS | PG_KR | PG_V;
-#endif
-
 			tlbflushg();
 		}
 
@@ -1359,11 +1354,7 @@ pmap_bootstrap(vaddr_t kva_start)
 		for (/* */; kva + NBPD_L2 <= kva_end; kva += NBPD_L2,
 		pa += NBPD_L2) {
 			pde = _BASE[pl2_i(kva)];
-#ifdef __x86_64__
 			*pde = pa | pmap_pg_g | PG_PS | pg_nx | PG_KW | PG_V;
-#else
-			*pde = pa | pmap_pg_g | PG_PS | PG_KW | PG_V;
-#endif
 			tlbflushg();
 		}
 	}



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 09:37:21 UTC 2016

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

Log Message:
The NOX bit on large pages does not need to be amd64-specific anymore.
The i386 secondary CPUs can now properly handle it.


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/x86/x86/pmap.c

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



CVS commit: src/sys/dev/ic

2016-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 08:52:20 UTC 2016

Modified Files:
src/sys/dev/ic: sl811hs.c

Log Message:
Another locking fix in slhci_roothub_ctrl


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/sl811hs.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/ic/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.68 src/sys/dev/ic/sl811hs.c:1.69
--- src/sys/dev/ic/sl811hs.c:1.68	Thu May 12 18:57:38 2016
+++ src/sys/dev/ic/sl811hs.c	Sat May 14 08:52:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $	*/
+/*	$NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $	*/
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $");
 
 #include "opt_slhci.h"
 
@@ -3162,9 +3162,11 @@ slhci_roothub_ctrl(struct usbd_bus *bus,
 	/* Write Requests */
 	case UR_CLEAR_FEATURE:
 		if (type == UT_WRITE_CLASS_OTHER) {
-			if (index == 1 /* Port */)
+			if (index == 1 /* Port */) {
+mutex_enter(>sc_intr_lock);
 error = slhci_clear_feature(sc, value);
-			else
+mutex_exit(>sc_intr_lock);
+			} else
 DLOG(D_ROOT, "Clear Port Feature "
 "index = %#.4x", index, 0,0,0);
 		}



CVS commit: src/sys/dev/ic

2016-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 08:52:20 UTC 2016

Modified Files:
src/sys/dev/ic: sl811hs.c

Log Message:
Another locking fix in slhci_roothub_ctrl


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/sl811hs.c

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:49:16 UTC 2016

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

Log Message:
Map rodata and data+bss independently, and give them R and RW with
fillkpt_nox. The code is exactly the same as amd64's.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/i386/i386/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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.120 src/sys/arch/i386/i386/locore.S:1.121
--- src/sys/arch/i386/i386/locore.S:1.120	Sat May 14 08:39:41 2016
+++ src/sys/arch/i386/i386/locore.S	Sat May 14 08:49:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.120 2016/05/14 08:39:41 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.121 2016/05/14 08:49:16 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.120 2016/05/14 08:39:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.121 2016/05/14 08:49:16 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -684,10 +684,6 @@ no_NOX:
 	 */
 	leal	(PROC0_PTP1_OFF)(%esi),%ebx
 
-	/* Compute &__rodata_start - KERNBASE. */
-	movl	$RELOC(__rodata_start),%edx
-	andl	$~PGOFSET,%edx
-
 	/* Skip the first MB. */
 	movl	$(KERNTEXTOFF - KERNBASE),%eax
 	movl	%eax,%ecx
@@ -697,19 +693,43 @@ no_NOX:
 #endif
 	addl	%ecx,%ebx
 
-	/* Map the kernel text read-only. */
-	movl	%edx,%ecx
+	/* Map the kernel text RX. */
+	movl	$RELOC(__rodata_start),%ecx
 	subl	%eax,%ecx
 	shrl	$PGSHIFT,%ecx
 	orl	$(PG_V|PG_KR),%eax
 	fillkpt
 
-	/* Map the data, BSS, and bootstrap tables read-write. */
-	leal	(PG_V|PG_KW)(%edx),%eax
-	movl	RELOC(tablesize),%ecx
-	addl	%esi,%ecx			/* end of tables */
-	subl	%edx,%ecx			/* subtract end of text */
+	/* Map the kernel rodata R. */
+	movl	$RELOC(__rodata_start),%eax
+	movl	$RELOC(__data_start),%ecx
+	subl	%eax,%ecx
+	shrl	$PGSHIFT,%ecx
+	orl	$(PG_V|PG_KR),%eax
+	fillkpt_nox
+
+	/* Map the kernel data+bss RW. */
+	movl	$RELOC(__data_start),%eax
+	movl	$RELOC(__kernel_end),%ecx
+	subl	%eax,%ecx
+	shrl	$PGSHIFT,%ecx
+	orl	$(PG_V|PG_KW),%eax
+	fillkpt_nox
+
+	/*
+	 * We actually have to be careful here. The memory layout is as
+	 * follows:
+	 *+--+-+--+
+	 *| DATA+BSS < [PRELOADED MODULES] | BOOTSTRAP TABLES >
+	 *+--+-+--+
+	 * We just map everything from < to > with RWX rights.
+	 */
+	movl	$RELOC(__kernel_end),%eax
+	movl	%esi,%ecx		/* start of BOOTSTRAP TABLES */
+	addl	RELOC(tablesize),%ecx	/* end of BOOTSTRAP TABLES */
+	subl	%eax,%ecx		/* subtract end of kernel image */
 	shrl	$PGSHIFT,%ecx
+	orl	$(PG_V|PG_KW),%eax
 	fillkpt
 
 	/* Map ISA I/O mem (later atdevbase) */



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:49:16 UTC 2016

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

Log Message:
Map rodata and data+bss independently, and give them R and RW with
fillkpt_nox. The code is exactly the same as amd64's.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/i386/i386/locore.S

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:39:42 UTC 2016

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

Log Message:
Define fillkpt_nox on i386, same as amd64.

But there is a difference in the way it is done here. If PAE is not enabled,
PDE_SIZE = 4, so there is no NOX bit set. If PAE is enabled, PDE_SIZE = 8,
so the NOX bit is set.

This works exactly as intended, since NOX does not exist in the non-PAE
case.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/i386/i386/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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.119 src/sys/arch/i386/i386/locore.S:1.120
--- src/sys/arch/i386/i386/locore.S:1.119	Sat May 14 08:34:00 2016
+++ src/sys/arch/i386/i386/locore.S	Sat May 14 08:39:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.119 2016/05/14 08:34:00 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.120 2016/05/14 08:39:41 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.119 2016/05/14 08:34:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.120 2016/05/14 08:39:41 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -200,6 +200,19 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 	loop	1b			;
 
 /*
+ * fillkpt_nox - Same as fillkpt, but sets the NX/XD bit.
+ */
+#define fillkpt_nox \
+	pushl	%ebp			; \
+	movl	RELOC(nox_flag),%ebp	; \
+1:	movl	%ebp,(PDE_SIZE-4)(%ebx)	;	/* upper 32 bits: NX */ \
+	movl	%eax,(%ebx)		;	/* store phys addr */	\
+	addl	$PDE_SIZE,%ebx		;	/* next PTE/PDE */	\
+	addl	$PAGE_SIZE,%eax		;	/* next phys page */	\
+	loop	1b			; \
+	popl	%ebp			;
+
+/*
  * killkpt - Destroy a kernel page table
  *	ebx = page table address
  *	ecx = number of pages to destroy



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:39:42 UTC 2016

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

Log Message:
Define fillkpt_nox on i386, same as amd64.

But there is a difference in the way it is done here. If PAE is not enabled,
PDE_SIZE = 4, so there is no NOX bit set. If PAE is enabled, PDE_SIZE = 8,
so the NOX bit is set.

This works exactly as intended, since NOX does not exist in the non-PAE
case.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/i386/i386/locore.S

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:34:01 UTC 2016

Modified Files:
src/sys/arch/i386/i386: locore.S mptramp.S

Log Message:
Fix the secondary CPUs bug in i386. Same as amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/i386/mptramp.S

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:34:01 UTC 2016

Modified Files:
src/sys/arch/i386/i386: locore.S mptramp.S

Log Message:
Fix the secondary CPUs bug in i386. Same as amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/i386/mptramp.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/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.118 src/sys/arch/i386/i386/locore.S:1.119
--- src/sys/arch/i386/i386/locore.S:1.118	Sat May 14 06:49:34 2016
+++ src/sys/arch/i386/i386/locore.S	Sat May 14 08:34:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.118 2016/05/14 06:49:34 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.119 2016/05/14 08:34:00 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.118 2016/05/14 06:49:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.119 2016/05/14 08:34:00 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -168,6 +168,9 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 #endif /* XEN */
 #define	RELOC(x)	_RELOC(_C_LABEL(x))
 
+/* 32bit version of PG_NX */
+#define PG_NX32	0x8000
+
 #ifndef PAE
 #define	PROC0_PDIR_OFF	0
 #else
@@ -234,6 +237,7 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
  */
 	.data
 
+	.globl	_C_LABEL(nox_flag)
 	.globl	_C_LABEL(cputype)
 	.globl	_C_LABEL(cpuid_level)
 	.globl	_C_LABEL(esym)
@@ -279,6 +283,10 @@ LABEL(lapic_tpr)
 	.long 0
 END(lapic_tpr)
 #endif
+
+	.type	_C_LABEL(nox_flag), @object
+LABEL(nox_flag)		.long	0	/* 32bit NOX flag, set if supported */
+END(nox_flag)
 	.type	_C_LABEL(cputype), @object
 LABEL(cputype)		.long	0	/* are we 80486, Pentium, or.. */
 END(cputype)
@@ -550,6 +558,16 @@ try586:	/* Use the `cpuid' instruction. 
 	 */
 	movl	$_RELOC(tmpstk),%esp
 
+	/*
+	 * Retrieve the NX/XD flag. We use the 32bit version of PG_NX.
+	 */
+	movl	$0x8001,%eax
+	cpuid
+	andl	$CPUID_NOX,%edx
+	jz	no_NOX
+	movl	$PG_NX32,RELOC(nox_flag)
+no_NOX:
+
 /*
  * There are two different layouts possible, depending on whether PAE is
  * enabled or not.
@@ -737,7 +755,20 @@ try586:	/* Use the `cpuid' instruction. 
 	movl	%eax,%cr3
 
 	/*
-	 * 2. Enable paging and the rest of it.
+	 * 2. Set NOX in EFER, if available.
+	 */
+	movl	RELOC(nox_flag),%ebx
+	cmpl	$0,%ebx
+	je 	skip_NOX
+	movl	$MSR_EFER,%ecx
+	rdmsr
+	xorl	%eax,%eax
+	orl	$(EFER_NXE),%eax
+	wrmsr
+skip_NOX:
+
+	/*
+	 * 3. Enable paging and the rest of it.
 	 */
 	movl	%cr0,%eax
 	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax

Index: src/sys/arch/i386/i386/mptramp.S
diff -u src/sys/arch/i386/i386/mptramp.S:1.28 src/sys/arch/i386/i386/mptramp.S:1.29
--- src/sys/arch/i386/i386/mptramp.S:1.28	Thu May 12 09:40:23 2016
+++ src/sys/arch/i386/i386/mptramp.S	Sat May 14 08:34:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: mptramp.S,v 1.28 2016/05/12 09:40:23 maxv Exp $	*/
+/*	$NetBSD: mptramp.S,v 1.29 2016/05/14 08:34:00 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000, 2016 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.28 2016/05/12 09:40:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.29 2016/05/14 08:34:00 maxv Exp $");
 
 #include "opt_mpbios.h"		/* for MPDEBUG */
 
@@ -177,11 +177,25 @@ no_PSE:
 	movl	%eax,%cr4
 #endif
 
+	/*
+	 * Set NOX in EFER, if available.
+	 */
+	movl	RELOC(nox_flag),%ebx
+	cmpl	$0,%ebx
+	je 	no_NOX
+	movl	$MSR_EFER,%ecx
+	rdmsr
+	xorl	%eax,%eax
+	orl	$(EFER_NXE),%eax
+	wrmsr
+no_NOX:
+
+	/* Load %cr3. */
 	movl	RELOC(mp_pdirpa),%ecx
 	HALTT(0x5,%ecx)
-
-	/* Load base of page directory and enable mapping. */
 	movl	%ecx,%cr3		/* load PTD addr into MMU */
+
+	/* Enable paging and the rest of it. */
 	movl	%cr0,%eax
 	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
 	movl	%eax,%cr0
@@ -191,17 +205,6 @@ no_PSE:
 #endif
 	HALT(0x6)
 
-	/*
-	 * If EFER_NXE is not enabled, fetching a page with a NX bit set
-	 * will raise a #GP. Avoid that by setting the NXE feature now.
-	 */
-	movl	_C_LABEL(cpu_feature)+2*4,%eax	/* cpu_feature[2] */
-	andl	$CPUID_NOX,%eax
-	jz	1f
-	movl	$MSR_EFER,%ecx
-	rdmsr
-	orl	$EFER_NXE,%eax	/* enable No-Execute feature */
-	wrmsr
 
 /*
  * ok, we are now running with paging enabled and sharing page tables



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:19:42 UTC 2016

Modified Files:
src/sys/arch/i386/conf: kern.ldscript

Log Message:
Align the segments on i386. We're going to map them independently.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/conf/kern.ldscript

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/conf/kern.ldscript
diff -u src/sys/arch/i386/conf/kern.ldscript:1.18 src/sys/arch/i386/conf/kern.ldscript:1.19
--- src/sys/arch/i386/conf/kern.ldscript:1.18	Fri May 13 10:18:01 2016
+++ src/sys/arch/i386/conf/kern.ldscript	Sat May 14 08:19:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript,v 1.18 2016/05/13 10:18:01 maxv Exp $	*/
+/*	$NetBSD: kern.ldscript,v 1.19 2016/05/14 08:19:42 maxv Exp $	*/
 
 #include "assym.h"
 
@@ -16,11 +16,7 @@ SECTIONS
 	_etext = . ;
 	PROVIDE (etext = .) ;
 
-	/*
-	 * Adjust the address for the rodata segment.  We want to adjust up to
-	 * the same address within the page on the next page up.
-	 */
-	. = ALIGN(0x1000) + (. & (0x1000 - 1));
+	. = ALIGN(__PAGE_SIZE);
 
 	__rodata_start = . ;
 	.rodata :
@@ -29,6 +25,8 @@ SECTIONS
 		*(.rodata.*)
 	}
 
+	. = ALIGN(__PAGE_SIZE);
+
 	__data_start = . ;
 	.data :
 	{
@@ -55,7 +53,7 @@ SECTIONS
 		*(.bss)
 		*(.bss.*)
 		*(COMMON)
-	. = ALIGN(32 / 8);
+		. = ALIGN(32 / 8);
 	}
 
 	. = ALIGN(__PAGE_SIZE);



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 08:19:42 UTC 2016

Modified Files:
src/sys/arch/i386/conf: kern.ldscript

Log Message:
Align the segments on i386. We're going to map them independently.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/conf/kern.ldscript

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



CVS commit: src/sys/dev/usb

2016-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 07:14:31 UTC 2016

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

Log Message:
Only set QH CMASK for FS/LS interrupt transfers


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/dev/usb/ehci.c

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

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.251 src/sys/dev/usb/ehci.c:1.252
--- src/sys/dev/usb/ehci.c:1.251	Fri May  6 16:30:01 2016
+++ src/sys/dev/usb/ehci.c	Sat May 14 07:14:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.251 2016/05/06 16:30:01 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.252 2016/05/14 07:14:31 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.251 2016/05/06 16:30:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.252 2016/05/14 07:14:31 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1953,7 +1953,8 @@ ehci_open(struct usbd_pipe *pipe)
 			sqh->qh.qh_endphub |= htole32(
 			EHCI_QH_SET_PORT(hshubport) |
 			EHCI_QH_SET_HUBA(hshubaddr) |
-			EHCI_QH_SET_CMASK(0x08) /* XXX */
+			(xfertype == UE_INTERRUPT ?
+ EHCI_QH_SET_CMASK(0x08) : 0)
 			);
 		sqh->qh.qh_curqtd = EHCI_NULL;
 		/* Fill the overlay qTD */



CVS commit: src/sys/dev/usb

2016-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 07:14:31 UTC 2016

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

Log Message:
Only set QH CMASK for FS/LS interrupt transfers


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/dev/usb/ehci.c

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



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 06:49:34 UTC 2016

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

Log Message:
Define killkpt, and don't use _RELOC. Same as amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/i386/i386/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/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.117 src/sys/arch/i386/i386/locore.S:1.118
--- src/sys/arch/i386/i386/locore.S:1.117	Fri May 13 14:03:00 2016
+++ src/sys/arch/i386/i386/locore.S	Sat May 14 06:49:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.117 2016/05/13 14:03:00 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.118 2016/05/14 06:49:34 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.117 2016/05/13 14:03:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.118 2016/05/14 06:49:34 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -196,6 +196,17 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 	addl	$PAGE_SIZE,%eax		;	/* next phys page */	\
 	loop	1b			;
 
+/*
+ * killkpt - Destroy a kernel page table
+ *	ebx = page table address
+ *	ecx = number of pages to destroy
+ */
+#define killkpt \
+1:	movl	$0,(PDE_SIZE-4)(%ebx)	;	/* upper bits (for PAE) */ \
+	movl	$0,(%ebx)		; \
+	addl	$PDE_SIZE,%ebx		; \
+	loop	1b			;
+
 
 #ifdef XEN
 /*
@@ -647,7 +658,7 @@ try586:	/* Use the `cpuid' instruction. 
 	andl	$~PGOFSET,%edx
 
 	/* Skip the first MB. */
-	movl	$_RELOC(KERNTEXTOFF),%eax
+	movl	$(KERNTEXTOFF - KERNBASE),%eax
 	movl	%eax,%ecx
 	shrl	$(PGSHIFT-2),%ecx	/* ((n >> PGSHIFT) << 2) for # PDEs */
 #ifdef PAE
@@ -743,10 +754,7 @@ begin:
 	movl	_C_LABEL(nkptp)+1*4,%ecx
 	leal	(PROC0_PDIR_OFF)(%esi),%ebx	/* old, phys address of PDIR */
 	addl	$(KERNBASE), %ebx		/* new, virt address of PDIR */
-1:	movl	$0,(PDE_SIZE-4)(%ebx)		/* upper bits (for PAE) */
-	movl	$0,(%ebx)
-	addl	$PDE_SIZE,%ebx
-	loop	1b
+	killkpt
 
 	/* Relocate atdevbase. */
 	movl	$KERNBASE,%edx



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

2016-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 14 06:49:34 UTC 2016

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

Log Message:
Define killkpt, and don't use _RELOC. Same as amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/i386/i386/locore.S

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