CVS commit: [netbsd-6] src/sys/compat/netbsd32

2016-04-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 21 15:20:17 UTC 2016

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_socket.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1378):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.42
Memory leak, triggerable from an unprivileged user.


To generate a diff of this commit:
cvs rdiff -u -r1.39.2.2 -r1.39.2.3 src/sys/compat/netbsd32/netbsd32_socket.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_socket.c
diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.39.2.2 src/sys/compat/netbsd32/netbsd32_socket.c:1.39.2.3
--- src/sys/compat/netbsd32/netbsd32_socket.c:1.39.2.2	Sat Aug 18 22:01:40 2012
+++ src/sys/compat/netbsd32/netbsd32_socket.c	Thu Apr 21 15:20:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_socket.c,v 1.39.2.2 2012/08/18 22:01:40 riz Exp $	*/
+/*	$NetBSD: netbsd32_socket.c,v 1.39.2.3 2016/04/21 15:20:17 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.39.2.2 2012/08/18 22:01:40 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.39.2.3 2016/04/21 15:20:17 martin Exp $");
 
 #include 
 #include 
@@ -331,7 +331,7 @@ netbsd32_sendmsg(struct lwp *l, const st
 	} */
 	struct msghdr msg;
 	struct netbsd32_msghdr msg32;
-	struct iovec aiov[UIO_SMALLIOV], *iov;
+	struct iovec aiov[UIO_SMALLIOV], *iov = aiov;
 	struct netbsd32_iovec *iov32;
 	size_t iovsz;
 	int error;
@@ -346,6 +346,7 @@ netbsd32_sendmsg(struct lwp *l, const st
 		error = copyin32_msg_control(l, &msg);
 		if (error)
 			return (error);
+		/* From here on, msg.msg_control is allocated */
 	} else {
 		msg.msg_control = NULL;
 		msg.msg_controllen = 0;
@@ -353,23 +354,32 @@ netbsd32_sendmsg(struct lwp *l, const st
 
 	iovsz = msg.msg_iovlen * sizeof(struct iovec);
 	if ((u_int)msg.msg_iovlen > UIO_SMALLIOV) {
-		if ((u_int)msg.msg_iovlen > IOV_MAX)
-			return (EMSGSIZE);
+		if ((u_int)msg.msg_iovlen > IOV_MAX) {
+			error = EMSGSIZE;
+			goto out;
+		}
 		iov = kmem_alloc(iovsz, KM_SLEEP);
-	} else
-		iov = aiov;
+	}
 
 	iov32 = NETBSD32PTR64(msg32.msg_iov);
 	error = netbsd32_to_iovecin(iov32, iov, msg.msg_iovlen);
 	if (error)
-		goto done;
+		goto out;
 	msg.msg_iov = iov;
 
 	error = do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
-done:
+	/* msg.msg_control freed by do_sys_sendmsg() */
+
 	if (iov != aiov)
 		kmem_free(iov, iovsz);
 	return (error);
+
+out:
+	if (iov != aiov)
+		kmem_free(iov, iovsz);
+	if (msg.msg_control)
+		m_free(msg.msg_control);
+	return error;
 }
 
 int



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2015-08-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug  2 12:50:48 UTC 2015

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_ioctl.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1318):
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82
Wrong logic. Here, userland can control the size and the data copied, which
basically means it can overflow kernel memory.
ok martin@ christos@


To generate a diff of this commit:
cvs rdiff -u -r1.64.8.1 -r1.64.8.2 src/sys/compat/netbsd32/netbsd32_ioctl.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_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.8.2
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.8.1	Tue Mar 18 07:18:22 2014
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Sun Aug  2 12:50:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.64.8.1 2014/03/18 07:18:22 msaitoh Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.64.8.2 2015/08/02 12:50:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.8.1 2014/03/18 07:18:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.8.2 2015/08/02 12:50:48 martin Exp $");
 
 #include 
 #include 
@@ -193,7 +193,7 @@ netbsd32_to_if_addrprefreq(const struct 
 	strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name));
 	ifap->ifap_preference = ifap32->ifap_preference;
 	memcpy(&ifap->ifap_addr, &ifap32->ifap_addr,
-	max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE));
+	min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE));
 }
 
 static inline void
@@ -443,7 +443,7 @@ netbsd32_from_if_addrprefreq(const struc
 	strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name));
 	ifap32->ifap_preference = ifap->ifap_preference;
 	memcpy(&ifap32->ifap_addr, &ifap->ifap_addr,
-	max(ifap->ifap_addr.ss_len, _SS_MAXSIZE));
+	min(ifap->ifap_addr.ss_len, _SS_MAXSIZE));
 }
 
 static inline void



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2014-12-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 14 13:59:09 UTC 2014

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_compat_30.c

