CVS commit: src

2018-05-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun May 27 05:31:20 UTC 2018

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile
src/sys/dev/i2c: files.i2c
Added Files:
src/share/man/man4: tsllux.4
src/sys/dev/i2c: tsl256x.c tsl256xreg.h

Log Message:
Add a driver for the Taos TSL256x light sensors.


To generate a diff of this commit:
cvs rdiff -u -r1.1589 -r1.1590 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.654 -r1.655 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/tsllux.4
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/tsl256x.c src/sys/dev/i2c/tsl256xreg.h

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1589 src/distrib/sets/lists/man/mi:1.1590
--- src/distrib/sets/lists/man/mi:1.1589	Wed May 23 01:05:47 2018
+++ src/distrib/sets/lists/man/mi	Sun May 27 05:31:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1589 2018/05/23 01:05:47 christos Exp $
+# $NetBSD: mi,v 1.1590 2018/05/27 05:31:20 thorpej Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1818,6 +1818,7 @@
 ./usr/share/man/cat4/tr.0			man-sys-catman		.cat
 ./usr/share/man/cat4/tra.0			man-sys-catman		.cat
 ./usr/share/man/cat4/trm.0			man-sys-catman		.cat
+./usr/share/man/cat4/tsllux.0			man-sys-catman		.cat
 ./usr/share/man/cat4/tty.0			man-sys-catman		.cat
 ./usr/share/man/cat4/tun.0			man-sys-catman		.cat
 ./usr/share/man/cat4/tuner.0			man-obsolete		obsolete
@@ -4887,6 +4888,7 @@
 ./usr/share/man/html4/tr.html			man-sys-htmlman		html
 ./usr/share/man/html4/tra.html			man-sys-htmlman		html
 ./usr/share/man/html4/trm.html			man-sys-htmlman		html
+./usr/share/man/html4/tsllux.html		man-sys-htmlman		html
 ./usr/share/man/html4/tty.html			man-sys-htmlman		html
 ./usr/share/man/html4/tun.html			man-sys-htmlman		html
 ./usr/share/man/html4/tuner.html		man-obsolete		obsolete
@@ -7876,6 +7878,7 @@
 ./usr/share/man/man4/tr.4			man-sys-man		.man
 ./usr/share/man/man4/tra.4			man-sys-man		.man
 ./usr/share/man/man4/trm.4			man-sys-man		.man
+./usr/share/man/man4/tsllux.4			man-sys-man		.man
 ./usr/share/man/man4/tty.4			man-sys-man		.man
 ./usr/share/man/man4/tun.4			man-sys-man		.man
 ./usr/share/man/man4/tuner.4			man-obsolete		obsolete

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.654 src/share/man/man4/Makefile:1.655
--- src/share/man/man4/Makefile:1.654	Sun May 20 14:08:33 2018
+++ src/share/man/man4/Makefile	Sun May 27 05:31:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.654 2018/05/20 14:08:33 thorpej Exp $
+#	$NetBSD: Makefile,v 1.655 2018/05/27 05:31:20 thorpej Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -63,7 +63,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	svwsata.4 swsensor.4 swwdog.4 sysmon.4 \
 	tap.4 tc.4 tcds.4 tcp.4 tcu.4 tdvfb.4 termios.4 tfb.4 thinkpad.4 \
 	ti.4 tl.4 tlp.4 tlphy.4 tpm.4 tprof.4 tr.4 tra.4 \
-	trm.4 tty.4 tun.4 tqphy.4 twa.4 twe.4 txp.4 \
+	trm.4 tsllux.4 tty.4 tun.4 tqphy.4 twa.4 twe.4 txp.4 \
 	uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 unix.4 userconf.4 \
 	vald.4 valz.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 vioif.4 viomb.4 \
 	viornd.4 vioscsi.4 virt.4 \

Index: src/sys/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.91 src/sys/dev/i2c/files.i2c:1.92
--- src/sys/dev/i2c/files.i2c:1.91	Sat May  5 02:01:34 2018
+++ src/sys/dev/i2c/files.i2c	Sun May 27 05:31:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.91 2018/05/05 02:01:34 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.92 2018/05/27 05:31:20 thorpej Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -334,3 +334,8 @@ file	dev/i2c/ims.cims
 device	imt: hid, hidmt, wsmousedev
 attach	imt at ihidbus
 file	dev/i2c/imt.cimt
+
+# Taos TSL256x ambient light sensor
+device	tsllux: sysmon_envsys
+attach	tsllux at iic
+file	dev/i2c/tsl256x.c			tsllux

Added files:

Index: src/share/man/man4/tsllux.4
diff -u /dev/null src/share/man/man4/tsllux.4:1.1
--- /dev/null	Sun May 27 05:31:20 2018
+++ src/share/man/man4/tsllux.4	Sun May 27 05:31:20 2018
@@ -0,0 +1,132 @@
+.\"	$NetBSD: tsllux.4,v 1.1 2018/05/27 05:31:20 thorpej Exp $
+.\"
+.\" Copyright (c) 2018 Jason R Thorpe
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the 

CVS commit: src

2018-05-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun May 27 01:39:00 UTC 2018

Modified Files:
src/sys/dev/sysmon: sysmon_envsys_tables.c
src/sys/sys: envsys.h
src/usr.sbin/envstat: envstat.c

Log Message:
Add support for light sensors that report Illuminance in lux.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sysmon/sysmon_envsys_tables.c
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/envsys.h
cvs rdiff -u -r1.95 -r1.96 src/usr.sbin/envstat/envstat.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/sysmon/sysmon_envsys_tables.c
diff -u src/sys/dev/sysmon/sysmon_envsys_tables.c:1.12 src/sys/dev/sysmon/sysmon_envsys_tables.c:1.13
--- src/sys/dev/sysmon/sysmon_envsys_tables.c:1.12	Sun May 18 11:46:23 2014
+++ src/sys/dev/sysmon/sysmon_envsys_tables.c	Sun May 27 01:39:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys_tables.c,v 1.12 2014/05/18 11:46:23 kardel Exp $ */
+/* $NetBSD: sysmon_envsys_tables.c,v 1.13 2018/05/27 01:39:00 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_tables.c,v 1.12 2014/05/18 11:46:23 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_tables.c,v 1.13 2018/05/27 01:39:00 thorpej Exp $");
 
 #include 
 
@@ -52,6 +52,7 @@ static const struct sme_descr_entry sme_
 	{ ENVSYS_BATTERY_CAPACITY, PENVSYS_TYPE_BATTERY,"Battery capacity" },
 	{ ENVSYS_BATTERY_CHARGE, -1,			"Battery charge" },
 	{ ENVSYS_SRELHUMIDITY,	-1,			"relative Humidity" },
+	{ ENVSYS_LUX,		-1,			"Illuminance" },
 	{ -1,			-1,			"unknown" }
 };
 

Index: src/sys/sys/envsys.h
diff -u src/sys/sys/envsys.h:1.36 src/sys/sys/envsys.h:1.37
--- src/sys/sys/envsys.h:1.36	Sat Jan 23 01:26:14 2016
+++ src/sys/sys/envsys.h	Sun May 27 01:39:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: envsys.h,v 1.36 2016/01/23 01:26:14 dholland Exp $ */
+/* $NetBSD: envsys.h,v 1.37 2018/05/27 01:39:00 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2007, 2014 The NetBSD Foundation, Inc.
@@ -64,6 +64,7 @@ enum envsys_units {
 	ENVSYS_BATTERY_CAPACITY,	/* Battery capacity */
 	ENVSYS_BATTERY_CHARGE,		/* Battery charging/discharging */
 	ENVSYS_SRELHUMIDITY,		/* relative humidity */
+	ENVSYS_LUX,			/* illumanice in lux */
 	ENVSYS_NSENSORS
 };
 
