CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Fri Jan 25 03:50:13 UTC 2019 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Use __nothing (== ((void)0)) instead of "do {} while (/*CONSTCOND*/false)". To generate a diff of this commit: cvs rdiff -u -r1.618 -r1.619 src/sys/dev/pci/if_wm.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/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.618 src/sys/dev/pci/if_wm.c:1.619 --- src/sys/dev/pci/if_wm.c:1.618 Thu Jan 24 04:50:04 2019 +++ src/sys/dev/pci/if_wm.c Fri Jan 25 03:50:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.618 2019/01/24 04:50:04 msaitoh Exp $ */ +/* $NetBSD: if_wm.c,v 1.619 2019/01/25 03:50:13 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.618 2019/01/24 04:50:04 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.619 2019/01/25 03:50:13 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -160,7 +160,7 @@ int wm_debug = WM_DEBUG_TX | WM_DEBUG_RX #define DPRINTF(x, y) if (wm_debug & (x)) printf y #else -#define DPRINTF(x, y) do { } while (/*CONSTCOND*/false) +#define DPRINTF(x, y) __nothing #endif /* WM_DEBUG */ #ifdef NET_MPSAFE
CVS commit: src/lib/libwrap
Module Name:src Committed By: mrg Date: Thu Jan 24 22:07:14 UTC 2019 Modified Files: src/lib/libwrap: expandm.c Log Message: remove the new check for tlen >= PTRDIFF_MAX. the prior checks assure the condition is met and GCC7 is happy. suggested by kre. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/libwrap/expandm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libwrap/expandm.c diff -u src/lib/libwrap/expandm.c:1.11 src/lib/libwrap/expandm.c:1.12 --- src/lib/libwrap/expandm.c:1.11 Wed Jan 23 02:48:48 2019 +++ src/lib/libwrap/expandm.c Thu Jan 24 22:07:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: expandm.c,v 1.11 2019/01/23 02:48:48 kre Exp $ */ +/* $NetBSD: expandm.c,v 1.12 2019/01/24 22:07:14 mrg Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: expandm.c,v 1.11 2019/01/23 02:48:48 kre Exp $"); +__RCSID("$NetBSD: expandm.c,v 1.12 2019/01/24 22:07:14 mrg Exp $"); #include #include @@ -82,13 +82,6 @@ expandm(const char *fmt, const char *sf, tlen = nlen + blen; - /* - * We can't exceed PTRDIFF_MAX because we would - * not be able to address the pointers - */ - if (tlen >= PTRDIFF_MAX) -goto out; - nbuf = realloc(buf, tlen + 1); if (nbuf == NULL) goto out;
CVS commit: src/external/gpl3/gcc/dist/libgcc
Module Name:src Committed By: mrg Date: Thu Jan 24 22:00:28 UTC 2019 Modified Files: src/external/gpl3/gcc/dist/libgcc: config.host Log Message: set md_unwind_header=aarch64/aarch64-unwind.h for netbsd arm64. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/external/gpl3/gcc/dist/libgcc/config.host Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc/dist/libgcc/config.host diff -u src/external/gpl3/gcc/dist/libgcc/config.host:1.20 src/external/gpl3/gcc/dist/libgcc/config.host:1.21 --- src/external/gpl3/gcc/dist/libgcc/config.host:1.20 Sat Jan 19 12:10:09 2019 +++ src/external/gpl3/gcc/dist/libgcc/config.host Thu Jan 24 22:00:28 2019 @@ -353,6 +353,7 @@ aarch64*-*-netbsd*) extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + md_unwind_header=aarch64/aarch64-unwind.h ;; aarch64*-*-linux*) extra_parts="$extra_parts crtfastmath.o"
CVS commit: src/distrib/sets/lists/comp
Module Name:src Committed By: mrg Date: Thu Jan 24 21:51:16 UTC 2019 Modified Files: src/distrib/sets/lists/comp: mi Log Message: adjust libstdc++ headers for gcc7. To generate a diff of this commit: cvs rdiff -u -r1.2251 -r1.2252 src/distrib/sets/lists/comp/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2251 src/distrib/sets/lists/comp/mi:1.2252 --- src/distrib/sets/lists/comp/mi:1.2251 Sat Jan 19 13:06:50 2019 +++ src/distrib/sets/lists/comp/mi Thu Jan 24 21:51:15 2019 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2251 2019/01/19 13:06:50 mrg Exp $ +# $NetBSD: mi,v 1.2252 2019/01/24 21:51:15 mrg Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.compcomp-sys-root @@ -969,7 +969,8 @@ ./usr/include/g++/bits/basic_string.tcc comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/boost_concept_check.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/c++0x_warning.h comp-cxx-include gcc,cxx,libstdcxx -./usr/include/g++/bits/c++14_warning.h comp-cxx-include gcc,cxx,libstdcxx +./usr/include/g++/bits/c++14_warning.h comp-cxx-include gcc=6,cxx,libstdcxx +./usr/include/g++/bits/c++14_warning.h comp-cxx-include gcc=7,obsolete ./usr/include/g++/bits/c++allocator.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/c++config.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/c++io.h comp-cxx-include gcc,cxx,libstdcxx @@ -986,10 +987,12 @@ ./usr/include/g++/bits/ctype_inline.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/ctype_noninline.h comp-obsolete obsolete ./usr/include/g++/bits/cxxabi_forced.h comp-cxx-include gcc,cxx,libstdcxx +./usr/include/g++/bits/cxxabi_init_exception.h comp-cxx-include gcc=7,cxx,libstdcxx ./usr/include/g++/bits/cxxabi_tweaks.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/deque.tcc comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/enable_special_members.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/error_constants.h comp-cxx-include gcc,cxx,libstdcxx +./usr/include/g++/bits/exception.h comp-cxx-include gcc=7,cxx,libstdcxx ./usr/include/g++/bits/exception_defines.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/exception_ptr.h comp-cxx-include gcc,cxx,libstdcxx ./usr/include/g++/bits/extc++.h comp-cxx-include gcc,cxx,libstdcxx
CVS commit: src/lib/libc/gen
Module Name:src Committed By: christos Date: Thu Jan 24 18:01:38 UTC 2019 Modified Files: src/lib/libc/gen: popen.c Log Message: PR/53904: Jintao Zhu: Use a mutex instead of an rwlock to assure thread safety To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/lib/libc/gen/popen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/popen.c diff -u src/lib/libc/gen/popen.c:1.35 src/lib/libc/gen/popen.c:1.36 --- src/lib/libc/gen/popen.c:1.35 Mon Feb 2 17:07:05 2015 +++ src/lib/libc/gen/popen.c Thu Jan 24 13:01:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: popen.c,v 1.35 2015/02/02 22:07:05 christos Exp $ */ +/* $NetBSD: popen.c,v 1.36 2019/01/24 18:01:38 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: popen.c,v 1.35 2015/02/02 22:07:05 christos Exp $"); +__RCSID("$NetBSD: popen.c,v 1.36 2019/01/24 18:01:38 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -73,7 +73,20 @@ static struct pid { } *pidlist; #ifdef _REENTRANT -static rwlock_t pidlist_lock = RWLOCK_INITIALIZER; +static mutex_t pidlist_mutex = MUTEX_INITIALIZER; +# define MUTEX_LOCK() \ +do { \ + if (__isthreaded) \ + mutex_lock(_mutex); \ +} while (/*CONSTCOND*/0) +# define MUTEX_UNLOCK() \ +do { \ + if (__isthreaded) \ + mutex_unlock(_mutex); \ +} while (/*CONSTCOND*/0) +#else +# define MUTEX_LOCK() __nothing +# define MUTEX_UNLOCK() __nothing #endif static struct pid * @@ -183,17 +196,13 @@ popen(const char *cmd, const char *type) if ((cur = pdes_get(pdes, )) == NULL) return NULL; -#ifdef _REENTRANT - (void)rwlock_rdlock(_lock); -#endif + MUTEX_LOCK(); (void)__readlockenv(); switch (pid = vfork()) { case -1: /* Error. */ serrno = errno; (void)__unlockenv(); -#ifdef _REENTRANT - (void)rwlock_unlock(_lock); -#endif + MUTEX_UNLOCK(); pdes_error(pdes, cur); errno = serrno; return NULL; @@ -208,9 +217,7 @@ popen(const char *cmd, const char *type) pdes_parent(pdes, cur, pid, type); -#ifdef _REENTRANT - (void)rwlock_unlock(_lock); -#endif + MUTEX_UNLOCK(); return cur->fp; } @@ -228,15 +235,11 @@ popenve(const char *cmd, char *const *ar if ((cur = pdes_get(pdes, )) == NULL) return NULL; -#ifdef _REENTRANT - (void)rwlock_rdlock(_lock); -#endif + MUTEX_LOCK(); switch (pid = vfork()) { case -1: /* Error. */ serrno = errno; -#ifdef _REENTRANT - (void)rwlock_unlock(_lock); -#endif + MUTEX_UNLOCK(); pdes_error(pdes, cur); errno = serrno; return NULL; @@ -250,9 +253,7 @@ popenve(const char *cmd, char *const *ar pdes_parent(pdes, cur, pid, type); -#ifdef _REENTRANT - (void)rwlock_unlock(_lock); -#endif + MUTEX_UNLOCK(); return cur->fp; } @@ -271,18 +272,14 @@ pclose(FILE *iop) _DIAGASSERT(iop != NULL); -#ifdef _REENTRANT - rwlock_wrlock(_lock); -#endif + MUTEX_LOCK(); /* Find the appropriate file pointer. */ for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next) if (cur->fp == iop) break; if (cur == NULL) { -#ifdef _REENTRANT - (void)rwlock_unlock(_lock); -#endif + MUTEX_UNLOCK(); errno = ESRCH; return -1; } @@ -295,9 +292,7 @@ pclose(FILE *iop) else last->next = cur->next; -#ifdef _REENTRANT - (void)rwlock_unlock(_lock); -#endif + MUTEX_UNLOCK(); do { pid = waitpid(cur->pid, , 0);
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Thu Jan 24 15:36:05 UTC 2019 Modified Files: src/doc [netbsd-8]: CHANGES-8.1 Log Message: Ticket #1168 To generate a diff of this commit: cvs rdiff -u -r1.1.2.93 -r1.1.2.94 src/doc/CHANGES-8.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.1 diff -u src/doc/CHANGES-8.1:1.1.2.93 src/doc/CHANGES-8.1:1.1.2.94 --- src/doc/CHANGES-8.1:1.1.2.93 Thu Jan 24 14:01:10 2019 +++ src/doc/CHANGES-8.1 Thu Jan 24 15:36:05 2019 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.1,v 1.1.2.93 2019/01/24 14:01:10 martin Exp $ +# $NetBSD: CHANGES-8.1,v 1.1.2.94 2019/01/24 15:36:05 martin Exp $ A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1 release: @@ -2273,3 +2273,9 @@ usr.sbin/rpcbind/util.c1.23 (adapted Fix wrong size allocation that triggers a buffer overflow. [christos, ticket #1167] +sys/kern/kern_ntptime.c1.60 + + Zero out the ntptimeval structure to prevent a 4 byte kernel + stack disclosure. + [maxv, ticket #1168] +
CVS commit: [netbsd-8] src/sys/kern
Module Name:src Committed By: martin Date: Thu Jan 24 15:35:14 UTC 2019 Modified Files: src/sys/kern [netbsd-8]: kern_ntptime.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1168): sys/kern/kern_ntptime.c: revision 1.60 Zero out the ntptimeval structure to prevent a 4 byte kernel stack disclosure. Reported by Thomas Barabosch. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.57.10.1 src/sys/kern/kern_ntptime.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/kern/kern_ntptime.c diff -u src/sys/kern/kern_ntptime.c:1.57 src/sys/kern/kern_ntptime.c:1.57.10.1 --- src/sys/kern/kern_ntptime.c:1.57 Mon Nov 23 23:45:44 2015 +++ src/sys/kern/kern_ntptime.c Thu Jan 24 15:35:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $ */ +/* $NetBSD: kern_ntptime.c,v 1.57.10.1 2019/01/24 15:35:14 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ #include /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */ -__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.57.10.1 2019/01/24 15:35:14 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ntp.h" @@ -239,6 +239,7 @@ static void hardupdate(long offset); void ntp_gettime(struct ntptimeval *ntv) { + memset(ntv, 0, sizeof(*ntv)); mutex_spin_enter(_lock); nanotime(>time);
CVS commit: [netbsd-7-1] src/doc
Module Name:src Committed By: martin Date: Thu Jan 24 14:13:46 UTC 2019 Modified Files: src/doc [netbsd-7-1]: CHANGES-7.1.3 Log Message: Tickets #1674 and #1675 To generate a diff of this commit: cvs rdiff -u -r1.1.2.36 -r1.1.2.37 src/doc/CHANGES-7.1.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-7.1.3 diff -u src/doc/CHANGES-7.1.3:1.1.2.36 src/doc/CHANGES-7.1.3:1.1.2.37 --- src/doc/CHANGES-7.1.3:1.1.2.36 Tue Jan 15 18:44:58 2019 +++ src/doc/CHANGES-7.1.3 Thu Jan 24 14:13:46 2019 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.1.3,v 1.1.2.36 2019/01/15 18:44:58 martin Exp $ +# $NetBSD: CHANGES-7.1.3,v 1.1.2.37 2019/01/24 14:13:46 martin Exp $ A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3 release: @@ -372,3 +372,14 @@ sys/arch/sparc/sparc/pmap.c 1.366 Fix deadlocks on machines with more than two cpus. [mrg, ticket #1672] +regress/sys/arch/m68k/060sp/Makefile 1.15 + + Replace manual realdepend dependency with DPSRCS. + [msaitoh, ticket #1674] + +sys/kern/kern_ntptime.c1.60 + + Zero out the ntptimeval structure to prevent a 4 byte kernel stack + disclosure. + [maxv, ticket #1675] +
CVS commit: [netbsd-8] src/usr.sbin/rpcbind
Module Name:src Committed By: martin Date: Thu Jan 24 13:59:40 UTC 2019 Modified Files: src/usr.sbin/rpcbind [netbsd-8]: util.c Log Message: Pull up following revision(s) (requested by christos in ticket #1167): usr.sbin/rpcbind/util.c: revision 1.23 - fix wrong size allocation that triggers buffer overflow - remove unneeded casts and assertions XXX: pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.20.8.1 src/usr.sbin/rpcbind/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/rpcbind/util.c diff -u src/usr.sbin/rpcbind/util.c:1.20 src/usr.sbin/rpcbind/util.c:1.20.8.1 --- src/usr.sbin/rpcbind/util.c:1.20 Sun Nov 8 16:36:28 2015 +++ src/usr.sbin/rpcbind/util.c Thu Jan 24 13:59:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.20 2015/11/08 16:36:28 christos Exp $ */ +/* $NetBSD: util.c,v 1.20.8.1 2019/01/24 13:59:40 martin Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -128,14 +128,14 @@ addrmerge(struct netbuf *caller, char *s if (serv_nbp == NULL) return NULL; - serv_sa = (struct sockaddr *)serv_nbp->buf; + serv_sa = serv_nbp->buf; if (clnt_uaddr != NULL) { clnt_nbp = uaddr2taddr(nconf, clnt_uaddr); if (clnt_nbp == NULL) { free(serv_nbp); return NULL; } - clnt_sa = (struct sockaddr *)clnt_nbp->buf; + clnt_sa = clnt_nbp->buf; if (clnt_sa->sa_family == AF_LOCAL) { free(serv_nbp); free(clnt_nbp); @@ -143,8 +143,12 @@ addrmerge(struct netbuf *caller, char *s return strdup(serv_uaddr); } } else { - clnt_sa = (struct sockaddr *) - malloc(sizeof (struct sockaddr_storage)); + clnt_sa = malloc(clnt->sa_len); + if (clnt_sa == NULL) { + free(serv_nbp); + free(clnt_nbp); + return 0; + } memcpy(clnt_sa, clnt, clnt->sa_len); } @@ -262,7 +266,6 @@ found: break; #ifdef INET6 case AF_INET6: - assert(newsin6); memcpy(newsin6, ifsin6, clnt_sa->sa_len); newsin6->sin6_port = servsin6->sin6_port; tbuf.maxlen = sizeof (struct sockaddr_storage);
CVS commit: [netbsd-7] src/doc
Module Name:src Committed By: martin Date: Thu Jan 24 14:14:32 UTC 2019 Modified Files: src/doc [netbsd-7]: CHANGES-7.3 Log Message: Tickets #1674 and #1675 To generate a diff of this commit: cvs rdiff -u -r1.1.2.33 -r1.1.2.34 src/doc/CHANGES-7.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-7.3 diff -u src/doc/CHANGES-7.3:1.1.2.33 src/doc/CHANGES-7.3:1.1.2.34 --- src/doc/CHANGES-7.3:1.1.2.33 Tue Jan 15 18:43:59 2019 +++ src/doc/CHANGES-7.3 Thu Jan 24 14:14:32 2019 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.3,v 1.1.2.33 2019/01/15 18:43:59 martin Exp $ +# $NetBSD: CHANGES-7.3,v 1.1.2.34 2019/01/24 14:14:32 martin Exp $ A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3 release: @@ -391,3 +391,14 @@ sys/arch/sparc/sparc/pmap.c 1.366 Fix deadlocks on machines with more than two cpus. [mrg, ticket #1672] +regress/sys/arch/m68k/060sp/Makefile 1.15 + + Replace manual realdepend dependency with DPSRCS. + [msaitoh, ticket #1674] + +sys/kern/kern_ntptime.c1.60 + + Zero out the ntptimeval structure to prevent a 4 byte kernel stack + disclosure. + [maxv, ticket #1675] +
CVS commit: [netbsd-7] src/sys/kern
Module Name:src Committed By: martin Date: Thu Jan 24 14:14:13 UTC 2019 Modified Files: src/sys/kern [netbsd-7]: kern_ntptime.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1675): sys/kern/kern_ntptime.c: revision 1.60 Zero out the ntptimeval structure to prevent a 4 byte kernel stack disclosure. Reported by Thomas Barabosch. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.55.4.1 src/sys/kern/kern_ntptime.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/kern/kern_ntptime.c diff -u src/sys/kern/kern_ntptime.c:1.55 src/sys/kern/kern_ntptime.c:1.55.4.1 --- src/sys/kern/kern_ntptime.c:1.55 Tue Feb 25 18:30:11 2014 +++ src/sys/kern/kern_ntptime.c Thu Jan 24 14:14:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ntptime.c,v 1.55 2014/02/25 18:30:11 pooka Exp $ */ +/* $NetBSD: kern_ntptime.c,v 1.55.4.1 2019/01/24 14:14:13 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ #include /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */ -__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.55 2014/02/25 18:30:11 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.55.4.1 2019/01/24 14:14:13 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ntp.h" @@ -239,6 +239,7 @@ static void hardupdate(long offset); void ntp_gettime(struct ntptimeval *ntv) { + memset(ntv, 0, sizeof(*ntv)); mutex_spin_enter(_lock); nanotime(>time);
CVS commit: [netbsd-7-0] src/sys/kern
Module Name:src Committed By: martin Date: Thu Jan 24 14:12:09 UTC 2019 Modified Files: src/sys/kern [netbsd-7-0]: kern_ntptime.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1675): sys/kern/kern_ntptime.c: revision 1.60 Zero out the ntptimeval structure to prevent a 4 byte kernel stack disclosure. Reported by Thomas Barabosch. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.55.8.1 src/sys/kern/kern_ntptime.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/kern/kern_ntptime.c diff -u src/sys/kern/kern_ntptime.c:1.55 src/sys/kern/kern_ntptime.c:1.55.8.1 --- src/sys/kern/kern_ntptime.c:1.55 Tue Feb 25 18:30:11 2014 +++ src/sys/kern/kern_ntptime.c Thu Jan 24 14:12:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ntptime.c,v 1.55 2014/02/25 18:30:11 pooka Exp $ */ +/* $NetBSD: kern_ntptime.c,v 1.55.8.1 2019/01/24 14:12:09 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ #include /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */ -__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.55 2014/02/25 18:30:11 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.55.8.1 2019/01/24 14:12:09 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ntp.h" @@ -239,6 +239,7 @@ static void hardupdate(long offset); void ntp_gettime(struct ntptimeval *ntv) { + memset(ntv, 0, sizeof(*ntv)); mutex_spin_enter(_lock); nanotime(>time);
CVS commit: [netbsd-7-1] src/sys/kern
Module Name:src Committed By: martin Date: Thu Jan 24 14:13:26 UTC 2019 Modified Files: src/sys/kern [netbsd-7-1]: kern_ntptime.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1675): sys/kern/kern_ntptime.c: revision 1.60 Zero out the ntptimeval structure to prevent a 4 byte kernel stack disclosure. Reported by Thomas Barabosch. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.55.12.1 src/sys/kern/kern_ntptime.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/kern/kern_ntptime.c diff -u src/sys/kern/kern_ntptime.c:1.55 src/sys/kern/kern_ntptime.c:1.55.12.1 --- src/sys/kern/kern_ntptime.c:1.55 Tue Feb 25 18:30:11 2014 +++ src/sys/kern/kern_ntptime.c Thu Jan 24 14:13:26 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ntptime.c,v 1.55 2014/02/25 18:30:11 pooka Exp $ */ +/* $NetBSD: kern_ntptime.c,v 1.55.12.1 2019/01/24 14:13:26 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ #include /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */ -__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.55 2014/02/25 18:30:11 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.55.12.1 2019/01/24 14:13:26 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ntp.h" @@ -239,6 +239,7 @@ static void hardupdate(long offset); void ntp_gettime(struct ntptimeval *ntv) { + memset(ntv, 0, sizeof(*ntv)); mutex_spin_enter(_lock); nanotime(>time);
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Thu Jan 24 14:01:10 UTC 2019 Modified Files: src/doc [netbsd-8]: CHANGES-8.1 Log Message: Ticket #1167 To generate a diff of this commit: cvs rdiff -u -r1.1.2.92 -r1.1.2.93 src/doc/CHANGES-8.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.1 diff -u src/doc/CHANGES-8.1:1.1.2.92 src/doc/CHANGES-8.1:1.1.2.93 --- src/doc/CHANGES-8.1:1.1.2.92 Mon Jan 21 20:12:40 2019 +++ src/doc/CHANGES-8.1 Thu Jan 24 14:01:10 2019 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.1,v 1.1.2.92 2019/01/21 20:12:40 martin Exp $ +# $NetBSD: CHANGES-8.1,v 1.1.2.93 2019/01/24 14:01:10 martin Exp $ A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1 release: @@ -2268,3 +2268,8 @@ sys/arch/xen/xen/if_xennet_xenbus.c 1.7 Don't call xennet_softstart from hard interrupt; schedule softint. [bouyer, ticket #1166] +usr.sbin/rpcbind/util.c1.23 (adapted) + + Fix wrong size allocation that triggers a buffer overflow. + [christos, ticket #1167] +
CVS commit: [netbsd-7-0] src/regress/sys/arch/m68k/060sp
Module Name:src Committed By: martin Date: Thu Jan 24 14:09:30 UTC 2019 Modified Files: src/regress/sys/arch/m68k/060sp [netbsd-7-0]: Makefile Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1674): regress/sys/arch/m68k/060sp/Makefile: revision 1.15 Replace manual realdepend dependency with DPSRCS. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.14.44.1 src/regress/sys/arch/m68k/060sp/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/regress/sys/arch/m68k/060sp/Makefile diff -u src/regress/sys/arch/m68k/060sp/Makefile:1.14 src/regress/sys/arch/m68k/060sp/Makefile:1.14.44.1 --- src/regress/sys/arch/m68k/060sp/Makefile:1.14 Fri Mar 28 22:29:16 2008 +++ src/regress/sys/arch/m68k/060sp/Makefile Thu Jan 24 14:09:30 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2008/03/28 22:29:16 apb Exp $ +# $NetBSD: Makefile,v 1.14.44.1 2019/01/24 14:09:30 martin Exp $ NOMAN= # defined @@ -9,6 +9,7 @@ SRCS= dotest.c dotestsubs.S AFLAGS+= -I. CPPFLAGS+= -I. SPDIR= ${NETBSDSRCDIR}/sys/arch/m68k/060sp +DPSRCS+= itest.S ftest.S CLEANFILES+= itest.S ftest.S .SUFFIXES: .S .sa @@ -19,7 +20,7 @@ CLEANFILES+= itest.S ftest.S .PATH: ${SPDIR}/dist -realdepend dotestsubs.o: itest.S ftest.S +dotestsubs.o: itest.S ftest.S regress: ${PROG} @/sbin/sysctl hw.model | grep -v -q 68060 || \
CVS commit: [netbsd-7-0] src/doc
Module Name:src Committed By: martin Date: Thu Jan 24 14:12:40 UTC 2019 Modified Files: src/doc [netbsd-7-0]: CHANGES-7.0.3 Log Message: Tickets #1674 and #1675 To generate a diff of this commit: cvs rdiff -u -r1.1.2.129 -r1.1.2.130 src/doc/CHANGES-7.0.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-7.0.3 diff -u src/doc/CHANGES-7.0.3:1.1.2.129 src/doc/CHANGES-7.0.3:1.1.2.130 --- src/doc/CHANGES-7.0.3:1.1.2.129 Tue Jan 15 18:45:51 2019 +++ src/doc/CHANGES-7.0.3 Thu Jan 24 14:12:40 2019 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.0.3,v 1.1.2.129 2019/01/15 18:45:51 martin Exp $ +# $NetBSD: CHANGES-7.0.3,v 1.1.2.130 2019/01/24 14:12:40 martin Exp $ A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3 release: @@ -5680,3 +5680,14 @@ sys/arch/sparc/sparc/pmap.c 1.366 Fix deadlocks on machines with more than two cpus. [mrg, ticket #1672] +regress/sys/arch/m68k/060sp/Makefile 1.15 + + Replace manual realdepend dependency with DPSRCS. + [msaitoh, ticket #1674] + +sys/kern/kern_ntptime.c1.60 + + Zero out the ntptimeval structure to prevent a 4 byte kernel stack + disclosure. + [maxv, ticket #1675] +
CVS commit: [netbsd-7-1] src/regress/sys/arch/m68k/060sp
Module Name:src Committed By: martin Date: Thu Jan 24 14:08:46 UTC 2019 Modified Files: src/regress/sys/arch/m68k/060sp [netbsd-7-1]: Makefile Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1674): regress/sys/arch/m68k/060sp/Makefile: revision 1.15 Replace manual realdepend dependency with DPSRCS. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.14.48.1 src/regress/sys/arch/m68k/060sp/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/regress/sys/arch/m68k/060sp/Makefile diff -u src/regress/sys/arch/m68k/060sp/Makefile:1.14 src/regress/sys/arch/m68k/060sp/Makefile:1.14.48.1 --- src/regress/sys/arch/m68k/060sp/Makefile:1.14 Fri Mar 28 22:29:16 2008 +++ src/regress/sys/arch/m68k/060sp/Makefile Thu Jan 24 14:08:46 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2008/03/28 22:29:16 apb Exp $ +# $NetBSD: Makefile,v 1.14.48.1 2019/01/24 14:08:46 martin Exp $ NOMAN= # defined @@ -9,6 +9,7 @@ SRCS= dotest.c dotestsubs.S AFLAGS+= -I. CPPFLAGS+= -I. SPDIR= ${NETBSDSRCDIR}/sys/arch/m68k/060sp +DPSRCS+= itest.S ftest.S CLEANFILES+= itest.S ftest.S .SUFFIXES: .S .sa @@ -19,7 +20,7 @@ CLEANFILES+= itest.S ftest.S .PATH: ${SPDIR}/dist -realdepend dotestsubs.o: itest.S ftest.S +dotestsubs.o: itest.S ftest.S regress: ${PROG} @/sbin/sysctl hw.model | grep -v -q 68060 || \
CVS commit: [netbsd-7] src/regress/sys/arch/m68k/060sp
Module Name:src Committed By: martin Date: Thu Jan 24 14:08:14 UTC 2019 Modified Files: src/regress/sys/arch/m68k/060sp [netbsd-7]: Makefile Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1674): regress/sys/arch/m68k/060sp/Makefile: revision 1.15 Replace manual realdepend dependency with DPSRCS. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.14.42.1 src/regress/sys/arch/m68k/060sp/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/regress/sys/arch/m68k/060sp/Makefile diff -u src/regress/sys/arch/m68k/060sp/Makefile:1.14 src/regress/sys/arch/m68k/060sp/Makefile:1.14.42.1 --- src/regress/sys/arch/m68k/060sp/Makefile:1.14 Fri Mar 28 22:29:16 2008 +++ src/regress/sys/arch/m68k/060sp/Makefile Thu Jan 24 14:08:14 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2008/03/28 22:29:16 apb Exp $ +# $NetBSD: Makefile,v 1.14.42.1 2019/01/24 14:08:14 martin Exp $ NOMAN= # defined @@ -9,6 +9,7 @@ SRCS= dotest.c dotestsubs.S AFLAGS+= -I. CPPFLAGS+= -I. SPDIR= ${NETBSDSRCDIR}/sys/arch/m68k/060sp +DPSRCS+= itest.S ftest.S CLEANFILES+= itest.S ftest.S .SUFFIXES: .S .sa @@ -19,7 +20,7 @@ CLEANFILES+= itest.S ftest.S .PATH: ${SPDIR}/dist -realdepend dotestsubs.o: itest.S ftest.S +dotestsubs.o: itest.S ftest.S regress: ${PROG} @/sbin/sysctl hw.model | grep -v -q 68060 || \
CVS commit: src/sys/dev/nvmm
Module Name:src Committed By: maxv Date: Thu Jan 24 13:05:59 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.h src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Optimize: change the behavior of the HLT vmexit, make it a "change in vcpu state" which occurs after the instruction executed, rather than an instruction intercept which occurs before. Disable the shadow and the intr window in kernel mode, and advance the RIP, so that the virtualizer doesn't have to do it itself. This saves two syscalls and one VMCB cache flush. Provide npc for other instruction intercepts, in case someone is interested. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/nvmm/nvmm.h cvs rdiff -u -r1.16 -r1.17 src/sys/dev/nvmm/x86/nvmm_x86_svm.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/dev/nvmm/nvmm.h diff -u src/sys/dev/nvmm/nvmm.h:1.2 src/sys/dev/nvmm/nvmm.h:1.3 --- src/sys/dev/nvmm/nvmm.h:1.2 Sun Jan 6 16:10:51 2019 +++ src/sys/dev/nvmm/nvmm.h Thu Jan 24 13:05:59 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: nvmm.h,v 1.2 2019/01/06 16:10:51 maxv Exp $ */ +/* $NetBSD: nvmm.h,v 1.3 2019/01/24 13:05:59 maxv Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -53,13 +53,13 @@ enum nvmm_exit_reason { NVMM_EXIT_MSR = 0x0003, NVMM_EXIT_INT_READY = 0x0004, NVMM_EXIT_NMI_READY = 0x0005, - NVMM_EXIT_SHUTDOWN = 0x0006, + NVMM_EXIT_HALTED = 0x0006, + NVMM_EXIT_SHUTDOWN = 0x0007, /* Instructions (x86). */ - NVMM_EXIT_HLT = 0x1000, - NVMM_EXIT_MONITOR = 0x1001, - NVMM_EXIT_MWAIT = 0x1002, - NVMM_EXIT_MWAIT_COND = 0x1003, + NVMM_EXIT_MONITOR = 0x1000, + NVMM_EXIT_MWAIT = 0x1001, + NVMM_EXIT_MWAIT_COND = 0x1002, NVMM_EXIT_INVALID = 0x }; @@ -106,7 +106,7 @@ struct nvmm_exit_msr { uint64_t npc; }; -struct nvmm_exit_hlt { +struct nvmm_exit_insn { uint64_t npc; }; @@ -116,7 +116,7 @@ struct nvmm_exit { struct nvmm_exit_memory mem; struct nvmm_exit_io io; struct nvmm_exit_msr msr; - struct nvmm_exit_hlt hlt; + struct nvmm_exit_insn insn; } u; uint64_t exitstate[8]; }; Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.16 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.17 --- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.16 Sun Jan 20 16:55:21 2019 +++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c Thu Jan 24 13:05:59 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: nvmm_x86_svm.c,v 1.16 2019/01/20 16:55:21 maxv Exp $ */ +/* $NetBSD: nvmm_x86_svm.c,v 1.17 2019/01/24 13:05:59 maxv Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.16 2019/01/20 16:55:21 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.17 2019/01/24 13:05:59 maxv Exp $"); #include #include @@ -726,31 +726,29 @@ svm_inject_ud(struct nvmm_machine *mach, } static void -svm_inject_db(struct nvmm_machine *mach, struct nvmm_cpu *vcpu) +svm_inject_gp(struct nvmm_machine *mach, struct nvmm_cpu *vcpu) { struct nvmm_event event; int ret __diagused; event.type = NVMM_EVENT_EXCEPTION; - event.vector = 1; + event.vector = 13; event.u.error = 0; ret = svm_vcpu_inject(mach, vcpu, ); KASSERT(ret == 0); } -static void -svm_inject_gp(struct nvmm_machine *mach, struct nvmm_cpu *vcpu) +static inline void +svm_inkernel_advance(struct vmcb *vmcb) { - struct nvmm_event event; - int ret __diagused; - - event.type = NVMM_EVENT_EXCEPTION; - event.vector = 13; - event.u.error = 0; - - ret = svm_vcpu_inject(mach, vcpu, ); - KASSERT(ret == 0); + /* + * Maybe we should also apply single-stepping and debug exceptions. + * Matters for guest-ring3, because it can execute 'cpuid' under a + * debugger. + */ + vmcb->state.rip = vmcb->ctrl.nrip; + vmcb->ctrl.intr &= ~VMCB_CTRL_INTR_SHADOW; } static void @@ -842,12 +840,7 @@ svm_exit_cpuid(struct nvmm_machine *mach /* Overwrite non-tunable leaves. */ svm_inkernel_handle_cpuid(vcpu, eax, ecx); - /* For now we omit DBREGS. */ - if (__predict_false(cpudata->vmcb->state.rflags & PSL_T)) { - svm_inject_db(mach, vcpu); - } - - cpudata->vmcb->state.rip = cpudata->vmcb->ctrl.nrip; + svm_inkernel_advance(cpudata->vmcb); exit->reason = NVMM_EXIT_NONE; } @@ -856,9 +849,14 @@ svm_exit_hlt(struct nvmm_machine *mach, struct nvmm_exit *exit) { struct svm_cpudata *cpudata = vcpu->cpudata; + struct vmcb *vmcb = cpudata->vmcb; - exit->reason = NVMM_EXIT_HLT; - exit->u.hlt.npc = cpudata->vmcb->ctrl.nrip; + if (cpudata->int_window_exit && (vmcb->state.rflags & PSL_I)) { + svm_event_waitexit_disable(vcpu, false); + } + + svm_inkernel_advance(cpudata->vmcb); + exit->reason = NVMM_EXIT_HALTED; } #define SVM_EXIT_IO_PORT __BITS(31,16) @@ -994,7
CVS commit: src/sys
Module Name:src Committed By: knakahara Date: Thu Jan 24 09:33:03 UTC 2019 Modified Files: src/sys/dev/bluetooth: bcsp.c btuart.c src/sys/dev/ir: irframe_tty.c src/sys/net: if_sl.c if_strip.c Log Message: Add comments about D_MPSAFE to functions called as struct linesw.l_ioctl. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/bluetooth/bcsp.c cvs rdiff -u -r1.28 -r1.29 src/sys/dev/bluetooth/btuart.c cvs rdiff -u -r1.62 -r1.63 src/sys/dev/ir/irframe_tty.c cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_sl.c cvs rdiff -u -r1.111 -r1.112 src/sys/net/if_strip.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/dev/bluetooth/bcsp.c diff -u src/sys/dev/bluetooth/bcsp.c:1.30 src/sys/dev/bluetooth/bcsp.c:1.31 --- src/sys/dev/bluetooth/bcsp.c:1.30 Mon Aug 15 08:20:11 2016 +++ src/sys/dev/bluetooth/bcsp.c Thu Jan 24 09:33:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: bcsp.c,v 1.30 2016/08/15 08:20:11 maxv Exp $ */ +/* $NetBSD: bcsp.c,v 1.31 2019/01/24 09:33:03 knakahara Exp $ */ /* * Copyright (c) 2007 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.30 2016/08/15 08:20:11 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.31 2019/01/24 09:33:03 knakahara Exp $"); #include #include @@ -467,6 +467,12 @@ bcspioctl(struct tty *tp, u_long cmd, vo struct bcsp_softc *sc = tp->t_sc; int error; + /* + * XXX + * This function can be called without KERNEL_LOCK when caller's + * struct cdevsw is set D_MPSAFE. Is KERNEL_LOCK required? + */ + if (sc == NULL || tp != sc->sc_tp) return EPASSTHROUGH; Index: src/sys/dev/bluetooth/btuart.c diff -u src/sys/dev/bluetooth/btuart.c:1.28 src/sys/dev/bluetooth/btuart.c:1.29 --- src/sys/dev/bluetooth/btuart.c:1.28 Thu Aug 20 14:40:17 2015 +++ src/sys/dev/bluetooth/btuart.c Thu Jan 24 09:33:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: btuart.c,v 1.28 2015/08/20 14:40:17 christos Exp $ */ +/* $NetBSD: btuart.c,v 1.29 2019/01/24 09:33:03 knakahara Exp $ */ /*- * Copyright (c) 2006, 2007 KIYOHARA Takashi @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.28 2015/08/20 14:40:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.29 2019/01/24 09:33:03 knakahara Exp $"); #include #include @@ -313,6 +313,12 @@ btuartioctl(struct tty *tp, u_long cmd, struct btuart_softc *sc = tp->t_sc; int error; + /* + * XXX + * This function can be called without KERNEL_LOCK when caller's + * struct cdevsw is set D_MPSAFE. Is KERNEL_LOCK required? + */ + if (sc == NULL || tp != sc->sc_tp) return EPASSTHROUGH; Index: src/sys/dev/ir/irframe_tty.c diff -u src/sys/dev/ir/irframe_tty.c:1.62 src/sys/dev/ir/irframe_tty.c:1.63 --- src/sys/dev/ir/irframe_tty.c:1.62 Wed Oct 25 08:12:38 2017 +++ src/sys/dev/ir/irframe_tty.c Thu Jan 24 09:33:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: irframe_tty.c,v 1.62 2017/10/25 08:12:38 maya Exp $ */ +/* $NetBSD: irframe_tty.c,v 1.63 2019/01/24 09:33:03 knakahara Exp $ */ /* * TODO @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.62 2017/10/25 08:12:38 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irframe_tty.c,v 1.63 2019/01/24 09:33:03 knakahara Exp $"); #include #include @@ -377,6 +377,12 @@ irframetioctl(struct tty *tp, u_long cmd DPRINTF(("%s: tp=%p\n", __func__, tp)); + /* + * XXX + * This function can be called without KERNEL_LOCK when caller's + * struct cdevsw is set D_MPSAFE. Is KERNEL_LOCK required? + */ + if (sc == NULL || tp != sc->sc_tp) return (EPASSTHROUGH); Index: src/sys/net/if_sl.c diff -u src/sys/net/if_sl.c:1.130 src/sys/net/if_sl.c:1.131 --- src/sys/net/if_sl.c:1.130 Sat Dec 22 13:11:37 2018 +++ src/sys/net/if_sl.c Thu Jan 24 09:33:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_sl.c,v 1.130 2018/12/22 13:11:37 maxv Exp $ */ +/* $NetBSD: if_sl.c,v 1.131 2019/01/24 09:33:03 knakahara Exp $ */ /* * Copyright (c) 1987, 1989, 1992, 1993 @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.130 2018/12/22 13:11:37 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.131 2019/01/24 09:33:03 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -443,6 +443,12 @@ sltioctl(struct tty *tp, u_long cmd, voi { struct sl_softc *sc = (struct sl_softc *)tp->t_sc; + /* + * XXX + * This function can be called without KERNEL_LOCK when caller's + * struct cdevsw is set D_MPSAFE. Is KERNEL_LOCK required? + */ + switch (cmd) { case SLIOCGUNIT: *(int *)data = sc->sc_unit; /* XXX */ Index: src/sys/net/if_strip.c diff -u src/sys/net/if_strip.c:1.111 src/sys/net/if_strip.c:1.112 --- src/sys/net/if_strip.c:1.111 Sat Dec 22 13:11:37 2018 +++ src/sys/net/if_strip.c Thu Jan 24 09:33:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_strip.c,v 1.111 2018/12/22 13:11:37 maxv Exp $ */ +/* $NetBSD:
CVS commit: src/sys/net
Module Name:src Committed By: knakahara Date: Thu Jan 24 09:31:10 UTC 2019 Modified Files: src/sys/net: ppp_tty.c Log Message: Add KERNEL_LOCK in ppptioctl() to protect struct ppp_softc members. struct linesw.i_ioctl can be called without any preservation when the caller's struct cdevsw is set D_MPSAFE such as ucom(4). To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/net/ppp_tty.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/net/ppp_tty.c diff -u src/sys/net/ppp_tty.c:1.64 src/sys/net/ppp_tty.c:1.65 --- src/sys/net/ppp_tty.c:1.64 Wed Feb 7 06:19:43 2018 +++ src/sys/net/ppp_tty.c Thu Jan 24 09:31:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ppp_tty.c,v 1.64 2018/02/07 06:19:43 mrg Exp $ */ +/* $NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $ */ /* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */ /* @@ -93,7 +93,7 @@ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.64 2018/02/07 06:19:43 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $"); #ifdef _KERNEL_OPT #include "ppp.h" @@ -439,8 +439,15 @@ ppptioctl(struct tty *tp, u_long cmd, vo struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; int error, s; -if (sc == NULL || tp != (struct tty *) sc->sc_devp) - return (EPASSTHROUGH); +if (sc == NULL) +return (EPASSTHROUGH); + +KERNEL_LOCK(1, NULL); + +if (tp != (struct tty *) sc->sc_devp) { +error = EPASSTHROUGH; +goto out; +} error = 0; switch (cmd) { @@ -492,6 +499,8 @@ ppptioctl(struct tty *tp, u_long cmd, vo pppgetm(sc); } + out: +KERNEL_UNLOCK_ONE(NULL); return error; }