CVS commit: src/tests/lib/libm

2017-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 20 08:25:47 UTC 2017

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
fix build (missing nexttoward on mips64 and aarch64)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libm/t_fe_round.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/libm/t_fe_round.c
diff -u src/tests/lib/libm/t_fe_round.c:1.7 src/tests/lib/libm/t_fe_round.c:1.8
--- src/tests/lib/libm/t_fe_round.c:1.7	Thu Aug 17 05:14:28 2017
+++ src/tests/lib/libm/t_fe_round.c	Sun Aug 20 04:25:47 2017
@@ -168,6 +168,9 @@ ATF_TC_BODY(fe_nexttoward, tc)
 	double received;
 	int res;
 
+#if defined(_LP64) && (defined(__mips__) || defined(__arm__))
+	ATF_CHECK_MSG(0, "nexttoward not supported yet on mips64 or aarch64");
+#else
 	for (unsigned int i = 0; i < __arraycount(values2); i++) {
 		received = nexttoward(values2[i].input, values2[i].toward);
 		if (values2[i].input < values2[i].toward) {
@@ -181,6 +184,7 @@ ATF_TC_BODY(fe_nexttoward, tc)
 			"input: %f (index %d): got %f, expected %f, res %d\n",
 			values2[i].input, i, received, values2[i].expected, res);
 	}
+#endif
 }
 
 ATF_TP_ADD_TCS(tp)



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

2017-08-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Aug 20 09:00:15 UTC 2017

Modified Files:
src/sys/arch/evbmips/conf: LOONGSON

Log Message:
Get rid of ATADEBUG on LOONGSON


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbmips/conf/LOONGSON

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/evbmips/conf/LOONGSON
diff -u src/sys/arch/evbmips/conf/LOONGSON:1.32 src/sys/arch/evbmips/conf/LOONGSON:1.33
--- src/sys/arch/evbmips/conf/LOONGSON:1.32	Sun Aug 13 08:48:30 2017
+++ src/sys/arch/evbmips/conf/LOONGSON	Sun Aug 20 09:00:15 2017
@@ -1,4 +1,4 @@
-# $NetBSD: LOONGSON,v 1.32 2017/08/13 08:48:30 christos Exp $
+# $NetBSD: LOONGSON,v 1.33 2017/08/20 09:00:15 maya Exp $
 #
 # LOONGSON machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/evbmips/conf/std.loongson
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"LOONGSON-$Revision: 1.32 $"
+#ident 		"LOONGSON-$Revision: 1.33 $"
 
 maxusers	16
 
@@ -222,7 +222,7 @@ options  	WDC_NO_IDS #workaround CS5536+
 
 # ATA (IDE) bus support
 atabus* at ata?
-options 	ATADEBUG
+#options 	ATADEBUG
 
 # IDE drives
 # Flags are used only with controllers that support DMA operations



CVS commit: src/sys/arch/mips/mips

2017-08-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Aug 20 09:21:54 UTC 2017

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
Don't need the errata workaround on user return
It's reported that the MMU will block such invalid reads in userland,
and it's only needed on entry.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/mips/mips/mipsX_subr.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/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.102 src/sys/arch/mips/mips/mipsX_subr.S:1.103
--- src/sys/arch/mips/mips/mipsX_subr.S:1.102	Tue Aug  8 09:34:59 2017
+++ src/sys/arch/mips/mips/mipsX_subr.S	Sun Aug 20 09:21:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.102 2017/08/08 09:34:59 maya Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.103 2017/08/20 09:21:54 maya Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -2655,10 +2655,6 @@ MIPSX(user_return):
 	REG_L	s6, CALLFRAME_SIZ+TF_REG_S6(sp)		# $22
 	REG_L	s7, CALLFRAME_SIZ+TF_REG_S7(sp)		# $23
 	REG_L	s8, CALLFRAME_SIZ+TF_REG_S8(sp)		# $30
-#ifdef MIPS3_LOONGSON2
-	li	t0, (MIPS_DIAG_ITLB_CLEAR | MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE)
-	mtc0	t0, MIPS_COP_0_DIAG
-#endif
 MIPSX(user_intr_return):
 #ifdef PARANOIA
 	PTR_L	t0, L_CPU(MIPS_CURLWP)



CVS commit: src/sys/arch/mips/mips

2017-08-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Aug 20 09:47:14 UTC 2017

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
use meaningful name for errata hack, dedup


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/mips/mips/mipsX_subr.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/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.103 src/sys/arch/mips/mips/mipsX_subr.S:1.104
--- src/sys/arch/mips/mips/mipsX_subr.S:1.103	Sun Aug 20 09:21:54 2017
+++ src/sys/arch/mips/mips/mipsX_subr.S	Sun Aug 20 09:47:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.103 2017/08/20 09:21:54 maya Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.104 2017/08/20 09:47:13 maya Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -150,6 +150,13 @@
 	li reg, MIPS_SR_EXL | MIPS_SR_KX; mtc0 reg, MIPS_COP_0_STATUS
 #endif
 
+#ifdef MIPS3_LOONGSON2
+#define KERN_ENTRY_ERRATA \
+	li k0, MIPS_DIAG_BTB_CLEAR|MIPS_DIAG_RAS_DISABLE; mtc0 k0, MIPS_COP_0_DIAG
+#else
+#define KERN_ENTRY_ERRATA /* nothing */
+#endif
+
 #if MIPS1
 #error This file can not be compiled with MIPS1 defined
 #endif