@@ -162,7 +163,7 @@ typedef struct envsys_tre_data envsys_tr
 #ifdef ENVSYSUNITNAMES
 static const char * const envsysunitnames[] = {
 "degC", "RPM", "VAC", "V", "Ohms", "W",
-"A", "Wh", "Ah", "bool", "integer", "drive", "%rH", "Unk"
+"A", "Wh", "Ah", "bool", "integer", "drive", "%rH", "lux", "Unk"
 };
 static const char * const envsysdrivestatus[] = {
 "unknown", "empty", "ready", "powering up", "online", "idle", "active",

Index: src/usr.sbin/envstat/envstat.c
diff -u src/usr.sbin/envstat/envstat.c:1.95 src/usr.sbin/envstat/envstat.c:1.96
--- src/usr.sbin/envstat/envstat.c:1.95	Sun May 18 11:46:24 2014
+++ src/usr.sbin/envstat/envstat.c	Sun May 27 01:39:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: envstat.c,v 1.95 2014/05/18 11:46:24 kardel Exp $ */
+/* $NetBSD: envstat.c,v 1.96 2018/05/27 01:39:00 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: envstat.c,v 1.95 2014/05/18 11:46:24 kardel Exp $");
+__RCSID("$NetBSD: envstat.c,v 1.96 2018/05/27 01:39:00 thorpej Exp $");
 #endif /* not lint */
 
 #include 
@@ -959,6 +959,52 @@ do {	\
 
 			(void)printf(":%10s", sensor->battcap);
 
+		/* Illuminance */
+		} else if (strcmp(sensor->type, "Illuminance") == 0) {
+
+			stype = "lux";
+
+			(void)printf(":%10u ", sensor->cur_value);
+
+			ilen = 8;
+			if (statistics) {
+/* show statistics if flag set */
+(void)printf("%8u %8u %8u ",
+stats->max, stats->min, stats->avg);
+ilen += 2;
+			} else {
+if (sensor->critmax_value) {
+	(void)printf("%*u ", (int)ilen,
+	sensor->critmax_value);
+	ilen = 8;
+} else
+	ilen += 9;
+
+if (sensor->warnmax_value) {
+	(void)printf("%*u ", (int)ilen,
+	sensor->warnmax_value);
+	ilen = 8;
+} else
+	ilen += 9;
+
+if (sensor->warnmin_value) {
+	(void)printf("%*u ", (int)ilen,
+	sensor->warnmin_value);
+	ilen = 8;
+} else
+	ilen += 9;
+
+if (sensor->critmin_value) {
+	(void)printf( "%*u ", (int)ilen,
+	sensor->critmin_value);
+	ilen = 8;
+} else
+	ilen += 9;
+
+			}
+
+			(void)printf("%*s", (int)ilen - 3, stype);
+
 		/* everything else */
 		} else {
 			if (strcmp(sensor->type, "Voltage DC") == 0)



CVS commit: src

2018-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 27 01:14:51 UTC 2018

Modified Files:
src/external/mit/xorg: xorg-pkg-ver.mk
src/sys/arch/acorn32/stand/lib: Makefile.inc
src/sys/arch/hppa/spmath: Makefile.inc
src/sys/arch/i386/stand/lib: Makefile.inc
src/sys/arch/ia64/stand/efi/libefi: Makefile.inc
src/sys/arch/m68k/fpsp: Makefile.inc
src/sys/compat/common: Makefile.inc
src/sys/lib/libgnuefi: Makefile.inc
src/sys/lib/libkern: Makefile.inc
src/sys/lib/libsa: Makefile.inc
src/sys/lib/libz: Makefile.inc
src/usr.bin/make: make.1 var.c
src/usr.bin/make/unit-tests: varquote.exp varquote.mk

Log Message:
- Introduce :q modifier for make variables and make it double escape $'s so
  that passing variables to recursive makes with :q works as expected.
- Revert :Q to work as before.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@
XXX: pullup 8


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/xorg/xorg-pkg-ver.mk
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/acorn32/stand/lib/Makefile.inc
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/spmath/Makefile.inc
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/stand/lib/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/stand/efi/libefi/Makefile.inc
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/m68k/fpsp/Makefile.inc
cvs rdiff -u -r1.24 -r1.25 src/sys/compat/common/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libgnuefi/Makefile.inc
cvs rdiff -u -r1.44 -r1.45 src/sys/lib/libkern/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libsa/Makefile.inc
cvs rdiff -u -r1.16 -r1.17 src/sys/lib/libz/Makefile.inc
cvs rdiff -u -r1.272 -r1.273 src/usr.bin/make/make.1
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varquote.exp \
src/usr.bin/make/unit-tests/varquote.mk

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

Modified files:

Index: src/external/mit/xorg/xorg-pkg-ver.mk
diff -u src/external/mit/xorg/xorg-pkg-ver.mk:1.8 src/external/mit/xorg/xorg-pkg-ver.mk:1.9
--- src/external/mit/xorg/xorg-pkg-ver.mk:1.8	Sun Aug  9 06:09:07 2015
+++ src/external/mit/xorg/xorg-pkg-ver.mk	Sat May 26 21:14:51 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: xorg-pkg-ver.mk,v 1.8 2015/08/09 10:09:07 aymeric Exp $
+#	$NetBSD: xorg-pkg-ver.mk,v 1.9 2018/05/27 01:14:51 christos Exp $
 
 # when including this make sure PROG is set so that $X11SRCDIR.$PROG
 # is a valid setting.  set XORG_PKG_VER_PROG if PROG is wrong.
@@ -19,7 +19,7 @@ XORG_PKG_PACKAGE_VERSION!= \
 	}' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure
 .if !empty(XORG_PKG_PACKAGE_VERSION)
 CPPFLAGS+=	-DPACKAGE_VERSION=\"${XORG_PKG_PACKAGE_VERSION:Q}\"
-CPPFLAGS+=	-DVERSION=\"${XORG_PKG_PACKAGE_VERSION:Q}\"
+CPPFLAGS+=	-DVERSION=\"${XORG_PKG_PACKAGE_VERSION:q}\"
 .endif
 
 XORG_PKG_PACKAGE_STRING!= \

Index: src/sys/arch/acorn32/stand/lib/Makefile.inc
diff -u src/sys/arch/acorn32/stand/lib/Makefile.inc:1.3 src/sys/arch/acorn32/stand/lib/Makefile.inc:1.4
--- src/sys/arch/acorn32/stand/lib/Makefile.inc:1.3	Tue Mar 22 04:25:22 2016
+++ src/sys/arch/acorn32/stand/lib/Makefile.inc	Sat May 26 21:14:50 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.3 2016/03/22 08:25:22 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.4 2018/05/27 01:14:50 christos Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -22,12 +22,12 @@ RISCOSLIB=		${RISCOSDST}/libriscos.a
 RISCOSMAKE= \
 	cd ${RISCOSDIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	  MAKEOBJDIR=${RISCOSDST} ${MAKE} \
-	CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
-	AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
-	LD=${LD:Q} STRIP=${STRIP:Q} \
-	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
-	RISCOSCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:Q} \
-	RISCOSMISCCPPFLAGS=${RISCOSMISCCPPFLAGS:Q} \
+	CC=${CC:q} CFLAGS=${CFLAGS:q} \
+	AS=${AS:q} AFLAGS=${AFLAGS:q} \
+	LD=${LD:q} STRIP=${STRIP:q} \
+	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
+	RISCOSCPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:q} \
+	RISCOSMISCCPPFLAGS=${RISCOSMISCCPPFLAGS:q} \
 	${RISCOSMISCMAKEFLAGS}
 
 ${RISCOSLIB}:		.NOTMAIN .MAKE __always_make_riscoslib

Index: src/sys/arch/hppa/spmath/Makefile.inc
diff -u src/sys/arch/hppa/spmath/Makefile.inc:1.9 src/sys/arch/hppa/spmath/Makefile.inc:1.10
--- src/sys/arch/hppa/spmath/Makefile.inc:1.9	Tue Mar 22 04:25:22 2016
+++ src/sys/arch/hppa/spmath/Makefile.inc	Sat May 26 21:14:50 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.9 2016/03/22 08:25:22 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.10 2018/05/27 01:14:50 christos Exp $
 
 #	$OpenBSD: Makefile.inc,v 1.4 2001/03/29 03:58:17 mickey Exp $
 #