Log Message:
Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.14.1 src/sys/compat/netbsd32/netbsd32_compat_30.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_30.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_30.c:1.30 src/sys/compat/netbsd32/netbsd32_compat_30.c:1.30.14.1
--- src/sys/compat/netbsd32/netbsd32_compat_30.c:1.30	Fri Apr 23 15:19:20 2010
+++ src/sys/compat/netbsd32/netbsd32_compat_30.c	Sun Dec 14 13:59:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_30.c,v 1.30 2010/04/23 15:19:20 rmind Exp $	*/
+/*	$NetBSD: netbsd32_compat_30.c,v 1.30.14.1 2014/12/14 13:59:08 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.30 2010/04/23 15:19:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.30.14.1 2014/12/14 13:59:08 martin Exp $");
 
 #include 
 #include 
@@ -78,6 +78,9 @@ compat_30_netbsd32_getdents(struct lwp *
 		error = EBADF;
 		goto out;
 	}
+	if (count == 0)
+		goto out;
+
 	buf = kmem_alloc(count, KM_SLEEP);
 	error = vn_readdir(fp, buf, UIO_SYSSPACE, count, &done, l, 0, 0);
 	if (error == 0) {



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2014-11-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Nov  9 07:09:17 UTC 2014

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_compat_50.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1179):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.28
fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.


To generate a diff of this commit:
cvs rdiff -u -r1.20.6.1 -r1.20.6.2 \
src/sys/compat/netbsd32/netbsd32_compat_50.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_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.20.6.1 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.20.6.2
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.20.6.1	Mon Jun 30 12:09:40 2014
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Sun Nov  9 07:09:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.20.6.1 2014/06/30 12:09:40 msaitoh Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.20.6.2 2014/11/09 07:09:17 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.20.6.1 2014/06/30 12:09:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.20.6.2 2014/11/09 07:09:17 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -248,30 +248,31 @@ compat_50_netbsd32_adjtime(struct lwp *l
 		return (error);
 
 	if (SCARG_P32(uap, olddelta)) {
+		mutex_spin_enter(&timecounter_lock);
 		atv.tv_sec = time_adjtime / 100;
 		atv.tv_usec = time_adjtime % 100;
 		if (atv.tv_usec < 0) {
 			atv.tv_usec += 100;
 			atv.tv_sec--;
 		}
-		(void) copyout(&atv,
-			   SCARG_P32(uap, olddelta), 
-			   sizeof(atv));
+		mutex_spin_exit(&timecounter_lock);
+
+		error = copyout(&atv, SCARG_P32(uap, olddelta), sizeof(atv));
 		if (error)
 			return (error);
 	}
 	
 	if (SCARG_P32(uap, delta)) {
-		error = copyin(SCARG_P32(uap, delta), &atv,
-			   sizeof(struct timeval));
+		error = copyin(SCARG_P32(uap, delta), &atv, sizeof(atv));
 		if (error)
 			return (error);
 
+		mutex_spin_enter(&timecounter_lock);
 		time_adjtime = (int64_t)atv.tv_sec * 100 + atv.tv_usec;
-
 		if (time_adjtime)
 			/* We need to save the system time during shutdown */
 			time_adjusted |= 1;
