CVS commit: [netbsd-8] src/sys/compat/common

2021-08-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 15 10:03:46 UTC 2021

Modified Files:
src/sys/compat/common [netbsd-8]: vfs_syscalls_30.c vfs_syscalls_43.c
vfs_syscalls_50.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1691):

sys/compat/common/vfs_syscalls_43.c: revision 1.67
sys/compat/common/vfs_syscalls_50.c: revision 1.26
sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
  (thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.12.1 src/sys/compat/common/vfs_syscalls_30.c
cvs rdiff -u -r1.59.8.2 -r1.59.8.3 src/sys/compat/common/vfs_syscalls_43.c
cvs rdiff -u -r1.18 -r1.18.12.1 src/sys/compat/common/vfs_syscalls_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/common/vfs_syscalls_30.c
diff -u src/sys/compat/common/vfs_syscalls_30.c:1.36 src/sys/compat/common/vfs_syscalls_30.c:1.36.12.1
--- src/sys/compat/common/vfs_syscalls_30.c:1.36	Mon Oct 20 11:58:01 2014
+++ src/sys/compat/common/vfs_syscalls_30.c	Sun Aug 15 10:03:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_30.c,v 1.36 2014/10/20 11:58:01 christos Exp $	*/
+/*	$NetBSD: vfs_syscalls_30.c,v 1.36.12.1 2021/08/15 10:03:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.36 2014/10/20 11:58:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.36.12.1 2021/08/15 10:03:46 martin Exp $");
 
 #include 
 #include 
@@ -55,7 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 #include 
 
-static void cvtstat(struct stat13 *, const struct stat *);
 
 /*
  * Convert from a new to an old stat structure.
@@ -64,6 +63,8 @@ static void
 cvtstat(struct stat13 *ost, const struct stat *st)
 {
 
+	/* Handle any padding. */
+	memset(ost, 0, sizeof(*ost));
 	ost->st_dev = st->st_dev;
 	ost->st_ino = (uint32_t)st->st_ino;
 	ost->st_mode = st->st_mode;
@@ -101,8 +102,7 @@ compat_30_sys___stat13(struct lwp *l, co
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, ub), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, ub), sizeof(osb));
 }
 
 
@@ -125,8 +125,7 @@ compat_30_sys___lstat13(struct lwp *l, c
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, ub), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, ub), sizeof(osb));
 }
 
 /* ARGSUSED */
@@ -140,33 +139,12 @@ compat_30_sys_fhstat(struct lwp *l, cons
 	struct stat sb;
 	struct stat13 osb;
 	int error;
-	struct compat_30_fhandle fh;
-	struct mount *mp;
-	struct vnode *vp;
-
-	/*
-	 * Must be super user
-	 */
-	if ((error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE,
-	0, NULL, NULL, NULL)))
-		return (error);
 
-	if ((error = copyin(SCARG(uap, fhp), , sizeof(fh))) != 0)
-		return (error);
-
-	if ((mp = vfs_getvfs(_fsid)) == NULL)
-		return (ESTALE);
-	if (mp->mnt_op->vfs_fhtovp == NULL)
-		return EOPNOTSUPP;
-	if ((error = VFS_FHTOVP(mp, (struct fid*)_fid, )))
-		return (error);
-	error = vn_stat(vp, );
-	vput(vp);
+	error = do_fhstat(l, SCARG(uap, fhp), sizeof(*SCARG(uap, fhp)), );
 	if (error)
-		return (error);
+		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, sb), sizeof(sb));
-	return (error);
+	return copyout(, SCARG(uap, sb), sizeof(osb));
 }
 
 /*
@@ -188,8 +166,7 @@ compat_30_sys___fstat13(struct lwp *l, c
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, sb), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, sb), sizeof(osb));
 }
 
 /*
@@ -265,7 +242,7 @@ again:
 		bdp = (struct dirent *)inp;
 		reclen = bdp->d_reclen;
 		if (reclen & _DIRENT_ALIGN(bdp))
-			panic("netbsd30_getdents: bad reclen %d", reclen);
+			panic("%s: bad reclen %d", __func__, reclen);
 		if (cookie)
 			off = *cookie++; /* each entry points to the next */
 		else
@@ -368,9 +345,8 @@ compat_30_sys_getfh(struct lwp *l, const
 		error = EINVAL;
 	}
 	if (error)