@@ -15,13 +15,13 @@ SPMATH_PROF=	${SPMATHDST}/spmath.po
 SPMATHMAKE= \
 	cd ${SPMATHDIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	  MAKEOBJDIR=${SPMATHDST} ${MAKE} \

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

2018-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 27 00:36:56 UTC 2018

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

Log Message:
alloca, bad; stack protector, good.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.54 src/tests/lib/libc/sys/t_ptrace_wait.c:1.55
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.54	Sat May 26 11:32:31 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Sat May 26 20:36:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.54 2018/05/26 15:32:31 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.55 2018/05/27 00:36:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.54 2018/05/26 15:32:31 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.55 2018/05/27 00:36:56 christos Exp $");
 
 #include 
 #include 
@@ -1711,12 +1711,11 @@ bytes_transfer_dummy(int a, int b, int c
 }
 
 static void
-bytes_transfer(int operation, int size, enum bytes_transfer_type type)
+bytes_transfer(int operation, size_t size, enum bytes_transfer_type type)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
 	pid_t child, wpid;
-
 	bool skip = false;
 
 	int lookup_me = 0;
@@ -1735,7 +1734,9 @@ bytes_transfer(int operation, int size, 
 #if defined(TWAIT_HAVE_STATUS)
 	int status;
 #endif
-	AuxInfo *ai = NULL, *aip;
+	AuxInfo ai[64], *aip;
+
+	ATF_REQUIRE(size < sizeof(ai));
 
 	/* Prepare variables for .TEXT transfers */
 	switch (type) {
@@ -1801,7 +1802,6 @@ bytes_transfer(int operation, int size, 
 		}
 		break;
 	case BYTES_TRANSFER_AUXV:
-		ai = alloca(size);
 		io.piod_op = operation;
 		io.piod_offs = 0;
 		io.piod_addr = ai;



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

2018-05-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 26 22:49:03 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: psci_fdt.c psci_fdt.h

Log Message:
Export a psci_fdt_reset function, usable from FDT platform code.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/fdt/psci_fdt.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/psci_fdt.h

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

Modified files:

Index: src/sys/arch/arm/fdt/psci_fdt.c
diff -u src/sys/arch/arm/fdt/psci_fdt.c:1.3 src/sys/arch/arm/fdt/psci_fdt.c:1.4
--- src/sys/arch/arm/fdt/psci_fdt.c:1.3	Mon Sep 11 09:21:56 2017
+++ src/sys/arch/arm/fdt/psci_fdt.c	Sat May 26 22:49:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.3 2017/09/11 09:21:56 jmcneill Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.4 2018/05/26 22:49:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.3 2017/09/11 09:21:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.4 2018/05/26 22:49:03 jmcneill Exp $");
 
 #include 
 #include 
@@ -60,22 +60,22 @@ static const char * const compatible[] =
 CFATTACH_DECL_NEW(psci_fdt, 0, psci_fdt_match, psci_fdt_attach, NULL, NULL);
 
 static void
-psci_fdt_reset(device_t dev)
+psci_fdt_power_reset(device_t dev)
 {
 	delay(50);
 	psci_system_reset();
 }
 
 static void
-psci_fdt_poweroff(device_t dev)
+psci_fdt_power_poweroff(device_t dev)
 {
 	delay(50);
 	psci_system_off();
 }
 
 static const struct fdtbus_power_controller_func psci_power_funcs = {
-	.reset = psci_fdt_reset,
-	.poweroff = psci_fdt_poweroff,
+	.reset = psci_fdt_power_reset,
+	.poweroff = psci_fdt_power_poweroff,
 };
 
 static int
@@ -136,6 +136,18 @@ psci_fdt_init(const int phandle)
 	return 0;
 }
 
+static int
+psci_fdt_preinit(void)
+{
+	const int phandle = OF_finddevice("/psci");
+	if (phandle == -1) {
+		aprint_error("PSCI: no /psci node found\n");
+		return ENODEV;
+	}
+
+	return psci_fdt_init(phandle);
+}
+
 void
 psci_fdt_bootstrap(void)
 {
@@ -158,13 +170,7 @@ psci_fdt_bootstrap(void)
 		if (fdtbus_status_okay(child))
 			arm_cpu_max++;
 
-	const int phandle = OF_finddevice("/psci");
-	if (phandle == -1) {
-		aprint_error("PSCI: no /psci node found\n");
-		return;
-	}
-
-	if (psci_fdt_init(phandle) != 0)
+	if (psci_fdt_preinit() != 0)
 		return;
 
 	/* MPIDR affinity levels of boot processor. */
@@ -200,3 +206,14 @@ psci_fdt_bootstrap(void)
 	}
 #endif
 }
+
+void
+psci_fdt_reset(void)
+{
+	if (psci_fdt_preinit() != 0) {
+		aprint_error("PSCI: reset failed\n");
+		return;
+	}
+
+	psci_system_reset();
+}

Index: src/sys/arch/arm/fdt/psci_fdt.h
diff -u src/sys/arch/arm/fdt/psci_fdt.h:1.1 src/sys/arch/arm/fdt/psci_fdt.h:1.2
--- src/sys/arch/arm/fdt/psci_fdt.h:1.1	Wed Jun 28 23:48:22 2017
+++ src/sys/arch/arm/fdt/psci_fdt.h	Sat May 26 22:49:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.h,v 1.1 2017/06/28 23:48:22 jmcneill Exp $ */
+/* $NetBSD: psci_fdt.h,v 1.2 2018/05/26 22:49:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -32,4 +32,7 @@
 /* Initialize PSCI and boot APs */
 void	psci_fdt_bootstrap(void);
 
+/* Board reset */
+void	psci_fdt_reset(void);
+
 #endif /* !_ARM_PSCI_FDT_H */



CVS commit: src/sys/dev/sysmon

2018-05-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 26 21:15:46 UTC 2018

Modified Files:
src/sys/dev/sysmon: sysmon_envsys.c

Log Message:
Avoid dereferencing NULL if we attempt to look up an known unit type.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.142 src/sys/dev/sysmon/sysmon_envsys.c:1.143
--- src/sys/dev/sysmon/sysmon_envsys.c:1.142	Sat May  5 00:14:28 2018
+++ src/sys/dev/sysmon/sysmon_envsys.c	Sat May 26 21:15:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.142 2018/05/05 00:14:28 pgoyette Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.142 2018/05/05 00:14:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $");
 
 #include 
 #include 
@@ -578,7 +578,7 @@ sysmon_envsys_sensor_attach(struct sysmo
 	 * Find the correct units for this sensor.
 	 */
 	sdt_units = sme_find_table_entry(SME_DESC_UNITS, edata->units);
-	if (sdt_units->type == -1)
+	if (sdt_units == NULL || sdt_units->type == -1)
 		return EINVAL;
 
 	/*



CVS commit: src/sys/compat/netbsd32

2018-05-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 26 21:07:47 UTC 2018

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysctl.c

Log Message:
Fix sysctl(3):vm.minaddress in compat_netbsd32(8)

Cast minaddress from LP64-specific long (64-bit) to 32-bit long (int).

This value is usually 0 or 0+PAGE_SIZE. There is need to change type in
order to keep original code functional, without prompting the value with
'long long' or a similar approach.

There are more CTLTYPE_LONG with a need for fixes in the compat code:

uipc_usrreq.c
1975 CTLTYPE_LONG, "sendspace",
1981 CTLTYPE_LONG, "recvspace",
1987 CTLTYPE_LONG, "sendspace",
1993 CTLTYPE_LONG, "recvspace",
vfs_bio.c
1921 CTLTYPE_LONG, "bufmem",
1928 CTLTYPE_LONG, "bufmem_lowater",
1935 CTLTYPE_LONG, "bufmem_hiwater",

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/netbsd32/netbsd32_sysctl.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_sysctl.c
diff -u src/sys/compat/netbsd32/netbsd32_sysctl.c:1.39 src/sys/compat/netbsd32/netbsd32_sysctl.c:1.40
--- src/sys/compat/netbsd32/netbsd32_sysctl.c:1.39	Sat May 26 18:18:19 2018
+++ src/sys/compat/netbsd32/netbsd32_sysctl.c	Sat May 26 21:07:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $	*/
+/*	$NetBSD: netbsd32_sysctl.c,v 1.40 2018/05/26 21:07:47 kamil Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.40 2018/05/26 21:07:47 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -153,6 +153,12 @@ netbsd32_sysctl_init(void)
 		   SYSCTL_DESCR("Maximum user address"),
 		   NULL, VM_MAXUSER_ADDRESS32, NULL, 0,
 		   CTL_VM, VM_MAXADDRESS, CTL_EOL);
+	sysctl_createv(_clog, 0, &_root, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+		   CTLTYPE_INT, "minaddress",
+		   SYSCTL_DESCR("Minimum user address"),
+		   NULL, VM_MIN_ADDRESS, NULL, 0,
+		   CTL_VM, VM_MINADDRESS, CTL_EOL);
 
 	sysctl_createv(_clog, 0, &_root, NULL,
 		   CTLFLAG_PERMANENT,



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

2018-05-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 26 20:27:48 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_amd64_wait.h t_ptrace_x86_wait.h

Log Message:
Port the CVE 2018-8897 mitigation to i386 ATF ptrace(2) tests

On i386 there is no need to switch execution mode.
Use 0x23 SS selector for i386, amd64 used 0x4f.

Based on pointers from .

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_ptrace_amd64_wait.h
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_amd64_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.4 src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.5
--- src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.4	Mon May 14 12:42:34 2018
+++ src/tests/lib/libc/sys/t_ptrace_amd64_wait.h	Sat May 26 20:27:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_amd64_wait.h,v 1.4 2018/05/14 12:42:34 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_amd64_wait.h,v 1.5 2018/05/26 20:27:48 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -113,219 +113,9 @@ ATF_TC_BODY(x86_64_regs1, tc)
 
 /// 
 
-ATF_TC(x86_64_cve_2018_8897);
-ATF_TC_HEAD(x86_64_cve_2018_8897, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	"Verify mitigation for CVE-2018-8897 (POP SS debug exception)");
-}
-
-#define CVE_2018_8897_PAGE 0x5000 /* page addressable by 32-bit registers */
-
-static void
-trigger_cve_2018_8897(void)
-{
-	/*
-	 * A function to trigger the POP SS (CVE-2018-8897) vulnerability
-	 *
-	 * We need to switch to 32-bit mode execution on 64-bit kernel.
-	 * This is achieved with far jump instruction and GDT descriptor
-	 * set to 32-bit CS selector. The 32-bit CS selector is kernel
-	 * specific, in the NetBSD case registered as GUCODE32_SEL
-	 * that is equal to (14 (decimal) << 3) with GDT and user
-	 * privilege level (this makes it 0x73).
-	 *
-	 * In UNIX as(1) assembly x86_64 far jump is coded as ljmp.
-	 * amd64 ljmp requires an indirect address with cs:RIP.
-	 *
-	 * When we are running in 32-bit mode, it's similar to the
-	 * mode as if the binary had been launched in netbsd32.
-	 *
-	 * There are two versions of this exploit, one with RIP
-	 * relative code and the other with static addresses.
-	 * The first one is PIE code aware, the other no-PIE one.
-	 *
-	 *
-	 * After switching to the 32-bit mode we can move on to the remaining
-	 * part of the exploit.
-	 *
-	 *
-	 * Set the stack pointer to the page we allocated earlier. Remember
-	 * that we put an SS selector exactly at this address, so we can pop.
-	 *
-	 * movl$0x5000,%esp
-	 *
-	 * Pop the SS selector off the stack. This reloads the SS selector,
-	 * which is fine. Remember that we set DR0 at address 0x5000, which
-	 * we are now reading. Therefore, on this instruction, the CPU will
-	 * raise a #DB exception.
-	 *
-	 * But the "pop %ss" instruction is special: it blocks exceptions
-	 * until the next instruction is executed. So the #DB that we just
-	 * raised is actually blocked.
-	 *
-	 * pop %ss
-	 *
-	 * We are still here, and didn't receive the #DB. After we execute
-	 * this instruction, the effect of "pop %ss" will disappear, and
-	 * we will receive the #DB for real.
-	 *
-	 * int $4
-	 *
-	 * Here the bug happens. We executed "int $4", so we entered the
-	 * kernel, with interrupts disabled. The #DB that was pending is
-	 * received. But, it is received immediately in kernel mode, and is
-	 * _NOT_ received when interrupts are enabled again.
-	 *
-	 * It means that, in the first instruction of the $4 handler, we
-	 * think we are safe with interrupts disabled. But we aren't, and
-	 * just got interrupted.	
-	 *
-	 * The new interrupt handler doesn't handle this particular context:
-	 * we are entered in kernel mode, the previous context was kernel
-	 * mode too but it still had the user context loaded.
-	 *
-	 * We find ourselves not doing a 'swapgs'. At the end of the day, it
-	 * means that we call trap() with a curcpu() that is fully
-	 * controllable by userland. From then on, it is easy to escalate
-	 * privileges.
-	 *
-	 * With SVS it also means we don't switch CR3, so this results in a
-	 * triple fault, which this time cannot be turned to a privilege
-	 * escalation.
-	 */
-
-#if __PIE__
-	void *csRIP;
-
-	csRIP = malloc(sizeof(int) + sizeof(short));
-	FORKEE_ASSERT(csRIP != NULL);
-
-	__asm__ __volatile__(
-		"	leal 24(%%eip), %%eax\n\t"
-		"	movq %0, %%rdx\n\t"
-		"	movl %%eax, (%%rdx)\n\t"
-		"	movw $0x73, 4(%%rdx)\n\t"
-		"	movq %1, %%rax\n\t"
-		"	ljmp *(%%rax)\n\t"
-		"	.code32\n\t"
-		"	movl $0x5000, %%esp\n\t"
-		"	pop %%ss\n\t"
-		"	int $4\n\t"
-		"	.code64\n\t"
-		: "=m"(csRIP)
-		: "m"(csRIP)
-		: "%rax", "%rdx", "%rsp"
-		);
-#else /* 

CVS commit: src/external/mit/lua/dist/src

2018-05-26 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat May 26 20:17:56 UTC 2018

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
Change LUAL_BUFFERSIZE from 4-8K to 128 bytes for kernel-side Lua.

LUAL_BUFFERSIZE defines how much luaL_Buffer allocates from
the stack. Apparently, 4-8K is too much for the kernel stack.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/mit/lua/dist/src/luaconf.h

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

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.21 src/external/mit/lua/dist/src/luaconf.h:1.22
--- src/external/mit/lua/dist/src/luaconf.h:1.21	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/luaconf.h	Sat May 26 20:17:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.21 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.22 2018/05/26 20:17:56 alnsn Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp 
@@ -757,7 +757,9 @@
 ** smaller buffer would force a memory allocation for each call to
 ** 'string.format'.)
 */
-#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
+#ifdef _KERNEL
+#define LUAL_BUFFERSIZE		128
+#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
 #define LUAL_BUFFERSIZE		8192
 #else
 #define LUAL_BUFFERSIZE   ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))



CVS commit: src/sys/arch/sparc64/sparc64

2018-05-26 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat May 26 19:20:21 UTC 2018

Modified Files:
src/sys/arch/sparc64/sparc64: locore.s

Log Message:
next_stick() - fix typy in comment: tick->stick


To generate a diff of this commit:
cvs rdiff -u -r1.413 -r1.414 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.413 src/sys/arch/sparc64/sparc64/locore.s:1.414
--- src/sys/arch/sparc64/sparc64/locore.s:1.413	Wed Apr 11 19:41:18 2018
+++ src/sys/arch/sparc64/sparc64/locore.s	Sat May 26 19:20:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.413 2018/04/11 19:41:18 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.414 2018/05/26 19:20:21 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -7452,7 +7452,7 @@ ENTRY(next_stick)
 	sllx	%o3, 63, %o3
 	andn	%o1, %o3, %o1
 	andn	%o2, %o3, %o2
-	cmp	%o1, %o2	! Did we wrap?  (tick < tick_cmpr)
+	cmp	%o1, %o2	! Did we wrap?  (stick < stick_cmpr)
 	bgt,pt	%icc, 1f
 	 add	%o1, 1000, %o1	! Need some slack so we don't lose intrs.
 



CVS commit: src/etc/rc.d

2018-05-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May 26 19:18:11 UTC 2018

Modified Files:
src/etc/rc.d: sshd

Log Message:
Revert previous: Don't generate XMSS host keys for sshd by default.

XMSS is a stateful post-quantum signature scheme.

- Post-quantum security for _online_ authentication is not important
  until quantum computers become practical; there's no danger of
  retroactive forgery in sessions that have already completed.

- As a stateful signature schemes, XMSS is qualitatively different
  from all the other ones sshd supports, requiring additional
  administrative care: roll back the state (e.g., from a disk backup
  or VM snapshot), and you've shot yourself in the foot.

If users want XMSS keys, they can make them explicitly, but there's
no need for this to be enabled by default.

Discussed with christos offline.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/etc/rc.d/sshd

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

Modified files:

Index: src/etc/rc.d/sshd
diff -u src/etc/rc.d/sshd:1.28 src/etc/rc.d/sshd:1.29
--- src/etc/rc.d/sshd:1.28	Sat May 26 00:17:54 2018
+++ src/etc/rc.d/sshd	Sat May 26 19:18:11 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: sshd,v 1.28 2018/05/26 00:17:54 jmcneill Exp $
+# $NetBSD: sshd,v 1.29 2018/05/26 19:18:11 riastradh Exp $
 #
 
 # PROVIDE: sshd
@@ -37,7 +37,6 @@ dsa	1024	ssh_host_dsa_key	2	DSA
 ecdsa	521	ssh_host_ecdsa_key	1	ECDSA
 ed25519	-1	ssh_host_ed25519_key	1	ED25519
 rsa	0	ssh_host_rsa_key	2	RSA
-xmss	0	ssh_host_xmss_key	1	XMSS
 _EOF
 )
 }



