CVS commit: src/usr.sbin/makemandb

2016-05-21 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Sun May 22 05:03:17 UTC 2016

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

Log Message:
Remove a trailing white space after .Nm (mandoc -Tlint was complaining about it)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/makemandb/makemandb.8

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

Modified files:

Index: src/usr.sbin/makemandb/makemandb.8
diff -u src/usr.sbin/makemandb/makemandb.8:1.8 src/usr.sbin/makemandb/makemandb.8:1.9
--- src/usr.sbin/makemandb/makemandb.8:1.8	Tue Mar  3 18:04:33 2015
+++ src/usr.sbin/makemandb/makemandb.8	Sun May 22 05:03:17 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: makemandb.8,v 1.8 2015/03/03 18:04:33 christos Exp $
+.\" $NetBSD: makemandb.8,v 1.9 2016/05/22 05:03:17 abhinav Exp $
 .\"
 .\" Copyright (c) 2011 Abhinav Upadhyay 
 .\" All rights reserved.
@@ -84,7 +84,7 @@ and a summary at the end of the index up
 .El
 .Pp
 The index generated by
-.Nm 
+.Nm
 is also used by the
 .Xr whatis 1
 program, replacing the old



CVS commit: src/tests/kernel

2016-05-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 04:34:44 UTC 2016

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

Log Message:
Test for PR kern/51135 is no longer failing.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/kernel/t_rnd.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_rnd.c
diff -u src/tests/kernel/t_rnd.c:1.8 src/tests/kernel/t_rnd.c:1.9
--- src/tests/kernel/t_rnd.c:1.8	Fri May 13 13:22:28 2016
+++ src/tests/kernel/t_rnd.c	Sun May 22 04:34:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rnd.c,v 1.8 2016/05/13 13:22:28 pooka Exp $	*/
+/*	$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_rnd.c,v 1.8 2016/05/13 13:22:28 pooka Exp $");
+__RCSID("$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $");
 
 #include 
 #include 
@@ -99,8 +99,6 @@ ATF_TC_BODY(read_random, tc)
 	char buf[128];
 	int fd;
 
-	atf_tc_expect_fail("PR kern/51135");
-
 	rump_init();
 	RL(fd = rump_sys_open("/dev/random", O_RDONLY));
 	RL(rump_sys_read(fd, buf, sizeof(buf)));



CVS commit: src/sys

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 22 01:09:09 UTC 2016

Modified Files:
src/sys/arch/sparc64/include: proc.h
src/sys/kern: kern_pax.c

Log Message:
Account for the VA hole differently (simpler)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc64/include/proc.h
cvs rdiff -u -r1.47 -r1.48 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/arch/sparc64/include/proc.h
diff -u src/sys/arch/sparc64/include/proc.h:1.15 src/sys/arch/sparc64/include/proc.h:1.16
--- src/sys/arch/sparc64/include/proc.h:1.15	Thu May 19 11:36:35 2016
+++ src/sys/arch/sparc64/include/proc.h	Sat May 21 21:09:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.15 2016/05/19 15:36:35 christos Exp $ */
+/*	$NetBSD: proc.h,v 1.16 2016/05/22 01:09:09 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,6 +60,7 @@ struct mdproc {
 
 #define netbsd32_syscall_intern syscall_intern
 
-#define PAX_ASLR_RAND_MMAP_MAX 0x4
+/* Override to account for the VA hole */
+#define	PAX_ASLR_DELTA_MMAP_LEN	18
 
 #endif /* _SPARC64_PROC_H */

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.47 src/sys/kern/kern_pax.c:1.48
--- src/sys/kern/kern_pax.c:1.47	Thu May 19 17:39:15 2016
+++ src/sys/kern/kern_pax.c	Sat May 21 21:09:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.47 2016/05/19 21:39:15 christos Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.48 2016/05/22 01:09:09 christos Exp $	*/
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.47 2016/05/19 21:39:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.48 2016/05/22 01:09:09 christos Exp $");
 
 #include "opt_pax.h"
 