+		mutex_spin_exit(&timecounter_lock);
 	}
 
 	return 0;



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2014-06-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 30 12:09:40 UTC 2014

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_compat_50.c
netbsd32_event.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1090):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.24
sys/compat/netbsd32/netbsd32_event.c: revision 1.11
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.9.10.1 -r1.9.10.2 src/sys/compat/netbsd32/netbsd32_event.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_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.20 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.20.6.1
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.20	Fri Nov 18 03:34:13 2011
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Mon Jun 30 12:09:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.20 2011/11/18 03:34:13 christos Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.20.6.1 2014/06/30 12:09:40 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.20 2011/11/18 03:34:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.20.6.1 2014/06/30 12:09:40 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -631,7 +631,8 @@ compat_50_netbsd32_kevent(struct lwp *l,
 
 	nchanges = SCARG(uap, nchanges);
 	nevents = SCARG(uap, nevents);
-	maxalloc = MIN(KQ_NEVENTS, MAX(nchanges, nevents));
+	maxalloc = KQ_NEVENTS;
+
 	netbsd32_kevent_ops.keo_private =
 	kmem_alloc(maxalloc * sizeof(struct netbsd32_kevent), KM_SLEEP);
 

Index: src/sys/compat/netbsd32/netbsd32_event.c
diff -u src/sys/compat/netbsd32/netbsd32_event.c:1.9.10.1 src/sys/compat/netbsd32/netbsd32_event.c:1.9.10.2
--- src/sys/compat/netbsd32/netbsd32_event.c:1.9.10.1	Tue Mar 18 08:01:34 2014
+++ src/sys/compat/netbsd32/netbsd32_event.c	Mon Jun 30 12:09:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_event.c,v 1.9.10.1 2014/03/18 08:01:34 msaitoh Exp $	*/
+/*	$NetBSD: netbsd32_event.c,v 1.9.10.2 2014/06/30 12:09:40 msaitoh Exp $	*/
 
 /*
  *  Copyright (c) 2005 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_event.c,v 1.9.10.1 2014/03/18 08:01:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_event.c,v 1.9.10.2 2014/06/30 12:09:40 msaitoh Exp $");
 
 #include 
 #include 
@@ -112,7 +112,8 @@ netbsd32___kevent50(struct lwp *l,
 
 	nchanges = SCARG(uap, nchanges);
 	nevents = SCARG(uap, nevents);
-	maxalloc = MIN(KQ_NEVENTS, MAX(nchanges, nevents));
+	maxalloc = KQ_NEVENTS;
+
 	netbsd32_kevent_ops.keo_private =
 	kmem_alloc(maxalloc * sizeof(struct netbsd32_kevent), KM_SLEEP);
 



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2014-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 03:28:47 UTC 2014

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_netbsd.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1084):
sys/compat/netbsd32/netbsd32_netbsd.c   rev. 1.187

Fix cases where count <= 0 (thanks to Maxime Villard for raising this).


To generate a diff of this commit:
cvs rdiff -u -r1.179.2.1 -r1.179.2.2 \
src/sys/compat/netbsd32/netbsd32_netbsd.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_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.179.2.1 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.179.2.2
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.179.2.1	Tue Mar 18 08:09:46 2014
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Thu Jun 26 03:28:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.179.2.1 2014/03/18 08:09:46 msaitoh Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.179.2.2 2014/06/26 03:28:47 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.179.2.1 2014/03/18 08:09:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.179.2.2 2014/06/26 03:28:47 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -1740,6 +1740,12 @@ netbsd32_swapctl_stats(struct lwp *l, st
 	int i, error = 0;
 	size_t ksep_len;
 
+	if (count < 0)
+		return EINVAL;
+
+	if (count == 0 || uvmexp.nswapdev == 0)
+		return 0;
+
 	/* Make sure userland cannot exhaust kernel memory */
 	if ((size_t)count > (size_t)uvmexp.nswapdev)
 		count = uvmexp.nswapdev;
@@ -1751,9 +1757,6 @@ netbsd32_swapctl_stats(struct lwp *l, st
 	uvm_swap_stats(SWAP_STATS, ksep, count, retval);
 	count = *retval;
 
-	if (count < 1)
-		goto out;
-
 	for (i = 0; i < count; i++) {
 		se32.se_dev = ksep[i].se_dev;
 		se32.se_flags = ksep[i].se_flags;
@@ -1768,8 +1771,6 @@ netbsd32_swapctl_stats(struct lwp *l, st
 			break;
 	}
 
-	
-out:
 	kmem_free(ksep, ksep_len);
 
 	return error;



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2014-03-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar 18 08:01:34 UTC 2014

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_event.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1021):
sys/compat/netbsd32/netbsd32_event.c: revision 1.10
Fix netbsd32 compatibility bug in kevent().

The keo_put_events() callback copies the events from kernel to userland.
It is called for sets of up to 8 events (constant chosen in kevbuf
definitition in kevent1()). The callback is called with pointer to
userland buffer, count of events to copy, and an index parameter which tracks
where we are in userland buffer when called multiple time.
COMPAT_NETBSD32's flavor of keo_put_events() is
netbsd32_kevent_put_events(). It did not honour the index parameter, which
caused invalid event data to be returned when userland requested more that 8
events. This caused many reliability problems, and the obvious startup crash
of dovecot log process when it accessed udata in the nineth event in its
buffer, which was NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.10.1 src/sys/compat/netbsd32/netbsd32_event.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_event.c
diff -u src/sys/compat/netbsd32/netbsd32_event.c:1.9 src/sys/compat/netbsd32/netbsd32_event.c:1.9.10.1
--- src/sys/compat/netbsd32/netbsd32_event.c:1.9	Mon May 23 21:34:47 2011
+++ src/sys/compat/netbsd32/netbsd32_event.c	Tue Mar 18 08:01:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_event.c,v 1.9 2011/05/23 21:34:47 joerg Exp $	*/
+/*	$NetBSD: netbsd32_event.c,v 1.9.10.1 2014/03/18 08:01:34 msaitoh Exp $	*/
 
 /*
  *  Copyright (c) 2005 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_event.c,v 1.9 2011/05/23 21:34:47 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_event.c,v 1.9.10.1 2014/03/18 08:01:34 msaitoh Exp $");
 
 #include 
 #include 
@@ -86,7 +86,7 @@ netbsd32_kevent_put_events(void *private
 
 	for (i = 0, kev32 = events32; i < n; i++, kev32++, events++)
 		netbsd32_from_kevent(events, kev32);
-	kev32 = (struct netbsd32_kevent *)eventlist;
+	kev32 = ((struct netbsd32_kevent *)eventlist) + index;
 	return  copyout(events32, kev32, n * sizeof(*events32));
 }
 



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2014-03-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar 18 07:18:22 UTC 2014

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Pull up following revision(s) (requested by manu in ticket #1022):
sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.44
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.68
Add ATAIOCCOMMAND ioctl form COMPAT_NETBSD32
This enables SMART monitoring by a netbsd32 binary.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.64.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.41 -r1.41.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.8.1
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64	Thu Oct  6 03:19:32 2011
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Tue Mar 18 07:18:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.64.8.1 2014/03/18 07:18:22 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.8.1 2014/03/18 07:18:22 msaitoh Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioc
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -243,6 +244,23 @@ netbsd32_to_sioc_sg_req(struct netbsd32_
 }
 
 static inline void
+netbsd32_to_atareq(struct netbsd32_atareq *s32p, struct atareq *p, u_long cmd)
+{
+	p->flags = (u_long)s32p->flags;
+	p->command = s32p->command;
+	p->features = s32p->features;
+	p->sec_count = s32p->sec_count;
+	p->sec_num = s32p->sec_num;
+	p->head = s32p->head;
+	p->cylinder = s32p->cylinder;
+	p->databuf =  (char *)NETBSD32PTR64(s32p->databuf);
+	p->datalen = (u_long)s32p->datalen;
+	p->timeout = s32p->timeout;
+	p->retsts = s32p->retsts;
+	p->error = s32p->error;
+}
+
+static inline void
 netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p, struct vnd_ioctl *p, u_long cmd)
 {
 
@@ -482,6 +500,23 @@ netbsd32_from_sioc_sg_req(struct sioc_sg
 }
 
 static inline void
+netbsd32_from_atareq(struct atareq *p, struct netbsd32_atareq *s32p, u_long cmd)
+{
+	s32p->flags = (netbsd32_u_long)p->flags;
+	s32p->command = p->command;
+	s32p->features = p->features;
+	s32p->sec_count = p->sec_count;
+	s32p->sec_num = p->sec_num;
+	s32p->head = p->head;
+	s32p->cylinder = p->cylinder;
+	NETBSD32PTR32(s32p->databuf, p->databuf);
+	s32p->datalen = (netbsd32_u_long)p->datalen;
+	s32p->timeout = p->timeout;
+	s32p->retsts = p->retsts;
+	s32p->error = p->error;
+}
+
+static inline void
 netbsd32_from_vnd_ioctl(struct vnd_ioctl *p, struct netbsd32_vnd_ioctl *s32p, u_long cmd)
 {
 
@@ -783,6 +818,9 @@ netbsd32_ioctl(struct lwp *l, const stru
 		IOCTL_STRUCT_CONV_TO(DIOCWFORMAT, format_op);
 #endif
 
+	case ATAIOCCOMMAND32:
+		IOCTL_STRUCT_CONV_TO(ATAIOCCOMMAND, atareq);
+
 /*
  * only a few ifreq syscalls need conversion and those are
  * all driver specific... XXX

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.41 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.41.8.1
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.41	Wed Sep 28 01:46:39 2011
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Tue Mar 18 07:18:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.41 2011/09/28 01:46:39 macallan Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.41.8.1 2014/03/18 07:18:22 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -90,6 +90,24 @@ struct netbsd32_format_op {
 #define DIOCWFORMAT32	_IOWR('d', 106, struct netbsd32_format_op)
 #endif
 
+/* from  */
+struct netbsd32_atareq {
+	netbsd32_u_long		flags;
+	u_char			command;
+	u_char			features;
+	u_char			sec_count;
+	u_char			sec_num;
+	u_char			head;
+	u_short			cylinder;
+	netbsd32_voidp		databuf;
+	netbsd32_u_long		datalen;
+	int			timeout;
+	u_char			retsts;
+	u_char			error;
+};
+#define ATAIOCCOMMAND32		_IOWR('Q', 8, struct netbsd32_atareq)
+
+
 /* from  */
 struct netbsd32_bpf_program {
 	u_int bf_len;



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2013-02-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Feb  8 20:45:50 UTC 2013

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_execve.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #793):
sys/compat/netbsd32/netbsd32_execve.c: revision 1.37
netbsd32_posix_spawn_fa_alloc: use the right length for path allocation.
This error lead to memory pool corruption when freeing kmem with wrong size.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/sys/compat/netbsd32/netbsd32_execve.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_execve.c
diff -u src/sys/compat/netbsd32/netbsd32_execve.c:1.33.2.1 src/sys/compat/netbsd32/netbsd32_execve.c:1.33.2.2
--- src/sys/compat/netbsd32/netbsd32_execve.c:1.33.2.1	Thu Apr 12 17:05:38 2012
+++ src/sys/compat/netbsd32/netbsd32_execve.c	Fri Feb  8 20:45:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_execve.c,v 1.33.2.1 2012/04/12 17:05:38 riz Exp $	*/
+/*	$NetBSD: netbsd32_execve.c,v 1.33.2.2 2013/02/08 20:45:50 riz Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.33.2.1 2012/04/12 17:05:38 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.33.2.2 2013/02/08 20:45:50 riz Exp $");
 
 #include 
 #include 
@@ -141,7 +141,7 @@ netbsd32_posix_spawn_fa_alloc(struct pos
 		MAXPATHLEN, &slen);
 		if (error)
 			goto out;
-		fae->fae_path = kmem_alloc(fal, KM_SLEEP);
+		fae->fae_path = kmem_alloc(slen, KM_SLEEP);
 		memcpy(fae->fae_path, pbuf, slen);
 		fae->fae_oflag = f32->fae_oflag;
 		fae->fae_mode = f32->fae_mode;



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2012-12-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Dec 17 00:31:29 UTC 2012

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_fs.c

Log Message:
Pull up following revision(s) (requested by matt in ticket #756):
sys/compat/netbsd32/netbsd32_fs.c: revision 1.64
Fix inverted error check.


To generate a diff of this commit:
cvs rdiff -u -r1.62.2.1 -r1.62.2.2 src/sys/compat/netbsd32/netbsd32_fs.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_fs.c
diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.62.2.1 src/sys/compat/netbsd32/netbsd32_fs.c:1.62.2.2
--- src/sys/compat/netbsd32/netbsd32_fs.c:1.62.2.1	Thu Dec 13 23:47:57 2012
+++ src/sys/compat/netbsd32/netbsd32_fs.c	Mon Dec 17 00:31:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_fs.c,v 1.62.2.1 2012/12/13 23:47:57 riz Exp $	*/
+/*	$NetBSD: netbsd32_fs.c,v 1.62.2.2 2012/12/17 00:31:29 riz Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.62.2.1 2012/12/13 23:47:57 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.62.2.2 2012/12/17 00:31:29 riz Exp $");
 
 #include 
 #include 
@@ -597,7 +597,7 @@ netbsd32___fhstat50(struct lwp *l, const
 	int error;
 
 	error = do_fhstat(l, SCARG_P32(uap, fhp), SCARG(uap, fh_size), &sb);
-	if (error != 0) {
+	if (error == 0) {
 		netbsd32_from_stat(&sb, &sb32);
 		error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb));
 	}



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2012-12-13 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec 13 23:47:57 UTC 2012

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32.h netbsd32_fs.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #742):
sys/compat/netbsd32/netbsd32.h: revision 1.94
sys/compat/netbsd32/netbsd32_fs.c: revision 1.63
allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


To generate a diff of this commit:
cvs rdiff -u -r1.92.2.1 -r1.92.2.2 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.62 -r1.62.2.1 src/sys/compat/netbsd32/netbsd32_fs.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.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.92.2.1 src/sys/compat/netbsd32/netbsd32.h:1.92.2.2
--- src/sys/compat/netbsd32/netbsd32.h:1.92.2.1	Thu Apr 12 17:05:37 2012
+++ src/sys/compat/netbsd32/netbsd32.h	Thu Dec 13 23:47:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.92.2.1 2012/04/12 17:05:37 riz Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.92.2.2 2012/12/13 23:47:57 riz Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -938,6 +938,19 @@ struct netbsd32_nfs_args {
 	int32_t		deadthresh;	/* Retrans threshold */
 	netbsd32_charp	hostname;	/* server's name */
 };
+struct netbsd32_msdosfs_args {
+	netbsd32_charp	fspec;		/* blocks special holding the fs to mount */
+	struct	netbsd32_export_args30 _pad1; /* compat with old userland tools */
+	uid_t	uid;		/* uid that owns msdosfs files */
+	gid_t	gid;		/* gid that owns msdosfs files */
+	mode_t  mask;		/* mask to be applied for msdosfs perms */
+	int	flags;		/* see below */
+
+	/* Following items added after versioning support */
+	int	version;	/* version of the struct */
+	mode_t  dirmask;	/* v2: mask to be applied for msdosfs perms */
+	int	gmtoff;		/* v3: offset from UTC in seconds */
+};
 
 struct netbsd32_posix_spawn_file_actions_entry {
 	enum { FAE32_OPEN, FAE32_DUP2, FAE32_CLOSE } fae_action;

Index: src/sys/compat/netbsd32/netbsd32_fs.c
diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.62 src/sys/compat/netbsd32/netbsd32_fs.c:1.62.2.1
--- src/sys/compat/netbsd32/netbsd32_fs.c:1.62	Wed Jan 25 14:06:07 2012
+++ src/sys/compat/netbsd32/netbsd32_fs.c	Thu Dec 13 23:47:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_fs.c,v 1.62 2012/01/25 14:06:07 christos Exp $	*/
+/*	$NetBSD: netbsd32_fs.c,v 1.62.2.1 2012/12/13 23:47:57 riz Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.62 2012/01/25 14:06:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.62.2.1 2012/12/13 23:47:57 riz Exp $");
 
 #include 
 #include 
@@ -50,6 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.
 #include 
 
 #include 
+#include 
+#include 
 #include 
 
 #define NFS_ARGS_ONLY
@@ -774,12 +776,14 @@ netbsd32___mount50(struct lwp *l, const 
 		struct netbsd32_mfs_args mfs_args;
 		struct netbsd32_iso_args iso_args;
 		struct netbsd32_nfs_args nfs_args;
+		struct netbsd32_msdosfs_args msdosfs_args;
 	} fs_args32;
 	union {
 		struct ufs_args ufs_args;
 		struct mfs_args mfs_args;
 		struct iso_args iso_args;
 		struct nfs_args nfs_args;
+		struct msdosfs_args msdosfs_args;
 	} fs_args;
 	const char *type = SCARG_P32(uap, type);
 	const char *path = SCARG_P32(uap, path);
@@ -812,7 +816,9 @@ netbsd32___mount50(struct lwp *l, const 
 		data_seg = UIO_SYSSPACE;
 		data = &fs_args.mfs_args;
 		data_len = sizeof(fs_args.mfs_args);
-	} else if (strcmp(mtype, MOUNT_UFS) == 0) {
+	} else if ((strcmp(mtype, MOUNT_UFS) == 0) ||
+		   (strcmp(mtype, MOUNT_EXT2FS) == 0) ||
+		   (strcmp(mtype, MOUNT_LFS) == 0)) {
 		if (data_len > sizeof(fs_args32.ufs_args))
 			return EINVAL;
 		if ((flags & MNT_GETARGS) == 0) {
@@ -843,6 +849,36 @@ netbsd32___mount50(struct lwp *l, const 
 		data_seg = UIO_SYSSPACE;
 		data = &fs_args.iso_args;
 		data_len = sizeof(fs_args.iso_args);
+	} else if (strcmp(mtype, MOUNT_MSDOS) == 0) {
+		if (data_len != sizeof(fs_args32.msdosfs_args))
+			return EINVAL;
+		if ((flags & MNT_GETARGS) == 0) {
+			error = copyin(data, &fs_args32.msdosfs_args, 
+			sizeof(fs_args32.msdosfs_args));
+			if (error)
+return error;
+			fs_args.msdosfs_args.fspec =
+			NETBSD32PTR64(fs_args32.msdosfs_args.fspec);
+			memset(&fs_args.msdosfs_args._pad1, 0,
+			sizeof(fs_args.msdosfs_args._pad1));
+			fs_args.msdosfs_args.uid =
+			fs_args32.msdosfs_args.uid;
+			fs_args.msdosfs_args.gid =
+			fs_args32.msdosfs_args.gid;
+			fs_args.msdosfs_args.mask =
+			fs_args32.msdosfs_args.mask;
+			fs_args.msdosfs_args.flags =
+			fs_args32.msdosfs_args.flags;
+			fs_args.msdosfs_args.version =
+			fs_args32.msdosfs_args.version;
+			fs_args.msdosfs_args.dirmask =
+			fs_args32.msdosfs_args.dirmask;
+			fs_args.msdosfs_args.gmtoff =
+			fs_args32.msdosfs_args.gmtoff;

CVS commit: [netbsd-6] src/sys/compat/netbsd32

2012-08-18 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Aug 18 22:01:41 UTC 2012

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_socket.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #510):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.41
Do not use a userland pointer, but the copied-in kernel version instead.
While there, reorder loop end condition for efficency.
Fixes net/fdpass tests on all archs with separate kernel/userland VA.


To generate a diff of this commit:
cvs rdiff -u -r1.39.2.1 -r1.39.2.2 src/sys/compat/netbsd32/netbsd32_socket.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_socket.c
diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.39.2.1 src/sys/compat/netbsd32/netbsd32_socket.c:1.39.2.2
--- src/sys/compat/netbsd32/netbsd32_socket.c:1.39.2.1	Mon Jul 30 07:55:58 2012
+++ src/sys/compat/netbsd32/netbsd32_socket.c	Sat Aug 18 22:01:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_socket.c,v 1.39.2.1 2012/07/30 07:55:58 martin Exp $	*/
+/*	$NetBSD: netbsd32_socket.c,v 1.39.2.2 2012/08/18 22:01:40 riz Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.39.2.1 2012/07/30 07:55:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.39.2.2 2012/08/18 22:01:40 riz Exp $");
 
 #include 
 #include 
@@ -296,7 +296,7 @@ copyin32_msg_control(struct lwp *l, stru
 
 		resid -= CMSG32_ALIGN(cmsg32.cmsg_len);
 		cidx += cmsg->cmsg_len;
-	} while ((cc = CMSG32_NXTHDR(mp, cc)) && resid > 0);
+	} while (resid > 0 && (cc = CMSG32_NXTHDR(mp, &cmsg32)));
 
 	/* If we allocated a buffer, attach to mbuf */
 	if (cidx > MLEN) {



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2012-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 30 07:55:58 UTC 2012

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_socket.c

Log Message:
Pull up following revision(s) (requested by matt in ticket #452):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.40
Make SCM_RIGHTS work correctly.  (make sure to advance m if we've completely
dealt with, the next mbuf (if any) comes into play).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/compat/netbsd32/netbsd32_socket.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_socket.c
diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.39 src/sys/compat/netbsd32/netbsd32_socket.c:1.39.2.1
--- src/sys/compat/netbsd32/netbsd32_socket.c:1.39	Fri Jan 20 14:08:07 2012
+++ src/sys/compat/netbsd32/netbsd32_socket.c	Mon Jul 30 07:55:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_socket.c,v 1.39 2012/01/20 14:08:07 joerg Exp $	*/
+/*	$NetBSD: netbsd32_socket.c,v 1.39.2.1 2012/07/30 07:55:58 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.39 2012/01/20 14:08:07 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.39.2.1 2012/07/30 07:55:58 martin Exp $");
 
 #include 
 #include 
@@ -138,7 +138,7 @@ copyout32_msg_control(struct lwp *l, str
 
 	q = (char *)mp->msg_control;
 
-	for (m = control; m != NULL; m = m->m_next) {
+	for (m = control; len > 0 && m != NULL; m = m->m_next) {
 		error = copyout32_msg_control_mbuf(l, mp, &len, m, &q, &truncated);
 		if (truncated) {
 			m = control;
@@ -146,8 +146,6 @@ copyout32_msg_control(struct lwp *l, str
 		}
 		if (error)
 			break;
-		if (len <= 0)
-			break;
 	}
 
 	free_control_mbuf(l, control, m);



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2012-07-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Jul 21 00:01:45 UTC 2012

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_lwp.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #431):
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.14
always allocate a full ucontext structure so that we don't corrupt memory.
XXX: needs pullup to 6?


To generate a diff of this commit:
cvs rdiff -u -r1.12.10.1 -r1.12.10.2 src/sys/compat/netbsd32/netbsd32_lwp.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_lwp.c
diff -u src/sys/compat/netbsd32/netbsd32_lwp.c:1.12.10.1 src/sys/compat/netbsd32/netbsd32_lwp.c:1.12.10.2
--- src/sys/compat/netbsd32/netbsd32_lwp.c:1.12.10.1	Mon May 21 15:25:59 2012
+++ src/sys/compat/netbsd32/netbsd32_lwp.c	Sat Jul 21 00:01:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_lwp.c,v 1.12.10.1 2012/05/21 15:25:59 riz Exp $	*/
+/*	$NetBSD: netbsd32_lwp.c,v 1.12.10.2 2012/07/21 00:01:45 riz Exp $	*/
 
 /*
  *  Copyright (c) 2005, 2006, 2007 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.12.10.1 2012/05/21 15:25:59 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.12.10.2 2012/07/21 00:01:45 riz Exp $");
 
 #include 
 #include 
@@ -60,7 +60,7 @@ netbsd32__lwp_create(struct lwp *l, cons
 
 	KASSERT(p->p_emul->e_ucsize == sizeof(*newuc));
 
-	newuc = kmem_alloc(sizeof(ucontext32_t), KM_SLEEP);
+	newuc = kmem_alloc(sizeof(ucontext_t), KM_SLEEP);
 	error = copyin(SCARG_P32(uap, ucp), newuc, p->p_emul->e_ucsize);
 	if (error)
 		goto fail;
@@ -85,7 +85,7 @@ netbsd32__lwp_create(struct lwp *l, cons
 	return copyout(&lid, SCARG_P32(uap, new_lwp), sizeof(lid));
 
 fail:
-	kmem_free(newuc, sizeof(*newuc));
+	kmem_free(newuc, sizeof(ucontext_t));
 	return error;
 }
 



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2012-04-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Apr 12 20:13:09 UTC 2012

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_syscall.h
netbsd32_syscallargs.h netbsd32_syscalls.c netbsd32_sysent.c

Log Message:
Regen for ticket 175.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.99.2.1 src/sys/compat/netbsd32/netbsd32_syscall.h \
src/sys/compat/netbsd32/netbsd32_syscallargs.h
cvs rdiff -u -r1.98 -r1.98.2.1 src/sys/compat/netbsd32/netbsd32_syscalls.c \
src/sys/compat/netbsd32/netbsd32_sysent.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_syscall.h
diff -u src/sys/compat/netbsd32/netbsd32_syscall.h:1.99 src/sys/compat/netbsd32/netbsd32_syscall.h:1.99.2.1
--- src/sys/compat/netbsd32/netbsd32_syscall.h:1.99	Wed Feb  1 05:42:17 2012
+++ src/sys/compat/netbsd32/netbsd32_syscall.h	Thu Apr 12 20:13:08 2012
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscall.h,v 1.99 2012/02/01 05:42:17 dholland Exp $ */
+/* $NetBSD: netbsd32_syscall.h,v 1.99.2.1 2012/04/12 20:13:08 riz Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.91 2012/02/01 05:40:01 dholland Exp
+ * created from	NetBSD
  */
 
 #ifndef _NETBSD32_SYS_SYSCALL_H_
@@ -1260,6 +1260,9 @@
 /* syscall: "netbsd32___quotactl" ret: "int" args: "const netbsd32_charp" "netbsd32_voidp" */
 #define	NETBSD32_SYS_netbsd32___quotactl	473
 
-#define	NETBSD32_SYS_MAXSYSCALL	474
+/* syscall: "netbsd32_posix_spawn" ret: "int" args: "netbsd32_pid_tp" "const netbsd32_charp" "const netbsd32_posix_spawn_file_actionsp" "const netbsd32_posix_spawnattrp" "netbsd32_charpp" "netbsd32_charpp" */
+#define	NETBSD32_SYS_netbsd32_posix_spawn	474
+
+#define	NETBSD32_SYS_MAXSYSCALL	475
 #define	NETBSD32_SYS_NSYSENT	512
 #endif /* _NETBSD32_SYS_SYSCALL_H_ */
Index: src/sys/compat/netbsd32/netbsd32_syscallargs.h
diff -u src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.99 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.99.2.1
--- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.99	Wed Feb  1 05:42:17 2012
+++ src/sys/compat/netbsd32/netbsd32_syscallargs.h	Thu Apr 12 20:13:09 2012
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscallargs.h,v 1.99 2012/02/01 05:42:17 dholland Exp $ */
+/* $NetBSD: netbsd32_syscallargs.h,v 1.99.2.1 2012/04/12 20:13:09 riz Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.91 2012/02/01 05:40:01 dholland Exp
+ * created from	NetBSD
  */
 
 #ifndef _NETBSD32_SYS_SYSCALLARGS_H_
@@ -2459,6 +2459,16 @@ struct netbsd32___quotactl_args {
 };
 check_syscall_args(netbsd32___quotactl)
 
+struct netbsd32_posix_spawn_args {
+	syscallarg(netbsd32_pid_tp) pid;
+	syscallarg(const netbsd32_charp) path;
+	syscallarg(const netbsd32_posix_spawn_file_actionsp) file_actions;
+	syscallarg(const netbsd32_posix_spawnattrp) attrp;
+	syscallarg(netbsd32_charpp) argv;
+	syscallarg(netbsd32_charpp) envp;
+};
+check_syscall_args(netbsd32_posix_spawn)
+
 /*
  * System call prototypes.
  */
@@ -3277,4 +3287,6 @@ int	netbsd32_futimens(struct lwp *, cons
 
 int	netbsd32___quotactl(struct lwp *, const struct netbsd32___quotactl_args *, register_t *);
 
+int	netbsd32_posix_spawn(struct lwp *, const struct netbsd32_posix_spawn_args *, register_t *);
+
 #endif /* _NETBSD32_SYS_SYSCALLARGS_H_ */

Index: src/sys/compat/netbsd32/netbsd32_syscalls.c
diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.98 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.98.2.1
--- src/sys/compat/netbsd32/netbsd32_syscalls.c:1.98	Wed Feb  1 05:42:17 2012
+++ src/sys/compat/netbsd32/netbsd32_syscalls.c	Thu Apr 12 20:13:09 2012
@@ -1,14 +1,14 @@
-/* $NetBSD: netbsd32_syscalls.c,v 1.98 2012/02/01 05:42:17 dholland Exp $ */
+/* $NetBSD: netbsd32_syscalls.c,v 1.98.2.1 2012/04/12 20:13:09 riz Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.91 2012/02/01 05:40:01 dholland Exp
+ * created from	NetBSD
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.98 2012/02/01 05:42:17 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.98.2.1 2012/04/12 20:13:09 riz Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
@@ -585,7 +585,7 @@ const char *const netbsd32_syscallnames[
 	/* 471 */	"netbsd32_unlinkat",
 	/* 472 */	"netbsd32_futimens",
 	/* 473 */	"netbsd32___quotactl",
-	/* 474 */	"# filler",
+	/* 474 */	"netbsd32_posix_spawn",
 	/* 475 */	"# filler",
 	/* 476 */	"# filler",
 	/* 477 */	"# filler",
Index: src/sys/compat/netbsd32/netbsd32_sysent.c
diff -u src/sys/compat/netbsd32/netbsd32_sysent.c:1.98 src/sys/compat/netbsd32/netbsd32_sysent.c:1.98.2.1
--- src/sys/compat/netbsd32/netbsd32_sysent.c:1.98	Wed Feb  1 05:42:17 2012
+++ s