CVS commit: src/sys/uvm

2018-05-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 26 18:57:35 UTC 2018

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

Log Message:
uvm_pageactivate() needs to be called _after_ code is done with the page, no 
reason
to bother pdaemon with PG_BUSY pages; also clear the PG_FAKE and PG_CLEAN after
we are done with the write

this does not make any difference on my machine, but maybe it might fix
the machine check panic on Martin's alpha

while here remove UBC_PARTIALOK handling from ubc_zeropage_direct(), just to be 
sure
it works exactly the same as the non-direct one


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/uvm/uvm_bio.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_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.95 src/sys/uvm/uvm_bio.c:1.96
--- src/sys/uvm/uvm_bio.c:1.95	Sat May 19 15:13:26 2018
+++ src/sys/uvm/uvm_bio.c	Sat May 26 18:57:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.95 2018/05/19 15:13:26 jdolecek Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.96 2018/05/26 18:57:35 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.95 2018/05/19 15:13:26 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.96 2018/05/26 18:57:35 jdolecek Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -872,19 +872,31 @@ again:
 
 		/* Page must be writable by now */
 		KASSERT((pg->flags & PG_RDONLY) == 0 || (flags & UBC_WRITE) == 0);
+	}
+	mutex_exit(uobj->vmobjlock);
+
+	return 0;
+}
+
+static void __noinline
+ubc_direct_release(struct uvm_object *uobj,
+	int flags, struct vm_page **pgs, int npages)
+{
+	mutex_enter(uobj->vmobjlock);
+	mutex_enter(_pageqlock);
+	for (int i = 0; i < npages; i++) {
+		struct vm_page *pg = pgs[i];
 
-		mutex_enter(_pageqlock);
 		uvm_pageactivate(pg);
-		mutex_exit(_pageqlock);
 
-		/* Page will be changed, no longer clean */
-		/* XXX do this AFTER the write? */
+		/* Page was changed, no longer fake and neither clean */
 		if (flags & UBC_WRITE)
 			pg->flags &= ~(PG_FAKE|PG_CLEAN);
 	}
-	mutex_exit(uobj->vmobjlock);
+	mutex_exit(_pageqlock);
 
-	return 0;
+	uvm_page_unbusy(pgs, npages);
+	mutex_exit(uobj->vmobjlock);
 }
 
 static int