@@ -482,9 +482,6 @@ pax_aslr_init_vm(struct lwp *l, struct v
 	if (pax_aslr_flags & PAX_ASLR_FIXED)
 		rand = pax_aslr_rand;
 #endif
-#ifdef PAX_ASLR_RAND_MMAP_MAX
-	rand &= PAX_ASLR_RAND_MMAP_MAX - 1;
-#endif
 	vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(rand,
 	PAX_ASLR_DELTA_MMAP_LSB, len);
 



CVS commit: src/share/man/man7

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 21:07:43 UTC 2016

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

Log Message:
Mention MPROTECT issues


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man7/security.7

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

Modified files:

Index: src/share/man/man7/security.7
diff -u src/share/man/man7/security.7:1.13 src/share/man/man7/security.7:1.14
--- src/share/man/man7/security.7:1.13	Sun Jun 14 12:56:36 2015
+++ src/share/man/man7/security.7	Sat May 21 17:07:43 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: security.7,v 1.13 2015/06/14 16:56:36 christos Exp $
+.\" $NetBSD: security.7,v 1.14 2016/05/21 21:07:43 christos Exp $
 .\"
 .\" Copyright (c) 2006, 2011 Elad Efrat 
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 14, 2015
+.Dd May 21, 2016
 .Dt SECURITY 7
 .Os
 .Sh NAME
@@ -197,6 +197,23 @@ globally:
 .Bd -literal -offset indent
 # sysctl -w security.pax.mprotect.global=1
 .Ed
+.Pp
+PaX MPROTECT affects the following three uses:
+.Bl -bullet -offset indent
+.It
+Processes that utilize code generation (such as the JVM) might need to have
+MPROTECT disabled.
+.It
+Miscompiled programs that have text relocations, will now core dump instead
+of having their relocations corrected.
+You will need to fix those programs (recompile them properly).
+.It
+Debugger breakpoints:
+.Xr gdb 1
+needs to be able to write to the text segment in order to insert and
+delete breakpoints.
+This will not work unless MPROTECT is disabled on the executable.
+.El
 .Ss PaX Segvguard
 .Em PaX Segvguard
 monitors the number of segmentation faults in a program on a per-user basis,



CVS commit: src/usr.bin/man

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 20:54:34 UTC 2016

Modified Files:
src/usr.bin/man: pathnames.h

Log Message:
put back _PATH_WHATIS, it is used.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/man/pathnames.h

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

Modified files:

Index: src/usr.bin/man/pathnames.h
diff -u src/usr.bin/man/pathnames.h:1.6 src/usr.bin/man/pathnames.h:1.7
--- src/usr.bin/man/pathnames.h:1.6	Sat May 21 13:21:40 2016
+++ src/usr.bin/man/pathnames.h	Sat May 21 16:54:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pathnames.h,v 1.6 2016/05/21 17:21:40 abhinav Exp $	*/
+/*	$NetBSD: pathnames.h,v 1.7 2016/05/21 20:54:34 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,4 +35,5 @@
 
 #define	_PATH_MANCONF	"/etc/man.conf"
 #define	_PATH_PAGER	"/usr/bin/more -s"
+#define	_PATH_WHATIS	"whatis.db"
 #define	TMPFILE		"man.XX"



CVS commit: src/share/mk

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 19:56:52 UTC 2016

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

Log Message:
switch evbarm to gdb-7.10.1


To generate a diff of this commit:
cvs rdiff -u -r1.926 -r1.927 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.926 src/share/mk/bsd.own.mk:1.927
--- src/share/mk/bsd.own.mk:1.926	Sat May 21 14:34:52 2016
+++ src/share/mk/bsd.own.mk	Sat May 21 15:56:52 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.926 2016/05/21 18:34:52 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.927 2016/05/21 19:56:52 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -143,6 +143,7 @@ USE_SSP?=	yes
 # What GDB is used?
 #
 .if ${MACHINE} == "amd64" || \
+${MACHINE} == "evbarm" || \
 ${MACHINE} == "i386" || \
 ${MACHINE} == "playstation2" || \
 ${MACHINE} == "sparc" || \



CVS commit: src/share/mk

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 18:34:53 UTC 2016

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

Log Message:
Switch evbarm to gcc-5.3 and turn on PIE.


To generate a diff of this commit:
cvs rdiff -u -r1.925 -r1.926 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.925 src/share/mk/bsd.own.mk:1.926
--- src/share/mk/bsd.own.mk:1.925	Thu May 19 21:36:16 2016
+++ src/share/mk/bsd.own.mk	Sat May 21 14:34:52 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.925 2016/05/20 01:36:16 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.926 2016/05/21 18:34:52 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -70,6 +70,7 @@ HAVE_GCC?=	0
 ${MACHINE} == "amd64" || \
 ${MACHINE} == "hppa" || \
 ${MACHINE} == "i386" || \
+${MACHINE} == "evbarm" || \
 ${MACHINE} == "playstation2" || \
 ${MACHINE_ARCH} == "powerpc" || \
 ${MACHINE_ARCH} == "vax"
@@ -1051,6 +1052,7 @@ MKCTF?=		yes
 #
 .if ${MACHINE_ARCH} == "i386" || \
 ${MACHINE_ARCH} == "x86_64" || \
+${MACHINE} == "evbarm" || \
 ${MACHINE} == "sparc64"
 MKPIE?=		yes
 .else



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

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 18:31:13 UTC 2016

Modified Files:
src/sys/arch/evbarm/conf: GENERIC.common

Log Message:
Add various security options; enables PaX ASLR/MPROTECT


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC.common
diff -u src/sys/arch/evbarm/conf/GENERIC.common:1.12 src/sys/arch/evbarm/conf/GENERIC.common:1.13
--- src/sys/arch/evbarm/conf/GENERIC.common:1.12	Thu Nov 12 05:48:30 2015
+++ src/sys/arch/evbarm/conf/GENERIC.common	Sat May 21 14:31:13 2016
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.common,v 1.12 2015/11/12 10:48:30 jmcneill Exp $
+#	$NetBSD: GENERIC.common,v 1.13 2016/05/21 18:31:13 christos Exp $
 #
 #	GENERIC evbarm kernel config (template)
 #
@@ -163,3 +163,28 @@ pseudo-device	pty			# pseudo-terminals
 #pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	ksyms			# /dev/ksyms
 pseudo-device	lockstat		# lock profiling
+
+options FILEASSOC   # fileassoc(9) - required for Veriexec
+
+# Veriexec
+#
+# a pseudo device needed for veriexec
+pseudo-device   veriexec
+#
+# Uncomment the fingerprint methods below that are desired. Note that
+# removing fingerprint methods will have almost no impact on the kernel  
+# code size.
+# 
+options VERIFIED_EXEC_FP_RMD160
+options VERIFIED_EXEC_FP_SHA256
+options VERIFIED_EXEC_FP_SHA384
+options VERIFIED_EXEC_FP_SHA512
+options VERIFIED_EXEC_FP_SHA1
+options VERIFIED_EXEC_FP_MD5
+
+
+options 	PAX_ASLR_DEBUG=1	# PaX ASLR debug
+options 	PAX_SEGVGUARD=0		# PaX Segmentation fault guard
+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



CVS commit: src/usr.bin/man

2016-05-21 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Sat May 21 17:21:40 UTC 2016

Modified Files:
src/usr.bin/man: man.c pathnames.h

Log Message:
Remove unused include and unused constant. Ok from christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/man/man.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/man/pathnames.h

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

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.62 src/usr.bin/man/man.c:1.63
--- src/usr.bin/man/man.c:1.62	Thu Aug 14 15:31:12 2014
+++ src/usr.bin/man/man.c	Sat May 21 17:21:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.62 2014/08/14 15:31:12 apb Exp $	*/
+/*	$NetBSD: man.c,v 1.63 2016/05/21 17:21:40 abhinav Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)man.c	8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.62 2014/08/14 15:31:12 apb Exp $");
+__RCSID("$NetBSD: man.c,v 1.63 2016/05/21 17:21:40 abhinav Exp $");
 #endif
 #endif /* not lint */
 
@@ -51,7 +51,6 @@ __RCSID("$NetBSD: man.c,v 1.62 2014/08/1
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -160,7 +159,8 @@ main(int argc, char **argv)
 			break;
 		case 'M':
 		case 'P':	/* -P for backward compatibility */
-			m.manpath = strdup(optarg);
+			if ((m.manpath = strdup(optarg)) == NULL)
+err(EXIT_FAILURE, "malloc failed");
 			break;
 		case 'p':
 			m.getpath = 1;

Index: src/usr.bin/man/pathnames.h
diff -u src/usr.bin/man/pathnames.h:1.5 src/usr.bin/man/pathnames.h:1.6
--- src/usr.bin/man/pathnames.h:1.5	Thu Aug  7 11:15:11 2003
+++ src/usr.bin/man/pathnames.h	Sat May 21 17:21:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pathnames.h,v 1.5 2003/08/07 11:15:11 agc Exp $	*/
+/*	$NetBSD: pathnames.h,v 1.6 2016/05/21 17:21:40 abhinav Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,5 +35,4 @@
 
 #define	_PATH_MANCONF	"/etc/man.conf"
 #define	_PATH_PAGER	"/usr/bin/more -s"
-#define	_PATH_WHATIS	"whatis.db"
 #define	TMPFILE		"man.XX"



CVS commit: src/lib/libedit

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 17:06:45 UTC 2016

Modified Files:
src/lib/libedit: editline.3

Log Message:
Fix the prototype used by EL_GETCFN, mention the associated typedef
name, document the return values, expand the list of affected
functions, warn against using EL_GETCFN, and clarify some wording
and notation. (Ingo Schwarze)


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/lib/libedit/editline.3

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

Modified files:

Index: src/lib/libedit/editline.3
diff -u src/lib/libedit/editline.3:1.90 src/lib/libedit/editline.3:1.91
--- src/lib/libedit/editline.3:1.90	Mon May  9 17:27:55 2016
+++ src/lib/libedit/editline.3	Sat May 21 13:06:44 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: editline.3,v 1.90 2016/05/09 21:27:55 christos Exp $
+.\"	$NetBSD: editline.3,v 1.91 2016/05/21 17:06:44 christos Exp $
 .\"
 .\" Copyright (c) 1997-2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -92,7 +92,7 @@
 .Ft int
 .Fn el_getc "EditLine *e" "char *ch"
 .Ft int
-.Fn el_wgetc "EditLine *e" "wchar_t *ch"
+.Fn el_wgetc "EditLine *e" "wchar_t *wc"
 .Ft void
 .Fn el_push "EditLine *e" "const char *str"
 .Ft void
@@ -255,13 +255,13 @@ or from the input stream written by
 and
 .Fn el_push
 if that is not empty, and store it in
-.Fa ch .
+.Fa wc .
 If an invalid or incomplete character is found, it is discarded,
 .Va errno
 is set to
 .Er EILSEQ ,
 and the next character is read and stored in
-.Fa ch .
+.Fa wc .
 Returns 1 if a valid character was read, 0 on end of file, or \-1 on
 .Xr read 2
 failure.
@@ -503,18 +503,31 @@ unbuffered mode is disabled (the default
 In unbuffered mode,
 .Fn el_gets
 will return immediately after processing a single character.
-.It Dv EL_GETCFN , Fa "int (*f)(EditLine *, char *c)"
-Define the character reading function as
-.Fa f ,
-which is to return the number of characters read and store them in
-.Fa c .
-This function is called internally by
-.Fn el_gets
+.It Dv EL_GETCFN , Fa "el_rfunc_t f"
+Whenever reading a character, use the function
+.Bd -ragged -offset indent -compact
+.Ft int
+.Fo f
+.Fa "EditLine *e"
+.Fa "wchar_t *wc"
+.Fc
+.Ed
+which stores the character in
+.Fa wc
+and returns 1 on success, 0 on end of file, or \-1 on I/O or encoding
+errors.
+Functions internally using it include
+.Fn el_wgets ,
+.Fn el_wgetc ,
+.Fn el_gets ,
 and
 .Fn el_getc .
-The builtin function can be set or restored with the special function
-name
-.Dq Dv EL_BUILTIN_GETCFN .
+Initially, a builtin function is installed, and replacing it
+is discouraged because writing such a function is very error prone.
+The builtin function can be restored at any time by passing the
+special value
+.Dv EL_BUILTIN_GETCFN
+instead of a function pointer.
 .It Dv EL_CLIENTDATA , Fa "void *data"
 Register
 .Fa data
@@ -558,7 +571,7 @@ are supported, along with actual type of
 .Bl -tag -width 4n
 .It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
 Set
-.Fa f .
+.Fa f
 to a pointer to the function that displays the prompt.
 If
 .Fa c
@@ -567,7 +580,7 @@ is not
 set it to the start/stop literal prompt character.
 .It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
 Set
-.Fa f .
+.Fa f
 to a pointer to the function that displays the prompt.
 If
 .Fa c
@@ -592,7 +605,7 @@ to the current value of that capability.
 .It Dv EL_SIGNAL , Fa "int *s"
 Set
 .Fa s
-to non zero if
+to non-zero if
 .Nm
 has installed private signal handlers (see
 .Fn el_get
@@ -601,10 +614,12 @@ above).
 Set
 .Fa c
 to non-zero if editing is enabled.
-.It Dv EL_GETCFN , Fa "int (**f)(EditLine *, char *)"
-Return a pointer to the function that read characters, which is equal to
-.Dq Dv EL_BUILTIN_GETCFN
-in the case of the default builtin function.
+.It Dv EL_GETCFN , Fa "el_rfunc_t *f"
+Set
+.Fa f
+to a pointer to the function that reads characters, or to
+.Dv EL_BUILTIN_GETCFN
+if the builtin function is in use.
 .It Dv EL_CLIENTDATA , Fa "void **data"
 Set
 .Fa data



CVS commit: src/external/gpl3/binutils/dist/ld/emulparams

2016-05-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 21 16:23:10 UTC 2016

Modified Files:
src/external/gpl3/binutils/dist/ld/emulparams: armelf_nbsd.sh

Log Message:
PIE in the face!


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh

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

Modified files:

Index: src/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh
diff -u src/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh:1.6 src/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh:1.7
--- src/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh:1.6	Sun Aug 10 01:57:30 2014
+++ src/external/gpl3/binutils/dist/ld/emulparams/armelf_nbsd.sh	Sat May 21 12:23:10 2016
@@ -2,6 +2,7 @@
 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 TEXT_START_ADDR=0x0001
 TARGET2_TYPE=got-rel
+GENERATE_PIE_SCRIPT=yes
 
 unset DATA_START_SYMBOLS
 unset STACK_ADDR



CVS commit: src/sys/kern

2016-05-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May 21 15:33:40 UTC 2016

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

Log Message:
Use rnd_getmore as intended.  No more essay needed here.

Workaround for buffering got pushed into rnd_getmore, closer to the
actual cause of the problem.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/kern/kern_rndsink.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_rndsink.c
diff -u src/sys/kern/kern_rndsink.c:1.16 src/sys/kern/kern_rndsink.c:1.17
--- src/sys/kern/kern_rndsink.c:1.16	Tue Apr 21 04:24:16 2015
+++ src/sys/kern/kern_rndsink.c	Sat May 21 15:33:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndsink.c,v 1.16 2015/04/21 04:24:16 riastradh Exp $	*/
+/*	$NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.16 2015/04/21 04:24:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 riastradh Exp $");
 
 #include 
 #include 
@@ -142,21 +142,10 @@ rndsinks_enqueue(struct rndsink *rndsink
 
 	KASSERT(mutex_owned());
 
-	/*
-	 * XXX This should request only rndsink->rs_bytes bytes of
-	 * entropy, but that might get buffered up indefinitely because
-	 * kern_rndq has no bound on the duration before it will
-	 * process queued entropy samples.  To work around this, we are
-	 * a little too incestuous with kern_rndq: we avoid marking polled
-	 * sources "fast" there, and know here that for non-fast sources,
-	 * that code will buffer two ints worth of data per source.
-	 * Later, we ought to (a) bound the duration before
-	 * queued entropy samples get processed, and (b) add a target
-	 * or something -- as soon as we get that much from the entropy
-	 * sources, distribute it.
-	 */
-	rnd_getmore(MAX(rndsink->rsink_bytes, 2 * sizeof(uint32_t)));
+	/* Kick on-demand entropy sources.  */
+	rnd_getmore(rndsink->rsink_bytes);
 
+	/* Ensure this rndsink is on the queue.  */
 	switch (rndsink->rsink_state) {
 	case RNDSINK_IDLE:
 		/* Not on the queue and nobody is handling it.  */



CVS commit: src/sys/kern

2016-05-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May 21 15:27:15 UTC 2016

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

Log Message:
Ask on-demand entropy sources to produce enough data to fill buffer.

Remainder of fix for PR kern/51135: if there is an entropy source
that can produce arbitrarily much data, as in rump, then nothing
should ever block indefinitely waiting for data.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/kern/kern_rndq.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_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.88 src/sys/kern/kern_rndq.c:1.89
--- src/sys/kern/kern_rndq.c:1.88	Mon Feb 29 01:57:30 2016
+++ src/sys/kern/kern_rndq.c	Sat May 21 15:27:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.88 2016/02/29 01:57:30 riastradh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.89 2016/05/21 15:27:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.88 2016/02/29 01:57:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.89 2016/05/21 15:27:15 riastradh Exp $");
 
 #include 
 #include 
@@ -258,6 +258,19 @@ rnd_getmore(size_t byteswanted)
 {
 	krndsource_t *rs, *next;
 
+	/*
+	 * Due to buffering in rnd_process_events, even if the entropy
+	 * sources provide the requested number of bytes, users may not
+	 * be woken because the data may be stuck in unfilled buffers.
+	 * So ask for enough data to fill all the buffers.
+	 *
+	 * XXX Just get rid of this buffering and solve the
+	 * /dev/random-as-side-channel-for-keystroke-timings a
+	 * different way.
+	 */
+	byteswanted = MAX(byteswanted,
+	MAX(RND_POOLBITS/NBBY, sizeof(uint32_t)*RND_SAMPLE_COUNT));
+
 	mutex_spin_enter(_global.lock);
 	LIST_FOREACH_SAFE(rs, _global.sources, list, next) {
 		/* Skip if the source is disabled.  */



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

2016-05-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May 21 14:59:45 UTC 2016

Modified Files:
src/sys/rump/librump/rumpkern: hyperentropy.c

Log Message:
Actually get as many bytes as requested from rumpuser_random.

rumpuser_random is limited to 32 bytes at a time -- which would be
reasonable, except that there are too many buffers in the way between
entropy sources and users of the entropy pool.

Partial fix for PR kern/51135.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/rump/librump/rumpkern/hyperentropy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.14 src/sys/rump/librump/rumpkern/hyperentropy.c:1.15
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.14	Wed Feb 17 01:48:36 2016
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Sat May 21 14:59:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.14 2016/02/17 01:48:36 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.15 2016/05/21 14:59:45 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.14 2016/02/17 01:48:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.15 2016/05/21 14:59:45 riastradh Exp $");
 
 #include 
 #include 
@@ -46,13 +46,20 @@ static void
 feedrandom(size_t bytes, void *cookie __unused)
 {
 	uint8_t *rnddata;
-	size_t dsize;
+	size_t n, nread;
 
 	rnddata = kmem_intr_alloc(MAXGET, KM_SLEEP);
-	if (rumpuser_getrandom(rnddata, MIN(MAXGET, bytes),
-	RUMPUSER_RANDOM_HARD|RUMPUSER_RANDOM_NOWAIT, ) == 0) {
+	n = 0;
+	while (n < MIN(MAXGET, bytes)) {
+		if (rumpuser_getrandom(rnddata + n, MIN(MAXGET, bytes) - n,
+			RUMPUSER_RANDOM_HARD|RUMPUSER_RANDOM_NOWAIT, )
+		!= 0)
+			break;
+		n += MIN(nread, MIN(MAXGET, bytes) - n);
+	}
+	if (n) {
 		mutex_enter(_lock);
-		rnd_add_data_sync(, rnddata, dsize, NBBY*dsize);
+		rnd_add_data_sync(, rnddata, n, NBBY*n);
 		mutex_exit(_lock);
 	}
 	kmem_intr_free(rnddata, MAXGET);



CVS commit: src/sys/modules/lua

2016-05-21 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Sat May 21 12:39:33 UTC 2016

Modified Files:
src/sys/modules/lua: lua.c

Log Message:
fix double require bug


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/modules/lua/lua.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/modules/lua/lua.c
diff -u src/sys/modules/lua/lua.c:1.16 src/sys/modules/lua/lua.c:1.17
--- src/sys/modules/lua/lua.c:1.16	Sat Feb  7 04:09:13 2015
+++ src/sys/modules/lua/lua.c	Sat May 21 12:39:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.c,v 1.16 2015/02/07 04:09:13 christos Exp $ */
+/*	$NetBSD: lua.c,v 1.17 2016/05/21 12:39:32 salazar Exp $ */
 
 /*
  * Copyright (c) 2014 by Lourival Vieira Neto .
@@ -355,7 +355,10 @@ luaioctl(dev_t dev, u_long cmd, void *da
 	case LUAREQUIRE:	/* 'require' a module in a State */
 		require = data;
 		LIST_FOREACH(s, _states, lua_next)
-			if (!strcmp(s->lua_name, require->state))
+			if (!strcmp(s->lua_name, require->state)) {
+LIST_FOREACH(m, >lua_modules, mod_next)
+	if (!strcmp(m->mod_name, require->module))
+		return ENXIO;
 LIST_FOREACH(m, _modules, mod_next)
 	if (!strcmp(m->mod_name,
 	require->module)) {
@@ -379,6 +382,7 @@ luaioctl(dev_t dev, u_long cmd, void *da
 		mod_next);
 		return 0;
 	}
+			}
 		return ENXIO;
 	case LUALOAD:
 		load = data;



CVS commit: src/doc

2016-05-21 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat May 21 07:22:28 UTC 2016

Modified Files:
src/doc: CHANGES

Log Message:
Add entry for recent merge of nick-nhusb branch.  Basically just a copy
of the commit log message, but this is easier for releng to find when
they start collecting info for 8.0

If anyone else wants to edit this entry, please feel free.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2163 src/doc/CHANGES:1.2164
--- src/doc/CHANGES:1.2163	Tue May 17 06:52:00 2016
+++ src/doc/CHANGES	Sat May 21 07:22:28 2016
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2163 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2164 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -283,6 +283,20 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	openresolv(8): Import openresolv-3.8.0 [roy 20160411]
 	ddb(4): rename show arptab to show routes [ozaki-r 20160413]
 	dhcpcd(8): Import dhcpcd-6.10.3 [roy 20160420]
+	usb(4) subsystem: Merge nick-nhusb [skrll 20160423]
+		- API / infra changes to support memory management changes.
+		- Memory management improvements and bug fixes.
+		- HCDs should now be MP safe
+		- conversion to KERNHIST based debug
+		- FS/LS isoc support on ehci(4).
+		- conversion to kmem(9)
+		- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
+		- interrupt transfers now get proper DMA operations
+		- general bug fixes
+		- kern/48308
+		- uhub status notification improvements
+		- umass(4) probe fix (applied to HEAD already)
+		- ohci(4) short transfer fix
 	nvme(4): Add a driver for Non-Volatile Memory Host Controller Interface
 		devices, ported from OpenBSD. [nonaka 20160501]
 	ntp: Import ntp 4.2.8p7. [christos 20160501]



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

2016-05-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 21 07:15:56 UTC 2016

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

Log Message:
There is an issue in the way the direct map is set up on amd64.

When allocating memory, the kernel allocates physical pages and virtual
addresses for these pages. In order to optimize allocations smaller
than PAGE_SIZE, uvm_km_kmem_alloc can allocate a single physical page
and take its virtual address in the direct map in high virtual memory.
This direct map is set up at boot time, its PTEs do not change, and
therefore they don't need to be kentered. These high virtual PTEs being
constant, the permissions of the areas they point to are fixed at boot
time and cannot change.

The problem is that at boot time, they are created with RWX permissions.
Therefore, allocations smaller than PAGE_SIZE in the kernel heap are all
executable: mbufs, pnbufs, small kmem allocations, etc.

Fix this by setting the NOX bit in the direct map pages at boot time. We
also set the NOX bit in the temporary tmpva, since it does not need to
be executable either.

This also makes the U-area non executable on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 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.195 src/sys/arch/x86/x86/pmap.c:1.196
--- src/sys/arch/x86/x86/pmap.c:1.195	Sun May 15 10:35:54 2016
+++ src/sys/arch/x86/x86/pmap.c	Sat May 21 07:15:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.195 2016/05/15 10:35:54 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.196 2016/05/21 07:15:56 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.195 2016/05/15 10:35:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.196 2016/05/21 07:15:56 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1366,7 +1366,7 @@ pmap_bootstrap(vaddr_t kva_start)
 	pte = PTE_BASE + pl1_i(tmpva);
 
 	/*
-	 * Map the direct map.  Use 1GB pages if they are available,
+	 * Map the direct map RW.  Use 1GB pages if they are available,
 	 * otherwise use 2MB pages.  Note that the unused parts of
 	 * PTPs * must be zero outed, as they might be accessed due
 	 * to speculative execution.  Also, PG_G is not allowed on
@@ -1382,51 +1382,51 @@ pmap_bootstrap(vaddr_t kva_start)
 	ndmpdp = (lastpa + NBPD_L3 - 1) >> L3_SHIFT;
 	dmpdp = avail_start;	avail_start += PAGE_SIZE;
 
-	*pte = dmpdp | PG_V | PG_RW;
+	*pte = dmpdp | PG_V | PG_RW | pg_nx;
 	pmap_update_pg(tmpva);
 	memset((void *)tmpva, 0, PAGE_SIZE);
 
 	if (cpu_feature[2] & CPUID_P1GB) {
 		for (i = 0; i < ndmpdp; i++) {
 			pdp = (paddr_t)&(((pd_entry_t *)dmpdp)[i]);
-			*pte = (pdp & PG_FRAME) | PG_V | PG_RW;
+			*pte = (pdp & PG_FRAME) | PG_V | PG_RW | pg_nx;
 			pmap_update_pg(tmpva);
 
 			pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME));
-			*pde = ((paddr_t)i << L3_SHIFT) |
-PG_RW | PG_V | PG_U | PG_PS | PG_G;
+			*pde = ((paddr_t)i << L3_SHIFT) | PG_RW | pg_nx |
+			PG_V | PG_U | PG_PS | PG_G;
 		}
 	} else {
 		dmpd = avail_start;	avail_start += ndmpdp * PAGE_SIZE;
 
 		for (i = 0; i < ndmpdp; i++) {
 			pdp = dmpd + i * PAGE_SIZE;
-			*pte = (pdp & PG_FRAME) | PG_V | PG_RW;
+			*pte = (pdp & PG_FRAME) | PG_V | PG_RW | pg_nx;
 			pmap_update_pg(tmpva);
 
 			memset((void *)tmpva, 0, PAGE_SIZE);
 		}
 		for (i = 0; i < NPDPG * ndmpdp; i++) {
 			pdp = (paddr_t)&(((pd_entry_t *)dmpd)[i]);
-			*pte = (pdp & PG_FRAME) | PG_V | PG_RW;
+			*pte = (pdp & PG_FRAME) | PG_V | PG_RW | pg_nx;
 			pmap_update_pg(tmpva);
 
 			pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME));
-			*pde = ((paddr_t)i << L2_SHIFT) |
-PG_RW | PG_V | PG_U | PG_PS | PG_G;
+			*pde = ((paddr_t)i << L2_SHIFT) | PG_RW | pg_nx |
+			PG_V | PG_U | PG_PS | PG_G;
 		}
 		for (i = 0; i < ndmpdp; i++) {
 			pdp = (paddr_t)&(((pd_entry_t *)dmpdp)[i]);
-			*pte = (pdp & PG_FRAME) | PG_V | PG_RW;
+			*pte = (pdp & PG_FRAME) | PG_V | PG_RW | pg_nx;
 			pmap_update_pg((vaddr_t)tmpva);
 
 			pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME));
-			*pde = (dmpd + (i << PAGE_SHIFT)) |
-PG_RW | PG_V | PG_U;
+			*pde = (dmpd + (i << PAGE_SHIFT)) | PG_RW | pg_nx |
+			PG_V | PG_U;
 		}
 	}
 
-	kpm->pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | PG_V | PG_U;
+	kpm->pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | pg_nx | PG_V | PG_U;
 
 	tlbflush();
 



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

2016-05-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 21 07:00:18 UTC 2016

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

Log Message:
Explain where this value comes from.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.36 src/sys/arch/amd64/include/pmap.h:1.37
--- src/sys/arch/amd64/include/pmap.h:1.36	Sat May 14 12:48:31 2016
+++ src/sys/arch/amd64/include/pmap.h	Sat May 21 07:00:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.36 2016/05/14 12:48:31 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.37 2016/05/21 07:00:18 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -155,7 +155,7 @@
 /* Xen use slots 256-272, let's move farther */
 #define L4_SLOT_KERN		320
 #endif
-#define L4_SLOT_KERNBASE	511
+#define L4_SLOT_KERNBASE	511 /* pl4_i(KERNBASE) */
 
 #define PDIR_SLOT_KERN	L4_SLOT_KERN
 #define PDIR_SLOT_PTE	L4_SLOT_PTE



CVS commit: src/sys/uvm

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

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

Log Message:
USPACE and USPACE_ALIGN are constants. Use a #if instead. Probably saves
some instructions.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/uvm/uvm_glue.c

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

Modified files:

Index: src/sys/uvm/uvm_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.161 src/sys/uvm/uvm_glue.c:1.162
--- src/sys/uvm/uvm_glue.c:1.161	Thu Nov 27 14:25:01 2014
+++ src/sys/uvm/uvm_glue.c	Sat May 21 06:37:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.161 2014/11/27 14:25:01 uebayasi Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.162 2016/05/21 06:37:28 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.161 2014/11/27 14:25:01 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.162 2016/05/21 06:37:28 maxv Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -240,31 +240,28 @@ static pool_cache_t uvm_uarea_system_cac
 static void *
 uarea_poolpage_alloc(struct pool *pp, int flags)
 {
-#if defined(PMAP_MAP_POOLPAGE)
-	if (USPACE == PAGE_SIZE && USPACE_ALIGN == 0) {
-		struct vm_page *pg;
-		vaddr_t va;
+#if defined(PMAP_MAP_POOLPAGE) && (USPACE == PAGE_SIZE && USPACE_ALIGN == 0)
+	struct vm_page *pg;
+	vaddr_t va;
 
 #if defined(PMAP_ALLOC_POOLPAGE)
-		pg = PMAP_ALLOC_POOLPAGE(
-		   ((flags & PR_WAITOK) == 0 ? UVM_KMF_NOWAIT : 0));
+	pg = PMAP_ALLOC_POOLPAGE(
+	   ((flags & PR_WAITOK) == 0 ? UVM_KMF_NOWAIT : 0));
 #else
-		pg = uvm_pagealloc(NULL, 0, NULL,
-		   ((flags & PR_WAITOK) == 0 ? UVM_KMF_NOWAIT : 0));
-#endif
-		if (pg == NULL)
-			return NULL;
-		va = PMAP_MAP_POOLPAGE(VM_PAGE_TO_PHYS(pg));
-		if (va == 0)
-			uvm_pagefree(pg);
-		return (void *)va;
-	}
-#endif
-#if defined(__HAVE_CPU_UAREA_ROUTINES)
+	pg = uvm_pagealloc(NULL, 0, NULL,
+	   ((flags & PR_WAITOK) == 0 ? UVM_KMF_NOWAIT : 0));
+#endif /* PMAP_ALLOC_POOLPAGE */
+	if (pg == NULL)
+		return NULL;
+	va = PMAP_MAP_POOLPAGE(VM_PAGE_TO_PHYS(pg));
+	if (va == 0)
+		uvm_pagefree(pg);
+	return (void *)va;
+#elif defined(__HAVE_CPU_UAREA_ROUTINES)
 	void *va = cpu_uarea_alloc(false);
 	if (va)
 		return (void *)va;
-#endif
+#endif /* __HAVE_CPU_UAREA_ROUTINES */
 	return (void *)uvm_km_alloc(kernel_map, pp->pr_alloc->pa_pagesz,
 	USPACE_ALIGN, UVM_KMF_WIRED |
 	((flags & PR_WAITOK) ? UVM_KMF_WAITVA :