CVS commit: src/sys/compat/svr4

2018-05-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu May 31 15:41:11 UTC 2018

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
Add XXX for NULL deref. Not sure how to fix it, not sure we care either...


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/compat/svr4/svr4_stream.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/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.93 src/sys/compat/svr4/svr4_stream.c:1.94
--- src/sys/compat/svr4/svr4_stream.c:1.93	Sat May  5 02:09:40 2018
+++ src/sys/compat/svr4/svr4_stream.c	Thu May 31 15:41:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.93 2018/05/05 02:09:40 christos Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.94 2018/05/31 15:41:11 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.93 2018/05/05 02:09:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.94 2018/05/31 15:41:11 maxv Exp $");
 
 #include 
 #include 
@@ -1791,6 +1791,10 @@ svr4_sys_getmsg(struct lwp *l, const str
 
 		sc.cmd = SVR4_TI_RECVFROM_IND;
 
+		/*
+		 * XXX: name = NULL?
+		 */
+
 		switch (st->s_family) {
 		case AF_INET:
 			sc.len = sizeof (struct sockaddr_in);



CVS commit: src/sys/compat/svr4

2017-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 16 09:05:29 UTC 2017

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
Make debug code compile


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/compat/svr4/svr4_stream.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/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.91 src/sys/compat/svr4/svr4_stream.c:1.92
--- src/sys/compat/svr4/svr4_stream.c:1.91	Fri Jul 28 17:52:47 2017
+++ src/sys/compat/svr4/svr4_stream.c	Sat Sep 16 09:05:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.91 2017/07/28 17:52:47 riastradh Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.92 2017/09/16 09:05:29 martin Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.91 2017/07/28 17:52:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.92 2017/09/16 09:05:29 martin Exp $");
 
 #include 
 #include 
@@ -201,9 +201,10 @@ show_ioc(const char *str, struct svr4_st
 
 	ptr = (u_char *) malloc(len, M_TEMP, M_WAITOK);
 	uprintf("%s cmd = %ld, timeout = %d, len = %d, buf = %p { ",
-	str, ioc->cmd, ioc->timeout, ioc->len, ioc->buf);
+	str, (long)ioc->cmd, ioc->timeout, ioc->len,
+	NETBSD32PTR(ioc->buf));
 
-	if ((error = copyin(ioc->buf, ptr, len)) != 0) {
+	if ((error = copyin(NETBSD32PTR(ioc->buf), ptr, len)) != 0) {
 		free((char *) ptr, M_TEMP);
 		return error;
 	}
@@ -237,13 +238,14 @@ show_strbuf(struct svr4_strbuf *str)
 	if (len > 0) {
 	ptr = (u_char *) malloc(len, M_TEMP, M_WAITOK);
 
-	if ((error = copyin(str->buf, ptr, len)) != 0) {
+	if ((error = copyin(NETBSD32PTR(str->buf), ptr, len)) != 0) {
 		free((char *) ptr, M_TEMP);
 		return error;
 	}
 	}
 
-	uprintf(", { %d, %d, %p=[ ", str->maxlen, str->len, str->buf);
+	uprintf(", { %d, %d, %p=[ ", str->maxlen, str->len,
+	NETBSD32PTR(str->buf));
 
 	if (ptr)
 		bufprint(ptr, len);
@@ -353,7 +355,7 @@ sockaddr_to_netaddr_in(struct svr4_strmc
 	na->port = sain->sin_port;
 	na->addr = sain->sin_addr.s_addr;
 	DPRINTF(("sockaddr_in -> netaddr %d %d %lx\n", na->family, na->port,
-		 na->addr));
+		 (unsigned long)na->addr));
 }
 
 
@@ -540,7 +542,7 @@ si_listen(file_t *fp, int fd, struct svr
 		return EINVAL;
 
 	if (lst.cmd != SVR4_TI_OLD_BIND_REQUEST) {
-		DPRINTF(("si_listen: bad request %ld\n", lst.cmd));
+		DPRINTF(("si_listen: bad request %ld\n", (long)lst.cmd));
 		return EINVAL;
 	}
 
@@ -707,7 +709,8 @@ sockmod(file_t *fp, int fd, struct svr4_
 		return si_getudata(fp, fd, ioc, l);
 
 	default:
-		DPRINTF(("Unknown sockmod ioctl %lx\n", ioc->cmd));
+		DPRINTF(("Unknown sockmod ioctl %lx\n",
+		(unsigned long)ioc->cmd));
 		return 0;
 
 	}
@@ -779,7 +782,7 @@ ti_bind(file_t *fp, int fd, struct svr4_
 		return error;
 
 	if (bnd.cmd != SVR4_TI_OLD_BIND_REQUEST) {
-		DPRINTF(("ti_bind: bad request %ld\n", bnd.cmd));
+		DPRINTF(("ti_bind: bad request %ld\n", (long)bnd.cmd));
 		return EINVAL;
 	}
 	if (bnd.offs < 0 ||
@@ -880,7 +883,7 @@ timod(file_t *fp, int fd, struct svr4_st
 		return 0;
 
 	default:
-		DPRINTF(("Unknown timod ioctl %lx\n", ioc->cmd));
+		DPRINTF(("Unknown timod ioctl %lx\n", (unsigned long)ioc->cmd));
 		return 0;
 	}
 }
@@ -1400,8 +1403,8 @@ svr4_sys_putmsg(struct lwp *l, const str
 
 
 #ifdef DEBUG_SVR4
-	show_msg(">putmsg", SCARG(uap, fd), SCARG(uap, ctl),
-		 SCARG(uap, dat), SCARG(uap, flags));
+	show_msg(">putmsg", SCARG(uap, fd), NETBSD32PTR(SCARG(uap, ctl)),
+		 NETBSD32PTR(SCARG(uap, dat)), SCARG(uap, flags));
 #endif /* DEBUG_SVR4 */
 
 	if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
@@ -1476,7 +1479,8 @@ svr4_sys_putmsg(struct lwp *l, const str
 goto out;
 			}
 #endif
-	DPRINTF(("putmsg: Invalid inet length %ld\n", sc.len));
+	DPRINTF(("putmsg: Invalid inet length %ld\n",
+			(long)sc.len));
 			error = EINVAL;
 			goto out;
 		}
@@ -1541,7 +1545,8 @@ svr4_sys_putmsg(struct lwp *l, const str
 		*retval = 0;
 		return error;
 	default:
-		DPRINTF(("putmsg: Unimplemented command %lx\n", sc.cmd));
+		DPRINTF(("putmsg: Unimplemented command %lx\n",
+		(unsigned long)sc.cmd));
 		error = ENOSYS;
 		goto out;
 	}
@@ -1571,8 +1576,8 @@ svr4_sys_getmsg(struct lwp *l, const str
 	memset(, 0, sizeof(sc));
 
 #ifdef DEBUG_SVR4
-	show_msg(">getmsg", SCARG(uap, fd), SCARG(uap, ctl),
-		 SCARG(uap, dat), 0);
+	show_msg(">getmsg", SCARG(uap, fd), NETBSD32PTR(SCARG(uap, ctl)),
+		 NETBSD32PTR(SCARG(uap, dat)), 0);
 #endif /* DEBUG_SVR4 */
 
 	if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
@@ -1869,8 +1874,8 @@ svr4_sys_getmsg(struct lwp *l, const str
 	*retval = 0;
 
 #ifdef DEBUG_SVR4
-	show_msg("

CVS commit: src/sys/compat/svr4

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 18:52:00 UTC 2017

Modified Files:
src/sys/compat/svr4: svr4_exec.h svr4_stat.c

Log Message:
Remove __i386__.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/svr4/svr4_exec.h
cvs rdiff -u -r1.70 -r1.71 src/sys/compat/svr4/svr4_stat.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/svr4/svr4_exec.h
diff -u src/sys/compat/svr4/svr4_exec.h:1.28 src/sys/compat/svr4/svr4_exec.h:1.29
--- src/sys/compat/svr4/svr4_exec.h:1.28	Thu Dec 10 14:13:53 2009
+++ src/sys/compat/svr4/svr4_exec.h	Wed Aug  9 18:52:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_exec.h,v 1.28 2009/12/10 14:13:53 matt Exp $	 */
+/*	$NetBSD: svr4_exec.h,v 1.29 2017/08/09 18:52:00 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -37,15 +37,6 @@
  * play with brk(2) a bit more.
  */
 
-#ifdef __i386__
-/*
- * I cannot load the interpreter after the data segment because brk(2)
- * breaks. I have to load it somewhere before. Programs start at
- * 0x0800 so I load the interpreter far before.
- */
-#define SVR4_INTERP_ADDR	0x0100
-#endif
-
 #ifdef __m68k__
 /*
  * Here programs load at 0x8000, so I load the interpreter far before.

Index: src/sys/compat/svr4/svr4_stat.c
diff -u src/sys/compat/svr4/svr4_stat.c:1.70 src/sys/compat/svr4/svr4_stat.c:1.71
--- src/sys/compat/svr4/svr4_stat.c:1.70	Thu Aug 14 17:29:30 2014
+++ src/sys/compat/svr4/svr4_stat.c	Wed Aug  9 18:52:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stat.c,v 1.70 2014/08/14 17:29:30 maxv Exp $	 */
+/*	$NetBSD: svr4_stat.c,v 1.71 2017/08/09 18:52:00 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_stat.c,v 1.70 2014/08/14 17:29:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stat.c,v 1.71 2017/08/09 18:52:00 maxv Exp $");
 
 #include 
 #include 
@@ -454,8 +454,6 @@ svr4_sys_systeminfo(struct lwp *l, const
 	case SVR4_SI_ISALIST:
 #if defined(__sparc__)
 		str = "sparcv9 sparcv9-fsmuld sparcv8 sparcv8-fsmuld sparcv7 sparc";
-#elif defined(__i386__)
-		str = "i386";
 #else
 		str = "unknown";
 #endif
@@ -475,9 +473,7 @@ svr4_sys_systeminfo(struct lwp *l, const
 		break;
 
 	case SVR4_SI_PLATFORM:
-#if defined(__i386__)
-		str = "i86pc";
-#elif defined(__sparc__)
+#if defined(__sparc__)
 		{
 			extern char machine_model[];
 



CVS commit: src/sys/compat/svr4

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 28 17:52:47 UTC 2017

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
Check bounds in svr4_sys_putmsg.  Check more svr4_strmcmd bounds.

svr4 streams code is still a disaster.

>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/compat/svr4/svr4_stream.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/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.90 src/sys/compat/svr4/svr4_stream.c:1.91
--- src/sys/compat/svr4/svr4_stream.c:1.90	Fri Jul 28 17:43:46 2017
+++ src/sys/compat/svr4/svr4_stream.c	Fri Jul 28 17:52:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.90 2017/07/28 17:43:46 riastradh Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.91 2017/07/28 17:52:47 riastradh Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.90 2017/07/28 17:43:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.91 2017/07/28 17:52:47 riastradh Exp $");
 
 #include 
 #include 
@@ -533,6 +533,11 @@ si_listen(file_t *fp, int fd, struct svr
 
 	if ((error = copyin(NETBSD32PTR(ioc->buf), , ioc->len)) != 0)
 		return error;
+	if (lst.offs < 0 ||
+	lst.len < 0 ||
+	lst.len > ioc->len ||
+	ioc->len - lst.len < lst.offs)
+		return EINVAL;
 
 	if (lst.cmd != SVR4_TI_OLD_BIND_REQUEST) {
 		DPRINTF(("si_listen: bad request %ld\n", lst.cmd));
@@ -777,7 +782,10 @@ ti_bind(file_t *fp, int fd, struct svr4_
 		DPRINTF(("ti_bind: bad request %ld\n", bnd.cmd));
 		return EINVAL;
 	}
-	if (bnd.offs < 0)
+	if (bnd.offs < 0 ||
+	bnd.len < 0 ||
+	bnd.len > ioc->len ||
+	ioc->len - bnd.len < bnd.offs)
 		return EINVAL;
 
 	switch (st->s_family) {
@@ -1434,7 +1442,10 @@ svr4_sys_putmsg(struct lwp *l, const str
 
 	if ((error = copyin(NETBSD32PTR(ctl.buf), , ctl.len)) != 0)
 		goto out;
-	if (sc.offs < 0) {
+	if (sc.offs < 0 ||
+	sc.len < 0 ||
+	sc.len > ctl.len ||
+	sc.offs > ctl.len - sc.len) {
 		error = EINVAL;
 		goto out;
 	}
@@ -1481,8 +1492,11 @@ svr4_sys_putmsg(struct lwp *l, const str
 			*retval = 0;
 			error = 0;
 			goto out;
-		}
-		else {
+		} else if (sc.len < sizeof(dev_t[2])) {
+			*retval = 0;
+			error = EINVAL;
+			goto out;
+		} else {
 			/* Maybe we've been given a device/inode pair */
 			dev_t *dev = SVR4_ADDROF();
 			svr4_ino_t *ino = (svr4_ino_t *) [1];



CVS commit: src/sys/compat/svr4

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 28 17:43:46 UTC 2017

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
Feebly attempt to get this reference counting less bad.

This svr4 streams code is bad and it should feel bad.

>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/compat/svr4/svr4_stream.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/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.89 src/sys/compat/svr4/svr4_stream.c:1.90
--- src/sys/compat/svr4/svr4_stream.c:1.89	Fri Jul 28 16:55:48 2017
+++ src/sys/compat/svr4/svr4_stream.c	Fri Jul 28 17:43:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.89 2017/07/28 16:55:48 riastradh Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.90 2017/07/28 17:43:46 riastradh Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.89 2017/07/28 16:55:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.90 2017/07/28 17:43:46 riastradh Exp $");
 
 #include 
 #include 
@@ -1507,10 +1507,12 @@ svr4_sys_putmsg(struct lwp *l, const str
  	switch (st->s_cmd = sc.cmd) {
 	case SVR4_TI_CONNECT_REQUEST:	/* connect 	*/
 	 	KERNEL_UNLOCK_ONE(NULL);
+		fd_putfile(SCARG(uap, fd));
 		return do_sys_connect(l, SCARG(uap, fd), skp);
 
 	case SVR4_TI_SENDTO_REQUEST:	/* sendto 	*/
 	 	KERNEL_UNLOCK_ONE(NULL);
+		fd_putfile(SCARG(uap, fd));
 		msg.msg_name = skp;
 		msg.msg_namelen = skp->sa_len;
 		msg.msg_iov = 



CVS commit: src/sys/compat/svr4

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 28 16:57:12 UTC 2017

Modified Files:
src/sys/compat/svr4: svr4_lwp.c

Log Message:
Zero stack data before copyout.

>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/svr4/svr4_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/svr4/svr4_lwp.c
diff -u src/sys/compat/svr4/svr4_lwp.c:1.19 src/sys/compat/svr4/svr4_lwp.c:1.20
--- src/sys/compat/svr4/svr4_lwp.c:1.19	Mon Nov 23 00:46:07 2009
+++ src/sys/compat/svr4/svr4_lwp.c	Fri Jul 28 16:57:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_lwp.c,v 1.19 2009/11/23 00:46:07 rmind Exp $	*/
+/*	$NetBSD: svr4_lwp.c,v 1.20 2017/07/28 16:57:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_lwp.c,v 1.19 2009/11/23 00:46:07 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_lwp.c,v 1.20 2017/07/28 16:57:12 riastradh Exp $");
 
 #include 
 #include 
@@ -108,6 +108,8 @@ svr4_sys__lwp_info(struct lwp *l, const 
 	struct svr4_lwpinfo lwpinfo;
 	int error;
 
+	memset(, 0, sizeof(lwpinfo));
+
 	/* XXX NJWLWP */
 	TIMEVAL_TO_TIMESPEC(>l_proc->p_stats->p_ru.ru_stime, _stime);
 	TIMEVAL_TO_TIMESPEC(>l_proc->p_stats->p_ru.ru_utime, _utime);



CVS commit: src/sys/compat/svr4

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 28 16:55:48 UTC 2017

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
Fix some of the multitudinous holes in svr4 streams.

We should never have enabled this by default; it is a minefield.

>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/compat/svr4/svr4_stream.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/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.88 src/sys/compat/svr4/svr4_stream.c:1.89
--- src/sys/compat/svr4/svr4_stream.c:1.88	Wed Apr 26 03:02:48 2017
+++ src/sys/compat/svr4/svr4_stream.c	Fri Jul 28 16:55:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.88 2017/04/26 03:02:48 riastradh Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.89 2017/07/28 16:55:48 riastradh Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.88 2017/04/26 03:02:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.89 2017/07/28 16:55:48 riastradh Exp $");
 
 #include 
 #include 
@@ -527,7 +527,8 @@ si_listen(file_t *fp, int fd, struct svr
 	if (st == NULL)
 		return EINVAL;
 
-	if (ioc->len > sizeof(lst))
+	if (ioc->len < offsetof(struct svr4_strmcmd, pad) ||
+	ioc->len > sizeof(lst))
 		return EINVAL;
 
 	if ((error = copyin(NETBSD32PTR(ioc->buf), , ioc->len)) != 0)
@@ -717,7 +718,9 @@ ti_getinfo(file_t *fp, int fd, struct sv
 
 	memset(, 0, sizeof(info));
 
-	if (ioc->len > sizeof(info))
+	/* tsdu is next after cmd, the only field we read */
+	if (ioc->len < offsetof(struct svr4_infocmd, tsdu) ||
+	ioc->len > sizeof(info))
 		return EINVAL;
 
 	if ((error = copyin(NETBSD32PTR(ioc->buf), , ioc->len)) != 0)
@@ -763,7 +766,8 @@ ti_bind(file_t *fp, int fd, struct svr4_
 		return EINVAL;
 	}
 
-	if (ioc->len > sizeof(bnd))
+	if (ioc->len < offsetof(struct svr4_strmcmd, pad) ||
+	ioc->len > sizeof(bnd))
 		return EINVAL;
 
 	if ((error = copyin(NETBSD32PTR(ioc->buf), , ioc->len)) != 0)
@@ -773,6 +777,8 @@ ti_bind(file_t *fp, int fd, struct svr4_
 		DPRINTF(("ti_bind: bad request %ld\n", bnd.cmd));
 		return EINVAL;
 	}
+	if (bnd.offs < 0)
+		return EINVAL;
 
 	switch (st->s_family) {
 	case AF_INET:
@@ -782,6 +788,9 @@ ti_bind(file_t *fp, int fd, struct svr4_
 		if (bnd.offs == 0)
 			goto reply;
 
+		if (ioc->len < sizeof(struct svr4_netaddr_in) ||
+		bnd.offs > ioc->len - sizeof(struct svr4_netaddr_in))
+			return EINVAL;
 		netaddr_to_sockaddr_in(sain, );
 
 		DPRINTF(("TI_BIND: fam %d, port %d, addr %x\n",
@@ -795,6 +804,9 @@ ti_bind(file_t *fp, int fd, struct svr4_
 		if (bnd.offs == 0)
 			goto reply;
 
+		if (ioc->len < sizeof(struct svr4_netaddr_un) ||
+		bnd.offs > ioc->len - sizeof(struct svr4_netaddr_un))
+			return EINVAL;
 		netaddr_to_sockaddr_un(saun, );
 
 		if (saun->sun_path[0] == '\0')
@@ -1412,7 +1424,8 @@ svr4_sys_putmsg(struct lwp *l, const str
 		goto out;
 	}
 
-	if (ctl.len > sizeof(sc)) {
+	if (ctl.len < offsetof(struct svr4_strmcmd, pad) ||
+	ctl.len > sizeof(sc)) {
 		DPRINTF(("putmsg: Bad control size %ld != %d\n",
 		(unsigned long)sizeof(struct svr4_strmcmd), ctl.len));
 		error = EINVAL;
@@ -1421,6 +1434,10 @@ svr4_sys_putmsg(struct lwp *l, const str
 
 	if ((error = copyin(NETBSD32PTR(ctl.buf), , ctl.len)) != 0)
 		goto out;
+	if (sc.offs < 0) {
+		error = EINVAL;
+		goto out;
+	}
 
 	switch (st->s_family) {
 	case AF_INET:
@@ -1723,8 +1740,16 @@ svr4_sys_getmsg(struct lwp *l, const str
 		if (ctl.len > sizeof(sc))
 			ctl.len = sizeof(sc);
 
+		if (ctl.len < offsetof(struct svr4_strmcmd, pad)) {
+			error = EINVAL;
+			goto out;
+		}
 		if ((error = copyin(NETBSD32PTR(ctl.buf), , ctl.len)) != 0)
 			goto out;
+		if (sc.offs < 0) {
+			error = EINVAL;
+			goto out;
+		}
 
 		msg.msg_name = NULL;
 		msg.msg_namelen = 0;



CVS commit: src/sys/compat/svr4

2015-12-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 13 19:47:08 UTC 2015

Modified Files:
src/sys/compat/svr4: svr4_termios.c

Log Message:
PR/50520: David Binderman: Fix missing breaks.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/svr4/svr4_termios.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/svr4/svr4_termios.c
diff -u src/sys/compat/svr4/svr4_termios.c:1.28 src/sys/compat/svr4/svr4_termios.c:1.29
--- src/sys/compat/svr4/svr4_termios.c:1.28	Sun Nov  9 13:16:55 2014
+++ src/sys/compat/svr4/svr4_termios.c	Sun Dec 13 14:47:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_termios.c,v 1.28 2014/11/09 18:16:55 maxv Exp $	 */
+/*	$NetBSD: svr4_termios.c,v 1.29 2015/12/13 19:47:08 christos Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_termios.c,v 1.28 2014/11/09 18:16:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_termios.c,v 1.29 2015/12/13 19:47:08 christos Exp $");
 
 #include 
 #include 
@@ -182,7 +182,7 @@ bsd_to_svr4_speed(u_long sp, u_long mask
 {
 	switch (sp) {
 #undef getval
-#define getval(a,b)	case __CONCAT(a,b):	sp = __CONCAT3(SVR4_,a,b)
+#define getval(a,b)	case __CONCAT(a,b): sp = __CONCAT3(SVR4_,a,b); break
 	getval(B,0);
 	getval(B,50);
 	getval(B,75);



CVS commit: src/sys/compat/svr4

2015-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 24 14:44:13 UTC 2015

Modified Files:
src/sys/compat/svr4: svr4_syscall.h svr4_syscallargs.h svr4_syscalls.c
svr4_sysent.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/compat/svr4/svr4_syscall.h \
src/sys/compat/svr4/svr4_syscalls.c
cvs rdiff -u -r1.85 -r1.86 src/sys/compat/svr4/svr4_syscallargs.h
cvs rdiff -u -r1.89 -r1.90 src/sys/compat/svr4/svr4_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/svr4/svr4_syscall.h
diff -u src/sys/compat/svr4/svr4_syscall.h:1.86 src/sys/compat/svr4/svr4_syscall.h:1.87
--- src/sys/compat/svr4/svr4_syscall.h:1.86	Sat Mar  7 11:41:54 2015
+++ src/sys/compat/svr4/svr4_syscall.h	Thu Sep 24 10:44:13 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_syscall.h,v 1.86 2015/03/07 16:41:54 christos Exp $ */
+/* $NetBSD: svr4_syscall.h,v 1.87 2015/09/24 14:44:13 christos Exp $ */
 
 /*
  * System call numbers.
Index: src/sys/compat/svr4/svr4_syscalls.c
diff -u src/sys/compat/svr4/svr4_syscalls.c:1.86 src/sys/compat/svr4/svr4_syscalls.c:1.87
--- src/sys/compat/svr4/svr4_syscalls.c:1.86	Sat Mar  7 11:41:54 2015
+++ src/sys/compat/svr4/svr4_syscalls.c	Thu Sep 24 10:44:13 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_syscalls.c,v 1.86 2015/03/07 16:41:54 christos Exp $ */
+/* $NetBSD: svr4_syscalls.c,v 1.87 2015/09/24 14:44:13 christos Exp $ */
 
 /*
  * System call names.
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_syscalls.c,v 1.86 2015/03/07 16:41:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_syscalls.c,v 1.87 2015/09/24 14:44:13 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
@@ -32,6 +32,8 @@ __KERNEL_RCSID(0, "$NetBSD: svr4_syscall
 #include 
 #include 
 #include 
+#else /* _KERNEL_OPT */
+#include 
 #endif /* _KERNEL_OPT */
 
 const char *const svr4_syscallnames[] = {
@@ -308,3 +310,280 @@ const char *const svr4_syscallnames[] = 
 	/* 254 */	"#254 (unimplemented lwp_sigtimedwait)",
 	/* 255 */	"#255 (unimplemented umount2)",
 };
+
+
+/* libc style syscall names */
+const char *const altsvr4_syscallnames[] = {
+	/*   0 */	"nosys",
+	/*   1 */	NULL, /* exit */
+	/*   2 */	NULL, /* fork */
+	/*   3 */	NULL, /* read */
+	/*   4 */	NULL, /* write */
+	/*   5 */	NULL, /* open */
+	/*   6 */	NULL, /* close */
+	/*   7 */	NULL, /* wait */
+	/*   8 */	NULL, /* creat */
+	/*   9 */	NULL, /* link */
+	/*  10 */	NULL, /* unlink */
+	/*  11 */	NULL, /* execv */
+	/*  12 */	NULL, /* chdir */
+	/*  13 */	NULL, /* time */
+	/*  14 */	NULL, /* mknod */
+	/*  15 */	NULL, /* chmod */
+	/*  16 */	"__posix_chown",
+	/*  17 */	NULL, /* break */
+	/*  18 */	NULL, /* stat */
+	/*  19 */	NULL, /* lseek */
+	/*  20 */	NULL, /* getpid */
+	/*  21 */	NULL, /* unimplemented old_mount */
+	/*  22 */	NULL, /* unimplemented System V umount */
+	/*  23 */	NULL, /* setuid */
+	/*  24 */	NULL, /* getuid_with_euid */
+	/*  25 */	NULL, /* unimplemented stime */
+	/*  26 */	NULL, /* unimplemented ptrace */
+	/*  27 */	NULL, /* alarm */
+	/*  28 */	NULL, /* fstat */
+	/*  29 */	NULL, /* pause */
+	/*  30 */	NULL, /* utime */
+	/*  31 */	NULL, /* unimplemented was stty */
+	/*  32 */	NULL, /* unimplemented was gtty */
+	/*  33 */	NULL, /* access */
+	/*  34 */	NULL, /* nice */
+	/*  35 */	NULL, /* unimplemented statfs */
+	/*  36 */	NULL, /* sync */
+	/*  37 */	NULL, /* kill */
+	/*  38 */	NULL, /* unimplemented fstatfs */
+	/*  39 */	NULL, /* pgrpsys */
+	/*  40 */	NULL, /* unimplemented xenix */
+	/*  41 */	NULL, /* dup */
+	/*  42 */	NULL, /* pipe */
+	/*  43 */	NULL, /* times */
+	/*  44 */	NULL, /* unimplemented profil */
+	/*  45 */	NULL, /* unimplemented plock */
+	/*  46 */	NULL, /* setgid */
+	/*  47 */	NULL, /* getgid_with_egid */
+	/*  48 */	NULL, /* signal */
+#ifdef SYSVMSG
+	/*  49 */	NULL, /* msgsys */
+#else
+	/*  49 */	NULL, /* unimplemented msgsys */
+#endif
+	/*  50 */	NULL, /* sysarch */
+	/*  51 */	NULL, /* unimplemented acct */
+#ifdef SYSVSHM
+	/*  52 */	NULL, /* shmsys */
+#else
+	/*  52 */	NULL, /* unimplemented shmsys */
+#endif
+#ifdef SYSVSEM
+	/*  53 */	NULL, /* semsys */
+#else
+	/*  53 */	NULL, /* unimplemented semsys */
+#endif
+	/*  54 */	NULL, /* ioctl */
+	/*  55 */	NULL, /* unimplemented uadmin */
+	/*  56 */	NULL, /* unimplemented exch */
+	/*  57 */	NULL, /* utssys */
+	/*  58 */	NULL, /* fsync */
+	/*  59 */	NULL, /* execve */
+	/*  60 */	NULL, /* umask */
+	/*  61 */	NULL, /* chroot */
+	/*  62 */	NULL, /* fcntl */
+	/*  63 */	NULL, /* ulimit */
+	/*  64 */	NULL, /* unimplemented reserved for unix/pc */
+	/*  65 */	NULL, /* unimplemented reserved for unix/pc */
+	/*  66 */	NULL, /* unimplemented reserved for unix/pc */
+	/*  67 */	NULL, /* unimplemented reserved for unix/pc */
+	/*  68 */	NULL, /* unimplemented reserved for unix/pc */
+	/*  69 */	NULL, /* unimplemented reserved for unix/pc */
+	

CVS commit: src/sys/compat/svr4

2015-05-23 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Sat May 23 15:27:55 UTC 2015

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
get rid of unnecessary use of mbuf to hold sockaddr, which was leaked...

while here change use to typed pointer sockaddr * instead of void * which
also lets us get rid of sasize variable used to track length (since we
can now use sa_len easily)


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/compat/svr4/svr4_stream.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/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.85 src/sys/compat/svr4/svr4_stream.c:1.86
--- src/sys/compat/svr4/svr4_stream.c:1.85	Sat May  2 17:18:03 2015
+++ src/sys/compat/svr4/svr4_stream.c	Sat May 23 15:27:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.85 2015/05/02 17:18:03 rtr Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.86 2015/05/23 15:27:55 rtr Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_stream.c,v 1.85 2015/05/02 17:18:03 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_stream.c,v 1.86 2015/05/23 15:27:55 rtr Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -1366,16 +1366,14 @@ int
 svr4_sys_putmsg(struct lwp *l, const struct svr4_sys_putmsg_args *uap, register_t *retval)
 {
 	struct proc *p = l-l_proc;
+	struct sockaddr *skp;
 	file_t	*fp;
 	struct svr4_strbuf dat, ctl;
 	struct svr4_strmcmd sc;
 	struct sockaddr_in sain;
 	struct sockaddr_un saun;
-	void *skp;
-	int sasize;
 	struct svr4_strm *st;
 	int error;
-	struct mbuf *nam;
 	struct msghdr msg;
 	struct iovec aiov;
 
@@ -1454,8 +1452,7 @@ svr4_sys_putmsg(struct lwp *l, const str
 			goto out;
 		}
 		netaddr_to_sockaddr_in(sain, sc);
-		skp = sain;
-		sasize = sizeof(sain);
+		skp = (struct sockaddr *)sain;
 		error = sain.sin_family != st-s_family;
 		break;
 
@@ -1471,13 +1468,14 @@ svr4_sys_putmsg(struct lwp *l, const str
 			/* Maybe we've been given a device/inode pair */
 			dev_t *dev = SVR4_ADDROF(sc);
 			svr4_ino_t *ino = (svr4_ino_t *) dev[1];
-			skp = svr4_find_socket(p, fp, *dev, *ino);
+			skp = (struct sockaddr *)svr4_find_socket(
+			p, fp, *dev, *ino);
 			if (skp == NULL) {
-skp = saun;
+skp = (struct sockaddr *)saun;
 /* I guess we have it by name */
-netaddr_to_sockaddr_un(skp, sc);
+netaddr_to_sockaddr_un(
+(struct sockaddr_un *)skp, sc);
 			}
-			sasize = sizeof(saun);
 		}
 		break;
 
@@ -1488,24 +1486,19 @@ svr4_sys_putmsg(struct lwp *l, const str
 		goto out;
 	}
 
-	nam = m_get(M_WAIT, MT_SONAME);
-	nam-m_len = sasize;
-	memcpy(mtod(nam, void *), skp, sasize);
-
  	switch (st-s_cmd = sc.cmd) {
 	case SVR4_TI_CONNECT_REQUEST:	/* connect 	*/
 	 	KERNEL_UNLOCK_ONE(NULL);
-		return do_sys_connect(l, SCARG(uap, fd),
-		mtod(nam, struct sockaddr *));
+		return do_sys_connect(l, SCARG(uap, fd), skp);
 
 	case SVR4_TI_SENDTO_REQUEST:	/* sendto 	*/
 	 	KERNEL_UNLOCK_ONE(NULL);
-		msg.msg_name = nam;
-		msg.msg_namelen = sasize;
+		msg.msg_name = skp;
+		msg.msg_namelen = skp-sa_len;
 		msg.msg_iov = aiov;
 		msg.msg_iovlen = 1;
 		msg.msg_control = NULL;
-		msg.msg_flags = MSG_NAMEMBUF;
+		msg.msg_flags = 0;
 		aiov.iov_base = NETBSD32PTR(dat.buf);
 		aiov.iov_len = dat.len;
 		error = do_sys_sendmsg(l, SCARG(uap, fd), msg,
@@ -1513,9 +1506,7 @@ svr4_sys_putmsg(struct lwp *l, const str
 
 		*retval = 0;
 		return error;
-  
 	default:
-		m_free(nam);
 		DPRINTF((putmsg: Unimplemented command %lx\n, sc.cmd));
 		error = ENOSYS;
 		goto out;



CVS commit: src/sys/compat/svr4

2015-04-19 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Sun Apr 19 19:17:37 UTC 2015

Modified Files:
src/sys/compat/svr4: svr4_stream.c

Log Message:
clean up the way ti_bind() was converted to use sockaddr_big.

instead of using the original sockaddr_{in,un} structures for storage
use the single sockaddr_big structure instead.

while here ditch superfluous assignment of sockaddr sb_len since the
assignment is already performed in netaddr_to_sockaddr_{in,un}


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/compat/svr4/svr4_stream.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/svr4/svr4_stream.c
diff -u src/sys/compat/svr4/svr4_stream.c:1.82 src/sys/compat/svr4/svr4_stream.c:1.83
--- src/sys/compat/svr4/svr4_stream.c:1.82	Fri Apr  3 20:01:07 2015
+++ src/sys/compat/svr4/svr4_stream.c	Sun Apr 19 19:17:37 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stream.c,v 1.82 2015/04/03 20:01:07 rtr Exp $	 */
+/*	$NetBSD: svr4_stream.c,v 1.83 2015/04/19 19:17:37 rtr Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_stream.c,v 1.82 2015/04/03 20:01:07 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_stream.c,v 1.83 2015/04/19 19:17:37 rtr Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -750,9 +750,9 @@ ti_bind(file_t *fp, int fd, struct svr4_
 {
 	int error;
 	struct svr4_strm *st = svr4_stream_get(fp);
-	struct sockaddr_in sain;
-	struct sockaddr_un saun;
-	struct sockaddr_big *sbig;
+	struct sockaddr_in *sain;
+	struct sockaddr_un *saun;
+	struct sockaddr_big sbig;
 	void *sup = NULL;
 	int sasize;
 	struct svr4_strmcmd bnd;
@@ -775,34 +775,34 @@ ti_bind(file_t *fp, int fd, struct svr4_
 
 	switch (st-s_family) {
 	case AF_INET:
-		sbig = (struct sockaddr_big *)sain;
-		sbig-sb_len = sasize = sizeof(sain);
+		sain = (struct sockaddr_in *)sbig;
+		sasize = sizeof(*sain);
 
 		if (bnd.offs == 0)
 			goto reply;
 
-		netaddr_to_sockaddr_in(sain, bnd);
+		netaddr_to_sockaddr_in(sain, bnd);
 
 		DPRINTF((TI_BIND: fam %d, port %d, addr %x\n,
-			 sain.sin_family, sain.sin_port,
-			 sain.sin_addr.s_addr));
+			 sain-sin_family, sain-sin_port,
+			 sain-sin_addr.s_addr));
 		break;
 
 	case AF_LOCAL:
-		sbig = (struct sockaddr_big *)saun;
-		sbig-sb_len = sasize = sizeof(saun);
+		saun = (struct sockaddr_un *)sbig;
+		sasize = sizeof(*saun);
 		if (bnd.offs == 0)
 			goto reply;
 
-		netaddr_to_sockaddr_un(saun, bnd);
+		netaddr_to_sockaddr_un(saun, bnd);
 
-		if (saun.sun_path[0] == '\0')
+		if (saun-sun_path[0] == '\0')
 			goto reply;
 
 		DPRINTF((TI_BIND: fam %d, path %s\n,
-			 saun.sun_family, saun.sun_path));
+			 saun-sun_family, saun-sun_path));
 
-		if ((error = clean_pipe(l, saun.sun_path)) != 0)
+		if ((error = clean_pipe(l, saun-sun_path)) != 0)
 			return error;
 
 		bnd.pad[28] = 0x1000;	/* magic again */
@@ -816,7 +816,7 @@ ti_bind(file_t *fp, int fd, struct svr4_
 
 	DPRINTF((TI_BIND: fileno %d\n, fd));
 
-	error = do_sys_bind(l, fd, (struct sockaddr *)sbig);
+	error = do_sys_bind(l, fd, (struct sockaddr *)sbig);
 	if (error != 0) {
 		DPRINTF((TI_BIND: bind failed %d\n, error));
 		return error;



CVS commit: src/sys/compat/svr4

2014-11-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Nov  9 18:16:55 UTC 2014

Modified Files:
src/sys/compat/svr4: svr4_exec_elf32.c svr4_exec_elf64.c svr4_fcntl.c
svr4_filio.c svr4_ioctl.c svr4_ipc.c svr4_schedctl.c svr4_signal.c
svr4_sockio.c svr4_termios.c svr4_ttold.c

Log Message:
Do not uselessly include sys/malloc.h.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/svr4/svr4_exec_elf32.c \
src/sys/compat/svr4/svr4_exec_elf64.c
cvs rdiff -u -r1.73 -r1.74 src/sys/compat/svr4/svr4_fcntl.c
cvs rdiff -u -r1.23 -r1.24 src/sys/compat/svr4/svr4_filio.c
cvs rdiff -u -r1.36 -r1.37 src/sys/compat/svr4/svr4_ioctl.c
cvs rdiff -u -r1.26 -r1.27 src/sys/compat/svr4/svr4_ipc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/svr4/svr4_schedctl.c
cvs rdiff -u -r1.65 -r1.66 src/sys/compat/svr4/svr4_signal.c
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/svr4/svr4_sockio.c
cvs rdiff -u -r1.27 -r1.28 src/sys/compat/svr4/svr4_termios.c
cvs rdiff -u -r1.33 -r1.34 src/sys/compat/svr4/svr4_ttold.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/svr4/svr4_exec_elf32.c
diff -u src/sys/compat/svr4/svr4_exec_elf32.c:1.14 src/sys/compat/svr4/svr4_exec_elf32.c:1.15
--- src/sys/compat/svr4/svr4_exec_elf32.c:1.14	Mon Apr 28 20:23:45 2008
+++ src/sys/compat/svr4/svr4_exec_elf32.c	Sun Nov  9 18:16:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_exec_elf32.c,v 1.14 2008/04/28 20:23:45 martin Exp $	 */
+/*	$NetBSD: svr4_exec_elf32.c,v 1.15 2014/11/09 18:16:55 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_exec_elf32.c,v 1.14 2008/04/28 20:23:45 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_exec_elf32.c,v 1.15 2014/11/09 18:16:55 maxv Exp $);
 
 #define	ELFSIZE		32/* XXX should die */
 
@@ -38,7 +38,6 @@ __KERNEL_RCSID(0, $NetBSD: svr4_exec_el
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/proc.h
-#include sys/malloc.h
 #include sys/namei.h
 #include sys/vnode.h
 #include sys/exec_elf.h
Index: src/sys/compat/svr4/svr4_exec_elf64.c
diff -u src/sys/compat/svr4/svr4_exec_elf64.c:1.14 src/sys/compat/svr4/svr4_exec_elf64.c:1.15
--- src/sys/compat/svr4/svr4_exec_elf64.c:1.14	Mon Apr 28 20:23:45 2008
+++ src/sys/compat/svr4/svr4_exec_elf64.c	Sun Nov  9 18:16:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_exec_elf64.c,v 1.14 2008/04/28 20:23:45 martin Exp $	 */
+/*	$NetBSD: svr4_exec_elf64.c,v 1.15 2014/11/09 18:16:55 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_exec_elf64.c,v 1.14 2008/04/28 20:23:45 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_exec_elf64.c,v 1.15 2014/11/09 18:16:55 maxv Exp $);
 
 #define	ELFSIZE		64/* XXX should die */
 
@@ -38,7 +38,6 @@ __KERNEL_RCSID(0, $NetBSD: svr4_exec_el
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/proc.h
-#include sys/malloc.h
 #include sys/namei.h
 #include sys/vnode.h
 #include sys/exec_elf.h

Index: src/sys/compat/svr4/svr4_fcntl.c
diff -u src/sys/compat/svr4/svr4_fcntl.c:1.73 src/sys/compat/svr4/svr4_fcntl.c:1.74
--- src/sys/compat/svr4/svr4_fcntl.c:1.73	Fri Sep  5 10:47:32 2014
+++ src/sys/compat/svr4/svr4_fcntl.c	Sun Nov  9 18:16:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_fcntl.c,v 1.73 2014/09/05 10:47:32 christos Exp $	 */
+/*	$NetBSD: svr4_fcntl.c,v 1.74 2014/11/09 18:16:55 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1997, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_fcntl.c,v 1.73 2014/09/05 10:47:32 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_fcntl.c,v 1.74 2014/11/09 18:16:55 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -42,7 +42,6 @@ __KERNEL_RCSID(0, $NetBSD: svr4_fcntl.c
 #include sys/ioctl.h
 #include sys/kernel.h
 #include sys/mount.h
-#include sys/malloc.h
 #include sys/vnode.h
 #include sys/kauth.h
 

Index: src/sys/compat/svr4/svr4_filio.c
diff -u src/sys/compat/svr4/svr4_filio.c:1.23 src/sys/compat/svr4/svr4_filio.c:1.24
--- src/sys/compat/svr4/svr4_filio.c:1.23	Sun May 24 21:41:25 2009
+++ src/sys/compat/svr4/svr4_filio.c	Sun Nov  9 18:16:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_filio.c,v 1.23 2009/05/24 21:41:25 ad Exp $	 */
+/*	$NetBSD: svr4_filio.c,v 1.24 2014/11/09 18:16:55 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_filio.c,v 1.23 2009/05/24 21:41:25 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_filio.c,v 1.24 2014/11/09 18:16:55 maxv Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -43,7 +43,6 @@ __KERNEL_RCSID(0, $NetBSD: svr4_filio.c
 #include sys/socket.h
 #include sys/mount.h
 #include net/if.h
-#include sys/malloc.h
 
 #include sys/syscallargs.h
 

Index: 

CVS commit: src/sys/compat/svr4

2014-09-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep  5 10:47:32 UTC 2014

Modified Files:
src/sys/compat/svr4: svr4_fcntl.c

Log Message:
make this compile again


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/compat/svr4/svr4_fcntl.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/svr4/svr4_fcntl.c
diff -u src/sys/compat/svr4/svr4_fcntl.c:1.72 src/sys/compat/svr4/svr4_fcntl.c:1.73
--- src/sys/compat/svr4/svr4_fcntl.c:1.72	Fri Sep  5 05:21:55 2014
+++ src/sys/compat/svr4/svr4_fcntl.c	Fri Sep  5 06:47:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_fcntl.c,v 1.72 2014/09/05 09:21:55 matt Exp $	 */
+/*	$NetBSD: svr4_fcntl.c,v 1.73 2014/09/05 10:47:32 christos Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1997, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_fcntl.c,v 1.72 2014/09/05 09:21:55 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_fcntl.c,v 1.73 2014/09/05 10:47:32 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -220,7 +220,7 @@ fd_revoke(struct lwp *l, int fd, registe
 	vnode_t *vp;
 	int error;
 
-	if ((error = fd_getvnode(SCARG(uap, fd), fp)) != 0)
+	if ((error = fd_getvnode(fd, fp)) != 0)
 		return error;
 
 	vp = fp-f_vnode;



CVS commit: src/sys/compat/svr4

2014-08-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug 14 17:29:30 UTC 2014

Modified Files:
src/sys/compat/svr4: svr4_stat.c

Log Message:
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-2

#06-0x01: Empty compiler block

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/compat/svr4/svr4_stat.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/svr4/svr4_stat.c
diff -u src/sys/compat/svr4/svr4_stat.c:1.69 src/sys/compat/svr4/svr4_stat.c:1.70
--- src/sys/compat/svr4/svr4_stat.c:1.69	Sun Jan 11 02:45:50 2009
+++ src/sys/compat/svr4/svr4_stat.c	Thu Aug 14 17:29:30 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stat.c,v 1.69 2009/01/11 02:45:50 christos Exp $	 */
+/*	$NetBSD: svr4_stat.c,v 1.70 2014/08/14 17:29:30 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_stat.c,v 1.69 2009/01/11 02:45:50 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_stat.c,v 1.70 2014/08/14 17:29:30 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -478,7 +478,6 @@ svr4_sys_systeminfo(struct lwp *l, const
 #if defined(__i386__)
 		str = i86pc;
 #elif defined(__sparc__)
-#elif defined(__sparc__)
 		{
 			extern char machine_model[];
 



CVS commit: src/sys/compat/svr4

2014-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar  7 08:40:59 UTC 2014

Modified Files:
src/sys/compat/svr4: svr4_mod.c

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/svr4/svr4_mod.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/svr4/svr4_mod.c
diff -u src/sys/compat/svr4/svr4_mod.c:1.3 src/sys/compat/svr4/svr4_mod.c:1.4
--- src/sys/compat/svr4/svr4_mod.c:1.3	Fri Mar  7 01:33:44 2014
+++ src/sys/compat/svr4/svr4_mod.c	Fri Mar  7 08:40:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_mod.c,v 1.3 2014/03/07 01:33:44 christos Exp $	*/
+/*	$NetBSD: svr4_mod.c,v 1.4 2014/03/07 08:40:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_mod.c,v 1.3 2014/03/07 01:33:44 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_mod.c,v 1.4 2014/03/07 08:40:59 martin Exp $);
 
 #ifndef ELFSIZE
 #define ELFSIZE ARCH_ELFSIZE
@@ -72,7 +72,7 @@ static struct execsw svr4_execsw[] = {
 		},
 		.es_emul = emul_svr4,
 		.es_prio = EXECSW_PRIO_LAST,
-		.es_argslen = ELF32_AUXSIZE,
+		.es_arglen = ELF32_AUXSIZE,
 		.es_copyargs = elf32_copyargs,
 		.es_setregs = NULL,
 		.es_coredump = coredump_elf32,



CVS commit: src/sys/compat/svr4

2011-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 27 00:52:56 UTC 2011

Modified Files:
src/sys/compat/svr4: svr4_misc.c

Log Message:
return the namemax from the bsd statvfs which is filesystem dependent, not
a random value.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/compat/svr4/svr4_misc.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/svr4/svr4_misc.c
diff -u src/sys/compat/svr4/svr4_misc.c:1.154 src/sys/compat/svr4/svr4_misc.c:1.155
--- src/sys/compat/svr4/svr4_misc.c:1.154	Tue Nov 30 05:43:02 2010
+++ src/sys/compat/svr4/svr4_misc.c	Mon Sep 26 20:52:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_misc.c,v 1.154 2010/11/30 10:43:02 dholland Exp $	 */
+/*	$NetBSD: svr4_misc.c,v 1.155 2011/09/27 00:52:55 christos Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_misc.c,v 1.154 2010/11/30 10:43:02 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_misc.c,v 1.155 2011/09/27 00:52:55 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1076,7 +1076,7 @@ svr4_copyout_statvfs(const struct statvf
 		sfs-f_flag |= SVR4_ST_RDONLY;
 	if (bfs-f_flag  MNT_NOSUID)
 		sfs-f_flag |= SVR4_ST_NOSUID;
-	sfs-f_namemax = MAXNAMLEN;
+	sfs-f_namemax = bfs-f_namemax;
 	memcpy(sfs-f_fstr, bfs-f_fstypename, sizeof(sfs-f_fstr)); /* XXX */
 	memset(sfs-f_filler, 0, sizeof(sfs-f_filler));
 
@@ -1108,7 +1108,7 @@ svr4_copyout_statvfs64(const struct stat
 		sfs-f_flag |= SVR4_ST_RDONLY;
 	if (bfs-f_flag  MNT_NOSUID)
 		sfs-f_flag |= SVR4_ST_NOSUID;
-	sfs-f_namemax = MAXNAMLEN;
+	sfs-f_namemax = bfs-f_namemax;
 	memcpy(sfs-f_fstr, bfs-f_fstypename, sizeof(sfs-f_fstr)); /* XXX */
 	memset(sfs-f_filler, 0, sizeof(sfs-f_filler));
 



CVS commit: src/sys/compat/svr4

2010-02-14 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Sun Feb 14 11:54:03 UTC 2010

Modified Files:
src/sys/compat/svr4: files.svr4

Log Message:
add missing glue file, otherwise the emulation will not work if
compiled into the kernel (and the module loader will load another
instance, causing symbol duplication)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/svr4/files.svr4

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/svr4/files.svr4
diff -u src/sys/compat/svr4/files.svr4:1.16 src/sys/compat/svr4/files.svr4:1.17
--- src/sys/compat/svr4/files.svr4:1.16	Sun Apr  2 06:34:18 2006
+++ src/sys/compat/svr4/files.svr4	Sun Feb 14 11:54:03 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.svr4,v 1.16 2006/04/02 06:34:18 macallan Exp $
+#	$NetBSD: files.svr4,v 1.17 2010/02/14 11:54:03 drochner Exp $
 #
 # Config file description for machine-independent SVR4 compat code.
 # Included by ports that need it.
@@ -16,6 +16,7 @@
 file	compat/svr4/svr4_ipc.c		compat_svr4
 file	compat/svr4/svr4_lwp.c		compat_svr4
 file	compat/svr4/svr4_misc.c		compat_svr4
+file	compat/svr4/svr4_mod.c		compat_svr4
 file	compat/svr4/svr4_net.c		compat_svr4
 file	compat/svr4/svr4_resource.c	compat_svr4
 file	compat/svr4/svr4_schedctl.c	compat_svr4