-		return (error);
-	error = copyout(, SCARG(uap, fhp), sizeof(struct compat_30_fhandle));
-	return (error);
+		return error;
+	return copyout(, SCARG(uap, fhp), sizeof(fh));
 }
 
 /*
@@ -407,8 +383,7 @@ compat_30_sys___fhstat30(struct lwp *l, 
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap_30, sb), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap_30, sb), sizeof(osb));
 }
 
 /* ARGSUSED */

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.59.8.2 src/sys/compat/common/vfs_syscalls_43.c:1.59.8.3
--- src/sys/compat/common/vfs_syscalls_43.c:1.59.8.2	Sun Dec 10 09:36:36 2017
+++ 

CVS commit: [netbsd-8] src/sys/compat/common

2020-10-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 10 14:36:57 UTC 2020

Modified Files:
src/sys/compat/common [netbsd-8]: tty_43.c

Log Message:
Pull up following revision(s) (requested by nia in ticket #1614):

sys/compat/common/tty_43.c: revision 1.38

tty_43: Check a bitset from userspace is valid before shifting it

Passing a negative value to these legacy compat ioctls results in
left shift on a negative value which is undefined behaviour and results
in the tty (at least, possibly other things) locking up.
The argument to the ioctl should always be > 0. Return EINVAL otherwise.

While here, adjustments to code style to match current guidelines.
Found by UBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.20.1 src/sys/compat/common/tty_43.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/common/tty_43.c
diff -u src/sys/compat/common/tty_43.c:1.30 src/sys/compat/common/tty_43.c:1.30.20.1
--- src/sys/compat/common/tty_43.c:1.30	Thu May 22 16:31:19 2014
+++ src/sys/compat/common/tty_43.c	Sat Oct 10 14:36:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_43.c,v 1.30 2014/05/22 16:31:19 dholland Exp $	*/
+/*	$NetBSD: tty_43.c,v 1.30.20.1 2020/10/10 14:36:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.30 2014/05/22 16:31:19 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.30.20.1 2020/10/10 14:36:57 martin Exp $");
 
 #include 
 #include 
@@ -211,20 +211,24 @@ ttcompat(struct tty *tp, u_long com, voi
 	case TIOCLBIC:
 	case TIOCLSET: {
 		struct termios term;
-		int flags;
+		int argbits, flags;
+
+		argbits = *(int *)data;
+		if (argbits < 0)
+			return EINVAL;
 
 		mutex_spin_enter(_lock);
 		term = tp->t_termios;
 		flags = ttcompatgetflags(tp);
 		switch (com) {
 		case TIOCLSET:
-			tp->t_flags = (flags&0x) | (*(int *)data<<16);
+			tp->t_flags = (flags & 0x) | (argbits << 16);
 			break;
 		case TIOCLBIS:
-			tp->t_flags = flags | (*(int *)data<<16);
+			tp->t_flags = flags | (argbits << 16);
 			break;
 		case TIOCLBIC:
-			tp->t_flags = flags & ~(*(int *)data<<16);
+			tp->t_flags = flags & ~(argbits << 16);
 			break;
 		}
 		ttcompatsetlflags(tp, );



CVS commit: [netbsd-8] src/sys/compat/common

2020-01-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 21 16:51:27 UTC 2020

Modified Files:
src/sys/compat/common [netbsd-8]: rtsock_50.c

Log Message:
Apply patch, requested by pgoyette in ticket #1484:

sys/compat/common/rtsock_50.c (patch)

PR kern/54861:

For MODULAR kernels, we include all of the compat code, even if not
required by the selected COMPAT_xx options.  Thus, rtsock_14.c is
included in the kernel.

rtsock_14.c in turn references routines in rtsock_50.c which is also
included in the kernel.  However, if the kernel is built without the
COMPAT_50 option, rtsock_50.c ends up being a no-op and doesn't
define any of the routines that rtsock_14.c needs.

Thus, MODULAR kernels which only have COMPAT_60 (or newer) will fail
to link becuase of the undefined symbols.

Fix is to make rtsock_50.c functional if MODULAR kernel option is
specified.


To generate a diff of this commit:
cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/compat/common/rtsock_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/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.4.10.1 src/sys/compat/common/rtsock_50.c:1.4.10.2
--- src/sys/compat/common/rtsock_50.c:1.4.10.1	Sat Jun  9 14:38:18 2018
+++ src/sys/compat/common/rtsock_50.c	Tue Jan 21 16:51:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.4.10.1 2018/06/09 14:38:18 martin Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.4.10.2 2020/01/21 16:51:27 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,14 +61,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.4.10.1 2018/06/09 14:38:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.4.10.2 2020/01/21 16:51:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
+#include "opt_modular.h"
 #endif
 
-#if defined(COMPAT_14) && !defined(COMPAT_50)
-#define	COMPAT_50	1	/* 1.4 needs 5.0 */
+#if (defined(MODULAR) || defined(COMPAT_14)) && !defined(COMPAT_50)
+#define	COMPAT_50	1	/* MODULAR and 1.4 need 5.0 */
 #endif
 
 #if defined(COMPAT_50)



CVS commit: [netbsd-8] src/sys/compat/common

2018-06-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  9 14:38:18 UTC 2018

Modified Files:
src/sys/compat/common [netbsd-8]: rtsock_50.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #861):

sys/compat/common/rtsock_50.c: revision 1.7

Added missing ifi_link_state at compat_50_rt_oifmsg() and compat_50_iflist().


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/compat/common/rtsock_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/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.4 src/sys/compat/common/rtsock_50.c:1.4.10.1
--- src/sys/compat/common/rtsock_50.c:1.4	Mon Aug 24 22:50:33 2015
+++ src/sys/compat/common/rtsock_50.c	Sat Jun  9 14:38:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.4 2015/08/24 22:50:33 pooka Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.4.10.1 2018/06/09 14:38:18 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.4 2015/08/24 22:50:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.4.10.1 2018/06/09 14:38:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -92,6 +92,7 @@ compat_50_rt_oifmsg(struct ifnet *ifp)
 	oifm.ifm_data.ifi_type = ifp->if_data.ifi_type;
 	oifm.ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
 	oifm.ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
+	oifm.ifm_data.ifi_link_state = ifp->if_data.ifi_link_state;
 	oifm.ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
 	oifm.ifm_data.ifi_metric = ifp->if_data.ifi_metric;
 	oifm.ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;
@@ -128,6 +129,7 @@ compat_50_iflist(struct ifnet *ifp, stru
 	ifm->ifm_data.ifi_type = ifp->if_data.ifi_type;
 	ifm->ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
 	ifm->ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
+	ifm->ifm_data.ifi_link_state = ifp->if_data.ifi_link_state;
 	ifm->ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
 	ifm->ifm_data.ifi_metric = ifp->if_data.ifi_metric;
 	ifm->ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;



CVS commit: [netbsd-8] src/sys/compat/common

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:35:33 UTC 2018

Modified Files:
src/sys/compat/common [netbsd-8]: compat_mod.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #807):

sys/compat/common/compat_mod.c: revision 1.29

Clean up a stray #ifdef _MODULE - it prevented definition of
COMPAT_SIGCONTEXT which in turn prevented building of the
SYS_compat16_sigaction_14 code.

Should address PR kern/53260

XXX Pull-up to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.8.1 src/sys/compat/common/compat_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/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24 src/sys/compat/common/compat_mod.c:1.24.8.1
--- src/sys/compat/common/compat_mod.c:1.24	Sat Nov  5 23:30:22 2016
+++ src/sys/compat/common/compat_mod.c	Sun May  6 09:35:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24 2016/11/05 23:30:22 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.8.1 2018/05/06 09:35:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24 2016/11/05 23:30:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.8.1 2018/05/06 09:35:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -69,15 +69,13 @@ MODULE(MODULE_CLASS_EXEC, compat, NULL);
 
 int	ttcompat(struct tty *, u_long, void *, int, struct lwp *);
 
-#ifdef _MODULE
 #ifdef COMPAT_16
 #if !defined(__amd64__) || defined(COMPAT_NETBSD32)
 #define COMPAT_SIGCONTEXT
 extern char sigcode[], esigcode[];
 struct uvm_object *emul_netbsd_object;
-#endif
-#endif
-#endif /* _MODULE */
+#endif /* !defined(__amd64__) || defined(COMPAT_NETBSD32) */
+#endif /* COMPAT_16 */
 
 extern krwlock_t exec_lock;
 extern krwlock_t ttcompat_lock;



CVS commit: [netbsd-8] src/sys/compat/common

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 09:36:36 UTC 2017

Modified Files:
src/sys/compat/common [netbsd-8]: vfs_syscalls_12.c vfs_syscalls_43.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #418):
sys/compat/common/vfs_syscalls_12.c: revision 1.35
sys/compat/common/vfs_syscalls_43.c: revision 1.62
Make code look the same, in particular zero out the rest of the directory
record.


To generate a diff of this commit:
cvs rdiff -u -r1.33.8.1 -r1.33.8.2 src/sys/compat/common/vfs_syscalls_12.c
cvs rdiff -u -r1.59.8.1 -r1.59.8.2 src/sys/compat/common/vfs_syscalls_43.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/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.33.8.1 src/sys/compat/common/vfs_syscalls_12.c:1.33.8.2
--- src/sys/compat/common/vfs_syscalls_12.c:1.33.8.1	Wed Aug  9 05:12:18 2017
+++ src/sys/compat/common/vfs_syscalls_12.c	Sun Dec 10 09:36:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.33.8.1 2017/08/09 05:12:18 snj Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.1 2017/08/09 05:12:18 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $");
 
 #include 
 #include 
@@ -183,6 +183,10 @@ again:
 off += reclen;
 			continue;
 		}
+		if (bdp->d_namlen >= sizeof(idb.d_name))
+			idb.d_namlen = sizeof(idb.d_name) - 1;
+		else
+			idb.d_namlen = bdp->d_namlen;
 		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
 		if (reclen > len || resid < old_reclen) {
 			/* entry too big for buffer, so just stop */
@@ -197,9 +201,9 @@ again:
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
 		idb.d_type = (uint8_t)bdp->d_type;
-		idb.d_namlen = (uint8_t)bdp->d_namlen;
-		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-		bdp->d_namlen));
+		(void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+		memset(idb.d_name + idb.d_namlen, 0,
+		idb.d_reclen - _DIRENT_NAMEOFF() - idb.d_namlen);
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.59.8.1 src/sys/compat/common/vfs_syscalls_43.c:1.59.8.2
--- src/sys/compat/common/vfs_syscalls_43.c:1.59.8.1	Wed Aug  9 05:12:18 2017
+++ src/sys/compat/common/vfs_syscalls_43.c	Sun Dec 10 09:36:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.59.8.1 2017/08/09 05:12:18 snj Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.59.8.2 2017/12/10 09:36:36 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.1 2017/08/09 05:12:18 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.2 2017/12/10 09:36:36 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -463,6 +463,10 @@ again:
 off += reclen;
 			continue;
 		}
