CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: msaitoh Date: Wed Mar 13 11:13:48 UTC 2019 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_compat_60.c Log Message: Pull up following revision(s) (requested by martin in ticket #1683): sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.3 don't forget to convert the timespec. XXX: pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.14.1 src/sys/compat/netbsd32/netbsd32_compat_60.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_compat_60.c diff -u src/sys/compat/netbsd32/netbsd32_compat_60.c:1.1 src/sys/compat/netbsd32/netbsd32_compat_60.c:1.1.14.1 --- src/sys/compat/netbsd32/netbsd32_compat_60.c:1.1 Fri Mar 29 01:13:54 2013 +++ src/sys/compat/netbsd32/netbsd32_compat_60.c Wed Mar 13 11:13:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_60.c,v 1.1 2013/03/29 01:13:54 christos Exp $ */ +/* $NetBSD: netbsd32_compat_60.c,v 1.1.14.1 2019/03/13 11:13:48 msaitoh Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_60.c,v 1.1 2013/03/29 01:13:54 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_60.c,v 1.1.14.1 2019/03/13 11:13:48 msaitoh Exp $"); #include #include @@ -71,6 +71,7 @@ compat_60_netbsd32__lwp_park(struct lwp error = copyin(SCARG_P32(uap, ts), &ts32, sizeof ts32); if (error != 0) return error; + netbsd32_to_timespec(&ts32, &ts); tsp = &ts; }
CVS commit: [netbsd-7] src/sys/compat/sys
Module Name:src Committed By: martin Date: Thu Jan 3 11:13:19 UTC 2019 Modified Files: src/sys/compat/sys [netbsd-7]: time_types.h Log Message: Additionally pull up the following for ticket #1668: sys/compat/sys/time_types.h 1.3 include libkern.h or string.h & stddef.h, to get the offsetof() and memset() definitions. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.40.1 src/sys/compat/sys/time_types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/time_types.h diff -u src/sys/compat/sys/time_types.h:1.1 src/sys/compat/sys/time_types.h:1.1.40.1 --- src/sys/compat/sys/time_types.h:1.1 Thu Nov 5 16:59:01 2009 +++ src/sys/compat/sys/time_types.h Thu Jan 3 11:13:19 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: time_types.h,v 1.1 2009/11/05 16:59:01 pooka Exp $ */ +/* $NetBSD: time_types.h,v 1.1.40.1 2019/01/03 11:13:19 martin Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -34,6 +34,13 @@ #ifndef _COMPAT_SYS_TIME_TYPES_H_ #define _COMPAT_SYS_TIME_TYPES_H_ +#ifdef _KERNEL +#include +#else +#include +#include +#endif + /* * Structure returned by gettimeofday(2) system call, * and used in other calls.
CVS commit: [netbsd-7] src/sys/compat
Module Name:src Committed By: martin Date: Wed Jan 2 15:25:29 UTC 2019 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_compat_14.c netbsd32_conv.h src/sys/compat/sys [netbsd-7]: msg.h Log Message: Pull up following revision(s) (requested by maxv in ticket #1668): sys/compat/netbsd32/netbsd32_conv.h: revision 1.37 sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27 sys/compat/sys/msg.h: revision 1.5 Fix kernel info leaks. + Possible info leak: [len=80, leaked=10] | #0 0x80bad7a7 in kleak_copyout | #1 0x8048e71b in netbsd32___msgctl50 | #2 0x8022fb5b in netbsd32_syscall | #3 0x802096dd in handle_syscall To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.21.74.1 src/sys/compat/netbsd32/netbsd32_compat_14.c cvs rdiff -u -r1.28.4.1 -r1.28.4.2 src/sys/compat/netbsd32/netbsd32_conv.h cvs rdiff -u -r1.4 -r1.4.40.1 src/sys/compat/sys/msg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_compat_14.c diff -u src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21 src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21.74.1 --- src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21 Thu Dec 20 23:03:01 2007 +++ src/sys/compat/netbsd32/netbsd32_compat_14.c Wed Jan 2 15:25:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $ */ +/* $NetBSD: netbsd32_compat_14.c,v 1.21.74.1 2019/01/02 15:25:29 martin Exp $ */ /* * Copyright (c) 1999 Eduardo E. Horvath @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21.74.1 2019/01/02 15:25:29 martin Exp $"); #include #include @@ -126,6 +126,7 @@ static inline void native_to_netbsd32_msqid_ds14(struct msqid_ds *msqbuf, struct netbsd32_msqid_ds14 *omsqbuf) { + memset(omsqbuf, 0, sizeof(*omsqbuf)); native_to_netbsd32_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm); #define CVT(x) omsqbuf->x = msqbuf->x Index: src/sys/compat/netbsd32/netbsd32_conv.h diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.1 src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.2 --- src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.1 Wed Nov 4 17:46:21 2015 +++ src/sys/compat/netbsd32/netbsd32_conv.h Wed Jan 2 15:25:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_conv.h,v 1.28.4.1 2015/11/04 17:46:21 riz Exp $ */ +/* $NetBSD: netbsd32_conv.h,v 1.28.4.2 2019/01/02 15:25:29 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -544,6 +544,7 @@ netbsd32_from_msqid_ds50(const struct ms struct netbsd32_msqid_ds50 *ds32p) { + memset(ds32p, 0, sizeof(*ds32p)); netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm); ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes; ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum; @@ -560,6 +561,7 @@ netbsd32_from_msqid_ds(const struct msqi struct netbsd32_msqid_ds *ds32p) { + memset(ds32p, 0, sizeof(*ds32p)); netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm); ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes; ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum; Index: src/sys/compat/sys/msg.h diff -u src/sys/compat/sys/msg.h:1.4 src/sys/compat/sys/msg.h:1.4.40.1 --- src/sys/compat/sys/msg.h:1.4 Mon Jan 19 19:39:41 2009 +++ src/sys/compat/sys/msg.h Wed Jan 2 15:25:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msg.h,v 1.4 2009/01/19 19:39:41 christos Exp $ */ +/* $NetBSD: msg.h,v 1.4.40.1 2019/01/02 15:25:29 martin Exp $ */ /* * SVID compatible msg.h file @@ -108,6 +108,7 @@ static __inline void __native_to_msqid_ds13(const struct msqid_ds *msqbuf, struct msqid_ds13 *omsqbuf) { + memset(omsqbuf, 0, sizeof(*omsqbuf)); omsqbuf->msg_perm = msqbuf->msg_perm; #define CVT(x) omsqbuf->x = msqbuf->x @@ -149,6 +150,7 @@ static __inline void __native_to_msqid_ds14(const struct msqid_ds *msqbuf, struct msqid_ds14 *omsqbuf) { + memset(omsqbuf, 0, sizeof(*omsqbuf)); __native_to_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm); #define CVT(x) omsqbuf->x = msqbuf->x
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Wed Nov 21 12:09:03 UTC 2018 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_socket.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1652): sys/compat/netbsd32/netbsd32_socket.c: revision 1.48 (via patch) Fix inverted logic, which leads to buffer overflow. Detected by kASan. To generate a diff of this commit: cvs rdiff -u -r1.41.14.1 -r1.41.14.2 \ src/sys/compat/netbsd32/netbsd32_socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_socket.c diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.41.14.1 src/sys/compat/netbsd32/netbsd32_socket.c:1.41.14.2 --- src/sys/compat/netbsd32/netbsd32_socket.c:1.41.14.1 Sat Aug 8 15:41:54 2015 +++ src/sys/compat/netbsd32/netbsd32_socket.c Wed Nov 21 12:09:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_socket.c,v 1.41.14.1 2015/08/08 15:41:54 martin Exp $ */ +/* $NetBSD: netbsd32_socket.c,v 1.41.14.2 2018/11/21 12:09:03 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.41.14.1 2015/08/08 15:41:54 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.41.14.2 2018/11/21 12:09:03 martin Exp $"); #include #include @@ -99,7 +99,7 @@ copyout32_msg_control_mbuf(struct lwp *l } ktrkuser("msgcontrol", cmsg, cmsg->cmsg_len); - error = copyout(&cmsg32, *q, MAX(i, sizeof(cmsg32))); + error = copyout(&cmsg32, *q, MIN(i, sizeof(cmsg32))); if (error) return (error); if (i > CMSG32_LEN(0)) {
CVS commit: [netbsd-7] src/sys/compat/linux32/arch/amd64
Module Name:src Committed By: snj Date: Sat Sep 9 16:57:38 UTC 2017 Modified Files: src/sys/compat/linux32/arch/amd64 [netbsd-7]: linux32_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1507): sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39 Fix a ring0 escalation vulnerability in compat_linux32 where the index of %cs is controlled by userland, making it easy to trigger the page fault and get kernel privileges. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.36.4.1 \ src/sys/compat/linux32/arch/amd64/linux32_machdep.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/linux32/arch/amd64/linux32_machdep.c diff -u src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.36 src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.36.4.1 --- src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.36 Wed Feb 19 21:45:01 2014 +++ src/sys/compat/linux32/arch/amd64/linux32_machdep.c Sat Sep 9 16:57:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_machdep.c,v 1.36 2014/02/19 21:45:01 dsl Exp $ */ +/* $NetBSD: linux32_machdep.c,v 1.36.4.1 2017/09/09 16:57:37 snj Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -31,7 +31,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.36 2014/02/19 21:45:01 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.36.4.1 2017/09/09 16:57:37 snj Exp $"); #include #include @@ -417,8 +417,9 @@ linux32_restore_sigcontext(struct lwp *l /* * Check for security violations. */ - if (((scp->sc_eflags ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 || - !USERMODE(scp->sc_cs, scp->sc_eflags)) + if (((scp->sc_eflags ^ tf->tf_rflags) & PSL_USERSTATIC) != 0) + return EINVAL; + if (!VALID_USER_CSEL32(scp->sc_cs)) return EINVAL; if (scp->sc_fs != 0 && !VALID_USER_DSEL32(scp->sc_fs) &&
CVS commit: [netbsd-7] src/sys/compat/svr4_32
Module Name:src Committed By: martin Date: Sat Aug 12 19:07:51 UTC 2017 Modified Files: src/sys/compat/svr4_32 [netbsd-7]: svr4_32_signal.c Log Message: Also pull up rev1.30 (accidently missing in ticket #1475) To generate a diff of this commit: cvs rdiff -u -r1.26.62.1 -r1.26.62.2 src/sys/compat/svr4_32/svr4_32_signal.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_32/svr4_32_signal.c diff -u src/sys/compat/svr4_32/svr4_32_signal.c:1.26.62.1 src/sys/compat/svr4_32/svr4_32_signal.c:1.26.62.2 --- src/sys/compat/svr4_32/svr4_32_signal.c:1.26.62.1 Sat Aug 12 04:00:50 2017 +++ src/sys/compat/svr4_32/svr4_32_signal.c Sat Aug 12 19:07:51 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_32_signal.c,v 1.26.62.1 2017/08/12 04:00:50 snj Exp $ */ +/* $NetBSD: svr4_32_signal.c,v 1.26.62.2 2017/08/12 19:07:51 martin Exp $ */ /*- * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.62.1 2017/08/12 04:00:50 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.62.2 2017/08/12 19:07:51 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_svr4.h" @@ -397,16 +397,16 @@ svr4_32_sys_signal(struct lwp *l, const nbsa.sa_handler = (sig_t)SCARG(uap, handler); sigemptyset(&nbsa.sa_mask); nbsa.sa_flags = 0; - error = sigaction1(l, signum, &nbsa, &obsa, NULL, 0); + error = sigaction1(l, native_signo, &nbsa, &obsa, NULL, 0); if (error) - return (error); + return error; *retval = (u_int)(u_long)obsa.sa_handler; - return (0); + return 0; case SVR4_SIGHOLD_MASK: sighold: sigemptyset(&ss); - sigaddset(&ss, signum); + sigaddset(&ss, native_signo); mutex_enter(p->p_lock); error = sigprocmask1(l, SIG_BLOCK, &ss, 0); mutex_exit(p->p_lock); @@ -414,7 +414,7 @@ svr4_32_sys_signal(struct lwp *l, const case SVR4_SIGRELSE_MASK: sigemptyset(&ss); - sigaddset(&ss, signum); + sigaddset(&ss, native_signo); mutex_enter(p->p_lock); error = sigprocmask1(l, SIG_UNBLOCK, &ss, 0); mutex_exit(p->p_lock); @@ -424,17 +424,17 @@ svr4_32_sys_signal(struct lwp *l, const nbsa.sa_handler = SIG_IGN; sigemptyset(&nbsa.sa_mask); nbsa.sa_flags = 0; - return (sigaction1(l, signum, &nbsa, 0, NULL, 0)); + return sigaction1(l, native_signo, &nbsa, 0, NULL, 0); case SVR4_SIGPAUSE_MASK: mutex_enter(p->p_lock); ss = l->l_sigmask; mutex_exit(p->p_lock); - sigdelset(&ss, signum); - return (sigsuspend1(l, &ss)); + sigdelset(&ss, native_signo); + return sigsuspend1(l, &ss); default: - return (ENOSYS); + return ENOSYS; } }
CVS commit: [netbsd-7] src/sys/compat/linux/common
Module Name:src Committed By: snj Date: Sat Aug 12 04:50:31 UTC 2017 Modified Files: src/sys/compat/linux/common [netbsd-7]: linux_time.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1486): sys/compat/linux/common/linux_time.c: revision 1.38-1.39 via patch Only let the superuser set the compat_linux timezone. Not really keen to invent a new kauth cookie for this useless purpose. >From Ilja Van Sprundel. -- Put suser check in the right function: settimeofday, not gettimeofday. While here, remove wrong comment. Noted by kre@. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.37.4.1 src/sys/compat/linux/common/linux_time.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_time.c diff -u src/sys/compat/linux/common/linux_time.c:1.37 src/sys/compat/linux/common/linux_time.c:1.37.4.1 --- src/sys/compat/linux/common/linux_time.c:1.37 Mon Jan 13 10:33:03 2014 +++ src/sys/compat/linux/common/linux_time.c Sat Aug 12 04:50:31 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_time.c,v 1.37 2014/01/13 10:33:03 njoly Exp $ */ +/* $NetBSD: linux_time.c,v 1.37.4.1 2017/08/12 04:50:31 snj Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.37 2014/01/13 10:33:03 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.37.4.1 2017/08/12 04:50:31 snj Exp $"); #include #include @@ -102,11 +102,10 @@ linux_sys_settimeofday(struct lwp *l, co return (error); } - /* - * If user is not the superuser, we returned - * after the sys_settimeofday() call. - */ if (SCARG(uap, tzp)) { + if (kauth_authorize_generic(kauth_cred_get(), + KAUTH_GENERIC_ISSUSER, NULL) != 0) + return (EPERM); error = copyin(SCARG(uap, tzp), &linux_sys_tz, sizeof(linux_sys_tz)); if (error) return (error);
CVS commit: [netbsd-7] src/sys/compat/ibcs2
Module Name:src Committed By: snj Date: Sat Aug 12 04:09:39 UTC 2017 Modified Files: src/sys/compat/ibcs2 [netbsd-7]: ibcs2_exec_coff.c ibcs2_ioctl.c ibcs2_stat.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1477): sys/compat/ibcs2/ibcs2_exec_coff.c: revision 1.27-1.29 sys/compat/ibcs2/ibcs2_ioctl.c: revision 1.46 sys/compat/ibcs2/ibcs2_stat.c: revision 1.49-1.50 Check for NUL termination within the buffer we have. >From Ilja Van Sprundel. -- Make sure we have enough space in the buffer before reading it. >From Ilja Van Sprundel. -- Make sure we move forward over the buffer. >From Ilja Van Sprundel. -- Zero buffers in ibcs2 ioctl to avoid disclosing stack to userland. >From Ilja Van Sprundel. -- Don't drop vnode ref until we're done with mount in ibcs2_stat(v)fs. Nothing else guarantees the mount will stick around. >From Ilja Van Sprundel. -- Little happy on the commit trigger. Actually use the out label. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/compat/ibcs2/ibcs2_exec_coff.c cvs rdiff -u -r1.45 -r1.45.58.1 src/sys/compat/ibcs2/ibcs2_ioctl.c cvs rdiff -u -r1.47 -r1.47.38.1 src/sys/compat/ibcs2/ibcs2_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/ibcs2/ibcs2_exec_coff.c diff -u src/sys/compat/ibcs2/ibcs2_exec_coff.c:1.26 src/sys/compat/ibcs2/ibcs2_exec_coff.c:1.26.4.1 --- src/sys/compat/ibcs2/ibcs2_exec_coff.c:1.26 Fri Oct 25 14:46:35 2013 +++ src/sys/compat/ibcs2/ibcs2_exec_coff.c Sat Aug 12 04:09:39 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_exec_coff.c,v 1.26 2013/10/25 14:46:35 martin Exp $ */ +/* $NetBSD: ibcs2_exec_coff.c,v 1.26.4.1 2017/08/12 04:09:39 snj Exp $ */ /* * Copyright (c) 1994, 1995, 1998 Scott Bartram @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec_coff.c,v 1.26 2013/10/25 14:46:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec_coff.c,v 1.26.4.1 2017/08/12 04:09:39 snj Exp $"); #include #include @@ -454,6 +454,10 @@ exec_ibcs2_coff_prep_zmagic(struct lwp * } bufp = tbuf; while (len) { + if (len < sizeof(struct coff_slhdr)) { +free(tbuf, M_TEMP); +return ENOEXEC; + } slhdr = (struct coff_slhdr *)bufp; if (slhdr->path_index > LONG_MAX / sizeof(long) || @@ -465,7 +469,9 @@ exec_ibcs2_coff_prep_zmagic(struct lwp * /* path_index = slhdr->path_index * sizeof(long); */ entry_len = slhdr->entry_len * sizeof(long); - if (entry_len > len) { + if (entry_len < sizeof(struct coff_slhdr) || + entry_len > len || + strnlen(slhdr->sl_name, entry_len) == entry_len) { free(tbuf, M_TEMP); return ENOEXEC; } Index: src/sys/compat/ibcs2/ibcs2_ioctl.c diff -u src/sys/compat/ibcs2/ibcs2_ioctl.c:1.45 src/sys/compat/ibcs2/ibcs2_ioctl.c:1.45.58.1 --- src/sys/compat/ibcs2/ibcs2_ioctl.c:1.45 Tue Jun 24 10:03:17 2008 +++ src/sys/compat/ibcs2/ibcs2_ioctl.c Sat Aug 12 04:09:39 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_ioctl.c,v 1.45 2008/06/24 10:03:17 gmcgarry Exp $ */ +/* $NetBSD: ibcs2_ioctl.c,v 1.45.58.1 2017/08/12 04:09:39 snj Exp $ */ /* * Copyright (c) 1994, 1995 Scott Bartram @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibcs2_ioctl.c,v 1.45 2008/06/24 10:03:17 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibcs2_ioctl.c,v 1.45.58.1 2017/08/12 04:09:39 snj Exp $"); #include #include @@ -402,8 +402,10 @@ ibcs2_sys_ioctl(struct lwp *l, const str if ((error = (*ctl)(fp, TIOCGETA, &bts)) != 0) goto out; + memset(&sts, 0, sizeof(sts)); btios2stios(&bts, &sts); if (SCARG(uap, cmd) == IBCS2_TCGETA) { + memset(&st, 0, sizeof(st)); stios2stio(&sts, &st); error = copyout(&st, SCARG(uap, data), sizeof(st)); if (error) @@ -559,6 +561,7 @@ ibcs2_sys_gtty(struct lwp *l, const stru fd_putfile(SCARG(uap, fd)); + memset(&itb, 0, sizeof(itb)); itb.sg_ispeed = tb.sg_ispeed; itb.sg_ospeed = tb.sg_ospeed; itb.sg_erase = tb.sg_erase; Index: src/sys/compat/ibcs2/ibcs2_stat.c diff -u src/sys/compat/ibcs2/ibcs2_stat.c:1.47 src/sys/compat/ibcs2/ibcs2_stat.c:1.47.38.1 --- src/sys/compat/ibcs2/ibcs2_stat.c:1.47 Mon Jun 29 05:08:16 2009 +++ src/sys/compat/ibcs2/ibcs2_stat.c Sat Aug 12 04:09:39 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_stat.c,v 1.47 2009/06/29 05:08:16 dholland Exp $ */ +/* $NetBSD: ibcs2_stat.c,v 1.47.38.1 2017/08/12 04:09:39 snj Exp $ */ /* * Copyright (c) 1995, 1998 Scott Bartram * All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibcs2_stat.c,v 1.47 2009/06/29 05:08:16 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibcs2_stat.c,v 1.47.38.1 2017/08/12 04:09:39 snj Exp $"); #include #include @@ -147,11 +147,13 @@ ibcs2_sys_statfs(struct lwp *l, const st return (error); mp = vp->v_mount; sp = &mp->mnt_stat; - vrele(vp); if ((error = VFS_STATVFS(mp, sp)) !
CVS commit: [netbsd-7] src/sys/compat
Module Name:src Committed By: snj Date: Sat Aug 12 04:00:50 UTC 2017 Modified Files: src/sys/compat/svr4 [netbsd-7]: svr4_lwp.c svr4_signal.c svr4_stream.c src/sys/compat/svr4_32 [netbsd-7]: svr4_32_signal.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1475): sys/compat/svr4/svr4_lwp.c: revision 1.20 sys/compat/svr4/svr4_signal.c: revision 1.67 sys/compat/svr4/svr4_stream.c: revision 1.89-1.91 via patch sys/compat/svr4_32/svr4_32_signal.c: revision 1.29 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. -- Zero stack data before copyout. >From Ilja Van Sprundel. -- Fix indexing of svr4 signals. >From Ilja Van Sprundel. -- Feebly attempt to get this reference counting less bad. This svr4 streams code is bad and it should feel bad. >From Ilja Van Sprundel. -- 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.19 -r1.19.38.1 src/sys/compat/svr4/svr4_lwp.c cvs rdiff -u -r1.65.30.1 -r1.65.30.2 src/sys/compat/svr4/svr4_signal.c cvs rdiff -u -r1.80 -r1.80.2.1 src/sys/compat/svr4/svr4_stream.c cvs rdiff -u -r1.26 -r1.26.62.1 src/sys/compat/svr4_32/svr4_32_signal.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.19.38.1 --- src/sys/compat/svr4/svr4_lwp.c:1.19 Mon Nov 23 00:46:07 2009 +++ src/sys/compat/svr4/svr4_lwp.c Sat Aug 12 04:00:50 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.19.38.1 2017/08/12 04:00:50 snj 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.19.38.1 2017/08/12 04:00:50 snj Exp $"); #include #include @@ -108,6 +108,8 @@ svr4_sys__lwp_info(struct lwp *l, const struct svr4_lwpinfo lwpinfo; int error; + memset(&lwpinfo, 0, sizeof(lwpinfo)); + /* XXX NJWLWP */ TIMEVAL_TO_TIMESPEC(&l->l_proc->p_stats->p_ru.ru_stime, &lwpinfo.lwp_stime); TIMEVAL_TO_TIMESPEC(&l->l_proc->p_stats->p_ru.ru_utime, &lwpinfo.lwp_utime); Index: src/sys/compat/svr4/svr4_signal.c diff -u src/sys/compat/svr4/svr4_signal.c:1.65.30.1 src/sys/compat/svr4/svr4_signal.c:1.65.30.2 --- src/sys/compat/svr4/svr4_signal.c:1.65.30.1 Sat Jan 17 12:10:53 2015 +++ src/sys/compat/svr4/svr4_signal.c Sat Aug 12 04:00:50 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_signal.c,v 1.65.30.1 2015/01/17 12:10:53 martin Exp $ */ +/* $NetBSD: svr4_signal.c,v 1.65.30.2 2017/08/12 04:00:50 snj Exp $ */ /*- * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: svr4_signal.c,v 1.65.30.1 2015/01/17 12:10:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: svr4_signal.c,v 1.65.30.2 2017/08/12 04:00:50 snj Exp $"); #include #include @@ -72,6 +72,21 @@ void native_to_svr4_sigaction(const stru extern const int native_to_svr4_signo[]; extern const int svr4_to_native_signo[]; +static int +svr4_decode_signum(int signum, int *native_signo, int *sigcall) +{ + + if (SVR4_SIGNO(signum) >= SVR4_NSIG) + return EINVAL; + + if (native_signo) + *native_signo = svr4_to_native_signo[SVR4_SIGNO(signum)]; + if (sigcall) + *sigcall = SVR4_SIGCALL(signum); + + return 0; +} + static inline void svr4_sigfillset(svr4_sigset_t *s) { @@ -173,6 +188,7 @@ svr4_sys_sigaction(struct lwp *l, const } */ struct svr4_sigaction nssa, ossa; struct sigaction nbsa, obsa; + int native_signo; int error; if (SCARG(uap, nsa)) { @@ -181,7 +197,12 @@ svr4_sys_sigaction(struct lwp *l, const return (error); svr4_to_native_sigaction(&nssa, &nbsa); } - error = sigaction1(l, svr4_to_native_signo[SVR4_SIGNO(SCARG(uap, signum))], + + error = svr4_decode_signum(SCARG(uap, signum), &native_signo, NULL); + if (error) + return error; + + error = sigaction1(l, native_signo, SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0, NULL, 0); if (error) @@ -216,16 +237,18 @@ svr4_sys_signal(struct lwp *l, const str syscallarg(int) signum; syscallarg(svr4_sig_t) handler; } */ - int signum = svr4_to_native_signo[SVR4_SIGNO(SCARG(uap, signum))]; + int native_signo, sigcall; struct proc *p = l->l_proc; struct sigaction nbsa, obsa; sigset_t ss; int error; - if (signum <= 0 || signum >= SVR4_NSIG) - return (EINVAL); + error = svr4_decode_signum(SCARG(uap, signum), &native_signo, + &sigcall); + if (error) + return error; - switch (SVR4_SIGCALL(SCARG(uap, signum))) { + switch (sigcall) { case SVR4_SIGDEFER_MASK:
CVS commit: [netbsd-7] src/sys/compat/linux/common
Module Name:src Committed By: snj Date: Wed Apr 19 16:58:28 UTC 2017 Modified Files: src/sys/compat/linux/common [netbsd-7]: linux_signal.h Log Message: Fix fallout from ticket #1354 by applying: sys/compat/linux/common/linux_signal.h: revision 1.32 Provide a dummy linux_sigset_t for all architectures that do not have any machdep one. This make kdump compile again. To generate a diff of this commit: cvs rdiff -u -r1.30.38.1 -r1.30.38.2 \ src/sys/compat/linux/common/linux_signal.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux/common/linux_signal.h diff -u src/sys/compat/linux/common/linux_signal.h:1.30.38.1 src/sys/compat/linux/common/linux_signal.h:1.30.38.2 --- src/sys/compat/linux/common/linux_signal.h:1.30.38.1 Mon Apr 17 05:19:09 2017 +++ src/sys/compat/linux/common/linux_signal.h Wed Apr 19 16:58:28 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_signal.h,v 1.30.38.1 2017/04/17 05:19:09 snj Exp $ */ +/* $NetBSD: linux_signal.h,v 1.30.38.2 2017/04/19 16:58:28 snj Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -46,6 +46,8 @@ #include #elif defined(__amd64__) #include +#else +typedef void linux_sigset_t; #endif typedef struct {
CVS commit: [netbsd-7] src/sys/compat/linux/arch
Module Name:src Committed By: snj Date: Mon Apr 17 05:23:01 UTC 2017 Modified Files: src/sys/compat/linux/arch/alpha [netbsd-7]: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c src/sys/compat/linux/arch/amd64 [netbsd-7]: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c src/sys/compat/linux/arch/arm [netbsd-7]: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c src/sys/compat/linux/arch/i386 [netbsd-7]: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c src/sys/compat/linux/arch/m68k [netbsd-7]: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c src/sys/compat/linux/arch/mips [netbsd-7]: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c src/sys/compat/linux/arch/powerpc [netbsd-7]: linux_syscall.h linux_syscallargs.h linux_syscalls.c linux_sysent.c Log Message: regen for ticket 1354 To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.94.2.1 \ src/sys/compat/linux/arch/alpha/linux_syscall.h \ src/sys/compat/linux/arch/alpha/linux_sysent.c cvs rdiff -u -r1.93 -r1.93.2.1 \ src/sys/compat/linux/arch/alpha/linux_syscallargs.h cvs rdiff -u -r1.95 -r1.95.2.1 \ src/sys/compat/linux/arch/alpha/linux_syscalls.c cvs rdiff -u -r1.54 -r1.54.2.1 \ src/sys/compat/linux/arch/amd64/linux_syscall.h \ src/sys/compat/linux/arch/amd64/linux_syscallargs.h \ src/sys/compat/linux/arch/amd64/linux_syscalls.c \ src/sys/compat/linux/arch/amd64/linux_sysent.c cvs rdiff -u -r1.64 -r1.64.2.1 src/sys/compat/linux/arch/arm/linux_syscall.h \ src/sys/compat/linux/arch/arm/linux_syscallargs.h \ src/sys/compat/linux/arch/arm/linux_syscalls.c \ src/sys/compat/linux/arch/arm/linux_sysent.c cvs rdiff -u -r1.103 -r1.103.2.1 \ src/sys/compat/linux/arch/i386/linux_syscall.h \ src/sys/compat/linux/arch/i386/linux_syscallargs.h \ src/sys/compat/linux/arch/i386/linux_sysent.c cvs rdiff -u -r1.104 -r1.104.2.1 \ src/sys/compat/linux/arch/i386/linux_syscalls.c cvs rdiff -u -r1.94 -r1.94.2.1 src/sys/compat/linux/arch/m68k/linux_syscall.h \ src/sys/compat/linux/arch/m68k/linux_syscalls.c \ src/sys/compat/linux/arch/m68k/linux_sysent.c cvs rdiff -u -r1.93 -r1.93.2.1 \ src/sys/compat/linux/arch/m68k/linux_syscallargs.h cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/compat/linux/arch/mips/linux_syscall.h cvs rdiff -u -r1.60 -r1.60.2.1 \ src/sys/compat/linux/arch/mips/linux_syscallargs.h \ src/sys/compat/linux/arch/mips/linux_syscalls.c \ src/sys/compat/linux/arch/mips/linux_sysent.c cvs rdiff -u -r1.70 -r1.70.2.1 \ src/sys/compat/linux/arch/powerpc/linux_syscall.h \ src/sys/compat/linux/arch/powerpc/linux_sysent.c cvs rdiff -u -r1.69 -r1.69.2.1 \ src/sys/compat/linux/arch/powerpc/linux_syscallargs.h \ src/sys/compat/linux/arch/powerpc/linux_syscalls.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/arch/alpha/linux_syscall.h diff -u src/sys/compat/linux/arch/alpha/linux_syscall.h:1.94 src/sys/compat/linux/arch/alpha/linux_syscall.h:1.94.2.1 --- src/sys/compat/linux/arch/alpha/linux_syscall.h:1.94 Thu May 29 10:36:31 2014 +++ src/sys/compat/linux/arch/alpha/linux_syscall.h Mon Apr 17 05:23:00 2017 @@ -1,10 +1,10 @@ -/* $NetBSD: linux_syscall.h,v 1.94 2014/05/29 10:36:31 njoly Exp $ */ +/* $NetBSD: linux_syscall.h,v 1.94.2.1 2017/04/17 05:23:00 snj Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.88 2014/05/29 10:35:26 njoly Exp + * created from NetBSD: syscalls.master,v 1.88.2.1 2017/04/17 05:19:09 snj Exp */ #ifndef _LINUX_SYS_SYSCALL_H_ @@ -639,6 +639,9 @@ /* syscall: "faccessat" ret: "int" args: "int" "const char *" "int" */ #define LINUX_SYS_faccessat 462 +/* syscall: "pselect6" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct linux_timespec *" "linux_sized_sigset_t *" */ +#define LINUX_SYS_pselect6 463 + /* syscall: "ppoll" ret: "int" args: "struct pollfd *" "int" "struct linux_timespec *" "linux_sigset_t *" */ #define LINUX_SYS_ppoll 464 Index: src/sys/compat/linux/arch/alpha/linux_sysent.c diff -u src/sys/compat/linux/arch/alpha/linux_sysent.c:1.94 src/sys/compat/linux/arch/alpha/linux_sysent.c:1.94.2.1 --- src/sys/compat/linux/arch/alpha/linux_sysent.c:1.94 Thu May 29 10:36:31 2014 +++ src/sys/compat/linux/arch/alpha/linux_sysent.c Mon Apr 17 05:23:00 2017 @@ -1,14 +1,14 @@ -/* $NetBSD: linux_sysent.c,v 1.94 2014/05/29 10:36:31 njoly Exp $ */ +/* $NetBSD: linux_sysent.c,v 1.94.2.1 2017/04/17 05:23:00 snj Exp $ */ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.88 2014/05/
CVS commit: [netbsd-7] src/sys/compat/linux
Module Name:src Committed By: snj Date: Mon Apr 17 05:19:09 UTC 2017 Modified Files: src/sys/compat/linux/arch/alpha [netbsd-7]: syscalls.master src/sys/compat/linux/arch/amd64 [netbsd-7]: syscalls.master src/sys/compat/linux/arch/arm [netbsd-7]: syscalls.master src/sys/compat/linux/arch/i386 [netbsd-7]: syscalls.master src/sys/compat/linux/arch/m68k [netbsd-7]: syscalls.master src/sys/compat/linux/arch/mips [netbsd-7]: syscalls.master src/sys/compat/linux/arch/powerpc [netbsd-7]: syscalls.master src/sys/compat/linux/common [netbsd-7]: linux_misc.c linux_signal.h Log Message: Pull up following revision(s) (requested by manu in ticket #1354): sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch sys/compat/linux/common/linux_misc.c: revision 1.234 sys/compat/linux/common/linux_signal.h: revision 1.31 Add pselect6 Linux system call. This lets Matlab R2016A run on NetBSD/amd64 To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.88.2.1 \ src/sys/compat/linux/arch/alpha/syscalls.master cvs rdiff -u -r1.52 -r1.52.2.1 \ src/sys/compat/linux/arch/amd64/syscalls.master cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/compat/linux/arch/arm/syscalls.master cvs rdiff -u -r1.118 -r1.118.2.1 \ src/sys/compat/linux/arch/i386/syscalls.master cvs rdiff -u -r1.88 -r1.88.2.1 src/sys/compat/linux/arch/m68k/syscalls.master cvs rdiff -u -r1.56 -r1.56.2.1 src/sys/compat/linux/arch/mips/syscalls.master cvs rdiff -u -r1.65 -r1.65.2.1 \ src/sys/compat/linux/arch/powerpc/syscalls.master cvs rdiff -u -r1.229 -r1.229.2.1 src/sys/compat/linux/common/linux_misc.c cvs rdiff -u -r1.30 -r1.30.38.1 src/sys/compat/linux/common/linux_signal.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux/arch/alpha/syscalls.master diff -u src/sys/compat/linux/arch/alpha/syscalls.master:1.88 src/sys/compat/linux/arch/alpha/syscalls.master:1.88.2.1 --- src/sys/compat/linux/arch/alpha/syscalls.master:1.88 Thu May 29 10:35:26 2014 +++ src/sys/compat/linux/arch/alpha/syscalls.master Mon Apr 17 05:19:09 2017 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.88 2014/05/29 10:35:26 njoly Exp $ + $NetBSD: syscalls.master,v 1.88.2.1 2017/04/17 05:19:09 snj Exp $ ; ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -728,7 +728,10 @@ linux_umode_t mode); } 462 STD { int|linux_sys||faccessat(int fd, const char *path, \ int amode); } -463 UNIMPL pselect6 +463 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \ + fd_set *writefds, fd_set *exceptfds, \ + struct linux_timespec *timeout, \ + linux_sized_sigset_t *ss); } 464 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ struct linux_timespec *timeout, \ linux_sigset_t *sigset); } Index: src/sys/compat/linux/arch/amd64/syscalls.master diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.52 src/sys/compat/linux/arch/amd64/syscalls.master:1.52.2.1 --- src/sys/compat/linux/arch/amd64/syscalls.master:1.52 Sat May 31 08:51:19 2014 +++ src/sys/compat/linux/arch/amd64/syscalls.master Mon Apr 17 05:19:09 2017 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.52 2014/05/31 08:51:19 njoly Exp $ + $NetBSD: syscalls.master,v 1.52.2.1 2017/04/17 05:19:09 snj Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -489,7 +489,10 @@ linux_umode_t mode); } 269 STD { int|linux_sys||faccessat(int fd, const char *path, \ int amode); } -270 UNIMPL pselect6 +270 STD { int|linux_sys||pselect6(int nfds, fd_set *readfds, \ + fd_set *writefds, fd_set *exceptfds, \ + struct linux_timespec *timeout, \ + linux_sized_sigset_t *ss); } 271 STD { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \ struct linux_timespec *timeout, \ linux_sigset_t *sigset); } Index: src/sys/compat/linux/arch/arm/syscalls.master diff -u src/sys/compat/linux/arch/arm/syscalls.master:1.61 src/sys/compat/linux/arch/arm/syscalls.master:1.61.2.1 --- src/sys/compat/linux/arch/arm/syscalls.master:1.61 Sat May 31 08:51:19 2014 +++ src/sys/compat/linux/arch/arm/syscalls.master Mon Apr 17 05:19:09 2017 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.61 2014/05/31 08:51:19 njoly Exp $ + $NetBSD: syscalls.master,v 1.61.2.1 2017/04/17 05:19:09 snj Exp $ ; Derived from sys/compat/linux/arch/*/syscalls.master ; and from Linux 2.4.12 arch/arm/kernel/calls.S @@ -5
CVS commit: [netbsd-7] src/sys/compat/linux/arch/amd64
Module Name:src Committed By: snj Date: Tue Feb 14 16:54:25 UTC 2017 Modified Files: src/sys/compat/linux/arch/amd64 [netbsd-7]: linux_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1359): sys/compat/linux/arch/amd64/linux_machdep.c: revisions 1.50, 1.51 Don't let userland choose %rip. This is the Intel Sysret vulnerability again. -- Make sure %rip is in userland. This is harmless, since the return to userland is made with iret instead of sysret in this path. While here, use size_t. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.48.4.1 \ src/sys/compat/linux/arch/amd64/linux_machdep.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/arch/amd64/linux_machdep.c diff -u src/sys/compat/linux/arch/amd64/linux_machdep.c:1.48 src/sys/compat/linux/arch/amd64/linux_machdep.c:1.48.4.1 --- src/sys/compat/linux/arch/amd64/linux_machdep.c:1.48 Wed Feb 19 20:50:56 2014 +++ src/sys/compat/linux/arch/amd64/linux_machdep.c Tue Feb 14 16:54:24 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.48 2014/02/19 20:50:56 dsl Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.48.4.1 2017/02/14 16:54:24 snj Exp $ */ /*- * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.48 2014/02/19 20:50:56 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.48.4.1 2017/02/14 16:54:24 snj Exp $"); #include #include @@ -230,7 +230,12 @@ linux_sendsig(const ksiginfo_t *ksi, con if (error != 0) { sigexit(l, SIGILL); return; - } + } + + if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS) { + sigexit(l, SIGILL); + return; + } linux_buildcontext(l, catcher, sp); tf->tf_rdi = sigframe.info.lsi_signo; @@ -448,7 +453,7 @@ linux_usertrap(struct lwp *l, vaddr_t tr { struct trapframe *tf = arg; uint64_t retaddr; - int vsyscallnr; + size_t vsyscallnr; /* * Check for a vsyscall. %rip must be the fault address, @@ -478,6 +483,8 @@ linux_usertrap(struct lwp *l, vaddr_t tr */ if (copyin((void *)tf->tf_rsp, &retaddr, sizeof retaddr) != 0) return 0; + if ((vaddr_t)retaddr >= VM_MAXUSER_ADDRESS) + return 0; tf->tf_rip = retaddr; tf->tf_rax = linux_vsyscall_to_syscall[vsyscallnr]; tf->tf_rsp += 8; /* "pop" the return address */
CVS commit: [netbsd-7] src/sys/compat/linux/common
Module Name:src Committed By: snj Date: Sat Dec 31 07:38:31 UTC 2016 Modified Files: src/sys/compat/linux/common [netbsd-7]: linux_sched.c Log Message: Pull up following revision(s) (requested by rin in ticket #1343): sys/compat/linux/common/linux_sched.c: revision 1.68 PR/50021: Rin Okuyama: Fix linux affinity syscalls To generate a diff of this commit: cvs rdiff -u -r1.66.4.1 -r1.66.4.2 src/sys/compat/linux/common/linux_sched.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_sched.c diff -u src/sys/compat/linux/common/linux_sched.c:1.66.4.1 src/sys/compat/linux/common/linux_sched.c:1.66.4.2 --- src/sys/compat/linux/common/linux_sched.c:1.66.4.1 Sat Jan 17 12:10:54 2015 +++ src/sys/compat/linux/common/linux_sched.c Sat Dec 31 07:38:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_sched.c,v 1.66.4.1 2015/01/17 12:10:54 martin Exp $ */ +/* $NetBSD: linux_sched.c,v 1.66.4.2 2016/12/31 07:38:31 snj Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.66.4.1 2015/01/17 12:10:54 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.66.4.2 2016/12/31 07:38:31 snj Exp $"); #include #include @@ -65,6 +65,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sched. static int linux_clone_nptl(struct lwp *, const struct linux_sys_clone_args *, register_t *); +/* Unlike Linux, dynamically calculate CPU mask size */ +#define LINUX_CPU_MASK_SIZE (sizeof(long) * ((ncpu + LONG_BIT - 1) / LONG_BIT)) + #if DEBUG_LINUX #define DPRINTF(x) uprintf x #else @@ -627,6 +630,10 @@ linux_sys_gettid(struct lwp *l, const vo return 0; } +/* + * The affinity syscalls assume that the layout of our cpu kcpuset is + * the same as linux's: a linear bitmask. + */ int linux_sys_sched_getaffinity(struct lwp *l, const struct linux_sys_sched_getaffinity_args *uap, register_t *retval) { @@ -635,39 +642,45 @@ linux_sys_sched_getaffinity(struct lwp * syscallarg(unsigned int) len; syscallarg(unsigned long *) mask; } */ - proc_t *p; - unsigned long *lp, *data; - int error, size, nb = ncpu; + struct lwp *t; + kcpuset_t *kcset; + size_t size; + cpuid_t i; + int error; - /* Unlike Linux, dynamically calculate cpu mask size */ - size = sizeof(long) * ((ncpu + LONG_BIT - 1) / LONG_BIT); + size = LINUX_CPU_MASK_SIZE; if (SCARG(uap, len) < size) return EINVAL; - /* XXX: Pointless check. TODO: Actually implement this. */ - mutex_enter(proc_lock); - p = proc_find(SCARG(uap, pid)); - mutex_exit(proc_lock); - if (p == NULL) { + /* Lock the LWP */ + t = lwp_find2(SCARG(uap, pid), l->l_lid); + if (t == NULL) return ESRCH; - } - - /* - * return the actual number of CPU, tag all of them as available - * The result is a mask, the first CPU being in the least significant - * bit. - */ - data = kmem_zalloc(size, KM_SLEEP); - lp = data; - while (nb > LONG_BIT) { - *lp++ = ~0UL; - nb -= LONG_BIT; - } - if (nb) - *lp = (1 << ncpu) - 1; - error = copyout(data, SCARG(uap, mask), size); - kmem_free(data, size); + /* Check the permission */ + if (kauth_authorize_process(l->l_cred, + KAUTH_PROCESS_SCHEDULER_GETAFFINITY, t->l_proc, NULL, NULL, NULL)) { + mutex_exit(t->l_proc->p_lock); + return EPERM; + } + + kcpuset_create(&kcset, true); + lwp_lock(t); + if (t->l_affinity != NULL) + kcpuset_copy(kcset, t->l_affinity); + else { + /* + * All available CPUs should be masked when affinity has not + * been set. + */ + kcpuset_zero(kcset); + for (i = 0; i < ncpu; i++) + kcpuset_set(kcset, i); + } + lwp_unlock(t); + mutex_exit(t->l_proc->p_lock); + error = kcpuset_copyout(kcset, (cpuset_t *)SCARG(uap, mask), size); + kcpuset_unuse(kcset, NULL); *retval = size; return error; } @@ -680,17 +693,17 @@ linux_sys_sched_setaffinity(struct lwp * syscallarg(unsigned int) len; syscallarg(unsigned long *) mask; } */ - proc_t *p; + struct sys__sched_setaffinity_args ssa; + size_t size; - /* XXX: Pointless check. TODO: Actually implement this. */ - mutex_enter(proc_lock); - p = proc_find(SCARG(uap, pid)); - mutex_exit(proc_lock); - if (p == NULL) { - return ESRCH; - } + size = LINUX_CPU_MASK_SIZE; + if (SCARG(uap, len) < size) + return EINVAL; - /* Let's ignore it */ - DPRINTF(("%s\n", __func__)); - return 0; + SCARG(&ssa, pid) = SCARG(uap, pid); + SCARG(&ssa, lid) = l->l_lid; + SCARG(&ssa, size) = size; + SCARG(&ssa, cpuset) = (cpuset_t *)SCARG(uap, mask); + + return sys__sched_setaffinity(l, &ssa, retval); }
CVS commit: [netbsd-7] src/sys/compat/common
Module Name:src Committed By: bouyer Date: Sat Aug 27 15:10:59 UTC 2016 Modified Files: src/sys/compat/common [netbsd-7]: vfs_syscalls_43.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1240): sys/compat/common/vfs_syscalls_43.c: revision 1.58 fill in the tv_nsec parts of the converted timespec in cvtstat(). To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.56.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.56 src/sys/compat/common/vfs_syscalls_43.c:1.56.4.1 --- src/sys/compat/common/vfs_syscalls_43.c:1.56 Tue Jan 28 01:29:04 2014 +++ src/sys/compat/common/vfs_syscalls_43.c Sat Aug 27 15:10:59 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_43.c,v 1.56 2014/01/28 01:29:04 christos Exp $ */ +/* $NetBSD: vfs_syscalls_43.c,v 1.56.4.1 2016/08/27 15:10:59 bouyer Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.56 2014/01/28 01:29:04 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.56.4.1 2016/08/27 15:10:59 bouyer Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -75,15 +75,42 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls #include #include +static void cvttimespec(struct timespec *, struct timespec50 *); static void cvtstat(struct stat *, struct stat43 *); /* + * Convert from an old to a new timespec structure. + */ +static void +cvttimespec(struct timespec *ts, struct timespec50 *ots) +{ + + if (ts->tv_sec > INT_MAX) { +#if defined(DEBUG) || 1 + static bool first = true; + + if (first) { + first = false; + printf("%s[%s:%d]: time_t does not fit\n", + __func__, curlwp->l_proc->p_comm, + curlwp->l_lid); + } +#endif + ots->tv_sec = INT_MAX; + } else + ots->tv_sec = ts->tv_sec; + ots->tv_nsec = ts->tv_nsec; +} + +/* * Convert from an old to a new stat structure. */ static void cvtstat(struct stat *st, struct stat43 *ost) { + /* Handle any padding. */ + memset(ost, 0, sizeof *ost); ost->st_dev = st->st_dev; ost->st_ino = st->st_ino; ost->st_mode = st->st_mode & 0x; @@ -95,9 +122,9 @@ cvtstat(struct stat *st, struct stat43 * ost->st_size = st->st_size; else ost->st_size = -2; - ost->st_atime = st->st_atime; - ost->st_mtime = st->st_mtime; - ost->st_ctime = st->st_ctime; + cvttimespec(&st->st_atimespec, &ost->st_atimespec); + cvttimespec(&st->st_mtimespec, &ost->st_mtimespec); + cvttimespec(&st->st_ctimespec, &ost->st_ctimespec); ost->st_blksize = st->st_blksize; ost->st_blocks = st->st_blocks; ost->st_flags = st->st_flags;
CVS commit: [netbsd-7] src/sys/compat
Module Name:src Committed By: riz Date: Sun Nov 8 02:02:37 UTC 2015 Modified Files: src/sys/compat/linux/common [netbsd-7]: linux_mod.c src/sys/compat/netbsd32 [netbsd-7]: netbsd32_mod.c Log Message: Pull up following revision(s) (requested by pgoyette in ticket #1020): sys/compat/netbsd32/netbsd32_mod.c: revision 1.6 sys/compat/netbsd32/netbsd32_mod.c: revision 1.7 sys/compat/netbsd32/netbsd32_mod.c: revision 1.8 sys/compat/netbsd32/netbsd32_mod.c: revision 1.9 sys/compat/linux/common/linux_mod.c: revision 1.5 Add an additional dependency on compat_sysv Add another dependency for nfsserver And yet another dependency, this time on mq Ooops, spell the module name in full. "mqueue" vs "mq" we need compat_sysv now. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/compat/linux/common/linux_mod.c cvs rdiff -u -r1.5 -r1.5.2.1 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/linux/common/linux_mod.c diff -u src/sys/compat/linux/common/linux_mod.c:1.4 src/sys/compat/linux/common/linux_mod.c:1.4.4.1 --- src/sys/compat/linux/common/linux_mod.c:1.4 Fri Mar 7 01:33:43 2014 +++ src/sys/compat/linux/common/linux_mod.c Sun Nov 8 02:02:37 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_mod.c,v 1.4 2014/03/07 01:33:43 christos Exp $ */ +/* $NetBSD: linux_mod.c,v 1.4.4.1 2015/11/08 02:02:37 riz Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.4 2014/03/07 01:33:43 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.4.4.1 2015/11/08 02:02:37 riz Exp $"); #ifdef _KERNEL_OPT #include "opt_execfmt.h" @@ -65,7 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_mod.c, # define MD3 "" #endif -MODULE(MODULE_CLASS_EXEC, compat_linux, "compat,compat_ossaudio" MD1 MD2 MD3); +MODULE(MODULE_CLASS_EXEC, compat_linux, "compat,compat_ossaudio,compat_sysv" + MD1 MD2 MD3); static struct execsw linux_execsw[] = { #if defined(EXEC_ELF32) && ELFSIZE == 32 Index: src/sys/compat/netbsd32/netbsd32_mod.c diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.5 src/sys/compat/netbsd32/netbsd32_mod.c:1.5.2.1 --- src/sys/compat/netbsd32/netbsd32_mod.c:1.5 Tue Jul 22 08:18:33 2014 +++ src/sys/compat/netbsd32/netbsd32_mod.c Sun Nov 8 02:02:36 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_mod.c,v 1.5 2014/07/22 08:18:33 maxv Exp $ */ +/* $NetBSD: netbsd32_mod.c,v 1.5.2.1 2015/11/08 02:02:36 riz Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -30,13 +30,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.5 2014/07/22 08:18:33 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.5.2.1 2015/11/08 02:02:36 riz Exp $"); #ifdef _KERNEL_OPT #include "opt_execfmt.h" -# define DEPS1 "compat" +# define DEPS1 "compat,compat_sysv,nfsserver,mqueue" #else -# define DEPS1 "compat,ksem" +# define DEPS1 "compat,compat_sysv,nfsserver,mqueue,ksem" #endif #ifndef ELFSIZE
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Fri Nov 6 09:19:24 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_syscall.h netbsd32_syscallargs.h netbsd32_syscalls.c netbsd32_sysent.c Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.109.2.2 -r1.109.2.3 \ src/sys/compat/netbsd32/netbsd32_syscall.h \ src/sys/compat/netbsd32/netbsd32_syscallargs.h cvs rdiff -u -r1.108.2.2 -r1.108.2.3 \ src/sys/compat/netbsd32/netbsd32_syscalls.c \ src/sys/compat/netbsd32/netbsd32_sysent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_syscall.h diff -u src/sys/compat/netbsd32/netbsd32_syscall.h:1.109.2.2 src/sys/compat/netbsd32/netbsd32_syscall.h:1.109.2.3 --- src/sys/compat/netbsd32/netbsd32_syscall.h:1.109.2.2 Wed Nov 4 17:46:21 2015 +++ src/sys/compat/netbsd32/netbsd32_syscall.h Fri Nov 6 09:19:24 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscall.h,v 1.109.2.2 2015/11/04 17:46:21 riz Exp $ */ +/* $NetBSD: netbsd32_syscall.h,v 1.109.2.3 2015/11/06 09:19:24 martin Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp + * created from NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp */ #ifndef _NETBSD32_SYS_SYSCALL_H_ @@ -441,9 +441,13 @@ /* syscall: "compat_43_netbsd32_ogetsockname" ret: "int" args: "int" "netbsd32_voidp" "netbsd32_intp" */ #define NETBSD32_SYS_compat_43_netbsd32_ogetsockname 150 +#if defined(NFSSERVER) || !defined(_KERNEL_OPT) /* syscall: "netbsd32_nfssvc" ret: "int" args: "int" "netbsd32_voidp" */ #define NETBSD32_SYS_netbsd32_nfssvc 155 +#else +/* 155 is excluded netbsd32_nfssvc */ +#endif /* syscall: "compat_43_netbsd32_ogetdirentries" ret: "int" args: "int" "netbsd32_charp" "u_int" "netbsd32_longp" */ #define NETBSD32_SYS_compat_43_netbsd32_ogetdirentries 156 Index: src/sys/compat/netbsd32/netbsd32_syscallargs.h diff -u src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109.2.2 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109.2.3 --- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109.2.2 Wed Nov 4 17:46:21 2015 +++ src/sys/compat/netbsd32/netbsd32_syscallargs.h Fri Nov 6 09:19:24 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscallargs.h,v 1.109.2.2 2015/11/04 17:46:21 riz Exp $ */ +/* $NetBSD: netbsd32_syscallargs.h,v 1.109.2.3 2015/11/06 09:19:24 martin Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp + * created from NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp */ #ifndef _NETBSD32_SYS_SYSCALLARGS_H_ @@ -815,12 +815,15 @@ struct compat_43_netbsd32_ogetsockname_a syscallarg(netbsd32_intp) alen; }; check_syscall_args(compat_43_netbsd32_ogetsockname) +#if defined(NFSSERVER) || !defined(_KERNEL_OPT) struct netbsd32_nfssvc_args { syscallarg(int) flag; syscallarg(netbsd32_voidp) argp; }; check_syscall_args(netbsd32_nfssvc) +#else +#endif struct compat_43_netbsd32_ogetdirentries_args { syscallarg(int) fd; @@ -2755,8 +2758,11 @@ int compat_43_sys_quota(struct lwp *, co int compat_43_netbsd32_ogetsockname(struct lwp *, const struct compat_43_netbsd32_ogetsockname_args *, register_t *); +#if defined(NFSSERVER) || !defined(_KERNEL_OPT) int netbsd32_nfssvc(struct lwp *, const struct netbsd32_nfssvc_args *, register_t *); +#else +#endif int compat_43_netbsd32_ogetdirentries(struct lwp *, const struct compat_43_netbsd32_ogetdirentries_args *, register_t *); int compat_20_netbsd32_statfs(struct lwp *, const struct compat_20_netbsd32_statfs_args *, register_t *); Index: src/sys/compat/netbsd32/netbsd32_syscalls.c diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108.2.2 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108.2.3 --- src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108.2.2 Wed Nov 4 17:46:21 2015 +++ src/sys/compat/netbsd32/netbsd32_syscalls.c Fri Nov 6 09:19:24 2015 @@ -1,18 +1,19 @@ -/* $NetBSD: netbsd32_syscalls.c,v 1.108.2.2 2015/11/04 17:46:21 riz Exp $ */ +/* $NetBSD: netbsd32_syscalls.c,v 1.108.2.3 2015/11/06 09:19:24 martin Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp + * created from NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.108.2.2 2015/11/04 17:46:21 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.108.2.3 2015/11/06 09:19:24 martin Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" +#include "opt_nfsserver.h" #include "op
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Fri Nov 6 09:16:49 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_nfssvc.c syscalls.master Log Message: Additionally pull up following revision(s) (requested by mrg in ticket #956): sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.2 sys/compat/netbsd32/syscalls.master: revision 1.109 Don't reference netbsd32_nfssvc unless NFSSERVER is defined. Fixes PR 49994. add missing opt_nfsserver.h To generate a diff of this commit: cvs rdiff -u -r1.3.4.2 -r1.3.4.3 src/sys/compat/netbsd32/netbsd32_nfssvc.c cvs rdiff -u -r1.101.2.2 -r1.101.2.3 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_nfssvc.c diff -u src/sys/compat/netbsd32/netbsd32_nfssvc.c:1.3.4.2 src/sys/compat/netbsd32/netbsd32_nfssvc.c:1.3.4.3 --- src/sys/compat/netbsd32/netbsd32_nfssvc.c:1.3.4.2 Wed Nov 4 17:46:21 2015 +++ src/sys/compat/netbsd32/netbsd32_nfssvc.c Fri Nov 6 09:16:48 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_nfssvc.c,v 1.3.4.2 2015/11/04 17:46:21 riz Exp $ */ +/* $NetBSD: netbsd32_nfssvc.c,v 1.3.4.3 2015/11/06 09:16:48 martin Exp $ */ /* * Copyright (c) 2015 Matthew R. Green @@ -29,10 +29,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_nfssvc.c,v 1.3.4.2 2015/11/04 17:46:21 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_nfssvc.c,v 1.3.4.3 2015/11/06 09:16:48 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_nfs.h" +#include "opt_nfsserver.h" #include "opt_compat_netbsd.h" #endif Index: src/sys/compat/netbsd32/syscalls.master diff -u src/sys/compat/netbsd32/syscalls.master:1.101.2.2 src/sys/compat/netbsd32/syscalls.master:1.101.2.3 --- src/sys/compat/netbsd32/syscalls.master:1.101.2.2 Wed Nov 4 17:46:21 2015 +++ src/sys/compat/netbsd32/syscalls.master Fri Nov 6 09:16:48 2015 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.101.2.2 2015/11/04 17:46:21 riz Exp $ + $NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 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 @@ -38,6 +38,7 @@ #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" +#include "opt_nfsserver.h" #include "opt_ntp.h" #include "opt_sysv.h" #include "opt_compat_43.h" @@ -317,7 +318,11 @@ 152 UNIMPL 153 UNIMPL 154 UNIMPL +#if defined(NFSSERVER) || !defined(_KERNEL_OPT) 155 STD { int|netbsd32||nfssvc(int flag, netbsd32_voidp argp); } +#else +155 EXCL netbsd32_nfssvc +#endif 156 COMPAT_43 { int|netbsd32||ogetdirentries(int fd, \ netbsd32_charp buf, u_int count, \ netbsd32_longp basep); }
CVS commit: [netbsd-7] src/sys/compat/linux/arch
Module Name:src Committed By: snj Date: Thu Nov 5 09:24:47 UTC 2015 Modified Files: src/sys/compat/linux/arch/arm [netbsd-7]: linux_ptrace.c src/sys/compat/linux/arch/i386 [netbsd-7]: linux_ptrace.c src/sys/compat/linux/arch/powerpc [netbsd-7]: linux_ptrace.c Log Message: Pull up following revision(s) (requested by pgoyette in ticket #998): sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19 sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31 sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29 Don't release proc_lock until we're done looking at things that are protected by the lock, particularly p_stat and p_waited. Found by Robert Elz. To generate a diff of this commit: cvs rdiff -u -r1.17.14.1 -r1.17.14.2 \ src/sys/compat/linux/arch/arm/linux_ptrace.c cvs rdiff -u -r1.28.2.2 -r1.28.2.3 \ src/sys/compat/linux/arch/i386/linux_ptrace.c cvs rdiff -u -r1.25.2.2 -r1.25.2.3 \ src/sys/compat/linux/arch/powerpc/linux_ptrace.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/arch/arm/linux_ptrace.c diff -u src/sys/compat/linux/arch/arm/linux_ptrace.c:1.17.14.1 src/sys/compat/linux/arch/arm/linux_ptrace.c:1.17.14.2 --- src/sys/compat/linux/arch/arm/linux_ptrace.c:1.17.14.1 Sat Jan 17 12:10:55 2015 +++ src/sys/compat/linux/arch/arm/linux_ptrace.c Thu Nov 5 09:24:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.17.14.1 2015/01/17 12:10:55 martin Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.17.14.2 2015/11/05 09:24:47 snj Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.17.14.1 2015/01/17 12:10:55 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.17.14.2 2015/11/05 09:24:47 snj Exp $"); #include #include @@ -140,7 +140,6 @@ linux_sys_ptrace_arch(struct lwp *l, con goto out; } mutex_enter(t->p_lock); - mutex_exit(proc_lock); /* * You cannot do what you want to the process if: @@ -148,6 +147,7 @@ linux_sys_ptrace_arch(struct lwp *l, con */ if (!ISSET(t->p_slflag, PSL_TRACED)) { mutex_exit(t->p_lock); + mutex_exit(proc_lock); error = EPERM; goto out; } @@ -160,9 +160,11 @@ linux_sys_ptrace_arch(struct lwp *l, con if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p || t->p_stat != SSTOP || !t->p_waited) { mutex_exit(t->p_lock); + mutex_exit(proc_lock); error = EBUSY; goto out; } + mutex_exit(proc_lock); /* XXX: ptrace needs revamp for multi-threading support. */ if (t->p_nlwps > 1) { mutex_exit(t->p_lock); Index: src/sys/compat/linux/arch/i386/linux_ptrace.c diff -u src/sys/compat/linux/arch/i386/linux_ptrace.c:1.28.2.2 src/sys/compat/linux/arch/i386/linux_ptrace.c:1.28.2.3 --- src/sys/compat/linux/arch/i386/linux_ptrace.c:1.28.2.2 Sat Jan 17 12:10:53 2015 +++ src/sys/compat/linux/arch/i386/linux_ptrace.c Thu Nov 5 09:24:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.28.2.2 2015/01/17 12:10:53 martin Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.28.2.3 2015/11/05 09:24:47 snj Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.28.2.2 2015/01/17 12:10:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.28.2.3 2015/11/05 09:24:47 snj Exp $"); #include #include @@ -185,7 +185,6 @@ linux_sys_ptrace_arch(struct lwp *l, con goto out; } mutex_enter(t->p_lock); - mutex_exit(proc_lock); /* * You cannot do what you want to the process if: @@ -193,6 +192,7 @@ linux_sys_ptrace_arch(struct lwp *l, con */ if (!ISSET(t->p_slflag, PSL_TRACED)) { mutex_exit(t->p_lock); + mutex_exit(proc_lock); error = EPERM; goto out; } @@ -205,9 +205,11 @@ linux_sys_ptrace_arch(struct lwp *l, con if (ISSET(t->p_slflag, PSL_FSTRACE) || t->p_pptr != p || t->p_stat != SSTOP || !t->p_waited) { mutex_exit(t->p_lock); + mutex_exit(proc_lock); error = EBUSY; goto out; } + mutex_exit(proc_lock); /* XXX: ptrace needs revamp for multi-threading support. */ if (t->p_nlwps > 1) { mutex_exit(t->p_lock); Index: src/sys/compat/linux/arch/powerpc/linux_ptrace.c diff -u src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.25.2.2 src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.25.2.3 --- src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.25.2.2 Sat Jan 17 12:10:56 2015 +++ src/sys/compat/linux/arch/powerpc/linux_ptrace.c Thu Nov 5 09:24:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.25.2.2 2015/01/17 12:10:56 martin Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.25.2.3 2015/11/05 09:24:47 snj Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.25.2.2 2015/01/17 12:10:56 martin Exp $"); +__KERNEL_RCS
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sat Aug 8 15:41:54 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_socket.c Log Message: Pull up following revision(s) (requested by maxv in ticket #941): sys/compat/netbsd32/netbsd32_socket.c: revision 1.42 Memory leak, triggerable from an unprivileged user. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.41.14.1 src/sys/compat/netbsd32/netbsd32_socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_socket.c diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.41 src/sys/compat/netbsd32/netbsd32_socket.c:1.41.14.1 --- src/sys/compat/netbsd32/netbsd32_socket.c:1.41 Sat Aug 18 15:25:15 2012 +++ src/sys/compat/netbsd32/netbsd32_socket.c Sat Aug 8 15:41:54 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_socket.c,v 1.41 2012/08/18 15:25:15 martin Exp $ */ +/* $NetBSD: netbsd32_socket.c,v 1.41.14.1 2015/08/08 15:41:54 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.41 2012/08/18 15:25:15 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.41.14.1 2015/08/08 15:41:54 martin Exp $"); #include #include @@ -331,7 +331,7 @@ netbsd32_sendmsg(struct lwp *l, const st } */ struct msghdr msg; struct netbsd32_msghdr msg32; - struct iovec aiov[UIO_SMALLIOV], *iov; + struct iovec aiov[UIO_SMALLIOV], *iov = aiov; struct netbsd32_iovec *iov32; size_t iovsz; int error; @@ -346,6 +346,7 @@ netbsd32_sendmsg(struct lwp *l, const st error = copyin32_msg_control(l, &msg); if (error) return (error); + /* From here on, msg.msg_control is allocated */ } else { msg.msg_control = NULL; msg.msg_controllen = 0; @@ -353,23 +354,32 @@ netbsd32_sendmsg(struct lwp *l, const st iovsz = msg.msg_iovlen * sizeof(struct iovec); if ((u_int)msg.msg_iovlen > UIO_SMALLIOV) { - if ((u_int)msg.msg_iovlen > IOV_MAX) - return (EMSGSIZE); + if ((u_int)msg.msg_iovlen > IOV_MAX) { + error = EMSGSIZE; + goto out; + } iov = kmem_alloc(iovsz, KM_SLEEP); - } else - iov = aiov; + } iov32 = NETBSD32PTR64(msg32.msg_iov); error = netbsd32_to_iovecin(iov32, iov, msg.msg_iovlen); if (error) - goto done; + goto out; msg.msg_iov = iov; error = do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval); -done: + /* msg.msg_control freed by do_sys_sendmsg() */ + if (iov != aiov) kmem_free(iov, iovsz); return (error); + +out: + if (iov != aiov) + kmem_free(iov, iovsz); + if (msg.msg_control) + m_free(msg.msg_control); + return error; } int
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sun Aug 2 11:29:10 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_ioctl.c Log Message: Pull up following revision(s) (requested by maxv in ticket #930): sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82 Wrong logic. Here, userland can control the size and the data copied, which basically means it can overflow kernel memory. ok martin@ christos@ To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.69.4.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.69 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.69.4.1 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.69 Fri Jan 24 12:16:10 2014 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 2 11:29:10 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.69 2014/01/24 12:16:10 bouyer Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.69.4.1 2015/08/02 11:29:10 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.69 2014/01/24 12:16:10 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.69.4.1 2015/08/02 11:29:10 martin Exp $"); #include #include @@ -137,7 +137,7 @@ netbsd32_to_if_addrprefreq(const struct strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); ifap->ifap_preference = ifap32->ifap_preference; memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, - max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void @@ -454,7 +454,7 @@ netbsd32_from_if_addrprefreq(const struc strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); ifap32->ifap_preference = ifap->ifap_preference; memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, - max(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: snj Date: Fri Jul 17 04:34:35 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_time.c Log Message: Pull up following revision(s) (requested by martin in ticket #879): sys/compat/netbsd32/netbsd32_time.c: revision 1.43 Use the right type in sizeof() for copyin() in adjtime To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.42.12.1 src/sys/compat/netbsd32/netbsd32_time.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_time.c diff -u src/sys/compat/netbsd32/netbsd32_time.c:1.42 src/sys/compat/netbsd32/netbsd32_time.c:1.42.12.1 --- src/sys/compat/netbsd32/netbsd32_time.c:1.42 Tue Oct 2 01:44:28 2012 +++ src/sys/compat/netbsd32/netbsd32_time.c Fri Jul 17 04:34:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_time.c,v 1.42 2012/10/02 01:44:28 christos Exp $ */ +/* $NetBSD: netbsd32_time.c,v 1.42.12.1 2015/07/17 04:34:34 snj Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.42 2012/10/02 01:44:28 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.42.12.1 2015/07/17 04:34:34 snj Exp $"); #if defined(_KERNEL_OPT) #include "opt_ntp.h" @@ -332,7 +332,7 @@ netbsd32___adjtime50(struct lwp *l, cons if (SCARG_P32(uap, delta)) { error = copyin(SCARG_P32(uap, delta), &atv, - sizeof(struct timeval)); + sizeof(atv)); if (error) return (error);
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sat May 16 14:15:50 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_lwp.c Log Message: Pull up the following revisions, requested by matt in ticket #776: src/sys/compat/netbsd32/netbsd32_lwp.c 1.15-1.18 Fix _lwp_ctl for big endian 64-bit platforms. (Little-endian too but not as noticable). To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.15.10.1 src/sys/compat/netbsd32/netbsd32_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_lwp.c diff -u src/sys/compat/netbsd32/netbsd32_lwp.c:1.15 src/sys/compat/netbsd32/netbsd32_lwp.c:1.15.10.1 --- src/sys/compat/netbsd32/netbsd32_lwp.c:1.15 Fri Mar 29 01:04:30 2013 +++ src/sys/compat/netbsd32/netbsd32_lwp.c Sat May 16 14:15:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_lwp.c,v 1.15 2013/03/29 01:04:30 christos Exp $ */ +/* $NetBSD: netbsd32_lwp.c,v 1.15.10.1 2015/05/16 14:15:50 martin Exp $ */ /* * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.15 2013/03/29 01:04:30 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.15.10.1 2015/05/16 14:15:50 martin Exp $"); #include #include @@ -280,9 +280,16 @@ netbsd32__lwp_ctl(struct lwp *l, const s syscallarg(int) features; syscallarg(netbsd32_pointer_t) address; } */ - struct sys__lwp_ctl_args ua; - - NETBSD32TO64_UAP(features); - NETBSD32TOP_UAP(address, struct lwpctl *); - return sys__lwp_ctl(l, &ua, retval); + netbsd32_pointer_t vaddr32; + int error, features; + vaddr_t vaddr; + + features = SCARG(uap, features); + features &= ~(LWPCTL_FEATURE_CURCPU | LWPCTL_FEATURE_PCTR); + if (features != 0) + return ENODEV; + if ((error = lwp_ctl_alloc(&vaddr)) != 0) + return error; + NETBSD32PTR32(vaddr32, (void *)vaddr); + return copyout(&vaddr32, SCARG_P32(uap, address), sizeof(vaddr32)); }
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: snj Date: Sat Mar 7 05:27:54 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_syscall.h netbsd32_syscallargs.h netbsd32_syscalls.c netbsd32_sysent.c Log Message: regen for ticket 560 To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.109.2.1 src/sys/compat/netbsd32/netbsd32_syscall.h \ src/sys/compat/netbsd32/netbsd32_syscallargs.h cvs rdiff -u -r1.108 -r1.108.2.1 src/sys/compat/netbsd32/netbsd32_syscalls.c \ src/sys/compat/netbsd32/netbsd32_sysent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_syscall.h diff -u src/sys/compat/netbsd32/netbsd32_syscall.h:1.109 src/sys/compat/netbsd32/netbsd32_syscall.h:1.109.2.1 --- src/sys/compat/netbsd32/netbsd32_syscall.h:1.109 Fri Jun 13 10:37:22 2014 +++ src/sys/compat/netbsd32/netbsd32_syscall.h Sat Mar 7 05:27:53 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscall.h,v 1.109 2014/06/13 10:37:22 joerg Exp $ */ +/* $NetBSD: netbsd32_syscall.h,v 1.109.2.1 2015/03/07 05:27:53 snj Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101 2014/06/13 10:36:18 joerg Exp + * created from NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp */ #ifndef _NETBSD32_SYS_SYSCALL_H_ @@ -1224,7 +1224,7 @@ /* syscall: "netbsd32_openat" ret: "int" args: "int" "const netbsd32_charp" "int" "..." */ #define NETBSD32_SYS_netbsd32_openat 468 -/* syscall: "netbsd32_readlinkat" ret: "int" args: "int" "const netbsd32_charp" "netbsd32_charp" "size_t" */ +/* syscall: "netbsd32_readlinkat" ret: "netbsd32_ssize_t" args: "int" "const netbsd32_charp" "netbsd32_charp" "size_t" */ #define NETBSD32_SYS_netbsd32_readlinkat 469 /* syscall: "netbsd32_symlinkat" ret: "int" args: "const netbsd32_charp" "int" "const netbsd32_charp" */ Index: src/sys/compat/netbsd32/netbsd32_syscallargs.h diff -u src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109.2.1 --- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109 Fri Jun 13 10:37:22 2014 +++ src/sys/compat/netbsd32/netbsd32_syscallargs.h Sat Mar 7 05:27:54 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscallargs.h,v 1.109 2014/06/13 10:37:22 joerg Exp $ */ +/* $NetBSD: netbsd32_syscallargs.h,v 1.109.2.1 2015/03/07 05:27:54 snj Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101 2014/06/13 10:36:18 joerg Exp + * created from NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp */ #ifndef _NETBSD32_SYS_SYSCALLARGS_H_ Index: src/sys/compat/netbsd32/netbsd32_syscalls.c diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108.2.1 --- src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108 Fri Jun 13 10:37:22 2014 +++ src/sys/compat/netbsd32/netbsd32_syscalls.c Sat Mar 7 05:27:54 2015 @@ -1,14 +1,14 @@ -/* $NetBSD: netbsd32_syscalls.c,v 1.108 2014/06/13 10:37:22 joerg Exp $ */ +/* $NetBSD: netbsd32_syscalls.c,v 1.108.2.1 2015/03/07 05:27:54 snj Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101 2014/06/13 10:36:18 joerg Exp + * created from NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.108 2014/06/13 10:37:22 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.108.2.1 2015/03/07 05:27:54 snj Exp $"); #if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT) Index: src/sys/compat/netbsd32/netbsd32_sysent.c diff -u src/sys/compat/netbsd32/netbsd32_sysent.c:1.108 src/sys/compat/netbsd32/netbsd32_sysent.c:1.108.2.1 --- src/sys/compat/netbsd32/netbsd32_sysent.c:1.108 Fri Jun 13 10:37:22 2014 +++ src/sys/compat/netbsd32/netbsd32_sysent.c Sat Mar 7 05:27:54 2015 @@ -1,14 +1,14 @@ -/* $NetBSD: netbsd32_sysent.c,v 1.108 2014/06/13 10:37:22 joerg Exp $ */ +/* $NetBSD: netbsd32_sysent.c,v 1.108.2.1 2015/03/07 05:27:54 snj Exp $ */ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101 2014/06/13 10:36:18 joerg Exp + * created from NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.108 2014/06/13 10:37:22 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.108.2.1 2015/03/07 05:27:54 snj Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h"
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: snj Date: Sat Mar 7 05:22:02 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: syscalls.master Log Message: Pull up following revision(s) (requested by khorben in ticket #560): sys/compat/netbsd32/syscalls.master: revision 1.102 readlinkat returns ssize_t To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.101.2.1 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/syscalls.master diff -u src/sys/compat/netbsd32/syscalls.master:1.101 src/sys/compat/netbsd32/syscalls.master:1.101.2.1 --- src/sys/compat/netbsd32/syscalls.master:1.101 Fri Jun 13 10:36:18 2014 +++ src/sys/compat/netbsd32/syscalls.master Sat Mar 7 05:22:01 2015 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.101 2014/06/13 10:36:18 joerg Exp $ + $NetBSD: syscalls.master,v 1.101.2.1 2015/03/07 05:22:01 snj Exp $ ; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -1008,7 +1008,7 @@ const netbsd32_charp path, \ int oflags, ... \ mode_t mode); } -469 STD { int|netbsd32||readlinkat(int fd, \ +469 STD { netbsd32_ssize_t|netbsd32||readlinkat(int fd, \ const netbsd32_charp path, \ netbsd32_charp buf, \ size_t bufsize); }
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Fri Dec 12 19:12:08 UTC 2014 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_compat_30.c Log Message: Pull up following revision(s) (requested by maxv in ticket #314): sys/compat/netbsd32/netbsd32_compat_30.c: revision 1.31 User-triggerable kmem_alloc(0). Ok martin@ christos@ User To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.30.34.1 src/sys/compat/netbsd32/netbsd32_compat_30.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_compat_30.c diff -u src/sys/compat/netbsd32/netbsd32_compat_30.c:1.30 src/sys/compat/netbsd32/netbsd32_compat_30.c:1.30.34.1 --- src/sys/compat/netbsd32/netbsd32_compat_30.c:1.30 Fri Apr 23 15:19:20 2010 +++ src/sys/compat/netbsd32/netbsd32_compat_30.c Fri Dec 12 19:12:08 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_30.c,v 1.30 2010/04/23 15:19:20 rmind Exp $ */ +/* $NetBSD: netbsd32_compat_30.c,v 1.30.34.1 2014/12/12 19:12:08 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.30 2010/04/23 15:19:20 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.30.34.1 2014/12/12 19:12:08 martin Exp $"); #include #include @@ -78,6 +78,9 @@ compat_30_netbsd32_getdents(struct lwp * error = EBADF; goto out; } + if (count == 0) + goto out; + buf = kmem_alloc(count, KM_SLEEP); error = vn_readdir(fp, buf, UIO_SYSSPACE, count, &done, l, 0, 0); if (error == 0) {
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Thu Oct 30 12:18:56 UTC 2014 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_compat_50.c Log Message: Pull up following revision(s) (requested by maxv in ticket #166): sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.28 fix multiple mistakes: - error from copyout was ignored - the wrong size was specified in copyin - missing locking. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.24.2.1 src/sys/compat/netbsd32/netbsd32_compat_50.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_compat_50.c diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.24 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.24.2.1 --- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.24 Tue Jun 24 14:33:57 2014 +++ src/sys/compat/netbsd32/netbsd32_compat_50.c Thu Oct 30 12:18:56 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_50.c,v 1.24 2014/06/24 14:33:57 maxv Exp $ */ +/* $NetBSD: netbsd32_compat_50.c,v 1.24.2.1 2014/10/30 12:18:56 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.24 2014/06/24 14:33:57 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.24.2.1 2014/10/30 12:18:56 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -248,30 +248,31 @@ compat_50_netbsd32_adjtime(struct lwp *l return (error); if (SCARG_P32(uap, olddelta)) { + mutex_spin_enter(&timecounter_lock); atv.tv_sec = time_adjtime / 100; atv.tv_usec = time_adjtime % 100; if (atv.tv_usec < 0) { atv.tv_usec += 100; atv.tv_sec--; } - (void) copyout(&atv, - SCARG_P32(uap, olddelta), - sizeof(atv)); + mutex_spin_exit(&timecounter_lock); + + error = copyout(&atv, SCARG_P32(uap, olddelta), sizeof(atv)); if (error) return (error); } if (SCARG_P32(uap, delta)) { - error = copyin(SCARG_P32(uap, delta), &atv, - sizeof(struct timeval)); + error = copyin(SCARG_P32(uap, delta), &atv, sizeof(atv)); if (error) return (error); + mutex_spin_enter(&timecounter_lock); time_adjtime = (int64_t)atv.tv_sec * 100 + atv.tv_usec; - if (time_adjtime) /* We need to save the system time during shutdown */ time_adjusted |= 1; + mutex_spin_exit(&timecounter_lock); } return 0;
CVS commit: [netbsd-7] src/sys/compat/linux/arch
Module Name:src Committed By: martin Date: Thu Oct 30 11:51:18 UTC 2014 Modified Files: src/sys/compat/linux/arch/i386 [netbsd-7]: linux_ptrace.c src/sys/compat/linux/arch/powerpc [netbsd-7]: linux_ptrace.c Log Message: Pull up following revision(s) (requested by maxv in ticket #163): sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.29 sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.26 sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.27 Fix four memory leaks in compat/linux. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.28.2.1 src/sys/compat/linux/arch/i386/linux_ptrace.c cvs rdiff -u -r1.25 -r1.25.2.1 \ src/sys/compat/linux/arch/powerpc/linux_ptrace.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/arch/i386/linux_ptrace.c diff -u src/sys/compat/linux/arch/i386/linux_ptrace.c:1.28 src/sys/compat/linux/arch/i386/linux_ptrace.c:1.28.2.1 --- src/sys/compat/linux/arch/i386/linux_ptrace.c:1.28 Tue Apr 15 17:53:09 2014 +++ src/sys/compat/linux/arch/i386/linux_ptrace.c Thu Oct 30 11:51:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.28 2014/04/15 17:53:09 maxv Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.28.2.1 2014/10/30 11:51:18 martin Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.28 2014/04/15 17:53:09 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.28.2.1 2014/10/30 11:51:18 martin Exp $"); #include #include @@ -182,7 +182,8 @@ linux_sys_ptrace_arch(struct lwp *l, con mutex_enter(proc_lock); if ((t = proc_find(SCARG(uap, pid))) == NULL) { mutex_exit(proc_lock); - return ESRCH; + error = ESRCH; + goto out; } mutex_enter(t->p_lock); mutex_exit(proc_lock); Index: src/sys/compat/linux/arch/powerpc/linux_ptrace.c diff -u src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.25 src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.25.2.1 --- src/sys/compat/linux/arch/powerpc/linux_ptrace.c:1.25 Tue Apr 15 17:53:09 2014 +++ src/sys/compat/linux/arch/powerpc/linux_ptrace.c Thu Oct 30 11:51:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_ptrace.c,v 1.25 2014/04/15 17:53:09 maxv Exp $ */ +/* $NetBSD: linux_ptrace.c,v 1.25.2.1 2014/10/30 11:51:18 martin Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.25 2014/04/15 17:53:09 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.25.2.1 2014/10/30 11:51:18 martin Exp $"); #include #include @@ -159,7 +159,8 @@ linux_sys_ptrace_arch(struct lwp *l, con mutex_enter(proc_lock); if ((t = proc_find(SCARG(uap, pid))) == NULL) { mutex_exit(proc_lock); - return ESRCH; + error = ESRCH; + goto out; } mutex_enter(t->p_lock); mutex_exit(proc_lock);
CVS commit: [netbsd-7] src/sys/compat/freebsd
Module Name:src Committed By: martin Date: Sat Oct 18 14:04:58 UTC 2014 Modified Files: src/sys/compat/freebsd [netbsd-7]: freebsd_sysctl.c Log Message: Pull up following revision(s) (requested by maxv in ticket #146): sys/compat/freebsd/freebsd_sysctl.c: revision 1.17 I'm not sure reading from an unsanitized userland pointer is a good idea. Some users might be tempted to give 0x01, in which case the kernel will crash. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/compat/freebsd/freebsd_sysctl.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/freebsd/freebsd_sysctl.c diff -u src/sys/compat/freebsd/freebsd_sysctl.c:1.16 src/sys/compat/freebsd/freebsd_sysctl.c:1.16.4.1 --- src/sys/compat/freebsd/freebsd_sysctl.c:1.16 Tue Feb 25 18:30:09 2014 +++ src/sys/compat/freebsd/freebsd_sysctl.c Sat Oct 18 14:04:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_sysctl.c,v 1.16 2014/02/25 18:30:09 pooka Exp $ */ +/* $NetBSD: freebsd_sysctl.c,v 1.16.4.1 2014/10/18 14:04:58 martin Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: freebsd_sysctl.c,v 1.16 2014/02/25 18:30:09 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: freebsd_sysctl.c,v 1.16.4.1 2014/10/18 14:04:58 martin Exp $"); #include #include @@ -90,7 +90,7 @@ freebsd_sys_sysctl(struct lwp *l, const } */ int error; int name[CTL_MAXNAME]; - size_t newlen, *oldlenp; + size_t newlen, *oldlenp, oldlen; u_int namelen; void *new, *old; @@ -141,9 +141,14 @@ freebsd_sys_sysctl(struct lwp *l, const old = SCARG(uap, old); oldlenp = SCARG(uap, oldlenp); - if (old == NULL || oldlenp == NULL || *oldlenp < sizeof(int)) + if (old == NULL || oldlenp == NULL) return(EINVAL); + if ((error = copyin(oldlenp, &oldlen, sizeof(oldlen + return (error); + if (oldlen < sizeof(int)) + return (EINVAL); + if ((locnew = (char *) malloc(newlen + 1, M_TEMP, M_WAITOK)) == NULL) return(ENOMEM); @@ -163,11 +168,11 @@ freebsd_sys_sysctl(struct lwp *l, const oidlen *= sizeof(int); error = copyout(oid, SCARG(uap, old), -MIN(oidlen, *SCARG(uap, oldlenp))); +MIN(oidlen, oldlen)); if (error) return(error); ktrmibio(-1, UIO_READ, SCARG(uap, old), - MIN(oidlen, *SCARG(uap, oldlenp)), 0); + MIN(oidlen, oldlen), 0); error = copyout(&oidlen, SCARG(uap, oldlenp), sizeof(u_int));
CVS commit: [netbsd-7] src/sys/compat/osf1
Module Name:src Committed By: msaitoh Date: Wed Aug 27 15:29:29 UTC 2014 Modified Files: src/sys/compat/osf1 [netbsd-7]: osf1_file.c Log Message: Pull up following revision(s) (requested by maxv in ticket #54): sys/compat/osf1/osf1_file.c: revision 1.42 Ensure nbytes > 0. Otherwise bad things may happen. Compile-tested only. ok christos@ To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.41.28.1 src/sys/compat/osf1/osf1_file.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/osf1/osf1_file.c diff -u src/sys/compat/osf1/osf1_file.c:1.41 src/sys/compat/osf1/osf1_file.c:1.41.28.1 --- src/sys/compat/osf1/osf1_file.c:1.41 Fri Jul 22 10:02:08 2011 +++ src/sys/compat/osf1/osf1_file.c Wed Aug 27 15:29:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: osf1_file.c,v 1.41 2011/07/22 10:02:08 njoly Exp $ */ +/* $NetBSD: osf1_file.c,v 1.41.28.1 2014/08/27 15:29:29 msaitoh Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.41 2011/07/22 10:02:08 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.41.28.1 2014/08/27 15:29:29 msaitoh Exp $"); #if defined(_KERNEL_OPT) #include "opt_syscall_debug.h" @@ -133,7 +133,7 @@ osf1_sys_getdirentries(struct lwp *l, co /* { syscallarg(int) fd; syscallarg(char *) buf; - syscallarg(u_int) nbytes; + syscallarg(int) nbytes; syscallarg(long *) basep; } */ struct dirent *bdp; @@ -151,6 +151,11 @@ osf1_sys_getdirentries(struct lwp *l, co off_t *cookiebuf = NULL, *cookie; int ncookies, fd; + if (SCARG(uap, nbytes) < 0) + return EINVAL; + if (SCARG(uap, nbytes) == 0) + return 0; + fd = SCARG(uap, fd); if ((error = fd_getvnode(fd, &fp)) != 0) return (error);