CVS commit: src/sys/compat/netbsd32

2019-02-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 21 05:02:21 UTC 2019

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

Log Message:
fix naming errors in previous.  (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/netbsd32/netbsd32_compat_14.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_compat_14.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_14.c:1.28 src/sys/compat/netbsd32/netbsd32_compat_14.c:1.29
--- src/sys/compat/netbsd32/netbsd32_compat_14.c:1.28	Thu Feb 21 03:37:19 2019
+++ src/sys/compat/netbsd32/netbsd32_compat_14.c	Thu Feb 21 05:02:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_14.c,v 1.28 2019/02/21 03:37:19 mrg Exp $	*/
+/*	$NetBSD: netbsd32_compat_14.c,v 1.29 2019/02/21 05:02:20 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999 Eduardo E. Horvath
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.28 2019/02/21 03:37:19 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.29 2019/02/21 05:02:20 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -146,7 +146,7 @@ static inline void
 native_to_netbsd32_semid_ds14(struct semid_ds *sembuf, struct netbsd32_semid_ds14 *osembuf)
 {
 
-	memset(omsemuf, 0, sizeof *osembuf);
+	memset(osembuf, 0, sizeof *osembuf);
 	native_to_netbsd32_ipc_perm14(>sem_perm, >sem_perm);
 
 #define	CVT(x)	osembuf->x = sembuf->x
@@ -177,7 +177,7 @@ static inline void
 native_to_netbsd32_shmid_ds14(struct shmid_ds *shmbuf, struct netbsd32_shmid_ds14 *oshmbuf)
 {
 
-	memset(omshmuf, 0, sizeof *oshmbuf);
+	memset(oshmbuf, 0, sizeof *oshmbuf);
 	native_to_netbsd32_ipc_perm14(>shm_perm, >shm_perm);
 
 #define	CVT(x)	oshmbuf->x = shmbuf->x



CVS commit: src/sys

2019-02-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 21 03:37:19 UTC 2019

Modified Files:
src/sys/compat/linux/common: linux_ipc.c
src/sys/compat/linux32/common: linux32_ipccall.c
src/sys/compat/netbsd32: netbsd32_compat_14.c netbsd32_compat_14_sysv.c
netbsd32_conv.h
src/sys/compat/sys: ipc.h msg.h sem.h shm.h
src/sys/kern: sysv_msg.c sysv_sem.c sysv_shm.c

Log Message:
for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles.  there
 are at least 3 different ones changed here.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/compat/linux/common/linux_ipc.c
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux32/common/linux32_ipccall.c
cvs rdiff -u -r1.27 -r1.28 src/sys/compat/netbsd32/netbsd32_compat_14.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/netbsd32/netbsd32_compat_14_sysv.c
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/ipc.h src/sys/compat/sys/msg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/sem.h
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/sys/shm.h
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/sysv_msg.c
cvs rdiff -u -r1.95 -r1.96 src/sys/kern/sysv_sem.c
cvs rdiff -u -r1.132 -r1.133 src/sys/kern/sysv_shm.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/linux/common/linux_ipc.c
diff -u src/sys/compat/linux/common/linux_ipc.c:1.55 src/sys/compat/linux/common/linux_ipc.c:1.56
--- src/sys/compat/linux/common/linux_ipc.c:1.55	Sat May 28 23:24:58 2011
+++ src/sys/compat/linux/common/linux_ipc.c	Thu Feb 21 03:37:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ipc.c,v 1.55 2011/05/28 23:24:58 alnsn Exp $	*/
+/*	$NetBSD: linux_ipc.c,v 1.56 2019/02/21 03:37:18 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.55 2011/05/28 23:24:58 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.56 2019/02/21 03:37:18 mrg Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -117,6 +117,7 @@ void
 bsd_to_linux_ipc_perm(struct ipc_perm *bpp, struct linux_ipc_perm *lpp)
 {
 
+	memset(lpp, 0, sizeof *lpp);
 	lpp->l_key = bpp->_key;
 	lpp->l_uid = bpp->uid;
 	lpp->l_gid = bpp->gid;
@@ -129,6 +130,8 @@ bsd_to_linux_ipc_perm(struct ipc_perm *b
 void
 bsd_to_linux_ipc64_perm(struct ipc_perm *bpp, struct linux_ipc64_perm *lpp)
 {
+
+	memset(lpp, 0, sizeof *lpp);
 	lpp->l_key = bpp->_key;
 	lpp->l_uid = bpp->uid;
 	lpp->l_gid = bpp->gid;
@@ -152,16 +155,19 @@ bsd_to_linux_ipc64_perm(struct ipc_perm 
 void
 bsd_to_linux_semid_ds(struct semid_ds *bs, struct linux_semid_ds *ls)
 {
+
+	memset(ls, 0, sizeof *ls);
 	bsd_to_linux_ipc_perm(>sem_perm, >l_sem_perm);
 	ls->l_sem_otime = bs->sem_otime;
 	ls->l_sem_ctime = bs->sem_ctime;
 	ls->l_sem_nsems = bs->sem_nsems;
-	ls->l_sem_base = bs->_sem_base;
 }
 
 void
 bsd_to_linux_semid64_ds(struct semid_ds *bs, struct linux_semid64_ds *ls)
 {
+
+	memset(ls, 0, sizeof *ls);
 	bsd_to_linux_ipc64_perm(>sem_perm, >l_sem_perm);
 	ls->l_sem_otime = bs->sem_otime;
 	ls->l_sem_ctime = bs->sem_ctime;
@@ -171,16 +177,17 @@ bsd_to_linux_semid64_ds(struct semid_ds 
 void
 linux_to_bsd_semid_ds(struct linux_semid_ds *ls, struct semid_ds *bs)
 {
+
 	linux_to_bsd_ipc_perm(>l_sem_perm, >sem_perm);
 	bs->sem_otime = ls->l_sem_otime;
 	bs->sem_ctime = ls->l_sem_ctime;
 	bs->sem_nsems = ls->l_sem_nsems;
-	bs->_sem_base = ls->l_sem_base;
 }
 
 void
 linux_to_bsd_semid64_ds(struct linux_semid64_ds *ls, struct semid_ds *bs)
 {
+
 	linux_to_bsd_ipc64_perm(>l_sem_perm, >sem_perm);
 	bs->sem_otime = ls->l_sem_otime;
 	bs->sem_ctime = ls->l_sem_ctime;
@@ -308,8 +315,6 @@ linux_to_bsd_msqid_ds(struct linux_msqid
 
 	memset(bmp, 0, sizeof(*bmp));
 	linux_to_bsd_ipc_perm(>l_msg_perm, >msg_perm);
-	bmp->_msg_first = lmp->l_msg_first;
-	bmp->_msg_last = lmp->l_msg_last;
 	bmp->_msg_cbytes = lmp->l_msg_cbytes;
 	bmp->msg_qnum = lmp->l_msg_qnum;
 	

CVS commit: src/share/misc

2019-02-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Feb 21 01:20:45 UTC 2019

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Sometimes negative acknowledgement also shows up as NAK


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.231 src/share/misc/acronyms.comp:1.232
--- src/share/misc/acronyms.comp:1.231	Tue Feb 19 16:31:38 2019
+++ src/share/misc/acronyms.comp	Thu Feb 21 01:20:45 2019
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.231 2019/02/19 16:31:38 sevan Exp $
+$NetBSD: acronyms.comp,v 1.232 2019/02/21 01:20:45 sevan Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -919,6 +919,7 @@ MVCC	multiversion concurrency control
 MWE	module width encoding
 MX	mail exchange
 NACK	negative acknowledgement
+NAK	negative acknowledgement
 NAN	not a number
 NAPT	Network Address Port Translation
 NAS	network attached storage



CVS commit: src/sys/kern

2019-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 20 19:42:14 UTC 2019

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

Log Message:
handle O_NOSIGPIPE too.


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/sys/kern/kern_descrip.c

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

Modified files:

Index: src/sys/kern/kern_descrip.c
diff -u src/sys/kern/kern_descrip.c:1.242 src/sys/kern/kern_descrip.c:1.243
--- src/sys/kern/kern_descrip.c:1.242	Thu Jan  3 05:16:43 2019
+++ src/sys/kern/kern_descrip.c	Wed Feb 20 14:42:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_descrip.c,v 1.242 2019/01/03 10:16:43 maxv Exp $	*/
+/*	$NetBSD: kern_descrip.c,v 1.243 2019/02/20 19:42:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.242 2019/01/03 10:16:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.243 2019/02/20 19:42:14 christos Exp $");
 
 #include 
 #include 
@@ -750,7 +750,7 @@ fd_dup2(file_t *fp, unsigned newfd, int 
 	fdfile_t *ff;
 	fdtab_t *dt;
 
-	if (flags & ~(O_CLOEXEC|O_NONBLOCK))
+	if (flags & ~(O_CLOEXEC|O_NONBLOCK|O_NOSIGPIPE))
 		return EINVAL;
 	/*
 	 * Ensure there are enough slots in the descriptor table,
@@ -791,7 +791,7 @@ fd_dup2(file_t *fp, unsigned newfd, int 
 	mutex_exit(>fd_lock);
 
 	dt->dt_ff[newfd]->ff_exclose = (flags & O_CLOEXEC) != 0;
-	fp->f_flag |= flags & FNONBLOCK;
+	fp->f_flag |= flags & (FNONBLOCK|FNOSIGPIPE);
 	/* Slot is now allocated.  Insert copy of the file. */
 	fd_affix(curproc, fp, newfd);
 	if (ff != NULL) {



CVS commit: src/sys/dev/i2c

2019-02-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 20 18:19:46 UTC 2019

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

Log Message:
moar match string


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/i2c/lm75.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/lm75.c
diff -u src/sys/dev/i2c/lm75.c:1.33 src/sys/dev/i2c/lm75.c:1.34
--- src/sys/dev/i2c/lm75.c:1.33	Tue Jun 26 06:03:57 2018
+++ src/sys/dev/i2c/lm75.c	Wed Feb 20 18:19:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm75.c,v 1.33 2018/06/26 06:03:57 thorpej Exp $	*/
+/*	$NetBSD: lm75.c,v 1.34 2019/02/20 18:19:46 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.33 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.34 2019/02/20 18:19:46 macallan Exp $");
 
 #include 
 #include 
@@ -103,6 +103,7 @@ static int	sysctl_lm75_temp(SYSCTLFN_ARG
 
 static const struct device_compatible_entry compat_data[] = {
 	{ "i2c-lm75",			0 },
+	{ "lm75",			0 },
 	{ "ds1775",			0 },
 	/*
 	 * see XXX in _attach() below: add code once non-lm75 matches are



CVS commit: src/share/man/man5

2019-02-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Feb 20 17:48:31 UTC 2019

Modified Files:
src/share/man/man5: mk.conf.5

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/share/man/man5/mk.conf.5

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

Modified files:

Index: src/share/man/man5/mk.conf.5
diff -u src/share/man/man5/mk.conf.5:1.77 src/share/man/man5/mk.conf.5:1.78
--- src/share/man/man5/mk.conf.5:1.77	Tue Feb 19 21:08:21 2019
+++ src/share/man/man5/mk.conf.5	Wed Feb 20 17:48:31 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mk.conf.5,v 1.77 2019/02/19 21:08:21 mrg Exp $
+.\"	$NetBSD: mk.conf.5,v 1.78 2019/02/20 17:48:31 wiz Exp $
 .\"
 .\"  Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
 .\"  All rights reserved.
@@ -816,7 +816,6 @@ Indicates whether X11 is built and insta
 (by descending into
 .Pa src/external/mit/xorg ) .
 .DFLTn
-.Pp
 .
 .It Sy MKX11FONTS
 .YorN



CVS commit: src/doc

2019-02-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 20 17:08:06 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
 Add support for BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2502 src/doc/CHANGES:1.2503
--- src/doc/CHANGES:1.2502	Wed Feb 20 00:22:29 2019
+++ src/doc/CHANGES	Wed Feb 20 17:08:06 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2502 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2503 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -330,3 +330,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	nsd: Import 4.1.26 [prlw1 20190212]
 	macppc: The kernels for the G5s are now built by default. These are
 		currently intended for netbooting via TFTP. [sevan 20190219]
+	bge(4): Add support for BCM5762, BCM5725, BCM5727, BCM57764, BCM57767
+		and BCM57787 [msaitoh 20190220]



CVS commit: src

2019-02-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 20 17:00:20 UTC 2019

Modified Files:
src/share/man/man4: bge.4
src/sys/dev/mii: brgphy.c
src/sys/dev/pci: if_bge.c if_bgereg.h

Log Message:
- Add support for BCM5762 ASIC devices.
- Add BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/bge.4
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.326 -r1.327 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/if_bgereg.h

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

Modified files:

Index: src/share/man/man4/bge.4
diff -u src/share/man/man4/bge.4:1.15 src/share/man/man4/bge.4:1.16
--- src/share/man/man4/bge.4:1.15	Tue Aug  6 19:02:57 2013
+++ src/share/man/man4/bge.4	Wed Feb 20 17:00:20 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bge.4,v 1.15 2013/08/06 19:02:57 snj Exp $
+.\"	$NetBSD: bge.4,v 1.16 2019/02/20 17:00:20 msaitoh Exp $
 .\"
 .\" Copyright (c) 2003 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 July 4, 2013
+.Dd February 20, 2019
 .Dt BGE 4
 .Os
 .Sh NAME
@@ -121,8 +121,8 @@ The
 driver supports IPv4 IP, TCP, and UDP checksum offload for receive,
 IP checksum offload for transmit, VLAN tag insertion and stripping,
 as well as a 256-bit multicast hash filter.
-The BCM5717, BCM5718, BCM5723, BCM5754, BCM5755, BCM5761, BCM5764, BCM5784,
-BCM5785, BCM5787 and BCM577xx chips also support IPv6 receive TCP/UDP
+The BCM5717, BCM5718, BCM5723, BCM5754, BCM5755, BCM5761, BCM5762, BCM5764,
+BCM5784, BCM5785, BCM5787 and BCM577xx chips also support IPv6 receive TCP/UDP
 checksum offload.
 The
 .Nm
@@ -132,9 +132,8 @@ See
 for information on how to enable this feature.
 .Pp
 The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704, BCM5714, BCM5717, BCM5719,
-BCM5720, BCM5780, BCM57765 and BCM57766 also support jumbo frames, which can be
-configured via the
-interface MTU setting.
+BCM5720, BCM5762, BCM5780, BCM57765 and BCM57766 also support jumbo frames,
+which can be configured via the interface MTU setting.
 Selecting an MTU larger than 1500 bytes with the
 .Xr ifconfig 8
 utility configures the adapter to receive and transmit Jumbo frames.

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.79 src/sys/dev/mii/brgphy.c:1.80
--- src/sys/dev/mii/brgphy.c:1.79	Tue Jan 22 03:42:27 2019
+++ src/sys/dev/mii/brgphy.c	Wed Feb 20 17:00:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.79 2019/01/22 03:42:27 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.80 2019/02/20 17:00:20 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.79 2019/01/22 03:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.80 2019/02/20 17:00:20 msaitoh Exp $");
 
 #include 
 #include 
@@ -246,6 +246,9 @@ static const struct mii_phydesc brgphys[
 	{ MII_OUI_BROADCOM3,		MII_MODEL_BROADCOM3_BCM57780,
 	  MII_STR_BROADCOM3_BCM57780 },
 
+	{ MII_OUI_BROADCOM4,		MII_MODEL_BROADCOM4_BCM5725C,
+	  MII_STR_BROADCOM4_BCM5725C },
+
 	{ MII_OUI_xxBROADCOM_ALT1,	MII_MODEL_xxBROADCOM_ALT1_BCM5906,
 	  MII_STR_xxBROADCOM_ALT1_BCM5906 },
 

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.326 src/sys/dev/pci/if_bge.c:1.327
--- src/sys/dev/pci/if_bge.c:1.326	Wed Feb 20 15:56:51 2019
+++ src/sys/dev/pci/if_bge.c	Wed Feb 20 17:00:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.326 2019/02/20 15:56:51 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.327 2019/02/20 17:00:20 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.326 2019/02/20 15:56:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.327 2019/02/20 17:00:20 msaitoh Exp $");
 
 #include 
 #include 
@@ -343,6 +343,8 @@ static const struct bge_product {
 	{ VIDDID(BROADCOM, BCM5721),	"Broadcom BCM5721 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5722),	"Broadcom BCM5722 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5723),	"Broadcom BCM5723 Gigabit" },
+	{ VIDDID(BROADCOM, BCM5725),	"Broadcom BCM5725 Gigabit" },
+	{ VIDDID(BROADCOM, BCM5727),	"Broadcom BCM5727 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5750),	"Broadcom BCM5750 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5751),	"Broadcom BCM5751 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5751F),	"Broadcom BCM5751F Gigabit" },
@@ -361,6 +363,7 @@ static const struct bge_product {
 	{ VIDDID(BROADCOM, BCM5761E),	"Broadcom BCM5761E Gigabit" },
 	{ VIDDID(BROADCOM, BCM5761S),	"Broadcom BCM5761S Gigabit" },
 	{ VIDDID(BROADCOM, BCM5761SE),	"Broadcom BCM5761SE Gigabit" },
+	{ VIDDID(BROADCOM, BCM5762),	"Broadcom BCM5762 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5764),	"Broadcom BCM5764 Gigabit" 

CVS commit: src/sys/dev/pci

2019-02-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 20 15:56:51 UTC 2019

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

Log Message:
 Add BCM5702FE, another BCM5704S and SysKonnect SK-9Mxx support.


To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/pci/if_bge.c

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.325 src/sys/dev/pci/if_bge.c:1.326
--- src/sys/dev/pci/if_bge.c:1.325	Wed Feb 20 08:03:58 2019
+++ src/sys/dev/pci/if_bge.c	Wed Feb 20 15:56:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.325 2019/02/20 08:03:58 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.326 2019/02/20 15:56:51 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.325 2019/02/20 08:03:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.326 2019/02/20 15:56:51 msaitoh Exp $");
 
 #include 
 #include 
@@ -318,12 +318,14 @@ static const struct bge_product {
 	{ VIDDID(BROADCOM, BCM5700),	"Broadcom BCM5700 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5701),	"Broadcom BCM5701 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5702),	"Broadcom BCM5702 Gigabit" },
+	{ VIDDID(BROADCOM, BCM5702FE),	"Broadcom BCM5702FE Fast" },
 	{ VIDDID(BROADCOM, BCM5702X),	"Broadcom BCM5702X Gigabit" },
 	{ VIDDID(BROADCOM, BCM5703),	"Broadcom BCM5703 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5703X),	"Broadcom BCM5703X Gigabit" },
 	{ VIDDID(BROADCOM, BCM5703_ALT),"Broadcom BCM5703 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5704C),	"Broadcom BCM5704C Dual Gigabit" },
 	{ VIDDID(BROADCOM, BCM5704S),	"Broadcom BCM5704S Dual Gigabit" },
+	{ VIDDID(BROADCOM, BCM5704S_ALT),"Broadcom BCM5704S Dual Gigabit" },
 	{ VIDDID(BROADCOM, BCM5705),	"Broadcom BCM5705 Gigabit" },
 	{ VIDDID(BROADCOM, BCM5705F),	"Broadcom BCM5705F Gigabit" },
 	{ VIDDID(BROADCOM, BCM5705K),	"Broadcom BCM5705K Gigabit" },
@@ -393,6 +395,7 @@ static const struct bge_product {
 	{ VIDDID(BROADCOM, BCM57791),	"Broadcom BCM57791 Gigabit" },
 	{ VIDDID(BROADCOM, BCM57795),	"Broadcom BCM57795 Gigabit" },
 	{ VIDDID(SCHNEIDERKOCH, SK_9DX1),"SysKonnect SK-9Dx1 Gigabit" },
+	{ VIDDID(SCHNEIDERKOCH, SK_9MXX),"SysKonnect SK-9Mxx Gigabit" },
 	{ VIDDID(3COM, 3C996),		"3Com 3c996 Gigabit" },
 	{ VIDDID(FUJITSU4, PW008GE4),	"Fujitsu PW008GE4 Gigabit" },
 	{ VIDDID(FUJITSU4, PW008GE5),	"Fujitsu PW008GE5 Gigabit" },



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

2019-02-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb 20 11:40:41 UTC 2019

Modified Files:
src/tests/lib/libc/misc: t_ubsan.c

Log Message:
Unify the style of t_ubsan tests

Apply similar change for load_invalid_value_bool in
test_load_invalid_value_enum.

Follow up of PR bin/53968 by Michael van Elst


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/misc/t_ubsan.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/misc/t_ubsan.c
diff -u src/tests/lib/libc/misc/t_ubsan.c:1.4 src/tests/lib/libc/misc/t_ubsan.c:1.5
--- src/tests/lib/libc/misc/t_ubsan.c:1.4	Wed Feb 20 09:50:09 2019
+++ src/tests/lib/libc/misc/t_ubsan.c	Wed Feb 20 11:40:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ubsan.c,v 1.4 2019/02/20 09:50:09 kamil Exp $	*/
+/*	$NetBSD: t_ubsan.c,v 1.5 2019/02/20 11:40:41 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2018\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ubsan.c,v 1.4 2019/02/20 09:50:09 kamil Exp $");
+__RCSID("$NetBSD: t_ubsan.c,v 1.5 2019/02/20 11:40:41 kamil Exp $");
 
 #include 
 #include 
@@ -318,7 +318,7 @@ static void
 test_load_invalid_value_enum(void)
 {
 	enum e { e1, e2, e3, e4 };
-	volatile int a = atoi("10");
+	volatile int a = INT_MAX - atoi("10");
 	volatile enum e E = *(REINTERPRET_CAST(volatile enum e*, ));
 
 	raise((E == e1) ? SIGSEGV : SIGBUS);



CVS commit: src/sys/kern

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:09:45 UTC 2019

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

Log Message:
- Make the fstrans mount info part of the per-lwp state and replace
  most accesses to the mount with fstrans mount info.

- Add "fmi_gone" to be true after unmount and add a counter of
  outstanding mount infos so fstrans_clear_lwp_info() only runs
  if there may be something to do.

- Move lookup of base mounts into per-lwp state.

- Keep a list of valid mounts for DIAGNOSTIC checks.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/kern/vfs_trans.c

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

Modified files:

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.53 src/sys/kern/vfs_trans.c:1.54
--- src/sys/kern/vfs_trans.c:1.53	Wed Feb 20 10:08:37 2019
+++ src/sys/kern/vfs_trans.c	Wed Feb 20 10:09:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.53 2019/02/20 10:08:37 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.54 2019/02/20 10:09:45 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.53 2019/02/20 10:08:37 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.54 2019/02/20 10:09:45 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -68,6 +68,8 @@ struct fstrans_lwp_info {
 	struct fstrans_lwp_info *fli_succ;
 	struct lwp *fli_self;
 	struct mount *fli_mount;
+	struct mount *fli_alias;
+	struct fstrans_mount_info *fli_mountinfo;
 	int fli_trans_cnt;
 	int fli_cow_cnt;
 	enum fstrans_lock_type fli_lock_type;
@@ -76,8 +78,10 @@ struct fstrans_lwp_info {
 struct fstrans_mount_info {
 	enum fstrans_state fmi_state;
 	unsigned int fmi_ref_cnt;
+	bool fmi_gone;
 	bool fmi_cow_change;
 	LIST_HEAD(, fscow_handler) fmi_cow_handler;
+	struct mount *fmi_mount;
 };
 
 static specificdata_key_t lwp_data_key;	/* Our specific data key. */
@@ -89,23 +93,87 @@ static kcondvar_t fstrans_count_cv;	/* F
 static pserialize_t fstrans_psz;	/* Pserialize state. */
 static LIST_HEAD(fstrans_lwp_head, fstrans_lwp_info) fstrans_fli_head;
 	/* List of all fstrans_lwp_info. */
+static int fstrans_gone_count;		/* Number of fstrans_mount_info gone. */
 
-static inline struct mount *fstrans_normalize_mount(struct mount *);
 static void fstrans_lwp_dtor(void *);
-static void fstrans_mount_dtor(struct mount *);
+static void fstrans_mount_dtor(struct fstrans_mount_info *);
 static void fstrans_clear_lwp_info(void);
 static inline struct fstrans_lwp_info *
 fstrans_get_lwp_info(struct mount *, bool);
 static struct fstrans_lwp_info *fstrans_alloc_lwp_info(struct mount *);
 static inline int _fstrans_start(struct mount *, enum fstrans_lock_type, int);
 static bool grant_lock(const enum fstrans_state, const enum fstrans_lock_type);
-static bool state_change_done(const struct mount *);
-static bool cow_state_change_done(const struct mount *);
-static void cow_change_enter(const struct mount *);
-static void cow_change_done(const struct mount *);
+static bool state_change_done(const struct fstrans_mount_info *);
+static bool cow_state_change_done(const struct fstrans_mount_info *);
+static void cow_change_enter(struct fstrans_mount_info *);
+static void cow_change_done(struct fstrans_mount_info *);
 
 extern struct mount *dead_rootmount;
 
+#if defined(DIAGNOSTIC)
+
+struct fstrans_debug_mount {
+	struct mount *fdm_mount;
+	SLIST_ENTRY(fstrans_debug_mount) fdm_list;
+};
+
+static SLIST_HEAD(, fstrans_debug_mount) fstrans_debug_mount_head =
+SLIST_HEAD_INITIALIZER(fstrans_debug_mount_head);
+
+static void
+fstrans_debug_mount(struct mount *mp)
+{
+	struct fstrans_debug_mount *fdm, *new;
+
+	KASSERT(mutex_owned(_mount_lock));
+
+	mutex_exit(_mount_lock);
+	new = kmem_alloc(sizeof(*new), KM_SLEEP);
+	new->fdm_mount = mp;
+	mutex_enter(_mount_lock);
+
+	SLIST_FOREACH(fdm, _debug_mount_head, fdm_list)
+		KASSERT(fdm->fdm_mount != mp);
+	SLIST_INSERT_HEAD(_debug_mount_head, new, fdm_list);
+}
+
+static void
+fstrans_debug_unmount(struct mount *mp)
+{
+	struct fstrans_debug_mount *fdm;
+
+	KASSERT(mutex_owned(_mount_lock));
+
+	SLIST_FOREACH(fdm, _debug_mount_head, fdm_list)
+		if (fdm->fdm_mount == mp)
+			break;
+	KASSERT(fdm != NULL);
+	SLIST_REMOVE(_debug_mount_head, fdm,
+	fstrans_debug_mount, fdm_list);
+	kmem_free(fdm, sizeof(*fdm));
+}
+
+static void
+fstrans_debug_validate_mount(struct mount *mp)
+{
+	struct fstrans_debug_mount *fdm;
+
+	KASSERT(mutex_owned(_mount_lock));
+
+	SLIST_FOREACH(fdm, _debug_mount_head, fdm_list)
+		if (fdm->fdm_mount == mp)
+			break;
+	KASSERTMSG(fdm != NULL, "mount %p invalid", mp);
+}
+
+#else /* defined(DIAGNOSTIC) */
+
+#define fstrans_debug_mount(mp)
+#define fstrans_debug_unmount(mp)
+#define fstrans_debug_validate_mount(mp)
+
+#endif  /* defined(DIAGNOSTIC) */
+
 /*
  * Initialize.
  */
@@ -127,21 +195,6 

CVS commit: src

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:08:38 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ctldir.c
src/sys/kern: vfs_mount.c vfs_trans.c

Log Message:
Move fstrans_unmount() to vfs_rele(), just before it would free the mount.
Don't take a mount reference for fstrans as it gets notified about the release.

Defer the final free of the mount to fstrans_mount_dtor() when fstrans
has released all references to this mount.  Prevents the mount's memory
to be reused as a new mount before fstrans released all references.

Address PR kern/53928 modules/t_builtin:disable test case randomly fails.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
cvs rdiff -u -r1.69 -r1.70 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.52 -r1.53 src/sys/kern/vfs_trans.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.5 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.6
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.5	Tue Feb  5 09:55:48 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c	Wed Feb 20 10:08:37 2019
@@ -1261,7 +1261,6 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int
 
 #ifdef __NetBSD__
 
-#include 
 #include 
 #include 
 #include 
@@ -1354,7 +1353,6 @@ sfs_snapshot_mount(vnode_t *vp, const ch
 out:;
 	if (error && vfsp) {
 		mutex_exit(>mnt_updating);
-		fstrans_unmount(vfsp);
 		vfs_rele(vfsp);
 	}
 	PNBUF_PUT(osname);

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.69 src/sys/kern/vfs_mount.c:1.70
--- src/sys/kern/vfs_mount.c:1.69	Wed Feb 20 10:07:27 2019
+++ src/sys/kern/vfs_mount.c	Wed Feb 20 10:08:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.69 2019/02/20 10:07:27 hannken Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.70 2019/02/20 10:08:37 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.69 2019/02/20 10:07:27 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.70 2019/02/20 10:08:37 hannken Exp $");
 
 #include 
 #include 
@@ -297,7 +297,13 @@ vfs_rele(struct mount *mp)
 	if (mp->mnt_op != NULL) {
 		vfs_delref(mp->mnt_op);
 	}
-	kmem_free(mp, sizeof(*mp));
+	fstrans_unmount(mp);
+	/*
+	 * Final free of mp gets done from fstrans_mount_dtor().
+	 *
+	 * Prevents this memory to be reused as a mount before
+	 * fstrans releases all references to it.
+	 */
 }
 
 /*
@@ -818,7 +824,6 @@ err_mounted:
 err_unmounted:
 	vp->v_mountedhere = NULL;
 	mutex_exit(>mnt_updating);
-	fstrans_unmount(mp);
 	vfs_rele(mp);
 
 	return error;
@@ -906,7 +911,6 @@ dounmount(struct mount *mp, int flags, s
 		panic("unmount: dangling vnode");
 	vfs_hooks_unmount(mp);
 
-	fstrans_unmount(mp);
 	vfs_rele(mp);	/* reference from mount() */
 	if (coveredvp != NULLVP) {
 		vrele(coveredvp);

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.52 src/sys/kern/vfs_trans.c:1.53
--- src/sys/kern/vfs_trans.c:1.52	Wed Feb 20 10:07:27 2019
+++ src/sys/kern/vfs_trans.c	Wed Feb 20 10:08:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.52 2019/02/20 10:07:27 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.53 2019/02/20 10:08:37 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.52 2019/02/20 10:07:27 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.53 2019/02/20 10:08:37 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -186,8 +186,8 @@ fstrans_mount_dtor(struct mount *mp)
 
 	mutex_exit(_mount_lock);
 
+	kmem_free(mp, sizeof(*mp));
 	kmem_free(fmi, sizeof(*fmi));
-	vfs_rele(mp);
 }
 
 /*
@@ -208,8 +208,6 @@ fstrans_mount(struct mount *mp)
 	mp->mnt_transinfo = newfmi;
 	mutex_exit(_mount_lock);
 
-	vfs_ref(mp);
-
 	return 0;
 }
 
@@ -719,8 +717,11 @@ fscow_establish(struct mount *mp, int (*
 
 	KASSERT(mp != dead_rootmount);
 
+	mutex_enter(_mount_lock);
 	fmi = mp->mnt_transinfo;
 	KASSERT(fmi != NULL);
+	fmi->fmi_ref_cnt += 1;
+	mutex_exit(_mount_lock);
 
 	newch = kmem_alloc(sizeof(*newch), KM_SLEEP);
 	newch->ch_func = func;
@@ -758,6 +759,8 @@ fscow_disestablish(struct mount *mp, int
 	}
 	cow_change_done(mp);
 
+	fstrans_mount_dtor(mp);
+
 	return hp ? 0 : EINVAL;
 }
 



CVS commit: src/sys

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:07:27 UTC 2019

Modified Files:
src/sys/kern: init_main.c vfs_mount.c vfs_trans.c vfs_vnode.c
src/sys/miscfs/genfs: genfs_vfsops.c
src/sys/rump/librump/rumpvfs: rump_vfs.c
src/sys/sys: fstypes.h

Log Message:
Attach "mnt_transinfo" to "dead_rootmount" so every mount has a
valid "mnt_transinfo" and remove now unneeded flag IMNT_HAS_TRANS.

Run fstrans_start()/fstrans_done() on dead_rootmount if FSTRANS_DEAD_ENABLED.
Should become the default for DIAGNOSTIC in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.502 -r1.503 src/sys/kern/init_main.c
cvs rdiff -u -r1.68 -r1.69 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.51 -r1.52 src/sys/kern/vfs_trans.c
cvs rdiff -u -r1.102 -r1.103 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.8 -r1.9 src/sys/miscfs/genfs/genfs_vfsops.c
cvs rdiff -u -r1.87 -r1.88 src/sys/rump/librump/rumpvfs/rump_vfs.c
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/fstypes.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/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.502 src/sys/kern/init_main.c:1.503
--- src/sys/kern/init_main.c:1.502	Wed Jan 23 13:38:30 2019
+++ src/sys/kern/init_main.c	Wed Feb 20 10:07:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.502 2019/01/23 13:38:30 kamil Exp $	*/
+/*	$NetBSD: init_main.c,v 1.503 2019/02/20 10:07:27 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.502 2019/01/23 13:38:30 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.503 2019/02/20 10:07:27 hannken Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -466,12 +466,13 @@ main(void)
 	if (usevnodes > desiredvnodes)
 		desiredvnodes = usevnodes;
 #endif
-	vfsinit();
-	lf_init();
 
 	/* Initialize fstrans. */
 	fstrans_init();
 
+	vfsinit();
+	lf_init();
+
 	/* Initialize the file descriptor system. */
 	fd_sys_init();
 

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.68 src/sys/kern/vfs_mount.c:1.69
--- src/sys/kern/vfs_mount.c:1.68	Tue Feb  5 09:49:44 2019
+++ src/sys/kern/vfs_mount.c	Wed Feb 20 10:07:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.68 2019/02/05 09:49:44 hannken Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.69 2019/02/20 10:07:27 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.68 2019/02/05 09:49:44 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.69 2019/02/20 10:07:27 hannken Exp $");
 
 #include 
 #include 
@@ -149,7 +149,6 @@ vfs_mountalloc(struct vfsops *vfsops, vn
 {
 	struct mount *mp;
 	int error __diagused;
-	extern struct vfsops dead_vfsops;
 
 	mp = kmem_zalloc(sizeof(*mp), KM_SLEEP);
 	mp->mnt_op = vfsops;
@@ -159,10 +158,9 @@ vfs_mountalloc(struct vfsops *vfsops, vn
 	mutex_init(>mnt_updating, MUTEX_DEFAULT, IPL_NONE);
 	mp->mnt_vnodecovered = vp;
 	mount_initspecific(mp);
-	if (vfsops != _vfsops) {
-		error = fstrans_mount(mp);
-		KASSERT(error == 0);
-	}
+
+	error = fstrans_mount(mp);
+	KASSERT(error == 0);
 
 	mutex_enter(_lock);
 	mp->mnt_gen = mountgen++;

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.51 src/sys/kern/vfs_trans.c:1.52
--- src/sys/kern/vfs_trans.c:1.51	Fri Oct  5 09:51:55 2018
+++ src/sys/kern/vfs_trans.c	Wed Feb 20 10:07:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.51 2018/10/05 09:51:55 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.52 2019/02/20 10:07:27 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.51 2018/10/05 09:51:55 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.52 2019/02/20 10:07:27 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -104,6 +104,8 @@ static bool cow_state_change_done(const 
 static void cow_change_enter(const struct mount *);
 static void cow_change_done(const struct mount *);
 
+extern struct mount *dead_rootmount;
+
 /*
  * Initialize.
  */
@@ -136,8 +138,6 @@ fstrans_normalize_mount(struct mount *mp
 		mp = mp->mnt_lower;
 	if (mp == NULL)
 		return NULL;
-	if ((mp->mnt_iflag & IMNT_HAS_TRANS) == 0)
-		return NULL;
 	return mp;
 }
 
@@ -182,7 +182,6 @@ fstrans_mount_dtor(struct mount *mp)
 	KASSERT(fmi->fmi_state == FSTRANS_NORMAL);
 	KASSERT(LIST_FIRST(>fmi_cow_handler) == NULL);
 
-	mp->mnt_iflag &= ~IMNT_HAS_TRANS;
 	mp->mnt_transinfo = NULL;
 
 	mutex_exit(_mount_lock);
@@ -207,7 +206,6 @@ fstrans_mount(struct mount *mp)
 
 	mutex_enter(_mount_lock);
 	mp->mnt_transinfo = newfmi;
-	mp->mnt_iflag |= IMNT_HAS_TRANS;
 	mutex_exit(_mount_lock);
 
 	vfs_ref(mp);
@@ -222,9 +220,6 @@ void
 fstrans_unmount(struct mount *mp)
 {
 
-	if ((mp->mnt_iflag & IMNT_HAS_TRANS) == 0)
-		return;

CVS commit: src/sys

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:06:00 UTC 2019

Modified Files:
src/sys/fs/union: union_vfsops.c
src/sys/miscfs/nullfs: null_vfsops.c
src/sys/miscfs/overlay: overlay_vfsops.c
src/sys/miscfs/umapfs: umap_vfsops.c

Log Message:
Set "mnt_lower" before the first file system operation on the new file system.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/fs/union/union_vfsops.c
cvs rdiff -u -r1.94 -r1.95 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.67 -r1.68 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.99 -r1.100 src/sys/miscfs/umapfs/umap_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/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.78 src/sys/fs/union/union_vfsops.c:1.79
--- src/sys/fs/union/union_vfsops.c:1.78	Sat Apr  1 19:35:56 2017
+++ src/sys/fs/union/union_vfsops.c	Wed Feb 20 10:05:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vfsops.c,v 1.78 2017/04/01 19:35:56 riastradh Exp $	*/
+/*	$NetBSD: union_vfsops.c,v 1.79 2019/02/20 10:05:59 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.78 2017/04/01 19:35:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.79 2019/02/20 10:05:59 hannken Exp $");
 
 #include 
 #include 
@@ -246,14 +246,13 @@ union_mount(struct mount *mp, const char
 
 	mp->mnt_data = um;
 	vfs_getnewfsid(mp);
+	mp->mnt_lower = um->um_uppervp->v_mount;
 
 	error = set_statvfs_info( path, UIO_USERSPACE, NULL, UIO_USERSPACE,
 	mp->mnt_op->vfs_name, mp, l);
 	if (error)
 		goto bad;
 
-	mp->mnt_lower = um->um_uppervp->v_mount;
-
 	switch (um->um_op) {
 	case UNMNT_ABOVE:
 		cp = ":";

Index: src/sys/miscfs/nullfs/null_vfsops.c
diff -u src/sys/miscfs/nullfs/null_vfsops.c:1.94 src/sys/miscfs/nullfs/null_vfsops.c:1.95
--- src/sys/miscfs/nullfs/null_vfsops.c:1.94	Tue Apr 11 07:51:37 2017
+++ src/sys/miscfs/nullfs/null_vfsops.c	Wed Feb 20 10:06:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: null_vfsops.c,v 1.94 2017/04/11 07:51:37 hannken Exp $	*/
+/*	$NetBSD: null_vfsops.c,v 1.95 2019/02/20 10:06:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.94 2017/04/11 07:51:37 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.95 2019/02/20 10:06:00 hannken Exp $");
 
 #include 
 #include 
@@ -146,6 +146,7 @@ nullfs_mount(struct mount *mp, const cha
 	 * that the node create call will work.
 	 */
 	vfs_getnewfsid(mp);
+	mp->mnt_lower = lowerrootvp->v_mount;
 
 	nmp->nullm_size = sizeof(struct null_node);
 	nmp->nullm_tag = VT_NULL;
@@ -175,7 +176,6 @@ nullfs_mount(struct mount *mp, const cha
 	if (error)
 		return error;
 
-	mp->mnt_lower = lowerrootvp->v_mount;
 	if (mp->mnt_lower->mnt_flag & MNT_LOCAL)
 		mp->mnt_flag |= MNT_LOCAL;
 	return 0;

Index: src/sys/miscfs/overlay/overlay_vfsops.c
diff -u src/sys/miscfs/overlay/overlay_vfsops.c:1.67 src/sys/miscfs/overlay/overlay_vfsops.c:1.68
--- src/sys/miscfs/overlay/overlay_vfsops.c:1.67	Tue Apr 11 07:51:37 2017
+++ src/sys/miscfs/overlay/overlay_vfsops.c	Wed Feb 20 10:06:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: overlay_vfsops.c,v 1.67 2017/04/11 07:51:37 hannken Exp $	*/
+/*	$NetBSD: overlay_vfsops.c,v 1.68 2019/02/20 10:06:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.67 2017/04/11 07:51:37 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.68 2019/02/20 10:06:00 hannken Exp $");
 
 #include 
 #include 
@@ -155,6 +155,7 @@ ov_mount(struct mount *mp, const char *p
 	 * that the node create call will work.
 	 */
 	vfs_getnewfsid(mp);
+	mp->mnt_lower = lowerrootvp->v_mount;
 
 	nmp->ovm_size = sizeof (struct overlay_node);
 	nmp->ovm_tag = VT_OVERLAY;
@@ -189,7 +190,6 @@ ov_mount(struct mount *mp, const char *p
 	if (error)
 		return error;
 
-	mp->mnt_lower = lowerrootvp->v_mount;
 	if (mp->mnt_lower->mnt_flag & MNT_LOCAL)
 		mp->mnt_flag |= MNT_LOCAL;
 #ifdef OVERLAYFS_DIAGNOSTIC

Index: src/sys/miscfs/umapfs/umap_vfsops.c
diff -u src/sys/miscfs/umapfs/umap_vfsops.c:1.99 src/sys/miscfs/umapfs/umap_vfsops.c:1.100
--- src/sys/miscfs/umapfs/umap_vfsops.c:1.99	Tue Apr 11 07:51:37 2017
+++ src/sys/miscfs/umapfs/umap_vfsops.c	Wed Feb 20 10:06:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: umap_vfsops.c,v 1.99 2017/04/11 07:51:37 hannken Exp $	*/
+/*	$NetBSD: umap_vfsops.c,v 1.100 2019/02/20 10:06:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.99 2017/04/11 07:51:37 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 

CVS commit: src/sys/kern

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:06:33 UTC 2019

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

Log Message:
Assign vnode to dead_rootmount before vcache_dealloc() releases it.

Now v_mount is never NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/kern/vfs_vnode.c

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

Modified files:

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.101 src/sys/kern/vfs_vnode.c:1.102
--- src/sys/kern/vfs_vnode.c:1.101	Tue Jan  1 10:06:54 2019
+++ src/sys/kern/vfs_vnode.c	Wed Feb 20 10:06:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.101 2019/01/01 10:06:54 hannken Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.102 2019/02/20 10:06:33 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.101 2019/01/01 10:06:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.102 2019/02/20 10:06:33 hannken Exp $");
 
 #include 
 #include 
@@ -1162,6 +1162,8 @@ vcache_dealloc(vnode_impl_t *vip)
 	KASSERT(mutex_owned(_lock));
 
 	vp = VIMPL_TO_VNODE(vip);
+	vfs_ref(dead_rootmount);
+	vfs_insmntque(vp, dead_rootmount);
 	mutex_enter(vp->v_interlock);
 	vp->v_op = dead_vnodeop_p;
 	VSTATE_CHANGE(vp, VS_LOADING, VS_RECLAIMED);



CVS commit: src/sys

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:05:20 UTC 2019

Modified Files:
src/sys/kern: vfs_syscalls.c
src/sys/nfs: nfs_serv.c

Log Message:
Bracket do_sys_renameat() and nfsrv_rename() with fstrans.

The v_mount field for vnodes on the same file system as "from"
is now stable for referenced vnodes.

VFS_RENAMELOCK no longer may use lock from an unreferenced and
freed "struct mount".


To generate a diff of this commit:
cvs rdiff -u -r1.525 -r1.526 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.176 -r1.177 src/sys/nfs/nfs_serv.c

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

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.525 src/sys/kern/vfs_syscalls.c:1.526
--- src/sys/kern/vfs_syscalls.c:1.525	Tue Feb 19 06:55:28 2019
+++ src/sys/kern/vfs_syscalls.c	Wed Feb 20 10:05:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.525 2019/02/19 06:55:28 mlelstv Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.526 2019/02/20 10:05:20 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.525 2019/02/19 06:55:28 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.526 2019/02/20 10:05:20 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -4224,9 +4224,18 @@ do_sys_renameat(struct lwp *l, int fromf
 	 */
 	fdvp = fnd.ni_dvp;
 	fvp = fnd.ni_vp;
+	mp = fdvp->v_mount;
 	KASSERT(fdvp != NULL);
 	KASSERT(fvp != NULL);
 	KASSERT((fdvp == fvp) || (VOP_ISLOCKED(fdvp) == LK_EXCLUSIVE));
+	/*
+	 * Bracket the operation with fstrans_start()/fstrans_done().
+	 *
+	 * Inside the bracket this file system cannot be unmounted so
+	 * a vnode on this file system cannot change its v_mount.
+	 * A vnode on another file system may still change to dead mount.
+	 */
+	fstrans_start(mp);
 
 	/*
 	 * Make sure neither fdvp nor fvp is locked.
@@ -4311,38 +4320,16 @@ do_sys_renameat(struct lwp *l, int fromf
 	}
 
 	/*
-	 * Get the mount point.  If the file system has been unmounted,
-	 * which it may be because we're not holding any vnode locks,
-	 * then v_mount will be NULL.  We're not really supposed to
-	 * read v_mount without holding the vnode lock, but since we
-	 * have fdvp referenced, if fdvp->v_mount changes then at worst
-	 * it will be set to NULL, not changed to another mount point.
-	 * And, of course, since it is up to the file system to
-	 * determine the real lock order, we can't lock both fdvp and
-	 * tdvp at the same time.
-	 */
-	mp = fdvp->v_mount;
-	if (mp == NULL) {
-		error = ENOENT;
-		goto abort1;
-	}
-
-	/*
-	 * Make sure the mount points match.  Again, although we don't
-	 * hold any vnode locks, the v_mount fields may change -- but
-	 * at worst they will change to NULL, so this will never become
-	 * a cross-device rename, because we hold vnode references.
+	 * Make sure the mount points match.  Although we don't hold
+	 * any vnode locks, the v_mount on fdvp file system are stable.
 	 *
-	 * XXX Because nothing is locked and the compiler may reorder
-	 * things here, unmounting the file system at an inopportune
-	 * moment may cause rename to fail with EXDEV when it really
-	 * should fail with ENOENT.
+	 * Unmounting another file system at an inopportune moment may
+	 * cause tdvp to disappear and change its v_mount to dead.
+	 *
+	 * So in either case different v_mount means cross-device rename.
 	 */
+	KASSERT(mp != NULL);
 	tmp = tdvp->v_mount;
-	if (tmp == NULL) {
-		error = ENOENT;
-		goto abort1;
-	}
 
 	if (mp != tmp) {
 		error = EXDEV;
@@ -4497,6 +4484,7 @@ do_sys_renameat(struct lwp *l, int fromf
 	 * destroy the pathbufs.
 	 */
 	VFS_RENAMELOCK_EXIT(mp);
+	fstrans_done(mp);
 	goto out2;
 
 abort3:	if ((tvp != NULL) && (tvp != tdvp))
@@ -4510,6 +4498,7 @@ abort1:	VOP_ABORTOP(tdvp, _cnd);
 abort0:	VOP_ABORTOP(fdvp, _cnd);
 	vrele(fdvp);
 	vrele(fvp);
+	fstrans_done(mp);
 out2:	pathbuf_destroy(tpb);
 out1:	pathbuf_destroy(fpb);
 out0:	return error;

Index: src/sys/nfs/nfs_serv.c
diff -u src/sys/nfs/nfs_serv.c:1.176 src/sys/nfs/nfs_serv.c:1.177
--- src/sys/nfs/nfs_serv.c:1.176	Sun Feb  3 03:19:28 2019
+++ src/sys/nfs/nfs_serv.c	Wed Feb 20 10:05:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_serv.c,v 1.176 2019/02/03 03:19:28 mrg Exp $	*/
+/*	$NetBSD: nfs_serv.c,v 1.177 2019/02/20 10:05:20 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.176 2019/02/03 03:19:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.177 2019/02/20 10:05:20 hannken Exp $");
 
 #include 
 #include 
@@ -64,6 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1957,12 +1958,13 @@ nfsrv_rename(struct nfsrv_descript *nfsd
 		}
 		return (0);
 	}
+	localfs = fromnd.ni_dvp->v_mount;
+	

CVS commit: src/sys/dev/raidframe

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:04:28 UTC 2019

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Fix vnode locking, must lock for VOP_OPEN() and VOP_UNLOCK() when done.


To generate a diff of this commit:
cvs rdiff -u -r1.374 -r1.375 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.374 src/sys/dev/raidframe/rf_netbsdkintf.c:1.375
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.374	Sat Feb  9 03:34:00 2019
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Feb 20 10:04:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.374 2019/02/09 03:34:00 christos Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.375 2019/02/20 10:04:28 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.374 2019/02/09 03:34:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.375 2019/02/20 10:04:28 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2838,6 +2838,7 @@ rf_find_raid_components(void)
 			if (bdevvp(dev, ))
 panic("RAID can't alloc vnode");
 
+			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
 
 			if (error) {
@@ -2858,7 +2859,6 @@ rf_find_raid_components(void)
 	printf("RAIDframe: can't get disk size"
 	" for dev %s (%d)\n",
 	device_xname(dv), error);
-vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 vput(vp);
 continue;
@@ -2870,19 +2870,18 @@ rf_find_raid_components(void)
 if (error) {
 	printf("RAIDframe: can't get wedge info for "
 	"dev %s (%d)\n", device_xname(dv), error);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 
 if (strcmp(dkw.dkw_ptype, DKW_PTYPE_RAIDFRAME) != 0) {
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 	
+VOP_UNLOCK(vp);
 ac_list = rf_get_component(ac_list, dev, vp,
 device_xname(dv), dkw.dkw_size, numsecs, secsize);
 rf_part_found = 1; /*There is a raid component on this disk*/
@@ -2903,7 +2902,6 @@ rf_find_raid_components(void)
 
 			/* don't need this any more.  We'll allocate it again
 			   a little later if we really do... */
-			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 			vput(vp);
 
@@ -2922,12 +2920,14 @@ rf_find_raid_components(void)
 if (bdevvp(dev, ))
 	panic("RAID can't alloc vnode");
 
+vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 error = VOP_OPEN(vp, FREAD, NOCRED);
 if (error) {
 	/* Whatever... */
 	vput(vp);
 	continue;
 }
+VOP_UNLOCK(vp);
 snprintf(cname, sizeof(cname), "%s%c",
 device_xname(dv), 'a' + i);
 ac_list = rf_get_component(ac_list, dev, vp, cname,
@@ -2949,12 +2949,15 @@ rf_find_raid_components(void)
 if (bdevvp(dev, ))
 	panic("RAID can't alloc vnode");
 
+vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+
 error = VOP_OPEN(vp, FREAD, NOCRED);
 if (error) {
 	/* Whatever... */
 	vput(vp);
 	continue;
 }
+VOP_UNLOCK(vp);
 snprintf(cname, sizeof(cname), "%s%c",
 device_xname(dv), 'a' + RAW_PART);
 ac_list = rf_get_component(ac_list, dev, vp, cname,



CVS commit: src/sys/ufs/mfs

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:03:56 UTC 2019

Modified Files:
src/sys/ufs/mfs: mfs_vnops.c

Log Message:
Remove superfluous VOP_UNLOCK(), vnode will be unlocked from spec_reclaim().


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/ufs/mfs/mfs_vnops.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/mfs/mfs_vnops.c
diff -u src/sys/ufs/mfs/mfs_vnops.c:1.58 src/sys/ufs/mfs/mfs_vnops.c:1.59
--- src/sys/ufs/mfs/mfs_vnops.c:1.58	Fri May 26 14:21:02 2017
+++ src/sys/ufs/mfs/mfs_vnops.c	Wed Feb 20 10:03:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mfs_vnops.c,v 1.58 2017/05/26 14:21:02 riastradh Exp $	*/
+/*	$NetBSD: mfs_vnops.c,v 1.59 2019/02/20 10:03:55 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.58 2017/05/26 14:21:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.59 2019/02/20 10:03:55 hannken Exp $");
 
 #include 
 #include 
@@ -297,8 +297,6 @@ mfs_reclaim(void *v)
 	struct mfsnode *mfsp = VTOMFS(vp);
 	int refcnt;
 
-	VOP_UNLOCK(vp);
-
 	mutex_enter(_lock);
 	vp->v_data = NULL;
 	refcnt = --mfsp->mfs_refcnt;



CVS commit: src/sys/dev

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:03:25 UTC 2019

Modified Files:
src/sys/dev: fss.c fssvar.h

Log Message:
Make FSS_ERROR a flag to prevent bogus fscow_disestablish() after error.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/fss.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/fssvar.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/fss.c
diff -u src/sys/dev/fss.c:1.106 src/sys/dev/fss.c:1.107
--- src/sys/dev/fss.c:1.106	Wed Aug 29 09:04:40 2018
+++ src/sys/dev/fss.c	Wed Feb 20 10:03:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.106 2018/08/29 09:04:40 hannken Exp $	*/
+/*	$NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.106 2018/08/29 09:04:40 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $");
 
 #include 
 #include 
@@ -398,8 +398,7 @@ fss_ioctl(dev_t dev, u_long cmd, void *d
 		mutex_enter(>sc_slock);
 		if ((flag & FWRITE) == 0) {
 			error = EPERM;
-		} else if (sc->sc_state != FSS_ACTIVE &&
-		sc->sc_state != FSS_ERROR) {
+		} else if (sc->sc_state != FSS_ACTIVE) {
 			error = EBUSY;
 		} else {
 			sc->sc_state = FSS_DESTROYING;
@@ -509,7 +508,7 @@ fss_error(struct fss_softc *sc, const ch
 
 	KASSERT(mutex_owned(>sc_slock));
 
-	if (sc->sc_state == FSS_ERROR)
+	if ((sc->sc_flags & FSS_ERROR))
 		return;
 
 	aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
@@ -518,7 +517,7 @@ fss_error(struct fss_softc *sc, const ch
 		fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
 		mutex_enter(>sc_slock);
 	}
-	sc->sc_state = FSS_ERROR;
+	sc->sc_flags |= FSS_ERROR;
 }
 
 /*
@@ -944,7 +943,8 @@ fss_delete_snapshot(struct fss_softc *sc
 {
 
 	mutex_enter(>sc_slock);
-	if ((sc->sc_flags & FSS_PERSISTENT) == 0 && sc->sc_state != FSS_ERROR) {
+	if ((sc->sc_flags & FSS_PERSISTENT) == 0 &&
+	(sc->sc_flags & FSS_ERROR) == 0) {
 		mutex_exit(>sc_slock);
 		fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
 	} else {

Index: src/sys/dev/fssvar.h
diff -u src/sys/dev/fssvar.h:1.31 src/sys/dev/fssvar.h:1.32
--- src/sys/dev/fssvar.h:1.31	Wed Aug 29 09:04:40 2018
+++ src/sys/dev/fssvar.h	Wed Feb 20 10:03:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fssvar.h,v 1.31 2018/08/29 09:04:40 hannken Exp $	*/
+/*	$NetBSD: fssvar.h,v 1.32 2019/02/20 10:03:25 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -137,8 +137,7 @@ typedef enum {
 	FSS_IDLE,			/* Device is unconfigured */
 	FSS_CREATING,			/* Device is currently configuring */
 	FSS_ACTIVE,			/* Device is configured */
-	FSS_DESTROYING,			/* Device is currently unconfiguring */
-	FSS_ERROR			/* Device had errors */
+	FSS_DESTROYING			/* Device is currently unconfiguring */
 } fss_state_t;
 
 struct fss_softc {
@@ -148,6 +147,7 @@ struct fss_softc {
 	kcondvar_t	sc_cache_cv;	/* Signals free cache slot */
 	fss_state_t	sc_state;	/* Current state */
 	volatile int	sc_flags;	/* Flags */
+#define FSS_ERROR	0x01		/* Device had errors. */
 #define FSS_BS_THREAD	0x04		/* Kernel thread is running */
 #define FSS_PERSISTENT	0x20		/* File system internal snapshot */
 #define FSS_CDEV_OPEN	0x40		/* character device open */



CVS commit: src/sys/kern

2019-02-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 20 10:02:52 UTC 2019

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

Log Message:
Fix vnode locking for opendisk(), must lock for VOP_OPEN().


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_disk_open.c

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

Modified files:

Index: src/sys/kern/subr_disk_open.c
diff -u src/sys/kern/subr_disk_open.c:1.13 src/sys/kern/subr_disk_open.c:1.14
--- src/sys/kern/subr_disk_open.c:1.13	Tue Dec  8 20:36:15 2015
+++ src/sys/kern/subr_disk_open.c	Wed Feb 20 10:02:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk_open.c,v 1.13 2015/12/08 20:36:15 christos Exp $	*/
+/*	$NetBSD: subr_disk_open.c,v 1.14 2019/02/20 10:02:51 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.13 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.14 2019/02/20 10:02:51 hannken Exp $");
 
 #include 
 #include 
@@ -65,6 +65,7 @@ opendisk(device_t dv)
 	if (bdevvp(dev, ))
 		panic("%s: can't alloc vnode for %s", __func__,
 		device_xname(dv));
+	vn_lock(tmpvn, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_OPEN(tmpvn, FREAD | FSILENT, NOCRED);
 	if (error) {
 		/*



CVS commit: src/sys/kern

2019-02-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Feb 20 09:59:39 UTC 2019

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

Log Message:
compat70_ocreds_valid is not a pointer to a boolean, it is the boolean
itself which controls whether or not we recognize the OCRED options.

Should fix the panic identified in PR kern/53991 (awaiting confirmation
from submitter).


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/kern/uipc_usrreq.c

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

Modified files:

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.190 src/sys/kern/uipc_usrreq.c:1.191
--- src/sys/kern/uipc_usrreq.c:1.190	Mon Feb  4 10:11:34 2019
+++ src/sys/kern/uipc_usrreq.c	Wed Feb 20 09:59:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.190 2019/02/04 10:11:34 mrg Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.191 2019/02/20 09:59:39 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.190 2019/02/04 10:11:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.191 2019/02/20 09:59:39 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -126,6 +126,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.
 #include 
 
 #include 
+#include 
 
 /*
  * Unix communications domain.
@@ -208,7 +209,7 @@ struct mbuf * stub_compat_70_unp_addsock
 	return control;
 }
 
-bool *compat70_ocreds_valid = false;
+bool compat70_ocreds_valid = false;
 
 /*
  * Initialize Unix protocols.
@@ -610,7 +611,7 @@ uipc_ctloutput(int op, struct socket *so
 	case PRCO_SETOPT:
 		switch (sopt->sopt_name) {
 		case LOCAL_OCREDS:
-			if (!*compat70_ocreds_valid)  {
+			if (!compat70_ocreds_valid)  {
 error = ENOPROTOOPT;
 break;
 			}
@@ -664,7 +665,7 @@ uipc_ctloutput(int op, struct socket *so
 			error = sockopt_setint(sopt, optval);
 			break;
 		case LOCAL_OCREDS:
-			if (*compat70_ocreds_valid) {
+			if (compat70_ocreds_valid) {
 optval = OPTBIT(UNP_OWANTCRED);
 error = sockopt_setint(sopt, optval);
 break;



CVS commit: [netbsd-8] src/doc

2019-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 20 09:51:25 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.1

Log Message:
Ticket #1194


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.108 -r1.1.2.109 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.108 src/doc/CHANGES-8.1:1.1.2.109
--- src/doc/CHANGES-8.1:1.1.2.108	Tue Feb 19 15:13:03 2019
+++ src/doc/CHANGES-8.1	Wed Feb 20 09:51:25 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.108 2019/02/19 15:13:03 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.109 2019/02/20 09:51:25 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2500,3 +2500,9 @@ sys/arch/evbppc/obs405/obs600_autoconf.c
 	Fix compile error.
 	[msaitoh, ticket #1193]
 
+sys/dev/usb/if_axen.c1.26
+sys/dev/usb/if_axenreg.h			1.7
+
+	axen(4): improve RX stability and small cosmetic changes.
+	[rin, ticket #1194]
+



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

2019-02-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb 20 09:50:09 UTC 2019

Modified Files:
src/tests/lib/libc/misc: t_ubsan.c

Log Message:
Try to make load_invalid_value_bool portable to Big-Endian

PR bin/53968 by Michael van Elst


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/misc/t_ubsan.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/misc/t_ubsan.c
diff -u src/tests/lib/libc/misc/t_ubsan.c:1.3 src/tests/lib/libc/misc/t_ubsan.c:1.4
--- src/tests/lib/libc/misc/t_ubsan.c:1.3	Mon Feb  4 03:10:33 2019
+++ src/tests/lib/libc/misc/t_ubsan.c	Wed Feb 20 09:50:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ubsan.c,v 1.3 2019/02/04 03:10:33 mrg Exp $	*/
+/*	$NetBSD: t_ubsan.c,v 1.4 2019/02/20 09:50:09 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2018\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ubsan.c,v 1.3 2019/02/04 03:10:33 mrg Exp $");
+__RCSID("$NetBSD: t_ubsan.c,v 1.4 2019/02/20 09:50:09 kamil Exp $");
 
 #include 
 #include 
@@ -295,7 +295,7 @@ UBSAN_TC_HEAD(load_invalid_value_bool, t
 static void
 test_load_invalid_value_bool(void)
 {
-	volatile int a = atoi("10");
+	volatile int a = INT_MAX - atoi("10");
 	volatile bool b = *(REINTERPRET_CAST(volatile bool *, ));
 
 	raise(b ? SIGSEGV : SIGBUS);



CVS commit: [netbsd-8] src/sys/dev/usb

2019-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 20 09:49:49 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-8]: if_axen.c if_axenreg.h

Log Message:
Pull up following revision(s) (requested by rin in ticket #1194):

sys/dev/usb/if_axen.c: revision 1.26
sys/dev/usb/if_axenreg.h: revision 1.7

Remove unused variable in axen_softc.

Drop AXEN_MEDIUM_ALWAYS_ONE (from Linux), which reduces drop erros in RX.


To generate a diff of this commit:
cvs rdiff -u -r1.11.8.6 -r1.11.8.7 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.3.10.2 -r1.3.10.3 src/sys/dev/usb/if_axenreg.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/usb/if_axen.c
diff -u src/sys/dev/usb/if_axen.c:1.11.8.6 src/sys/dev/usb/if_axen.c:1.11.8.7
--- src/sys/dev/usb/if_axen.c:1.11.8.6	Tue Feb 19 15:09:51 2019
+++ src/sys/dev/usb/if_axen.c	Wed Feb 20 09:49:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axen.c,v 1.11.8.6 2019/02/19 15:09:51 martin Exp $	*/
+/*	$NetBSD: if_axen.c,v 1.11.8.7 2019/02/20 09:49:48 martin Exp $	*/
 /*	$OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.11.8.6 2019/02/19 15:09:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.11.8.7 2019/02/20 09:49:48 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -271,9 +271,8 @@ axen_miibus_statchg(struct ifnet *ifp)
 	if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX)
 		val |= AXEN_MEDIUM_FDX;
 
-	val |= (AXEN_MEDIUM_RECV_EN | AXEN_MEDIUM_ALWAYS_ONE);
-	val |= (AXEN_MEDIUM_RXFLOW_CTRL_EN | AXEN_MEDIUM_TXFLOW_CTRL_EN);
-
+	val |= AXEN_MEDIUM_RXFLOW_CTRL_EN | AXEN_MEDIUM_TXFLOW_CTRL_EN |
+	AXEN_MEDIUM_RECV_EN;
 	switch (IFM_SUBTYPE(mii->mii_media_active)) {
 	case IFM_1000_T:
 		val |= AXEN_MEDIUM_GIGA | AXEN_MEDIUM_EN_125MHZ;
@@ -588,9 +587,9 @@ axen_ax88179_init(struct axen_softc *sc)
 	DPRINTF(("axen: Monitor mode = 0x%02x\n", val));
 
 	/* set medium type */
-	ctl = AXEN_MEDIUM_GIGA | AXEN_MEDIUM_FDX | AXEN_MEDIUM_ALWAYS_ONE |
-	  AXEN_MEDIUM_RXFLOW_CTRL_EN | AXEN_MEDIUM_TXFLOW_CTRL_EN;
-	ctl |= AXEN_MEDIUM_RECV_EN;
+	ctl = AXEN_MEDIUM_GIGA | AXEN_MEDIUM_FDX | AXEN_MEDIUM_EN_125MHZ |
+	AXEN_MEDIUM_RXFLOW_CTRL_EN | AXEN_MEDIUM_TXFLOW_CTRL_EN |
+	AXEN_MEDIUM_RECV_EN;
 	wval = htole16(ctl);
 	DPRINTF(("axen: set to medium mode: 0x%04x\n", ctl));
 	axen_cmd(sc, AXEN_CMD_MAC_WRITE2, 2, AXEN_MEDIUM_STATUS, );

Index: src/sys/dev/usb/if_axenreg.h
diff -u src/sys/dev/usb/if_axenreg.h:1.3.10.2 src/sys/dev/usb/if_axenreg.h:1.3.10.3
--- src/sys/dev/usb/if_axenreg.h:1.3.10.2	Tue Feb 19 15:09:51 2019
+++ src/sys/dev/usb/if_axenreg.h	Wed Feb 20 09:49:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axenreg.h,v 1.3.10.2 2019/02/19 15:09:51 martin Exp $	*/
+/*	$NetBSD: if_axenreg.h,v 1.3.10.3 2019/02/20 09:49:48 martin Exp $	*/
 /*	$OpenBSD: if_axenreg.h,v 1.1 2013/10/07 05:37:41 yuo Exp $	*/
 
 /*
@@ -289,7 +289,6 @@ struct axen_softc {
 
 	int			axen_link;
 
-	uint8_t			axen_ipgs[3];
 	int			axen_phyno;
 	struct timeval		axen_rx_notice;
 	struct timeval		axen_tx_notice;



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

2019-02-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb 20 09:25:12 UTC 2019

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

Log Message:
Replace signal4 (PT_STEP) test with refactored ones with extra asserts

New tests: step_signalmasked and step_signalignored.

Assert that signal context is not reset upon PT_STEP trap.

Mark new tests as expecting to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 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.94 src/tests/lib/libc/sys/t_ptrace_wait.c:1.95
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.94	Wed Feb 20 07:18:18 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Wed Feb 20 09:25:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.94 2019/02/20 07:18:18 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.95 2019/02/20 09:25:11 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.94 2019/02/20 07:18:18 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.95 2019/02/20 09:25:11 kamil Exp $");
 
 #include 
 #include 
@@ -3724,7 +3724,7 @@ ACCESS_REGS(access_fpregs2, "fpregs", "s
 
 #if defined(PT_STEP)
 static void
-ptrace_step(int N, int setstep)
+ptrace_step(int N, int setstep, bool masked, bool ignored)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -3733,19 +3733,45 @@ ptrace_step(int N, int setstep)
 	int status;
 #endif
 	int happy;
+	struct sigaction sa;
 	struct ptrace_siginfo info;
+	sigset_t intmask;
+	struct kinfo_proc2 kp;
+	size_t len = sizeof(kp);
+
+	int name[6];
+	const size_t namelen = __arraycount(name);
+	ki_sigset_t kp_sigmask;
+	ki_sigset_t kp_sigignore;
 
 #if defined(__arm__)
 	/* PT_STEP not supported on arm 32-bit */
 	atf_tc_expect_fail("PR kern/52119");
 #endif
 
+	if (masked || ignored)
+		atf_tc_expect_fail("Unexpected sigmask reset on crash under "
+		"debugger");
+
 	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);
 
+		if (masked) {
+			sigemptyset();
+			sigaddset(, SIGTRAP);
+			sigprocmask(SIG_BLOCK, , NULL);
+		}
+
+		if (ignored) {
+			memset(, 0, sizeof(sa));
+			sa.sa_handler = SIG_IGN;
+			sigemptyset(_mask);
+			FORKEE_ASSERT(sigaction(SIGTRAP, , NULL) != -1);
+		}
+
 		happy = check_happy(999);
 
 		DPRINTF("Before raising %s from child\n", strsignal(sigval));
@@ -3771,6 +3797,21 @@ ptrace_step(int N, int setstep)
 	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
 	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
 
+	name[0] = CTL_KERN,
+	name[1] = KERN_PROC2,
+	name[2] = KERN_PROC_PID;
+	name[3] = child;
+	name[4] = sizeof(kp);
+	name[5] = 1;
+
+	FORKEE_ASSERT_EQ(sysctl(name, namelen, , , NULL, 0), 0);
+
+	if (masked)
+		kp_sigmask = kp.p_sigmask;
+
+	if (ignored)
+		kp_sigignore = kp.p_sigignore;
+
 	while (N --> 0) {
 		if (setstep) {
 			DPRINTF("Before resuming the child process where it "
@@ -3804,6 +3845,42 @@ ptrace_step(int N, int setstep)
 		if (setstep) {
 			SYSCALL_REQUIRE(ptrace(PT_CLEARSTEP, child, 0, 0) != -1);
 		}
+
+		ATF_REQUIRE_EQ(sysctl(name, namelen, , , NULL, 0), 0);
+
+		if (masked) {
+			DPRINTF("kp_sigmask="
+			"%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02"
+			PRIx32 "\n",
+			kp_sigmask.__bits[0], kp_sigmask.__bits[1],
+			kp_sigmask.__bits[2], kp_sigmask.__bits[3]);
+
+			DPRINTF("kp.p_sigmask="
+			"%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02"
+			PRIx32 "\n",
+			kp.p_sigmask.__bits[0], kp.p_sigmask.__bits[1],
+			kp.p_sigmask.__bits[2], kp.p_sigmask.__bits[3]);
+
+			ATF_REQUIRE(!memcmp(_sigmask, _sigmask,
+			sizeof(kp_sigmask)));
+		}
+
+		if (ignored) {
+			DPRINTF("kp_sigignore="
+			"%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02"
+			PRIx32 "\n",
+			kp_sigignore.__bits[0], kp_sigignore.__bits[1],
+			kp_sigignore.__bits[2], kp_sigignore.__bits[3]);
+
+			DPRINTF("kp.p_sigignore="
+			"%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02"
+			PRIx32 "\n",
+			kp.p_sigignore.__bits[0], kp.p_sigignore.__bits[1],
+			kp.p_sigignore.__bits[2], kp.p_sigignore.__bits[3]);
+
+			ATF_REQUIRE(!memcmp(_sigignore, _sigignore,
+			sizeof(kp_sigignore)));
+		}
 	}
 
 	DPRINTF("Before resuming the child process where it left off and "
@@ -3830,7 +3907,7 @@ ATF_TC_HEAD(test, tc)			\
 ATF_TC_BODY(test, tc)			\
 {	\
 	\
-ptrace_step(N, setstep);	\
+ptrace_step(N, setstep, false, false);\
 }
 
 PTRACE_STEP(step1, 1, 0)
@@ -3841,6 +3918,30 @@ PTRACE_STEP(setstep1, 1, 1)
 PTRACE_STEP(setstep2, 2, 1)
 

CVS commit: src/sys/dev/pci

2019-02-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 20 08:03:58 UTC 2019

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

Log Message:
 Simplify PCI device table. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/dev/pci/if_bge.c

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.324 src/sys/dev/pci/if_bge.c:1.325
--- src/sys/dev/pci/if_bge.c:1.324	Wed Feb 20 04:49:08 2019
+++ src/sys/dev/pci/if_bge.c	Wed Feb 20 08:03:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.324 2019/02/20 04:49:08 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.325 2019/02/20 08:03:58 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.324 2019/02/20 04:49:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.325 2019/02/20 08:03:58 msaitoh Exp $");
 
 #include 
 #include 
@@ -297,375 +297,107 @@ void		bge_debug_info(struct bge_softc *)
 #define	BGE_EVCNT_UPD(ev, val)	/* nothing */
 #endif
 
+#define VIDDID(a, b) PCI_VENDOR_ ## a, PCI_PRODUCT_ ## a ## _ ## b
+/*
+ * The BCM5700 documentation seems to indicate that the hardware still has the
+ * Alteon vendor ID burned into it, though it should always be overridden by
+ * the value in the EEPROM.  We'll check for it anyway.
+ */
 static const struct bge_product {
 	pci_vendor_id_t		bp_vendor;
 	pci_product_id_t	bp_product;
 	const char		*bp_name;
 } bge_products[] = {
-	/*
-	 * The BCM5700 documentation seems to indicate that the hardware
-	 * still has the Alteon vendor ID burned into it, though it
-	 * should always be overridden by the value in the EEPROM.  We'll
-	 * check for it anyway.
-	 */
-	{ PCI_VENDOR_ALTEON,
-	  PCI_PRODUCT_ALTEON_BCM5700,
-	  "Broadcom BCM5700 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_ALTEON,
-	  PCI_PRODUCT_ALTEON_BCM5701,
-	  "Broadcom BCM5701 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC1000,
-	  "Altima AC1000 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC1001,
-	  "Altima AC1001 Gigabit Ethernet",
-	   },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC1003,
-	  "Altima AC1003 Gigabit Ethernet",
-	   },
-	{ PCI_VENDOR_ALTIMA,
-	  PCI_PRODUCT_ALTIMA_AC9100,
-	  "Altima AC9100 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_APPLE,
-	  PCI_PRODUCT_APPLE_BCM5701,
-	  "APPLE BCM5701 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5700,
-	  "Broadcom BCM5700 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5701,
-	  "Broadcom BCM5701 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5702,
-	  "Broadcom BCM5702 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5702X,
-	  "Broadcom BCM5702X Gigabit Ethernet" },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5703,
-	  "Broadcom BCM5703 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5703X,
-	  "Broadcom BCM5703X Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5703_ALT,
-	  "Broadcom BCM5703 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5704C,
-	  "Broadcom BCM5704C Dual Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5704S,
-	  "Broadcom BCM5704S Dual Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705,
-	  "Broadcom BCM5705 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705F,
-	  "Broadcom BCM5705F Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705K,
-	  "Broadcom BCM5705K Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705M,
-	  "Broadcom BCM5705M Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5705M_ALT,
-	  "Broadcom BCM5705M Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5714,
-	  "Broadcom BCM5714 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5714S,
-	  "Broadcom BCM5714S Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5715,
-	  "Broadcom BCM5715 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5715S,
-	  "Broadcom BCM5715S Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5717,
-	  "Broadcom BCM5717 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5717C,
-	  "Broadcom BCM5717 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5718,
-	  "Broadcom BCM5718 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-	  PCI_PRODUCT_BROADCOM_BCM5719,
-	  "Broadcom BCM5719 Gigabit Ethernet",
-	  },
-	{ PCI_VENDOR_BROADCOM,
-