CVS commit: [netbsd-9] src/sys/compat/common
Module Name:src Committed By: martin Date: Sun Aug 15 09:27:50 UTC 2021 Modified Files: src/sys/compat/common [netbsd-9]: vfs_syscalls_30.c vfs_syscalls_43.c vfs_syscalls_50.c Log Message: Pull up following revision(s) (requested by christos in ticket #1337): 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.38 -r1.38.4.1 src/sys/compat/common/vfs_syscalls_30.c cvs rdiff -u -r1.64.4.1 -r1.64.4.2 src/sys/compat/common/vfs_syscalls_43.c cvs rdiff -u -r1.23.2.1 -r1.23.2.2 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.38 src/sys/compat/common/vfs_syscalls_30.c:1.38.4.1 --- src/sys/compat/common/vfs_syscalls_30.c:1.38 Sun Jan 27 02:08:39 2019 +++ src/sys/compat/common/vfs_syscalls_30.c Sun Aug 15 09:27:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_30.c,v 1.38 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: vfs_syscalls_30.c,v 1.38.4.1 2021/08/15 09:27:50 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.38 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.38.4.1 2021/08/15 09:27:50 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -61,8 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls #include #include -static void cvtstat(struct stat13 *, const struct stat *); - static const struct syscall_package vfs_syscalls_30_syscalls[] = { { SYS_compat_30___fhstat30, 0, (sy_call_t *)compat_30_sys___fhstat30 }, { SYS_compat_30___fstat13, 0, (sy_call_t *)compat_30_sys___fstat13 }, @@ -83,6 +81,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; @@ -121,8 +121,7 @@ compat_30_sys___stat13(struct lwp *l, if (error) return error; cvtstat(, ); - error = copyout(, SCARG(uap, ub), sizeof (osb)); - return error; + return copyout(, SCARG(uap, ub), sizeof(osb)); } @@ -146,8 +145,7 @@ compat_30_sys___lstat13(struct lwp *l, if (error) return error; cvtstat(, ); - error = copyout(, SCARG(uap, ub), sizeof (osb)); - return error; + return copyout(, SCARG(uap, ub), sizeof(osb)); } /* ARGSUSED */ @@ -162,33 +160,12 @@ compat_30_sys_fhstat(struct lwp *l, 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)); } /* @@ -211,8 +188,7 @@ compat_30_sys___fstat13(struct lwp *l, if (error) return error; cvtstat(, ); - error = copyout(, SCARG(uap, sb), sizeof (osb)); - return error; + return copyout(, SCARG(uap, sb), sizeof(osb)); } /* @@ -289,7 +265,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 @@ -393,9 +369,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)); } /* @@ -434,8 +409,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
CVS commit: [netbsd-9] src/sys/compat/linux/common
Module Name:src Committed By: martin Date: Sun Nov 8 08:39:13 UTC 2020 Modified Files: src/sys/compat/linux/common [netbsd-9]: linux_socket.c Log Message: Pull up following revision(s) (requested by kamil in ticket #1127): sys/compat/linux/common/linux_socket.c: revision 1.151 Fix compat with Linux programs that use longer namelen for sockets Linux is less strict than NetBSD and permits namelen to be larger than valid struct sockaddr_in*. If this is the case, truncate the value to the correct size, so that NetBSD networking does not return an error. Reviewed by kamil To generate a diff of this commit: cvs rdiff -u -r1.145.4.2 -r1.145.4.3 \ src/sys/compat/linux/common/linux_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/linux/common/linux_socket.c diff -u src/sys/compat/linux/common/linux_socket.c:1.145.4.2 src/sys/compat/linux/common/linux_socket.c:1.145.4.3 --- src/sys/compat/linux/common/linux_socket.c:1.145.4.2 Fri Jul 17 15:24:48 2020 +++ src/sys/compat/linux/common/linux_socket.c Sun Nov 8 08:39:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socket.c,v 1.145.4.2 2020/07/17 15:24:48 martin Exp $ */ +/* $NetBSD: linux_socket.c,v 1.145.4.3 2020/11/08 08:39:12 martin Exp $ */ /*- * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.145.4.2 2020/07/17 15:24:48 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.145.4.3 2020/11/08 08:39:12 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -1612,6 +1612,21 @@ linux_get_sa(struct lwp *l, int s, struc sin6->sin6_scope_id = 0; } + /* + * Linux is less strict than NetBSD and permits namelen to be larger + * than valid struct sockaddr_in*. If this is the case, truncate + * the value to the correct size, so that NetBSD networking does not + * return an error. + */ + switch (bdom) { + case AF_INET: + namelen = MIN(namelen, sizeof(struct sockaddr_in)); + break; + case AF_INET6: + namelen = MIN(namelen, sizeof(struct sockaddr_in6)); + break; + } + sb->sb_family = bdom; sb->sb_len = namelen; ktrkuser("mbsoname", sb, namelen);
CVS commit: [netbsd-9] src/sys/compat/common
Module Name:src Committed By: martin Date: Sat Oct 10 14:35:07 UTC 2020 Modified Files: src/sys/compat/common [netbsd-9]: tty_43.c Log Message: Pull up following revision(s) (requested by nia in ticket #1106): 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.34 -r1.34.4.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.34 src/sys/compat/common/tty_43.c:1.34.4.1 --- src/sys/compat/common/tty_43.c:1.34 Fri Mar 1 11:06:56 2019 +++ src/sys/compat/common/tty_43.c Sat Oct 10 14:35:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tty_43.c,v 1.34 2019/03/01 11:06:56 pgoyette Exp $ */ +/* $NetBSD: tty_43.c,v 1.34.4.1 2020/10/10 14:35:06 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.34 2019/03/01 11:06:56 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.34.4.1 2020/10/10 14:35:06 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -220,20 +220,24 @@ compat_43_ttioctl(struct tty *tp, u_long 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-9] src/sys/compat/ossaudio
Module Name:src Committed By: martin Date: Wed Apr 22 18:12:26 UTC 2020 Modified Files: src/sys/compat/ossaudio [netbsd-9]: ossaudio.c Log Message: Pull up following revision(s) (requested by maxv in ticket #841): sys/compat/ossaudio/ossaudio.c: revision 1.83 ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv. The uninitalized field in this structure is `fillers`, an array that simply reserves space for later changes in OSSv4, which this version of the OSS compat layer (specifically for Linux applications) makes no effort to implement. To generate a diff of this commit: cvs rdiff -u -r1.74.4.2 -r1.74.4.3 src/sys/compat/ossaudio/ossaudio.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/ossaudio/ossaudio.c diff -u src/sys/compat/ossaudio/ossaudio.c:1.74.4.2 src/sys/compat/ossaudio/ossaudio.c:1.74.4.3 --- src/sys/compat/ossaudio/ossaudio.c:1.74.4.2 Tue Nov 19 11:01:27 2019 +++ src/sys/compat/ossaudio/ossaudio.c Wed Apr 22 18:12:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ossaudio.c,v 1.74.4.2 2019/11/19 11:01:27 martin Exp $ */ +/* $NetBSD: ossaudio.c,v 1.74.4.3 2020/04/22 18:12:26 martin Exp $ */ /*- * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.74.4.2 2019/11/19 11:01:27 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.74.4.3 2020/04/22 18:12:26 martin Exp $"); #include #include @@ -1084,6 +1084,7 @@ oss_ioctl_mixer(struct lwp *lwp, const s __func__, error)); goto out; } + memset(, 0, sizeof omi); omi.modify_counter = 1; strncpy(omi.id, adev.name, sizeof omi.id); strncpy(omi.name, adev.name, sizeof omi.name);
CVS commit: [netbsd-9] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Mon Mar 9 09:55:52 UTC 2020 Modified Files: src/sys/compat/netbsd32 [netbsd-9]: netbsd32_mod.c Log Message: Pull up following revision(s) (requested by pgoyette in ticket #770): sys/compat/netbsd32/netbsd32_mod.c: revision 1.19 If a syscall requires a module to be autoloaded, the initial invocation of that syscall will return ERESTART. For amd64's netbsd32_syscall() that means we need to back up the PC saved in the trap frame so we can re-issue the syscall instruction. For "normal" syscall traps, we saved the instruction length in the trap frame, but this was missing for the oosyscall/lcall path. Since the PC was not backed up, the kernel-only value ERESTART was returned to userland, causing all sort of grief for old compat_netbsd32 executables! XXX Pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.15.4.2 -r1.15.4.3 src/sys/compat/netbsd32/netbsd32_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/netbsd32/netbsd32_mod.c diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.2 src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.3 --- src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.2 Mon Mar 9 05:36:24 2020 +++ src/sys/compat/netbsd32/netbsd32_mod.c Mon Mar 9 09:55:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $ */ +/* $NetBSD: netbsd32_mod.c,v 1.15.4.3 2020/03/09 09:55:52 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.3 2020/03/09 09:55:52 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_execfmt.h" @@ -148,8 +148,9 @@ amd64_oosyscall_handle(struct proc *p, s copyin((void *)frame->tf_rip, tmp, sz) == 0 && memcmp(tmp, lcall, sz) == 0) { - /* Advance past the lcall. */ + /* Advance past the lcall and save instruction size. */ frame->tf_rip += sz; + frame->tf_err = sz; /* Do the syscall */ p->p_md.md_syscall(frame); @@ -157,7 +158,7 @@ amd64_oosyscall_handle(struct proc *p, s } else return EPASSTHROUGH; } -#endif +#endif /* defined(__amd64__) */ static int compat_netbsd32_modcmd(modcmd_t cmd, void *arg) @@ -175,14 +176,14 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi #if defined(__amd64__) MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo", amd64_oosyscall_handle); -#endif +#endif /* defined(__amd64__) */ } return error; case MODULE_CMD_FINI: #if defined(__amd64__) MODULE_HOOK_UNSET(amd64_oosyscall_hook); -#endif +#endif /* defined(__amd64__) */ netbsd32_machdep_md_fini(); netbsd32_sysctl_fini(); netbsd32_kern_proc_32_fini(); @@ -196,7 +197,7 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi #if defined(__amd64__) MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo", amd64_oosyscall_handle); -#endif +#endif /* defined(__amd64__) */ } return error;
CVS commit: [netbsd-9] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Mon Mar 9 05:36:24 UTC 2020 Modified Files: src/sys/compat/netbsd32 [netbsd-9]: netbsd32_mod.c Log Message: Apply patch, requested by pgoyette in ticket #775 to fix fallout from ticket #762: sys/compat/netbsd32/netbsd32_mod.c (patched) Fiy arguments to MODULE_HOOK_SET for the new amd64_oosyscall_hook. To generate a diff of this commit: cvs rdiff -u -r1.15.4.1 -r1.15.4.2 src/sys/compat/netbsd32/netbsd32_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/netbsd32/netbsd32_mod.c diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.1 src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.2 --- src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.1 Sun Mar 8 10:54:43 2020 +++ src/sys/compat/netbsd32/netbsd32_mod.c Mon Mar 9 05:36:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_mod.c,v 1.15.4.1 2020/03/08 10:54:43 martin Exp $ */ +/* $NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.1 2020/03/08 10:54:43 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_execfmt.h" @@ -173,7 +173,7 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi netbsd32_machdep_md_init(); netbsd32_kern_proc_32_init(); #if defined(__amd64__) - MODULE_HOOK_SET(amd64_oosyscall_hook, + MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo", amd64_oosyscall_handle); #endif } @@ -194,7 +194,7 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi netbsd32_sysctl_init(); netbsd32_machdep_md_init(); #if defined(__amd64__) - MODULE_HOOK_SET(amd64_oosyscall_hook, + MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo", amd64_oosyscall_handle); #endif }
CVS commit: [netbsd-9] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sun Mar 8 10:38:10 UTC 2020 Modified Files: src/sys/compat/netbsd32 [netbsd-9]: netbsd32_syscall.h netbsd32_syscallargs.h netbsd32_syscalls.c netbsd32_syscalls_autoload.c netbsd32_sysent.c netbsd32_systrace_args.c Log Message: Regen (for ticket #761) To generate a diff of this commit: cvs rdiff -u -r1.142.2.1 -r1.142.2.2 \ src/sys/compat/netbsd32/netbsd32_syscall.h cvs rdiff -u -r1.141.2.1 -r1.141.2.2 \ src/sys/compat/netbsd32/netbsd32_syscallargs.h \ src/sys/compat/netbsd32/netbsd32_syscalls.c cvs rdiff -u -r1.21.2.1 -r1.21.2.2 \ src/sys/compat/netbsd32/netbsd32_syscalls_autoload.c cvs rdiff -u -r1.140.2.1 -r1.140.2.2 \ src/sys/compat/netbsd32/netbsd32_sysent.c cvs rdiff -u -r1.32.2.1 -r1.32.2.2 \ src/sys/compat/netbsd32/netbsd32_systrace_args.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.142.2.1 src/sys/compat/netbsd32/netbsd32_syscall.h:1.142.2.2 --- src/sys/compat/netbsd32/netbsd32_syscall.h:1.142.2.1 Mon Nov 4 14:47:33 2019 +++ src/sys/compat/netbsd32/netbsd32_syscall.h Sun Mar 8 10:38:10 2020 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscall.h,v 1.142.2.1 2019/11/04 14:47:33 martin Exp $ */ +/* $NetBSD: netbsd32_syscall.h,v 1.142.2.2 2020/03/08 10:38:10 martin Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp + * created from NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp */ #ifndef _NETBSD32_SYS_SYSCALL_H_ @@ -432,13 +432,10 @@ /* syscall: "compat_50_netbsd32_quotactl" ret: "int" args: "netbsd32_charp" "int" "int" "netbsd32_voidp" */ #define NETBSD32_SYS_compat_50_netbsd32_quotactl 148 -/* syscall: "compat_43_oquota" ret: "int" args: */ -#define NETBSD32_SYS_compat_43_oquota 149 - #else /* 148 is excluded compat_netbsd32_quotactl */ -/* 149 is excluded compat_netbsd32_quota */ #endif +/* 149 is excluded compat_netbsd32_quota */ /* syscall: "compat_43_netbsd32_ogetsockname" ret: "int" args: "int" "netbsd32_voidp" "netbsd32_intp" */ #define NETBSD32_SYS_compat_43_netbsd32_ogetsockname 150 Index: src/sys/compat/netbsd32/netbsd32_syscallargs.h diff -u src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.141.2.1 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.141.2.2 --- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.141.2.1 Mon Nov 4 14:47:33 2019 +++ src/sys/compat/netbsd32/netbsd32_syscallargs.h Sun Mar 8 10:38:10 2020 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscallargs.h,v 1.141.2.1 2019/11/04 14:47:33 martin Exp $ */ +/* $NetBSD: netbsd32_syscallargs.h,v 1.141.2.2 2020/03/08 10:38:10 martin Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp + * created from NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp */ #ifndef _NETBSD32_SYS_SYSCALLARGS_H_ @@ -2899,8 +2899,6 @@ int sys_setsid(struct lwp *, const void #if defined(QUOTA) || !defined(_KERNEL_OPT) int compat_50_netbsd32_quotactl(struct lwp *, const struct compat_50_netbsd32_quotactl_args *, register_t *); -int compat_43_sys_quota(struct lwp *, const void *, register_t *); - #else #endif int compat_43_netbsd32_ogetsockname(struct lwp *, const struct compat_43_netbsd32_ogetsockname_args *, register_t *); Index: src/sys/compat/netbsd32/netbsd32_syscalls.c diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.141.2.1 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.141.2.2 --- src/sys/compat/netbsd32/netbsd32_syscalls.c:1.141.2.1 Mon Nov 4 14:47:33 2019 +++ src/sys/compat/netbsd32/netbsd32_syscalls.c Sun Mar 8 10:38:10 2020 @@ -1,14 +1,14 @@ -/* $NetBSD: netbsd32_syscalls.c,v 1.141.2.1 2019/11/04 14:47:33 martin Exp $ */ +/* $NetBSD: netbsd32_syscalls.c,v 1.141.2.2 2020/03/08 10:38:10 martin Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp + * created from NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.141.2.1 2019/11/04 14:47:33 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.141.2.2 2020/03/08 10:38:10 martin Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) @@ -180,11 +180,10 @@ const char *const netbsd32_syscallnames[ /* 147 */ "setsid", #if defined(QUOTA) || !defined(_KERNEL_OPT) /* 148 */ "compat_50_netbsd32_quotactl", - /* 149 */ "compat_43_oquota", #else /* 148 */ "#148 (excluded compat_netbsd32_quotactl)", - /* 149 */
CVS commit: [netbsd-9] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sun Mar 8 10:36:38 UTC 2020 Modified Files: src/sys/compat/netbsd32 [netbsd-9]: netbsd32_compat_43.c syscalls.master Log Message: Pull up following revision(s) (requested by pgoyette in ticket #761): sys/compat/netbsd32/syscalls.master: revision 1.132 sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.60 Properly mark netbsd32_compat_43 syscalls that are directly implemented by calling their compat_43 equivalents. With these changes, and with built-in versions of COMPAT_NETBSD32, COMPAT_NOMID, and COMPAT_09, I can now run a netbsd-0.9 statically linked i386 (32-bit) version of /bin/ls on a 9.99.x amd64 host! Addresses PR kern/55047 but more changes coming to handle non-built-in modules. XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.57.4.2 -r1.57.4.3 \ src/sys/compat/netbsd32/netbsd32_compat_43.c cvs rdiff -u -r1.127.2.1 -r1.127.2.2 src/sys/compat/netbsd32/syscalls.master 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_43.c diff -u src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.2 src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.3 --- src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.2 Thu Jan 2 09:50:34 2020 +++ src/sys/compat/netbsd32/netbsd32_compat_43.c Sun Mar 8 10:36:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_43.c,v 1.57.4.2 2020/01/02 09:50:34 martin Exp $ */ +/* $NetBSD: netbsd32_compat_43.c,v 1.57.4.3 2020/03/08 10:36:38 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.57.4.2 2020/01/02 09:50:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.57.4.3 2020/03/08 10:36:38 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_43.h" @@ -769,6 +769,26 @@ static struct syscall_package compat_net (sy_call_t *)compat_43_netbsd32_sigsetmask }, { NETBSD32_SYS_compat_43_netbsd32_osigstack, 0, (sy_call_t *)compat_43_netbsd32_osigstack }, +/* + * These syscalls are provided by emul_netbsd compat_43 code, but their + * entry points must still be loaded in the emul_netbsd32 disatch table + */ + { NETBSD32_SYS_compat_43_ogetpagesize, 0, + (sy_call_t *)compat_43_sys_getpagesize }, + { NETBSD32_SYS_compat_43_ogetdtablesize, 0, + (sy_call_t *)compat_43_sys_getdtablesize}, + { NETBSD32_SYS_compat_43_ogethostid, 0, + (sy_call_t *)compat_43_sys_gethostid }, + { NETBSD32_SYS_compat_43_owait, 0, + (sy_call_t *)compat_43_sys_wait }, +/* + * Skip oquota since it isn't part of compat_43 + * { NETBSD32_SYS_compat_43_oquota, 0, + * (sy_call_t *)compat_43_sys_quota }, + */ + +/* End of compat_43 syscalls */ + { 0, 0, NULL } }; Index: src/sys/compat/netbsd32/syscalls.master diff -u src/sys/compat/netbsd32/syscalls.master:1.127.2.1 src/sys/compat/netbsd32/syscalls.master:1.127.2.2 --- src/sys/compat/netbsd32/syscalls.master:1.127.2.1 Mon Nov 4 14:46:57 2019 +++ src/sys/compat/netbsd32/syscalls.master Sun Mar 8 10:36:38 2020 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp $ + $NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp $ ; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -183,7 +183,7 @@ { int|netbsd32||ogetkerninfo(int op, \ netbsd32_charp where, netbsd32_intp size, \ int arg); } -64 COMPAT_43 MODULAR compat_netbsd32_43 \ +64 COMPAT_43 MODULAR compat_43 \ { int|sys||getpagesize(void); } ogetpagesize 65 COMPAT_12 MODULAR compat_netbsd32_12 \ { int|netbsd32||msync(netbsd32_voidp addr, \ @@ -219,7 +219,7 @@ { int|netbsd32||setitimer(int which, \ netbsd32_itimerval50p_t itv, \ netbsd32_itimerval50p_t oitv); } -84 COMPAT_43 MODULAR compat_netbsd32_43 \ +84 COMPAT_43 MODULAR compat_43 \ { int|sys||wait(void); } owait 85 COMPAT_12 MODULAR compat_netbsd32_12 \ { int|netbsd32||oswapon(netbsd32_charp name); } @@ -232,7 +232,7 @@ 88 COMPAT_43 MODULAR compat_netbsd32_43 \ { int|netbsd32||osethostname(netbsd32_charp hostname, \ u_int len); } -89 COMPAT_43 MODULAR compat_netbsd32_43 \ +89 COMPAT_43 MODULAR compat_43 \ { int|sys||getdtablesize(void); } ogetdtablesize 90 STD { int|netbsd32||dup2(int from, int to); } 91 UNIMPL getdopt @@ -343,7 +343,7 @@ 141 COMPAT_43 MODULAR compat_netbsd32_43 \ { int|netbsd32||ogetpeername(int fdes, \ netbsd32_voidp asa, netbsd32_intp alen); } -142 COMPAT_43 MODULAR compat_netbsd32_43 \ +142 COMPAT_43 MODULAR compat_43 \ { int32_t|sys||gethostid(void); } ogethostid 143 COMPAT_43 MODULAR compat_netbsd32_43 \ { int|netbsd32||sethostid(int32_t hostid); } @@ -360,12 +360,10 @@ 148 COMPAT_50 MODULAR compat_netbsd32_50 \ {
CVS commit: [netbsd-9] src/sys/compat/common
Module Name:src Committed By: martin Date: Thu Feb 27 19:00:05 UTC 2020 Modified Files: src/sys/compat/common [netbsd-9]: vfs_syscalls_43.c Log Message: Pull up following revision(s) (requested by pgoyette in ticket #741): sys/compat/common/vfs_syscalls_43.c: revision 1.65 Include all of the vfs syscalls in the syscall_package, not just oquota. Should fix PR kern/55025 XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.64.4.1 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_43.c diff -u src/sys/compat/common/vfs_syscalls_43.c:1.64 src/sys/compat/common/vfs_syscalls_43.c:1.64.4.1 --- src/sys/compat/common/vfs_syscalls_43.c:1.64 Sun Jan 27 02:08:39 2019 +++ src/sys/compat/common/vfs_syscalls_43.c Thu Feb 27 19:00:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_43.c,v 1.64 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: vfs_syscalls_43.c,v 1.64.4.1 2020/02/27 19:00:05 martin Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.64 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.64.4.1 2020/02/27 19:00:05 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -79,7 +79,16 @@ static void cvttimespec(struct timespec static void cvtstat(struct stat *, struct stat43 *); static struct syscall_package vfs_syscalls_43_syscalls[] = { - { SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota }, + { SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota }, + { SYS_compat_43_stat43, 0, (sy_call_t *)compat_43_sys_stat }, + { SYS_compat_43_lstat43,0, (sy_call_t *)compat_43_sys_lstat }, + { SYS_compat_43_fstat43,0, (sy_call_t *)compat_43_sys_fstat }, + { SYS_compat_43_otruncate, 0, (sy_call_t *)compat_43_sys_ftruncate }, + { SYS_compat_43_oftruncate, 0, (sy_call_t *)compat_43_sys_ftruncate }, + { SYS_compat_43_olseek, 0, (sy_call_t *)compat_43_sys_lseek }, + { SYS_compat_43_ocreat, 0, (sy_call_t *)compat_43_sys_creat }, + { SYS_compat_43_ogetdirentries, 0, + (sy_call_t *)compat_43_sys_getdirentries }, { 0, 0, NULL } };
CVS commit: [netbsd-9] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Thu Feb 13 19:28:15 UTC 2020 Modified Files: src/sys/compat/netbsd32 [netbsd-9]: netbsd32_ioctl.c Log Message: Pull up following revision(s) (requested by mlelstv in ticket #706): sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.108 sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.109 Don't use strlcpy to copy untrusted input, it may not be NUL-terminated. Where did the +1 came from ? To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.103.2.1 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.103 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.103.2.1 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.103 Fri May 17 07:37:12 2019 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Thu Feb 13 19:28:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.103 2019/05/17 07:37:12 msaitoh Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.103.2.1 2020/02/13 19:28:15 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.103 2019/05/17 07:37:12 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.103.2.1 2020/02/13 19:28:15 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_ntp.h" @@ -146,7 +146,7 @@ netbsd32_to_if_addrprefreq(const struct struct if_addrprefreq *ifap, u_long cmd) { - strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); + memcpy(ifap->ifap_name, ifap32->ifap_name, IFNAMSIZ); ifap->ifap_preference = ifap32->ifap_preference; memcpy(>ifap_addr, >ifap_addr, uimin(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); @@ -385,7 +385,7 @@ netbsd32_to_ieee80211req(struct netbsd32 struct ieee80211req *ireq, u_long cmd) { - strlcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ); + memcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ); ireq->i_type = ireq32->i_type; ireq->i_val = ireq32->i_val; ireq->i_len = ireq32->i_len; @@ -398,7 +398,7 @@ netbsd32_to_ieee80211_nwkey(struct netbs { int i; - strlcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ); + memcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ); nwk->i_wepon = nwk32->i_wepon; nwk->i_defkid = nwk32->i_defkid; for (i = 0; i < IEEE80211_WEP_NKID; i++) { @@ -629,7 +629,7 @@ netbsd32_from_if_addrprefreq(const struc struct netbsd32_if_addrprefreq *ifap32, u_long cmd) { - strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); + memcpy(ifap32->ifap_name, ifap->ifap_name, IFNAMSIZ); ifap32->ifap_preference = ifap->ifap_preference; memcpy(>ifap_addr, >ifap_addr, uimin(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); @@ -864,7 +864,7 @@ netbsd32_from_ieee80211req(struct ieee80 struct netbsd32_ieee80211req *ireq32, u_long cmd) { - strlcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ); + memcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ); ireq32->i_type = ireq->i_type; ireq32->i_val = ireq->i_val; ireq32->i_len = ireq->i_len; @@ -877,7 +877,7 @@ netbsd32_from_ieee80211_nwkey(struct iee { int i; - strlcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ); + memcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ); nwk32->i_wepon = nwk->i_wepon; nwk32->i_defkid = nwk->i_defkid; for (i = 0; i < IEEE80211_WEP_NKID; i++) {
CVS commit: [netbsd-9] src/sys/compat
Module Name:src Committed By: martin Date: Thu Jan 2 09:50:34 UTC 2020 Modified Files: src/sys/compat/common [netbsd-9]: kern_sig_43.c src/sys/compat/netbsd32 [netbsd-9]: netbsd32_compat_20.c netbsd32_compat_43.c netbsd32_compat_50.c Log Message: Pull up following revision(s) (requested by maxv in ticket #597): sys/compat/common/kern_sig_43.c: revision 1.36 sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.39 sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.59 sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.44 Fix sizeof mismatch in copyin. This leads to a user-triggerable stack overflow. On my test build at least, by luck, the compiler orders the variables in a way that the overflow hits only local structures which haven't yet been initialized and used, so the overflow is harmless. Very easily seeable with kASan - just invoke the syscall from a 32bit binary. Fix three stack info leaks, found by kMSan when just invoking all syscalls with a zero page as argument. MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat() MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack() MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40() To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/compat/common/kern_sig_43.c cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/compat/netbsd32/netbsd32_compat_20.c cvs rdiff -u -r1.57.4.1 -r1.57.4.2 \ src/sys/compat/netbsd32/netbsd32_compat_43.c cvs rdiff -u -r1.39.2.1 -r1.39.2.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/common/kern_sig_43.c diff -u src/sys/compat/common/kern_sig_43.c:1.35 src/sys/compat/common/kern_sig_43.c:1.35.4.1 --- src/sys/compat/common/kern_sig_43.c:1.35 Sun Jan 27 02:08:39 2019 +++ src/sys/compat/common/kern_sig_43.c Thu Jan 2 09:50:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig_43.c,v 1.35 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: kern_sig_43.c,v 1.35.4.1 2020/01/02 09:50:34 martin Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.35 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.35.4.1 2020/01/02 09:50:34 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -128,6 +128,7 @@ compat_43_sigstack_to_sigaltstack(const void compat_43_sigaltstack_to_sigstack(const struct sigaltstack *sa, struct sigstack *ss) { + memset(ss, 0, sizeof(*ss)); ss->ss_sp = sa->ss_sp; if (sa->ss_flags & SS_ONSTACK) ss->ss_onstack = 1; Index: src/sys/compat/netbsd32/netbsd32_compat_20.c diff -u src/sys/compat/netbsd32/netbsd32_compat_20.c:1.38 src/sys/compat/netbsd32/netbsd32_compat_20.c:1.38.4.1 --- src/sys/compat/netbsd32/netbsd32_compat_20.c:1.38 Sun Jan 27 02:08:40 2019 +++ src/sys/compat/netbsd32/netbsd32_compat_20.c Thu Jan 2 09:50:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_20.c,v 1.38 2019/01/27 02:08:40 pgoyette Exp $ */ +/* $NetBSD: netbsd32_compat_20.c,v 1.38.4.1 2020/01/02 09:50:34 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.38 2019/01/27 02:08:40 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.38.4.1 2020/01/02 09:50:34 martin Exp $"); #include #include @@ -57,6 +57,7 @@ static inline void compat_20_netbsd32_fr static inline void compat_20_netbsd32_from_statvfs(struct statvfs *sbp, struct netbsd32_statfs *sb32p) { + sb32p->f_type = 0; /* XXX Put an actual value? */ sb32p->f_flags = sbp->f_flag; sb32p->f_bsize = (netbsd32_long)sbp->f_bsize; sb32p->f_iosize = (netbsd32_long)sbp->f_iosize; Index: src/sys/compat/netbsd32/netbsd32_compat_43.c diff -u src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.1 src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.2 --- src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.1 Fri Sep 13 06:25:26 2019 +++ src/sys/compat/netbsd32/netbsd32_compat_43.c Thu Jan 2 09:50:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_43.c,v 1.57.4.1 2019/09/13 06:25:26 martin Exp $ */ +/* $NetBSD: netbsd32_compat_43.c,v 1.57.4.2 2020/01/02 09:50:34 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.57.4.1 2019/09/13 06:25:26 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.57.4.2 2020/01/02 09:50:34 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_43.h" @@ -433,7 +433,7 @@ compat_43_netbsd32_orecvmsg(struct lwp * struct iovec *iov,
CVS commit: [netbsd-9] src/sys/compat/common
Module Name:src Committed By: martin Date: Sun Dec 29 09:36:27 UTC 2019 Modified Files: src/sys/compat/common [netbsd-9]: compat_30_mod.c Log Message: Pull up following revision(s) (requested by pgoyette in ticket #588): sys/compat/common/compat_30_mod.c: revision 1.3 For the built-in COMPAT_30 module code, make sure to initialize the uipc_syscalls_30 stuff, notably to include compat_30_socket(). PR kern/54804 XXX Pullup-9 XXX To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/compat/common/compat_30_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_30_mod.c diff -u src/sys/compat/common/compat_30_mod.c:1.2 src/sys/compat/common/compat_30_mod.c:1.2.6.1 --- src/sys/compat/common/compat_30_mod.c:1.2 Sun Jan 27 02:08:39 2019 +++ src/sys/compat/common/compat_30_mod.c Sun Dec 29 09:36:27 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_30_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: compat_30_mod.c,v 1.2.6.1 2019/12/29 09:36:27 martin Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.2.6.1 2019/12/29 09:36:27 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -66,6 +66,12 @@ compat_30_init(void) vfs_syscalls_30_fini(); return error; } + error = uipc_syscalls_30_init(); + if (error != 0) { + kern_time_30_fini(); + vfs_syscalls_30_fini(); + return error; + } bio_30_init(); vnd_30_init(); usb_30_init(); @@ -82,18 +88,24 @@ compat_30_fini(void) vnd_30_fini(); bio_30_fini(); - error = kern_time_30_fini(); + error = uipc_syscalls_30_fini(); if (error != 0) goto err1; - error = vfs_syscalls_30_fini(); + error = kern_time_30_fini(); if (error != 0) goto err2; + error = vfs_syscalls_30_fini(); + if (error != 0) + goto err3; + return 0; - err2: + err3: kern_time_30_init(); + err2: + uipc_syscalls_30_init(); err1: bio_30_init(); vnd_30_init();