@@ -942,9 +954,7 @@ ubc_uiomove_direct(struct uvm_object *uo
 			ubc_zerorange_process, NULL);
 		}
 
-		mutex_enter(uobj->vmobjlock);
-		uvm_page_unbusy(pgs, npages);
-		mutex_exit(uobj->vmobjlock);
+		ubc_direct_release(uobj, flags, pgs, npages);
 
 		off += bytelen;
 		todo -= bytelen;
@@ -963,12 +973,14 @@ ubc_zerorange_direct(struct uvm_object *
 	int error, npages;
 	struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT];
 
+	flags |= UBC_WRITE;
+
 	error = 0;
 	while (todo > 0) {
 		vsize_t bytelen = todo;
 
 		error = ubc_alloc_direct(uobj, off, , UVM_ADV_NORMAL,
-		UBC_WRITE, pgs, );
+		flags, pgs, );
 		if (error != 0) {
 			/* can't do anything, failed to get the pages */
 			break;
@@ -977,16 +989,10 @@ ubc_zerorange_direct(struct uvm_object *
 		error = uvm_direct_process(pgs, npages, off, bytelen,
 		ubc_zerorange_process, NULL);
 
-		mutex_enter(uobj->vmobjlock);
-		uvm_page_unbusy(pgs, npages);
-		mutex_exit(uobj->vmobjlock);
+		ubc_direct_release(uobj, flags, pgs, npages);
 
 		off += bytelen;
 		todo -= bytelen;
-
-		if (error != 0 && ISSET(flags, UBC_PARTIALOK)) {
-			break;
-		}
 	}
 }
 



CVS commit: src/sys/compat/netbsd32

2018-05-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 26 18:18:19 UTC 2018

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysctl.c

Log Message:
Handle vm.maxaddress in compat_netbsd32(8)

Return VM_MAXUSER_ADDRESS32 instead of the 64-bit specific address.

Use CTLTYPE_INT instead of CTLTYPE_LONG in order to retain the same integer
type between 64-bit native kernel and 32-bit emulated program.

There probably should be CTLTYPE_LONG32 available for this purpose.

On NetBSD/i386:
vm.maxaddress=bfeff000

On NetBSD/amd64:
vm.maxaddress=7fbfdfeff000

On NetBSD/amd64 running i386 program:
vm.maxaddress=f000

A 32-bit program on the 64-bit kernel can use larger user space, this
difference is on purpose and expected.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/netbsd32/netbsd32_sysctl.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_sysctl.c
diff -u src/sys/compat/netbsd32/netbsd32_sysctl.c:1.38 src/sys/compat/netbsd32/netbsd32_sysctl.c:1.39
--- src/sys/compat/netbsd32/netbsd32_sysctl.c:1.38	Tue Oct 31 16:10:25 2017
+++ src/sys/compat/netbsd32/netbsd32_sysctl.c	Sat May 26 18:18:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_sysctl.c,v 1.38 2017/10/31 16:10:25 kre Exp $	*/
+/*	$NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.38 2017/10/31 16:10:25 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -147,6 +147,12 @@ netbsd32_sysctl_init(void)
 		   netbsd32_sysctl_vm_loadavg, 0, NULL,
 		   sizeof(struct netbsd32_loadavg),
 		   CTL_VM, VM_LOADAVG, CTL_EOL);
+	sysctl_createv(_clog, 0, &_root, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+		   CTLTYPE_INT, "maxaddress",
+		   SYSCTL_DESCR("Maximum user address"),
+		   NULL, VM_MAXUSER_ADDRESS32, NULL, 0,
+		   CTL_VM, VM_MAXADDRESS, CTL_EOL);
 
 	sysctl_createv(_clog, 0, &_root, NULL,
 		   CTLFLAG_PERMANENT,



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

2018-05-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 26 15:32:31 UTC 2018

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

Log Message:
Refactor the PT_WRITE*/PT_READ* and PIOD_* ATF ptrace(2) tests

Merge all the PT_WRITE*/PT_READ* and PIOD_* the test cases into the common
body.

Changes:
 - treat D and I variations exactly the same
 - stop testing 2-3-4 attempts to perform the same read/write operation
 - stop testing interlocked (handshake) read/write operations
 - rename the tests
 - test write to .text section (with D and I type of operations)

New tests:
 - bytes_transfer_piod_read_d_8
 - bytes_transfer_piod_read_d_16
 - bytes_transfer_piod_read_d_32
 - bytes_transfer_piod_read_d_64
 - bytes_transfer_piod_read_i_8
 - bytes_transfer_piod_read_i_16
 - bytes_transfer_piod_read_i_32
 - bytes_transfer_piod_read_i_64
 - bytes_transfer_piod_write_d_8
 - bytes_transfer_piod_write_d_16
 - bytes_transfer_piod_write_d_32
 - bytes_transfer_piod_write_d_64
 - bytes_transfer_piod_write_i_8
 - bytes_transfer_piod_write_i_16
 - bytes_transfer_piod_write_i_32
 - bytes_transfer_piod_write_i_64
 - bytes_transfer_read_d
 - bytes_transfer_read_i
 - bytes_transfer_write_d
 - bytes_transfer_write_i
 - bytes_transfer_piod_read_d_8_text
 - bytes_transfer_piod_read_d_16_text
 - bytes_transfer_piod_read_d_32_text
 - bytes_transfer_piod_read_d_64_text
 - bytes_transfer_piod_read_i_8_text
 - bytes_transfer_piod_read_i_16_text
 - bytes_transfer_piod_read_i_32_text
 - bytes_transfer_piod_read_i_64_text
 - bytes_transfer_piod_write_d_8_text
 - bytes_transfer_piod_write_d_16_text
 - bytes_transfer_piod_write_d_32_text
 - bytes_transfer_piod_write_d_64_text
 - bytes_transfer_piod_write_i_8_text
 - bytes_transfer_piod_write_i_16_text
 - bytes_transfer_piod_write_i_32_text
 - bytes_transfer_piod_write_i_64_text
 - bytes_transfer_read_d_text
 - bytes_transfer_read_i_text
 - bytes_transfer_write_d_text
 - bytes_transfer_write_i_text
 - bytes_transfer_piod_read_auxv

These tests are now covering all usual code paths.

All tests pass.
The PaX MPROTECT violating ones automatically detect whether to be skipped.

Eliminated 4x more code than removed.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.53 src/tests/lib/libc/sys/t_ptrace_wait.c:1.54
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.53	Wed May 23 23:56:07 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Sat May 26 15:32:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.53 2018/05/23 23:56:07 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.54 2018/05/26 15:32:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2018/05/23 23:56:07 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.54 2018/05/26 15:32:31 kamil Exp $");
 
 #include 
 #include 