@@ -1288,10 +1295,7 @@ NESTED_NOPROFILE(MIPSX(user_reserved_ins
 	/*
 	 * Save a minimum of registers to see if this is rdhwr $3,$29
 	 */
-#ifdef MIPS3_LOONGSON2
-	li	k0, MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE
-	mtc0	k0, MIPS_COP_0_DIAG
-#endif
+	KERN_ENTRY_ERRATA
 	/* K1 already has CURLWP */
 	PTR_L	k0, L_PCB(k1)			# XXXuvm_lwp_getuarea
 	PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1353,10 +1357,7 @@ NESTED_NOPROFILE(MIPSX(user_gen_exceptio
 	/*
 	 * Save all the registers except the kernel temporaries onto the stack.
 	 */
-#ifdef MIPS3_LOONGSON2
-	li	k0, MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE
-	mtc0	k0, MIPS_COP_0_DIAG
-#endif
+	KERN_ENTRY_ERRATA
 	/* K1 already has CURLWP */
 	PTR_L	k0, L_PCB(k1)			# XXXuvm_lwp_getuarea
 	PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1468,10 +1469,7 @@ NESTED_NOPROFILE(MIPSX(user_intr), CALLF
  * Save the relevant user registers onto the kernel stack.
  * We don't need to save s0 - s8 because the compiler does it for us.
  */
-#ifdef MIPS3_LOONGSON2
-	li	k0, MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE
-	mtc0	k0, MIPS_COP_0_DIAG
-#endif
+	KERN_ENTRY_ERRATA
 	/* k1 contains curlwp */
 	PTR_L	k0, L_PCB(k1)			# XXXuvm_lwp_getuarea
 	PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
@@ -1660,10 +1658,7 @@ NESTED_NOPROFILE(MIPSX(systemcall), CALL
 	/*
 	 * Save all the registers but kernel temporaries onto the stack.
 	 */
-#ifdef MIPS3_LOONGSON2
-	li	k0, MIPS_DIAG_BTB_CLEAR | MIPS_DIAG_RAS_DISABLE
-	mtc0	k0, MIPS_COP_0_DIAG
-#endif
+	KERN_ENTRY_ERRATA
 	/* k1 already contains cpulwp */
 	PTR_L	k0, L_PCB(k1)			# XXXuvm_lwp_getuarea
 	PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ



CVS commit: src/usr.bin/sys_info

2017-08-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 20 10:17:55 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Use tcsh --version instead of an echo $version -- the old way did not
work for me (not quite sure why not).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/sys_info/sys_info.sh

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/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.3 src/usr.bin/sys_info/sys_info.sh:1.4
--- src/usr.bin/sys_info/sys_info.sh:1.3	Sat Aug 19 18:36:31 2017
+++ src/usr.bin/sys_info/sys_info.sh	Sun Aug 20 10:17:55 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.3 2017/08/19 18:36:31 agc Exp $
+# $NetBSD: sys_info.sh,v 1.4 2017/08/20 10:17:55 martin Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -107,7 +107,7 @@ getversion() {
 		sshd -V 2>&1 | awk '/OpenSSH/ { sub("_", "D-", $1); print tolower($1) }'
 		;;
 	tcsh)
-		grep '/tcsh' /etc/shells > /dev/null 2>&1 && tcsh -c 'echo $version' | awk '{ print $1 "-" $2 }'
+		grep '/tcsh' /etc/shells > /dev/null 2>&1 && tcsh --version | awk '{ print $1 "-" $2 }'
 		;;
 	unbound)
 		case $(uname -s) in



CVS commit: src/sys/dev/pci

2017-08-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Aug 20 10:55:37 UTC 2017

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

Log Message:
M_WAITOK cannot fail, so remove the test branches. Otherwise it looks
like leak/uninitialized area.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/oboe.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/oboe.c
diff -u src/sys/dev/pci/oboe.c:1.43 src/sys/dev/pci/oboe.c:1.44
--- src/sys/dev/pci/oboe.c:1.43	Fri Jul 24 06:17:10 2015
+++ src/sys/dev/pci/oboe.c	Sun Aug 20 10:55:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: oboe.c,v 1.43 2015/07/24 06:17:10 martin Exp $	*/
+/*	$NetBSD: oboe.c,v 1.44 2017/08/20 10:55:37 maxv Exp $	*/
 
 /*	FVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.43 2015/07/24 06:17:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.44 2017/08/20 10:55:37 maxv Exp $");
 
 #include 
 #include 
@@ -641,9 +641,7 @@ oboe_alloc_taskfile(struct oboe_softc *s
 	/* XXX */
 	uintptr_t addr =
 	(uintptr_t)malloc(OBOE_TASK_BUF_LEN, M_DEVBUF, M_WAITOK);
-	if (addr == 0) {
-		goto bad;
-	}
+
 	addr &= ~(sizeof (struct OboeTaskFile) - 1);
 	addr += sizeof (struct OboeTaskFile);
 	sc->sc_taskfile = (struct OboeTaskFile *) addr;
@@ -653,26 +651,15 @@ oboe_alloc_taskfile(struct oboe_softc *s
 			malloc(TX_BUF_SZ, M_DEVBUF, M_WAITOK);
 		sc->sc_xmit_stores[i] =
 			malloc(TX_BUF_SZ, M_DEVBUF, M_WAITOK);
-		if (sc->sc_xmit_bufs[i] == NULL ||
-		sc->sc_xmit_stores[i] == NULL) {
-			goto bad;
-		}
 	}
 	for (i = 0; i < RX_SLOTS; ++i) {
 		sc->sc_recv_bufs[i] =
 			malloc(RX_BUF_SZ, M_DEVBUF, M_WAITOK);
 		sc->sc_recv_stores[i] =
 			malloc(RX_BUF_SZ, M_DEVBUF, M_WAITOK);
-		if (sc->sc_recv_bufs[i] == NULL ||
-		sc->sc_recv_stores[i] == NULL) {
-			goto bad;
-		}
 	}
 
 	return 0;
-bad:
-	printf("oboe: malloc for buffers failed()\n");
-	return 1;
 }
 
 static void



CVS commit: src/sys/dev/ic

2017-08-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Aug 20 11:00:30 UTC 2017

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

Log Message:
M_WAITOK cannot fail, so remove the test, otherwise it looks like an
spl leak; found by mootja


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

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

Modified files:

Index: src/sys/dev/ic/rrunner.c
diff -u src/sys/dev/ic/rrunner.c:1.83 src/sys/dev/ic/rrunner.c:1.84
--- src/sys/dev/ic/rrunner.c:1.83	Thu Dec 15 09:28:05 2016
+++ src/sys/dev/ic/rrunner.c	Sun Aug 20 11:00:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rrunner.c,v 1.83 2016/12/15 09:28:05 ozaki-r Exp $	*/
+/*	$NetBSD: rrunner.c,v 1.84 2017/08/20 11:00:30 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.83 2016/12/15 09:28:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.84 2017/08/20 11:00:30 maxv Exp $");
 
 #include "opt_inet.h"
 
@@ -786,8 +786,6 @@ esh_fpopen(dev_t dev, int oflags, int de
 
 	recv = (struct esh_fp_ring_ctl *)
 	malloc(sizeof(*recv), M_DEVBUF, M_WAITOK|M_ZERO);
-	if (recv == NULL)
-		return(ENOMEM);
 	TAILQ_INIT(&recv->ec_queue);
 
 	size = RR_FP_RECV_RING_SIZE * sizeof(struct rr_descr);



CVS commit: src/sys/arch/amiga/amiga

2017-08-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Aug 20 11:03:04 UTC 2017

Modified Files:
src/sys/arch/amiga/amiga: cc.c

Log Message:
spl leak, found by mootja


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amiga/amiga/cc.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/amiga/amiga/cc.c
diff -u src/sys/arch/amiga/amiga/cc.c:1.26 src/sys/arch/amiga/amiga/cc.c:1.27
--- src/sys/arch/amiga/amiga/cc.c:1.26	Wed Jan 22 00:25:16 2014
+++ src/sys/arch/amiga/amiga/cc.c	Sun Aug 20 11:03:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cc.c,v 1.26 2014/01/22 00:25:16 christos Exp $	*/
+/*	$NetBSD: cc.c,v 1.27 2017/08/20 11:03:04 maxv Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.26 2014/01/22 00:25:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.27 2017/08/20 11:03:04 maxv Exp $");
 
 #include 
 #include 
@@ -503,8 +503,10 @@ alloc_chipmem(u_long size)
 		if (size <= mn->size)
 			break;
 
-	if (mn == NULL)
+	if (mn == NULL) {
+		splx(s);
 		return NULL;
+	}
 
 	if ((mn->size - size) <= sizeof (*mn)) {
 		/*



CVS commit: src/sys/arch/mips/cavium/dev

2017-08-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Aug 20 11:05:24 UTC 2017

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_gmx.c

Log Message:
as the xxx implicitly points out, there's a division by zero here, so
panic right away; found by mootja


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_gmx.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/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.2 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.3
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.2	Mon Jun  1 22:55:12 2015
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c	Sun Aug 20 11:05:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmx.c,v 1.2 2015/06/01 22:55:12 matt Exp $	*/
+/*	$NetBSD: octeon_gmx.c,v 1.3 2017/08/20 11:05:24 maxv Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.2 2015/06/01 22:55:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.3 2017/08/20 11:05:24 maxv Exp $");
 
 #include "opt_octeon.h"
 
@@ -654,6 +654,7 @@ octeon_gmx_rgmii_speed(struct octeon_gmx
 		break;
 	default:
 		baudrate = 0/* XXX */;
+		panic("unable to get baudrate");
 		break;
 	}
 	ifp->if_baudrate = baudrate;



CVS commit: src/sys/arch/mips/mips

2017-08-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Aug 20 11:06:36 UTC 2017

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
spl leak, found by mootja


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.32 src/sys/arch/mips/mips/cpu_subr.c:1.33
--- src/sys/arch/mips/mips/cpu_subr.c:1.32	Sun May  7 04:14:20 2017
+++ src/sys/arch/mips/mips/cpu_subr.c	Sun Aug 20 11:06:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.32 2017/05/07 04:14:20 skrll Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.33 2017/08/20 11:06:35 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.32 2017/05/07 04:14:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.33 2017/08/20 11:06:35 maxv Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -771,8 +771,10 @@ cpu_pause(struct reg *regsp)
 	int s = splhigh();
 	cpuid_t cii = cpu_index(curcpu());
 
-	if (__predict_false(cold))
+	if (__predict_false(cold)) {
+		splx(s);
 		return;
+	}
 
 	do {
 		kcpuset_atomic_set(cpus_paused, cii);



CVS commit: src/sys/fs/msdosfs

2017-08-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 20 11:48:15 UTC 2017

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.

Does fix PR 52485.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/fs/msdosfs/msdosfs_vfsops.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/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.127 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.128
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.127	Mon Apr 17 08:32:00 2017
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Sun Aug 20 11:48:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.127 2017/04/17 08:32:00 hannken Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.128 2017/08/20 11:48:15 mlelstv Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.127 2017/04/17 08:32:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.128 2017/08/20 11:48:15 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -467,6 +467,7 @@ msdosfs_mountfs(struct vnode *devvp, str
 	int	ronly, error, BlkPerSec;
 	uint64_t psize;
 	unsigned secsize;
+	u_long fatbytes, fatblocksecs;
 
 	/* Flush out any old buffers remaining from a previous use. */
 	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
@@ -710,12 +711,40 @@ msdosfs_mountfs(struct vnode *devvp, str
 			pmp->pm_fatdiv = 1;
 		}
 	}
-	if (FAT12(pmp))
-		pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
-	else
+
+	/* validate cluster count against FAT */
+	if ((pmp->pm_maxcluster & pmp->pm_fatmask) != pmp->pm_maxcluster) {
+		DPRINTF("maxcluster %lu outside of mask %#lx\n",
+			pmp->pm_maxcluster, pmp->pm_fatmask);
+		error = EINVAL;
+		goto error_exit;
+	}
+
+	/* validate FAT size */
+	fatbytes = (pmp->pm_maxcluster+1) * pmp->pm_fatmult / pmp->pm_fatdiv;
+	fatblocksecs = howmany(fatbytes, pmp->pm_BytesPerSec);
+
+	if (pmp->pm_FATsecs != fatblocksecs) {
+		DPRINTF("FATsecs %lu != real %lu\n", pmp->pm_FATsecs,
+			fatblocksecs);
+		error = EINVAL;
+		goto error_exit;
+	}
+
+	if (FAT12(pmp)) {
+		/*
+		 * limit block size to what is needed to read a FAT block
+		 * to not exceed MAXBSIZE
+		 */
+		pmp->pm_fatblocksec = min(3, fatblocksecs);
+		pmp->pm_fatblocksize = pmp->pm_fatblocksec
+			* pmp->pm_BytesPerSec;
+	} else {
 		pmp->pm_fatblocksize = MAXBSIZE;
+		pmp->pm_fatblocksec = pmp->pm_fatblocksize
+			/ pmp->pm_BytesPerSec;
+	}
 
-	pmp->pm_fatblocksec = pmp->pm_fatblocksize / pmp->pm_BytesPerSec;
 	pmp->pm_bnshift = ffs(pmp->pm_BytesPerSec) - 1;
 
 	/*



CVS commit: src/sys/ufs/ufs

2017-08-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Aug 20 12:09:06 UTC 2017

Modified Files:
src/sys/ufs/ufs: inode.h

Log Message:
update the comment to the current IFMT/permissions location


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/ufs/ufs/inode.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/ufs/ufs/inode.h
diff -u src/sys/ufs/ufs/inode.h:1.75 src/sys/ufs/ufs/inode.h:1.76
--- src/sys/ufs/ufs/inode.h:1.75	Sun Aug 14 11:31:41 2016
+++ src/sys/ufs/ufs/inode.h	Sun Aug 20 12:09:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: inode.h,v 1.75 2016/08/14 11:31:41 jdolecek Exp $	*/
+/*	$NetBSD: inode.h,v 1.76 2017/08/20 12:09:06 maya Exp $	*/
 
 /*
  * Copyright (c) 1982, 1989, 1993
@@ -144,7 +144,7 @@ struct inode {
 	 * These fields are currently only used by FFS and LFS,
 	 * do NOT use them with ext2fs.
 	 */
-	u_int16_t i_mode;	/* IFMT, permissions; see below. */
+	u_int16_t i_mode;	/* IFMT, permissions; see dinode.h. */
 	int16_t   i_nlink;	/* File link count. */
 	u_int64_t i_size;	/* File byte count. */
 	u_int32_t i_flags;	/* Status flags (chflags). */



CVS commit: src/sys/ufs/ffs

2017-08-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Aug 20 12:51:39 UTC 2017

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
print mode as octal for readability


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 src/sys/ufs/ffs/ffs_vfsops.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/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.353 src/sys/ufs/ffs/ffs_vfsops.c:1.354
--- src/sys/ufs/ffs/ffs_vfsops.c:1.353	Mon Apr 17 08:32:01 2017
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sun Aug 20 12:51:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.353 2017/04/17 08:32:01 hannken Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.354 2017/08/20 12:51:38 maya Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.353 2017/04/17 08:32:01 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.354 2017/08/20 12:51:38 maya Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -2132,7 +2132,7 @@ ffs_newvnode(struct mount *mp, struct vn
 
 	ip = VTOI(vp);
 	if (ip->i_mode) {
-		panic("%s: dup alloc ino=%" PRId64 " on %s: mode %x/%x "
+		panic("%s: dup alloc ino=%" PRId64 " on %s: mode %o/%o "
 		"gen %x/%x size %" PRIx64 " blocks %" PRIx64,
 		__func__, ino, fs->fs_fsmnt, DIP(ip, mode), ip->i_mode,
 		DIP(ip, gen), ip->i_gen, DIP(ip, size), DIP(ip, blocks));



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

2017-08-20 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug 20 14:52:36 UTC 2017

Modified Files:
src/sys/arch/evbarm/awin: awin_machdep.c

Log Message:
BPI has no programmable current limiters for the USB host, just a PCB fuse


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/evbarm/awin/awin_machdep.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/evbarm/awin/awin_machdep.c
diff -u src/sys/arch/evbarm/awin/awin_machdep.c:1.49 src/sys/arch/evbarm/awin/awin_machdep.c:1.50
--- src/sys/arch/evbarm/awin/awin_machdep.c:1.49	Thu Oct 20 09:53:07 2016
+++ src/sys/arch/evbarm/awin/awin_machdep.c	Sun Aug 20 14:52:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_machdep.c,v 1.49 2016/10/20 09:53:07 skrll Exp $ */
+/*	$NetBSD: awin_machdep.c,v 1.50 2017/08/20 14:52:36 tnn Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.49 2016/10/20 09:53:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.50 2017/08/20 14:52:36 tnn Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -722,12 +722,14 @@ awin_device_register(device_t self, void
 		} else {
 			prop_dictionary_set_cstring(dict, "usb0drv", ">PB2");
 		}
+#if AWIN_board != AWIN_bpi
+		prop_dictionary_set_cstring(dict, "usb1drv", ">PH6");
 		prop_dictionary_set_cstring(dict, "usb2drv", ">PH3");
+#endif
 		prop_dictionary_set_cstring(dict, "usb0iddet",
 		(cubietruck_p ? "PH6");
 #endif
 #if AWIN_board == AWIN_cubietruck
 		prop_dictionary_set_cstring(dict, "usb0restrict", ">PH0");



CVS commit: src/etc/etc.evbarm

2017-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 20 15:35:31 UTC 2017

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Creating installation/ramdisk here does not work; it happens too late.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/etc/etc.evbarm/Makefile.inc

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

Modified files:

Index: src/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.89 src/etc/etc.evbarm/Makefile.inc:1.90
--- src/etc/etc.evbarm/Makefile.inc:1.89	Wed Jul  5 20:35:28 2017
+++ src/etc/etc.evbarm/Makefile.inc	Sun Aug 20 11:35:31 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.89 2017/07/06 00:35:28 jmcneill Exp $
+#	$NetBSD: Makefile.inc,v 1.90 2017/08/20 15:35:31 christos Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -200,5 +200,4 @@ snap_md_post: check_DESTDIR check_RELEAS
 KERNEL_SUFFIXES=	bin srec ub
 
 INSTALLATION_DIRS+=	binary/gzimg		\
-			installation/instkernel	\
-			installation/ramdisk
+			installation/instkernel



CVS commit: src/distrib/evbarm/instkernel/ramdisk

2017-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 20 15:38:22 UTC 2017

Modified Files:
src/distrib/evbarm/instkernel/ramdisk: Makefile

Log Message:
Create the ramdisk destination dir here.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/distrib/evbarm/instkernel/ramdisk/Makefile

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

Modified files:

Index: src/distrib/evbarm/instkernel/ramdisk/Makefile
diff -u src/distrib/evbarm/instkernel/ramdisk/Makefile:1.17 src/distrib/evbarm/instkernel/ramdisk/Makefile:1.18
--- src/distrib/evbarm/instkernel/ramdisk/Makefile:1.17	Wed Jul  5 15:50:49 2017
+++ src/distrib/evbarm/instkernel/ramdisk/Makefile	Sun Aug 20 11:38:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2017/07/05 19:50:49 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.18 2017/08/20 15:38:22 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -38,11 +38,13 @@ ${CRUNCHBIN}:	libhack.o
 .include "${DISTRIBDIR}/common/Makefile.makedev"
 .include "${DISTRIBDIR}/common/Makefile.image"
 
+RAMDISKDIR=${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/ramdisk
+
 release:	${IMAGE}
-	${RELEASE_INSTALL} ${IMAGE} \
-	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/ramdisk/
+	${INSTALL} -d -m 755 ${RAMDISKDIR}
+	${RELEASE_INSTALL} ${IMAGE}  ${RAMDISKDIR}
 	${TOOL_MKUBOOTIMAGE} -A arm -C none -O linux -T ramdisk \
 	-a 0 -n "NetBSD/${MACHINE_ARCH} ramdisk" ${IMAGE} \
-	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/ramdisk/${IMAGE:S/.fs/.ub/}
+	${RAMDISKDIR}/${IMAGE:S/.fs/.ub/}
 
 .include 



CVS commit: src/sys/dev

2017-08-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 20 15:58:44 UTC 2017

Modified Files:
src/sys/dev: ld.c ldvar.h
src/sys/dev/sdmmc: ld_sdmmc.c sdmmc_mem.c sdmmcvar.h

Log Message:
make the sc_discard interface for the ld backend asynchronous and
signal completion through new callback lddiscardend. Use a standard
struct buf to pass disk address and range instead of two off_t values.

make lddiscard synchronous again. This is a requirement of the current
ffs discard code.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/ld.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ldvar.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sdmmc/ld_sdmmc.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/sdmmc/sdmmc_mem.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sdmmc/sdmmcvar.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/ld.c
diff -u src/sys/dev/ld.c:1.102 src/sys/dev/ld.c:1.103
--- src/sys/dev/ld.c:1.102	Wed Aug  9 16:44:39 2017
+++ src/sys/dev/ld.c	Sun Aug 20 15:58:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld.c,v 1.102 2017/08/09 16:44:39 mlelstv Exp $	*/
+/*	$NetBSD: ld.c,v 1.103 2017/08/20 15:58:43 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.102 2017/08/09 16:44:39 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.103 2017/08/20 15:58:43 mlelstv Exp $");
 
 #include 
 #include 
@@ -595,22 +595,45 @@ static int
 ld_discard(device_t dev, off_t pos, off_t len)
 {
 	struct ld_softc *sc = device_private(dev);
-	int rc;
+	struct buf dbuf, *bp = &dbuf;
+	int error = 0;
+
+	KASSERT(len <= INT_MAX);
 
 	if (sc->sc_discard == NULL)
 		return (ENODEV);
 
 	if ((sc->sc_flags & LDF_MPSAFE) == 0)
 		KERNEL_LOCK(1, curlwp);
-	mutex_enter(&sc->sc_mutex);
 
-	rc = (*sc->sc_discard)(sc, pos, len);
+	buf_init(bp);
+	bp->b_vp = NULL;
+	bp->b_data = NULL;
+	bp->b_bufsize = 0;
+	bp->b_rawblkno = pos / sc->sc_secsize;
+	bp->b_bcount = len;
+	bp->b_flags = B_WRITE;
+	bp->b_cflags = BC_BUSY;
+
+	error = (*sc->sc_discard)(sc, bp);
+	if (error == 0)
+		error = biowait(bp);
+
+	buf_destroy(bp);
 
-	mutex_exit(&sc->sc_mutex);
 	if ((sc->sc_flags & LDF_MPSAFE) == 0)
 		KERNEL_UNLOCK_ONE(curlwp);
 
-	return rc;
+	return error;
+}
+
+void
+lddiscardend(struct ld_softc *sc, struct buf *bp)
+{
+
+	if (bp->b_error)
+		bp->b_resid = bp->b_bcount;
+	biodone(bp);
 }
 
 static int

Index: src/sys/dev/ldvar.h
diff -u src/sys/dev/ldvar.h:1.31 src/sys/dev/ldvar.h:1.32
--- src/sys/dev/ldvar.h:1.31	Wed Aug  9 16:44:39 2017
+++ src/sys/dev/ldvar.h	Sun Aug 20 15:58:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldvar.h,v 1.31 2017/08/09 16:44:39 mlelstv Exp $	*/
+/*	$NetBSD: ldvar.h,v 1.32 2017/08/20 15:58:43 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@ struct ld_softc {
 	int		(*sc_dump)(struct ld_softc *, void *, int, int);
 	int		(*sc_ioctl)(struct ld_softc *, u_long, void *, int32_t, bool);
 	int		(*sc_start)(struct ld_softc *, struct buf *);
-	int		(*sc_discard)(struct ld_softc *, off_t, off_t);
+	int		(*sc_discard)(struct ld_softc *, struct buf *);
 };
 
 /* sc_flags */
@@ -75,5 +75,6 @@ void	ldattach(struct ld_softc *, const c
 int	ldbegindetach(struct ld_softc *, int);
 void	ldenddetach(struct ld_softc *);
 void	lddone(struct ld_softc *, struct buf *);
+void	lddiscardend(struct ld_softc *, struct buf *);
 
 #endif	/* !_DEV_LDVAR_H_ */

Index: src/sys/dev/sdmmc/ld_sdmmc.c
diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.33 src/sys/dev/sdmmc/ld_sdmmc.c:1.34
--- src/sys/dev/sdmmc/ld_sdmmc.c:1.33	Fri Aug 11 18:41:42 2017
+++ src/sys/dev/sdmmc/ld_sdmmc.c	Sun Aug 20 15:58:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_sdmmc.c,v 1.33 2017/08/11 18:41:42 jmcneill Exp $	*/
+/*	$NetBSD: ld_sdmmc.c,v 1.34 2017/08/20 15:58:43 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.33 2017/08/11 18:41:42 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.34 2017/08/20 15:58:43 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -75,14 +75,9 @@ struct ld_sdmmc_task {
 
 	struct ld_sdmmc_softc *task_sc;
 
-	/* bio tasks */
 	struct buf *task_bp;
 	int task_retries; /* number of xfer retry */
 	struct callout task_restart_ch;
-
-	/* discard tasks */
-	off_t task_pos;
-	off_t task_len;
 };
 
 struct ld_sdmmc_softc {
@@ -105,7 +100,7 @@ static int ld_sdmmc_detach(device_t, int
 static int ld_sdmmc_dump(struct ld_softc *, void *, int, int);
 static int ld_sdmmc_start(struct ld_softc *, struct buf *);
 static void ld_sdmmc_restart(void *);
-static int ld_sdmmc_discard(struct ld_softc *, off_t, off_t);
+static int ld_sdmmc_discard(struct ld_softc *, struct buf *);
 static int ld_sdmmc_ioctl(struct ld_softc *, u_long, void *, int32_t, bool);
 
 static void ld_sdmmc_doattach(void *);
@@ -342,22 +337,

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

2017-08-20 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Aug 20 21:00:01 UTC 2017

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c

Log Message:
Ignore 0-sized memory regions in the FDT.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/fdt/fdt_machdep.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/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.11 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.12
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.11	Fri Jul 21 01:00:08 2017
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Sun Aug 20 21:00:01 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.11 2017/07/21 01:00:08 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.12 2017/08/20 21:00:01 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.11 2017/07/21 01:00:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.12 2017/08/20 21:00:01 jakllsch Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -235,7 +235,7 @@ fdt_build_bootconfig(uint64_t mem_addr, 
 	for (index = 0;
 	 fdtbus_get_reg64(memory, index, &addr, &size) == 0;
 	 index++) {
-		if (addr >= max_addr)
+		if (addr >= max_addr || size == 0)
 			continue;
 		if (addr + size > max_addr)
 			size = max_addr - addr;



CVS commit: src/tests/bin/sh

2017-08-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Aug 21 00:56:22 UTC 2017

Modified Files:
src/tests/bin/sh: t_syntax.sh

Log Message:
Make the $'...' syntax tests test what is supposed to work, rather than
what I thought was required (just a couple of changes...).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/bin/sh/t_syntax.sh

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

Modified files:

Index: src/tests/bin/sh/t_syntax.sh
diff -u src/tests/bin/sh/t_syntax.sh:1.8 src/tests/bin/sh/t_syntax.sh:1.9
--- src/tests/bin/sh/t_syntax.sh:1.8	Sat Aug 19 21:18:47 2017
+++ src/tests/bin/sh/t_syntax.sh	Mon Aug 21 00:56:22 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_syntax.sh,v 1.8 2017/08/19 21:18:47 kre Exp $
+# $NetBSD: t_syntax.sh,v 1.9 2017/08/21 00:56:22 kre Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -324,7 +324,8 @@ d_cstrings_body() {
 	atf_check -s exit:0 -e empty -o empty ${TEST_SH} -c \
 		"test \$'\\r-\\n-\\f' = \$'\\cm-\\cj-\\cl'"
 	atf_check -s exit:0 -e empty -o empty ${TEST_SH} -c \
-		"test \$'\\u0123' = \$'\\304\\243'"
+		"unset LC_ALL; export LC_CTYPE=en_AU.UTF-8;
+		test \$'\\u0123' = \$'\\304\\243'"
 	atf_check -s exit:0 -e empty -o empty ${TEST_SH} -c \
 		"test \$'\\u0123' = \$'\\xC4\\xA3'"
 	atf_check -s exit:0 -e empty -o empty ${TEST_SH} -c \
@@ -348,17 +349,13 @@ d_cstrings_body() {
 	atf_check -s not-exit:0 -e not-empty -o ignore ${TEST_SH} -c \
 		": \$'\\uDEFF'"
 	atf_check -s not-exit:0 -e not-empty -o ignore ${TEST_SH} -c \
-		": \$'\\u00'"
-	atf_check -s not-exit:0 -e not-empty -o ignore ${TEST_SH} -c \
-		": \$'\\u8'"
-	atf_check -s not-exit:0 -e not-empty -o ignore ${TEST_SH} -c \
 		": \$'abcd"
 	atf_check -s not-exit:0 -e not-empty -o ignore ${TEST_SH} -c \
 		": \$'abcd\\"
 
-	# anything that generates \0 ends the $'...' immediately (\u cannot)
-	atf_check -s exit:0 -e empty -o inline:'aAa' ${TEST_SH} -c \
-		"printf '%s' \$'a\\0x'\$'A\\x00X'\$'a\\c@x'"
+	# anything that generates \0 ends the $'...' immediately
+	atf_check -s exit:0 -e empty -o inline:'aAaA' ${TEST_SH} -c \
+		"printf '%s' \$'a\\0x'\$'A\\x00X'\$'a\\c@x'\$'A\\uX'"
 
 	# \newline in a $'...' is dropped (just like in "" strings)
 	atf_check -s exit:0 -e empty -o inline:'abcdef' ${TEST_SH} -c \



CVS commit: [netbsd-7] src

2017-08-20 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Aug 21 02:24:17 UTC 2017

Modified Files:
src/crypto/external/bsd/openssh/bin/ssh [netbsd-7]: Makefile
src/crypto/external/bsd/openssh/bin/sshd [netbsd-7]: Makefile
src/external/bsd/dhcp [netbsd-7]: Makefile.inc
src/libexec/telnetd [netbsd-7]: Makefile
src/usr.bin/passwd [netbsd-7]: Makefile
src/usr.bin/telnet [netbsd-7]: Makefile
src/usr.sbin/racoon [netbsd-7]: Makefile

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1493):
crypto/external/bsd/openssh/bin/ssh/Makefile: revision 1.11
usr.bin/passwd/Makefile: revision 1.45
external/bsd/dhcp/Makefile.inc: revision 1.17
crypto/external/bsd/openssh/bin/sshd/Makefile: revision 1.15
usr.bin/telnet/Makefile: revision 1.51
usr.sbin/racoon/Makefile: revision 1.28
libexec/telnetd/Makefile: revision 1.50
krb5 needs sqlite3 now
kerberos needs sqlite3
add sqlite3
add sqlite3
add sqlite3
add sqlite3


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.12.1 \
src/crypto/external/bsd/openssh/bin/ssh/Makefile
cvs rdiff -u -r1.9.12.1 -r1.9.12.2 \
src/crypto/external/bsd/openssh/bin/sshd/Makefile
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/external/bsd/dhcp/Makefile.inc
cvs rdiff -u -r1.49 -r1.49.18.1 src/libexec/telnetd/Makefile
cvs rdiff -u -r1.44 -r1.44.8.1 src/usr.bin/passwd/Makefile
cvs rdiff -u -r1.50 -r1.50.10.1 src/usr.bin/telnet/Makefile
cvs rdiff -u -r1.27 -r1.27.4.1 src/usr.sbin/racoon/Makefile

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

Modified files:

Index: src/crypto/external/bsd/openssh/bin/ssh/Makefile
diff -u src/crypto/external/bsd/openssh/bin/ssh/Makefile:1.8 src/crypto/external/bsd/openssh/bin/ssh/Makefile:1.8.12.1
--- src/crypto/external/bsd/openssh/bin/ssh/Makefile:1.8	Fri Aug 10 12:20:12 2012
+++ src/crypto/external/bsd/openssh/bin/ssh/Makefile	Mon Aug 21 02:24:16 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2012/08/10 12:20:12 joerg Exp $
+#	$NetBSD: Makefile,v 1.8.12.1 2017/08/21 02:24:16 snj Exp $
 
 .include 
 
@@ -29,8 +29,8 @@ DPADD+=	${LIBKRB5} ${LIBHX509} ${LIBHEIM
 LDADD+=	-lkafs -lasn1 -lcrypt
 DPADD+=	${LIBKAFS} ${LIBASN1} ${LIBCRYPT}
 
-LDADD+=	-lcom_err -lroken -lutil
-DPADD+=	${LIBCOM_ERR} ${LIBROKEN} ${LIBUTIL}
+LDADD+=	-lcom_err -lroken -lsqlite3 -lutil
+DPADD+=	${LIBCOM_ERR} ${LIBROKEN} ${LIBSQLITE3} ${LIBUTIL}
 .endif
 
 .include 

Index: src/crypto/external/bsd/openssh/bin/sshd/Makefile
diff -u src/crypto/external/bsd/openssh/bin/sshd/Makefile:1.9.12.1 src/crypto/external/bsd/openssh/bin/sshd/Makefile:1.9.12.2
--- src/crypto/external/bsd/openssh/bin/sshd/Makefile:1.9.12.1	Thu Apr 30 06:07:29 2015
+++ src/crypto/external/bsd/openssh/bin/sshd/Makefile	Mon Aug 21 02:24:16 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9.12.1 2015/04/30 06:07:29 riz Exp $
+#	$NetBSD: Makefile,v 1.9.12.2 2017/08/21 02:24:16 snj Exp $
 
 .include 
 
@@ -51,8 +51,8 @@ SRCS+=	auth-krb5.c auth2-krb5.c
 LDADD+=	-lkrb5 -lasn1
 DPADD+=	${LIBKRB5} ${LIBASN1}
 
-LDADD+=	-lcom_err -lroken
-DPADD+=	${LIBCOM_ERR} ${LIBROKEN}
+LDADD+=	-lcom_err -lroken -lsqlite3
+DPADD+=	${LIBCOM_ERR} ${LIBROKEN} ${LIBSQLITE3}
 .endif
 
 .if (${USE_LDAP} != "no")

Index: src/external/bsd/dhcp/Makefile.inc
diff -u src/external/bsd/dhcp/Makefile.inc:1.11.2.1 src/external/bsd/dhcp/Makefile.inc:1.11.2.2
--- src/external/bsd/dhcp/Makefile.inc:1.11.2.1	Sat Oct 11 16:22:28 2014
+++ src/external/bsd/dhcp/Makefile.inc	Mon Aug 21 02:24:16 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.11.2.1 2014/10/11 16:22:28 snj Exp $
+# $NetBSD: Makefile.inc,v 1.11.2.2 2017/08/21 02:24:16 snj Exp $
 
 WARNS?=	1	# XXX -Wshadow -Wcast-qual -Wsign-compare
 
@@ -39,9 +39,9 @@ LDADD+=-lpthread
 .if (${MKCRYPTO} != "no")
 .if (${MKKERBEROS} != "no")
 LDADD+= -lgssapi -lkrb5 -lhx509 -lheimntlm -lheimbase \
-	-lcom_err  -lroken -lasn1 -lwind
+	-lcom_err  -lroken -lasn1 -lwind -lsqlite3
 DPADD+= ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBHEIMNTLM} ${LIBHEIMBASE} \
-	${LIBCOM_ERR} ${LIBROKEN} ${LIBASN1} ${LIBWIND}
+	${LIBCOM_ERR} ${LIBROKEN} ${LIBASN1} ${LIBWIND} ${LIBSQLITE3}
 .endif
 .if defined(PROG) && ${PROG} == "dhclient"
 LDADD+=-Wl,-Bdynamic

Index: src/libexec/telnetd/Makefile
diff -u src/libexec/telnetd/Makefile:1.49 src/libexec/telnetd/Makefile:1.49.18.1
--- src/libexec/telnetd/Makefile:1.49	Mon Jan  9 16:36:48 2012
+++ src/libexec/telnetd/Makefile	Mon Aug 21 02:24:16 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.49 2012/01/09 16:36:48 christos Exp $
+#	$NetBSD: Makefile,v 1.49.18.1 2017/08/21 02:24:16 snj Exp $
 #	from: @(#)Makefile	8.2 (Berkeley) 12/15/93
 
 WARNS?=	4		# XXX: const issues in sys_term.c
@@ -22,8 +22,8 @@ LIBTELNETDIR!=	cd ${.CURDIR}/../../lib/l
 
 .if (${USE_KERBEROS} != "no")
 CPPFLAGS+=-DKRB5 -DAUTHENTICATION -DENCRYPTION
-LDADD+= -lkrb5 -lasn1 -lcom_err -lroken
-DPADD+=	${LIBKRB5} ${LIBASN1} ${LIBCOM_ERR} ${

CVS commit: src/sys/netipsec

2017-08-20 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Aug 21 02:35:13 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
fix localcount leak in sav. fixed by ozaki-r@n.o.

I commit on behalf of him.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/netipsec/key.c

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

Modified files:

Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.223 src/sys/netipsec/key.c:1.224
--- src/sys/netipsec/key.c:1.223	Wed Aug  9 09:48:11 2017
+++ src/sys/netipsec/key.c	Mon Aug 21 02:35:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.223 2017/08/09 09:48:11 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.224 2017/08/21 02:35:13 knakahara Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.223 2017/08/09 09:48:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.224 2017/08/21 02:35:13 knakahara Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -8291,6 +8291,7 @@ key_sa_chgstate(struct secasvar *sav, u_
 		return;
 
 	key_unlink_sav(sav);
+	localcount_fini(&sav->localcount); /*  fixed by ozaki-r */
 	SAVLIST_ENTRY_DESTROY(sav);
 	key_init_sav(sav);
 



CVS commit: src/usr.sbin/acpitools/acpidump

2017-08-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 21 02:58:49 UTC 2017

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c

Log Message:
 Add new function acpi_select_address() derived from acpi_get_fadt_revision().
On some systems, 32bit address is used for (X)Dsdt even if (X)Facs uses 64bit.
Don't assume an address size from FADT revision.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/acpitools/acpidump/acpi.c

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

Modified files:

Index: src/usr.sbin/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.17 src/usr.sbin/acpitools/acpidump/acpi.c:1.18
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.17	Fri Aug 18 09:49:24 2017
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Mon Aug 21 02:58:49 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.17 2017/08/18 09:49:24 msaitoh Exp $ */
+/* $NetBSD: acpi.c,v 1.18 2017/08/21 02:58:49 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: acpi.c,v 1.17 2017/08/18 09:49:24 msaitoh Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.18 2017/08/21 02:58:49 msaitoh Exp $");
 
 #include 
 #include 
@@ -67,6 +67,7 @@ static void	acpi_print_whea(ACPI_WHEA_HE
 		void (*print_ins)(ACPI_WHEA_HEADER *),
 		void (*print_flags)(ACPI_WHEA_HEADER *));
 static int	acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt);
+static uint64_t	acpi_select_address(uint32_t, uint64_t);
 static void	acpi_handle_fadt(ACPI_TABLE_HEADER *fadt);
 static void	acpi_print_cpu(u_char cpu_id);
 static void	acpi_print_cpu_uid(uint32_t uid, char *uid_string);
@@ -751,30 +752,45 @@ acpi_get_fadt_revision(ACPI_TABLE_FADT *
 	return (fadt_revision);
 }
 
+static uint64_t
+acpi_select_address(uint32_t addr32, uint64_t addr64)
+{
+
+	if (addr64 == 0)
+		return addr32;
+
+	if ((addr32 != 0) && ((addr64 & 0xfff) != addr32)) {
+		/*
+		 * A few systems (e.g., IBM T23) have an RSDP that claims
+		 * revision 2 but the 64 bit addresses are invalid.  If
+		 * revision 2 and the 32 bit address is non-zero but the
+		 * 32 and 64 bit versions don't match, prefer the 32 bit
+		 * version for all subsequent tables.
+		 */
+		return addr32;
+	}
+
+	return addr64;
+}
+
 static void
 acpi_handle_fadt(ACPI_TABLE_HEADER *sdp)
 {
 	ACPI_TABLE_HEADER *dsdp;
 	ACPI_TABLE_FACS	*facs;
 	ACPI_TABLE_FADT *fadt;
-	int		fadt_revision;
 
 	fadt = (ACPI_TABLE_FADT *)sdp;
 	acpi_print_fadt(sdp);
 
-	fadt_revision = acpi_get_fadt_revision(fadt);
-	if (fadt_revision == 1)
-		facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->Facs);
-	else
-		facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->XFacs);
+	facs = (ACPI_TABLE_FACS *)acpi_map_sdt(
+		acpi_select_address(fadt->Facs, fadt->XFacs));
 	if (memcmp(facs->Signature, ACPI_SIG_FACS, 4) != 0 || facs->Length < 64)
 		errx(EXIT_FAILURE, "FACS is corrupt");
 	acpi_print_facs(facs);
 
-	if (fadt_revision == 1)
-		dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->Dsdt);
-	else
-		dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->XDsdt);
+	dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(
+		acpi_select_address(fadt->Dsdt, fadt->XDsdt));
 	if (memcmp(dsdp->Signature, ACPI_SIG_DSDT, 4) != 0)
 		errx(EXIT_FAILURE, "DSDT signature mismatch");
 	if (acpi_checksum(dsdp, dsdp->Length))
@@ -3020,10 +3036,8 @@ dsdt_from_fadt(ACPI_TABLE_FADT *fadt)
 	ACPI_TABLE_HEADER	*sdt;
 
 	/* Use the DSDT address if it is version 1, otherwise use XDSDT. */
-	if (acpi_get_fadt_revision(fadt) == 1)
-		sdt = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->Dsdt);
-	else
-		sdt = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->XDsdt);
+	sdt = (ACPI_TABLE_HEADER *)acpi_map_sdt(
+		acpi_select_address(fadt->Dsdt, fadt->XDsdt));
 	if (acpi_checksum(sdt, sdt->Length))
 		errx(EXIT_FAILURE, "DSDT is corrupt");
 	return (sdt);