+		if (bdp->d_namlen >= sizeof(idb.d_name))
+			idb.d_namlen = sizeof(idb.d_name) - 1;
+		else
+			idb.d_namlen = bdp->d_namlen;
 		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
 		if (reclen > len || resid < old_reclen) {
 			/* entry too big for buffer, so just stop */
@@ -476,9 +480,10 @@ again:
 		 */
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
-		idb.d_namlen = (uint16_t)bdp->d_namlen;
-		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-		idb.d_namlen));
+		idb.d_fileno = (uint32_t)bdp->d_fileno;
+		(void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+		memset(idb.d_name + idb.d_namlen, 0,
+		idb.d_reclen - _DIRENT_NAMEOFF() - idb.d_namlen);
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */



CVS commit: [netbsd-8] src/sys/compat/common

2017-12-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  4 13:55:00 UTC 2017

Modified Files:
src/sys/compat/common [netbsd-8]: uipc_syscalls_40.c

Log Message:
Additionaly pull up rev 1.15 for ticket #407, requested by ozaki-r:
#idef the label next_ifa: just like the only goto using it.


To generate a diff of this commit:
cvs rdiff -u -r1.13.6.1 -r1.13.6.2 src/sys/compat/common/uipc_syscalls_40.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/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.13.6.1 src/sys/compat/common/uipc_syscalls_40.c:1.13.6.2
--- src/sys/compat/common/uipc_syscalls_40.c:1.13.6.1	Thu Nov 30 15:57:37 2017
+++ src/sys/compat/common/uipc_syscalls_40.c	Mon Dec  4 13:55:00 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.13.6.1 2017/11/30 15:57:37 martin Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.13.6.2 2017/12/04 13:55:00 martin Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13.6.1 2017/11/30 15:57:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13.6.2 2017/12/04 13:55:00 martin Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -124,7 +124,9 @@ compat_ifconf(u_long cmd, void *data)
 			}
 			space -= sz;
 
+#ifdef COMPAT_OSOCK
 		next_ifa:
+#endif
 			s = pserialize_read_enter();
 			ifa_release(ifa, _ifa);
 		}