@@ -1682,1952 +1682,134 @@ FORK_TEST(vfork7, DSCR(vfork,0,1,1,0,0),
 FORK_TEST(vfork8, DSCR(vfork,1,1,1,0,0), vfork, T, T, T, F, F)
 #endif
 
+/// 
 
+enum bytes_transfer_type {
+	BYTES_TRANSFER_DATA,
+	BYTES_TRANSFER_DATAIO,
+	BYTES_TRANSFER_TEXT,
+	BYTES_TRANSFER_TEXTIO,
+	BYTES_TRANSFER_AUXV
+};
 
+static int __used
+bytes_transfer_dummy(int a, int b, int c, int d)
+{
+	int e, f, g, h;
 
-ATF_TC(io_read_d1);
-ATF_TC_HEAD(io_read_d1, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	"Verify PT_IO with PIOD_READ_D and len = sizeof(uint8_t)");
-}
-
-ATF_TC_BODY(io_read_d1, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-	uint8_t lookup_me = 0;
-	const uint8_t magic = 0xab;
-	struct ptrace_io_desc io = {
-		.piod_op = PIOD_READ_D,
-		.piod_offs = _me,
-		.piod_addr = _me,
-		.piod_len = sizeof(lookup_me)
-	};
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		lookup_me = magic;
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n",
-	child, getpid());
-	SYSCALL_REQUIRE(ptrace(PT_IO, child, , 0) != -1);
-
-	

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

2018-05-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 26 15:15:17 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Introduce can_we_write_to_text() to ATF ptrace(2) tests

The purpose of this function is to detect whether a tracer can write to the
.text section of its tracee.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/sys/t_ptrace_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.7 src/tests/lib/libc/sys/t_ptrace_wait.h:1.8
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.7	Thu May 24 08:28:40 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Sat May 26 15:15:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.7 2018/05/24 08:28:40 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.8 2018/05/26 15:15:17 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -504,6 +504,23 @@ can_we_set_dbregs(void)
 }
 #endif
 
+static bool __used
+can_we_write_to_text(pid_t pid)
+{
+	int mib[3];
+	int paxflags;
+	size_t len = sizeof(int);
+
+	mib[0] = CTL_PROC;
+	mib[1] = pid;
+	mib[2] = PROC_PID_PAXFLAGS;
+
+	if (sysctl(mib, 3, , , NULL, 0) == -1)
+		return false;
+
+	return !(paxflags & CTL_PROC_PAXFLAGS_MPROTECT);
+}
+
 static void __used
 trigger_trap(void)
 {



CVS commit: src/sys/dev/i2c

2018-05-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 26 14:39:20 UTC 2018

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

Log Message:
Add battery voltage, charge current, and discharge current sensors for
AXP803.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/axppmic.c

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

Modified files:

Index: src/sys/dev/i2c/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.9 src/sys/dev/i2c/axppmic.c:1.10
--- src/sys/dev/i2c/axppmic.c:1.9	Sun May 13 22:58:58 2018
+++ src/sys/dev/i2c/axppmic.c	Sat May 26 14:39:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.9 2018/05/13 22:58:58 jmcneill Exp $ */
+/* $NetBSD: axppmic.c,v 1.10 2018/05/26 14:39:20 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.9 2018/05/13 22:58:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.10 2018/05/26 14:39:20 jmcneill Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 
 #define	AXP_POWER_SOURCE_REG	0x00
 #define	 AXP_POWER_SOURCE_ACIN_PRESENT	__BIT(7)
 #define	 AXP_POWER_SOURCE_VBUS_PRESENT	__BIT(5)
+#define	 AXP_POWER_SOURCE_CHARGE_DIRECTION __BIT(2)
 
 #define	AXP_POWER_MODE_REG	0x01
 #define	 AXP_POWER_MODE_BATT_VALID	__BIT(4)
@@ -63,8 +64,21 @@ __KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 
 #define	 AXP_IRQ1_VBUS_LOWER	__BIT(2)
 #define AXP_IRQ_STATUS_REG(n)	(0x48 + (n) - 1)
 
+#define	AXP_BATSENSE_HI_REG	0x78
+#define	AXP_BATSENSE_LO_REG	0x79
+
+#define	AXP_BATTCHG_HI_REG	0x7a
+#define	AXP_BATTCHG_LO_REG	0x7b
+
+#define	AXP_BATTDISCHG_HI_REG	0x7c
+#define	AXP_BATTDISCHG_LO_REG	0x7d
+
+#define	AXP_ADC_RAW(_hi, _lo)	\
+	(((u_int)(_hi) << 4) | ((lo) & 0xf))
+
 #define	AXP_FUEL_GAUGE_CTRL_REG	0xb8
 #define	 AXP_FUEL_GAUGE_CTRL_EN	__BIT(7)
+
 #define	AXP_BATT_CAP_REG	0xb9
 #define	 AXP_BATT_CAP_VALID	__BIT(7)
 #define	 AXP_BATT_CAP_PERCENT	__BITS(6,0)
@@ -198,6 +212,11 @@ struct axppmic_config {
 	struct axppmic_irq battirq;
 	struct axppmic_irq chargeirq;
 	struct axppmic_irq chargestirq;
+	u_int batsense_step;	/* uV */
+	u_int charge_step;	/* uA */
+	u_int discharge_step;	/* uA */
+	u_int maxcap_step;	/* uAh */
+	u_int coulomb_step;	/* uAh */
 };
 
 enum axppmic_sensor {
@@ -206,7 +225,10 @@ enum axppmic_sensor {
 	AXP_SENSOR_BATT_PRESENT,
 	AXP_SENSOR_BATT_CHARGING,
 	AXP_SENSOR_BATT_CHARGE_STATE,
-	AXP_SENSOR_BATT_CAPACITY,
+	AXP_SENSOR_BATT_VOLTAGE,
+	AXP_SENSOR_BATT_CHARGE_CURRENT,
+	AXP_SENSOR_BATT_DISCHARGE_CURRENT,
+	AXP_SENSOR_BATT_CAPACITY_PERCENT,
 	AXP_NSENSORS
 };
 
@@ -249,6 +271,9 @@ static const struct axppmic_config axp80
 	.irq_regs = 6,
 	.has_battery = true,
 	.has_fuel_gauge = true,
+	.batsense_step = 1100,
+	.charge_step = 1000,
+	.discharge_step = 1000,
 	.poklirq = AXPPMIC_IRQ(5, __BIT(3)),
 	.acinirq = AXPPMIC_IRQ(1, __BITS(6,5)),
 	.vbusirq = AXPPMIC_IRQ(1, __BITS(3,2)),
@@ -380,11 +405,16 @@ static void
 axppmic_sensor_update(struct sysmon_envsys *sme, envsys_data_t *e)
 {
 	struct axppmic_softc *sc = sme->sme_cookie;
+	const struct axppmic_config *c = sc->sc_conf;
 	const int flags = I2C_F_POLL;
-	uint8_t val;
+	uint8_t val, lo, hi;
 
 	e->state = ENVSYS_SINVALID;
 
+	const bool battery_present =
+	sc->sc_sensor[AXP_SENSOR_BATT_PRESENT].state == ENVSYS_SVALID &&
+	sc->sc_sensor[AXP_SENSOR_BATT_PRESENT].value_cur == 1;
+
 	switch (e->private) {
 	case AXP_SENSOR_ACIN_PRESENT:
 		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_SOURCE_REG, , flags) == 0) {
@@ -413,9 +443,7 @@ axppmic_sensor_update(struct sysmon_envs
 		}
 		break;
 	case AXP_SENSOR_BATT_CHARGE_STATE:
-		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_MODE_REG, , flags) == 0 &&
-		(val & AXP_POWER_MODE_BATT_VALID) != 0 &&
-		(val & AXP_POWER_MODE_BATT_PRESENT) != 0 &&
+		if (battery_present &&
 		axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_BATT_CAP_REG, , flags) == 0 &&
 		(val & AXP_BATT_CAP_VALID) != 0) {
 			const u_int batt_val = __SHIFTOUT(val, AXP_BATT_CAP_PERCENT);
@@ -431,16 +459,42 @@ axppmic_sensor_update(struct sysmon_envs
 			}
 		}
 		break;
-	case AXP_SENSOR_BATT_CAPACITY:
-		if (axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_POWER_MODE_REG, , flags) == 0 &&
-		(val & AXP_POWER_MODE_BATT_VALID) != 0 &&
-		(val & AXP_POWER_MODE_BATT_PRESENT) != 0 &&
+	case AXP_SENSOR_BATT_CAPACITY_PERCENT:
+		if (battery_present &&
 		axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_BATT_CAP_REG, , flags) == 0 &&
 		(val & AXP_BATT_CAP_VALID) != 0) {
 			e->state = ENVSYS_SVALID;
 			e->value_cur = __SHIFTOUT(val, AXP_BATT_CAP_PERCENT);
 		}
 		break;
+	case AXP_SENSOR_BATT_VOLTAGE:
+		if (battery_present &&
+		axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_BATSENSE_HI_REG, , flags) == 0 &&
+		axppmic_read(sc->sc_i2c, sc->sc_addr, AXP_BATSENSE_LO_REG, , flags) == 0) {
+			e->state = 

CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:33:44 UTC 2018

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

Log Message:
Match PCI_PRODUCT_INTEL_82Q45_IDER.

Not entirely sure which chip map to use, but as this is for AMT, it's
probably not like there's a real PATA interface to configure DMA for,
and as the 965 AMT stuff uses the sata version of the chip map, we'll
cargo cult it for now.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/piixide.c

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

Modified files:

Index: src/sys/dev/pci/piixide.c
diff -u src/sys/dev/pci/piixide.c:1.65 src/sys/dev/pci/piixide.c:1.66
--- src/sys/dev/pci/piixide.c:1.65	Mon Feb  1 08:28:48 2016
+++ src/sys/dev/pci/piixide.c	Sat May 26 13:33:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: piixide.c,v 1.65 2016/02/01 08:28:48 msaitoh Exp $	*/
+/*	$NetBSD: piixide.c,v 1.66 2018/05/26 13:33:44 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.65 2016/02/01 08:28:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.66 2018/05/26 13:33:44 jakllsch Exp $");
 
 #include 
 #include 
@@ -289,6 +289,11 @@ static const struct pciide_product_desc 
 	  "Intel 82965PM IDE controller",
 	  piixsata_chip_map,
 	},
+	{ PCI_PRODUCT_INTEL_82Q45_IDER,
+	  0,
+	  "Intel 82Q45 IDE Redirection controller",
+	  piixsata_chip_map,
+	},
 	{
 	  PCI_PRODUCT_INTEL_3400_SATA_1,
 	  0,



CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:26:02 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1326 -r1.1327 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1325 -r1.1326 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1326 src/sys/dev/pci/pcidevs.h:1.1327
--- src/sys/dev/pci/pcidevs.h:1.1326	Thu May 24 04:29:55 2018
+++ src/sys/dev/pci/pcidevs.h	Sat May 26 13:26:01 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1326 2018/05/24 04:29:55 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1327 2018/05/26 13:26:01 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1335 2018/05/24 04:29:25 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp
  */
 
 /*
@@ -4124,6 +4124,7 @@
 #define	PCI_PRODUCT_INTEL_82Q45_EXP	0x2e11		/* 82Q45 PCI Express Bridge */
 #define	PCI_PRODUCT_INTEL_82Q45_IGD	0x2e12		/* 82Q45 Integrated Graphics Device */
 #define	PCI_PRODUCT_INTEL_82Q45_IGD_1	0x2e13		/* 82Q45 Integrated Graphics Device */
+#define	PCI_PRODUCT_INTEL_82Q45_IDER	0x2e16		/* 82Q45 IDER */
 #define	PCI_PRODUCT_INTEL_82Q45_KT_1	0x2e17		/* 82Q45 KT */
 #define	PCI_PRODUCT_INTEL_82G45_HB	0x2e20		/* 82G45 Host Bridge */
 #define	PCI_PRODUCT_INTEL_82G45_IGD	0x2e22		/* 82G45 Integrated Graphics Device */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1325 src/sys/dev/pci/pcidevs_data.h:1.1326
--- src/sys/dev/pci/pcidevs_data.h:1.1325	Thu May 24 04:29:55 2018
+++ src/sys/dev/pci/pcidevs_data.h	Sat May 26 13:26:01 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1325 2018/05/24 04:29:55 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1326 2018/05/26 13:26:01 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1335 2018/05/24 04:29:25 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp
  */
 
 /*
@@ -6968,24 +6968,26 @@ static const uint16_t pci_products[] = {
 	22843, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_IGD_1, 
 	22843, 692, 1716, 2427, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_IDER, 
+	22843, 22849, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82Q45_KT_1, 
 	22843, 21244, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G45_HB, 
-	22849, 6839, 6449, 0,
+	22854, 6839, 6449, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G45_IGD, 
-	22849, 692, 1716, 2427, 0,
+	22854, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G41_HB, 
-	22855, 6839, 6449, 0,
+	22860, 6839, 6449, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82G41_IGD, 
-	22855, 692, 1716, 2427, 0,
+	22860, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82B43_HB, 
-	22861, 6839, 6449, 0,
+	22866, 6839, 6449, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82B43_IGD, 
-	22861, 692, 1716, 2427, 0,
+	22866, 692, 1716, 2427, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_DMI2, 
 	18869, 18998, 18882, 19004, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_1_1, 
-	18869, 18998, 18882, 18304, 7962, 7975, 22867, 19004, 22870, 0,
+	18869, 18998, 18882, 18304, 7962, 7975, 22872, 19004, 22875, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_1_2, 
 	18869, 18998, 18882, 18304, 7962, 7975, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_2_1, 
@@ -7005,33 +7007,33 @@ static const uint16_t pci_products[] = {
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_PCIE_3_4, 
 	18869, 18998, 18882, 18304, 7962, 7975, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_R2PCIE_1, 
-	18869, 18998, 22875, 22883, 692, 8365, 5905, 3027, 0,
+	18869, 18998, 22880, 22888, 692, 8365, 5905, 3027, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_UBOX_1, 
-	18869, 18998, 18882, 22892, 558, 22903, 0,
+	18869, 18998, 18882, 22897, 558, 22908, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_UBOX_3, 
-	18869, 18998, 18882, 22892, 558, 22903, 0,
+	18869, 18998, 18882, 22897, 558, 22908, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH0, 
-	18869, 18998, 18882, 22914, 19044, 15233, 7956, 0,
+	18869, 18998, 18882, 22919, 19044, 15233, 7956, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH1, 
-	18869, 18998, 18882, 22914, 19044, 15233, 7958, 0,
+	18869, 18998, 18882, 22919, 19044, 15233, 7958, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH2, 
-	18869, 18998, 18882, 22914, 19044, 15233, 6297, 0,
+	18869, 18998, 18882, 22919, 19044, 15233, 6297, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE5_V3_QDT_CH3, 
-	18869, 

CVS commit: src/sys/dev/pci

2018-05-26 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 26 13:25:19 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel 82Q45 IDER


To generate a diff of this commit:
cvs rdiff -u -r1.1335 -r1.1336 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1335 src/sys/dev/pci/pcidevs:1.1336
--- src/sys/dev/pci/pcidevs:1.1335	Thu May 24 04:29:25 2018
+++ src/sys/dev/pci/pcidevs	Sat May 26 13:25:19 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1335 2018/05/24 04:29:25 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1336 2018/05/26 13:25:19 jakllsch Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4117,6 +4117,7 @@ product INTEL 82Q45_HB		0x2e10	82Q45 Hos
 product INTEL 82Q45_EXP		0x2e11	82Q45 PCI Express Bridge
 product INTEL 82Q45_IGD		0x2e12	82Q45 Integrated Graphics Device
 product INTEL 82Q45_IGD_1	0x2e13	82Q45 Integrated Graphics Device
+product INTEL 82Q45_IDER	0x2e16	82Q45 IDER
 product INTEL 82Q45_KT_1	0x2e17	82Q45 KT
 product INTEL 82G45_HB		0x2e20	82G45 Host Bridge
 product INTEL 82G45_IGD		0x2e22	82G45 Integrated Graphics Device



CVS commit: src/usr.sbin/ofctl

2018-05-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat May 26 12:40:06 UTC 2018

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

Log Message:
Merge single-letter options. Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/ofctl/ofctl.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/ofctl/ofctl.8
diff -u src/usr.sbin/ofctl/ofctl.8:1.5 src/usr.sbin/ofctl/ofctl.8:1.6
--- src/usr.sbin/ofctl/ofctl.8:1.5	Sat May 26 10:21:41 2018
+++ src/usr.sbin/ofctl/ofctl.8	Sat May 26 12:40:06 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ofctl.8,v 1.5 2018/05/26 10:21:41 jmcneill Exp $
+.\"	$NetBSD: ofctl.8,v 1.6 2018/05/26 12:40:06 wiz Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,8 +35,7 @@
 .Nd display the OpenPROM or OpenFirmware device tree
 .Sh SYNOPSIS
 .Nm
-.Op Fl p
-.Op Fl v
+.Op Fl pv
 .Op Fl f Ar file
 .Op Ar node
 .Sh DESCRIPTION
@@ -72,9 +71,9 @@ Display the full path name for each node
 .El
 .Sh FILES
 .Bl -tag -width "/dev/openprom "
-.It /dev/openprom
+.It Pa /dev/openprom
 The openprom device on systems with OpenPROM.
-.It /dev/openfirm
+.It Pa /dev/openfirm
 The openfirm device on systems with OpenFirmware.
 .El
 .Sh SEE ALSO



CVS commit: [pgoyette-compat] src/doc

2018-05-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat May 26 03:12:34 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Remove a To-Do entry that is already done (re-pointing the MODULAR
sys-calls at their individual module).

Merge the multiple entries concerning rtsock compat code.  It really
is a mess, but we don't need to say so three times!


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/doc/COMPAT-branch-notes

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

Modified files:

Index: src/doc/COMPAT-branch-notes
diff -u src/doc/COMPAT-branch-notes:1.1.2.15 src/doc/COMPAT-branch-notes:1.1.2.16
--- src/doc/COMPAT-branch-notes:1.1.2.15	Thu Apr 26 01:58:25 2018
+++ src/doc/COMPAT-branch-notes	Sat May 26 03:12:34 2018
@@ -55,7 +55,8 @@ TODO
 
 2.  The rtsock compat code is a disaster, with rtsock_50.c #include-ing
 the main rtsock.c code with various manipulations of the COMPAT_50
-macro.
+macro.  Once rtsock is separated, compat_14 references to rtsock_50
+routines needs to be verified.
 
 3.  The compat_60 module still needs some work for XEN systems.  We
 probably need some build infrastructure changes to ensure that
@@ -63,30 +64,20 @@ TODO
 macros defined and with -I directories specified in the same order
 as for building kernels.
 
-4.  Update syscalls.master to point the compat calls at the specific
-modules rather than the monolithic compat module.  Update the
-"required" lists of other modules, too.
-
-5.  The rtsock compatability code needs to be de-spaghetti'd and made
-separable into rtsock_70 and rtsock_50 pieces.
-
-6.  Once rtsock is separated, compat_14 references to rtsock_50 routines
-needs to be verified.
-
-7.  For compat_60, still need to figure out what to do with BSDPTY and
+4.  For compat_60, still need to figure out what to do with BSDPTY and
 tty_ptm
 
-8.  Also for compat_60, need to fix the building of XEN (and, for i386,
+5.  Also for compat_60, need to fix the building of XEN (and, for i386,
 XEN-PAE) module variants so that the obj-dir symlinks and the -I
 include order match those present in a kernel build.  See PR/53130
 (Currently, this affects the compat_60 module and its implementation
 of microcode updates for AMD processors - i386 and amd64.)
 
-9.  For compat_50, in addition to rtsock there are some things in dev/vnd,
+6.  For compat_50, in addition to rtsock there are some things in dev/vnd,
 dev/gpio, and dev/wscons/wsmux that I haven't been able to cleanly
 separate.
 
-10. There seems to be quite a bit of MD compat_xx code, in the various
+7.  There seems to be quite a bit of MD compat_xx code, in the various
 sys/arch/ directories.  I haven't yet looked at any of this.  But it
 seems to me that the MI compat build infrastructure should have some
 mechanism to "reach over" to the MD code, #include a Makefile.inc file,



CVS commit: [pgoyette-compat] src/doc

2018-05-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat May 26 11:48:40 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Add a $NetBSD$ line to track revision/changes


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/doc/COMPAT-branch-notes

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

Modified files:

Index: src/doc/COMPAT-branch-notes
diff -u src/doc/COMPAT-branch-notes:1.1.2.16 src/doc/COMPAT-branch-notes:1.1.2.17
--- src/doc/COMPAT-branch-notes:1.1.2.16	Sat May 26 03:12:34 2018
+++ src/doc/COMPAT-branch-notes	Sat May 26 11:48:40 2018
@@ -1,3 +1,5 @@
+/* $NetBSD: COMPAT-branch-notes,v 1.1.2.17 2018/05/26 11:48:40 pgoyette Exp $ */
+
 DONE
 
 1.  Removed linking of the kernel compat object library into all kernels;



CVS commit: src/usr.bin/tr

2018-05-26 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Sat May 26 11:20:31 UTC 2018

Modified Files:
src/usr.bin/tr: str.c

Log Message:
Do not accept invalid octal character values (>= 0400).

This also avoid possible stack corruption (e.g. previously `tr -s '\400'' or
similars lead to them).

Reviewed and thanks to !


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/tr/str.c

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

Modified files:

Index: src/usr.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.29 src/usr.bin/tr/str.c:1.30
--- src/usr.bin/tr/str.c:1.29	Sun Aug 11 01:54:35 2013
+++ src/usr.bin/tr/str.c	Sat May 26 11:20:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.29 2013/08/11 01:54:35 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.30 2018/05/26 11:20:30 leot Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)str.c	8.2 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: str.c,v 1.29 2013/08/11 01:54:35 dholland Exp $");
+__RCSID("$NetBSD: str.c,v 1.30 2018/05/26 11:20:30 leot Exp $");
 #endif /* not lint */
 
 #include 
@@ -417,6 +417,8 @@ backslash(STR *s)
 	}
 	if (cnt) {
 		/* We saw digits, so return their value */
+		if (val >= OOBCH)
+			errx(1, "Invalid octal character value");
 		return val;
 	}
 	if (ch == '\0') {



CVS commit: src/usr.sbin/ofctl

2018-05-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 26 10:21:41 UTC 2018

Modified Files:
src/usr.sbin/ofctl: ofctl.8 ofctl.c

Log Message:
Add -v flag which prints the full path of each device node when dumping
the full tree.


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

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

Modified files:

Index: src/usr.sbin/ofctl/ofctl.8
diff -u src/usr.sbin/ofctl/ofctl.8:1.4 src/usr.sbin/ofctl/ofctl.8:1.5
--- src/usr.sbin/ofctl/ofctl.8:1.4	Thu Sep 25 22:44:51 2008
+++ src/usr.sbin/ofctl/ofctl.8	Sat May 26 10:21:41 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ofctl.8,v 1.4 2008/09/25 22:44:51 reed Exp $
+.\"	$NetBSD: ofctl.8,v 1.5 2018/05/26 10:21:41 jmcneill Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 29, 2006
+.Dd May 26, 2018
 .Dt OFCTL 8
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl p
+.Op Fl v
 .Op Fl f Ar file
 .Op Ar node
 .Sh DESCRIPTION
@@ -66,6 +67,8 @@ instead of the default
 .Pa /dev/openfirm .
 .It Fl p
 Display each node's properties.
+.It Fl v
+Display the full path name for each node.
 .El
 .Sh FILES
 .Bl -tag -width "/dev/openprom "

Index: src/usr.sbin/ofctl/ofctl.c
diff -u src/usr.sbin/ofctl/ofctl.c:1.12 src/usr.sbin/ofctl/ofctl.c:1.13
--- src/usr.sbin/ofctl/ofctl.c:1.12	Wed Dec 23 13:42:24 2015
+++ src/usr.sbin/ofctl/ofctl.c	Sat May 26 10:21:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofctl.c,v 1.12 2015/12/23 13:42:24 jmcneill Exp $	*/
+/*	$NetBSD: ofctl.c,v 1.13 2018/05/26 10:21:41 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2006, 2007\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: ofctl.c,v 1.12 2015/12/23 13:42:24 jmcneill Exp $");
+__RCSID("$NetBSD: ofctl.c,v 1.13 2018/05/26 10:21:41 jmcneill Exp $");
 #endif /* not lint */
 
 #include 
@@ -62,6 +62,7 @@ static int isstrprint(const char *, size
 
 static int lflag;
 static int pflag;
+static int vflag;
 
 struct of_node {
 	TAILQ_ENTRY(of_node) of_sibling;
@@ -500,10 +501,11 @@ main(int argc, char **argv)
 	const char *propfilein = NULL;
 	const char *propfileout = NULL;
 
-	while ((c = getopt(argc, argv, "f:lpr:w:")) != EOF) {
+	while ((c = getopt(argc, argv, "f:lpr:vw:")) != EOF) {
 		switch (c) {
 		case 'l': lflag++; break;
 		case 'p': pflag++; break;
+		case 'v': vflag++; break;
 		case 'f': file = optarg; break;
 		case 'r': propfilein = optarg; break;
 		case 'w': propfileout = optarg; break;
@@ -511,7 +513,7 @@ main(int argc, char **argv)
 		}
 	}
 	if (errflag)
-		errx(1, "usage: ofctl [-pl] [-f file] [-r propfile] [-w propfile] [node...]");
+		errx(1, "usage: ofctl [-plv] [-f file] [-r propfile] [-w propfile] [node...]");
 
 	if (propfilein != NULL) {
 		of_proplib = prop_dictionary_internalize_from_file(propfilein);
@@ -694,7 +696,7 @@ oflist(int node, const char *parent_devi
 	int len;
 	while (node != 0) {
 		int child;
-		if (pflag == 0) {
+		if (pflag == 0 && vflag == 0) {
 			len = ofname(node, of_buf, of_buflen-1);
 			printf("%08x: %*s%s", node, depth * 2, "",
 			(char *) of_buf);