CVS commit: src/sys/kern
Module Name:src Committed By: pgoyette Date: Mon Apr 15 03:58:29 UTC 2019 Modified Files: src/sys/kern: uipc_socket.c Log Message: If the compat code successfully handled an option, don't return an error. To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.277 src/sys/kern/uipc_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/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.276 src/sys/kern/uipc_socket.c:1.277 --- src/sys/kern/uipc_socket.c:1.276 Mon Apr 15 02:35:28 2019 +++ src/sys/kern/uipc_socket.c Mon Apr 15 03:58:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.276 2019/04/15 02:35:28 pgoyette Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.277 2019/04/15 03:58:29 pgoyette Exp $ */ /* * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.276 2019/04/15 02:35:28 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.277 2019/04/15 03:58:29 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1864,6 +1864,8 @@ sosetopt1(struct socket *so, const struc break; default: + if (error == 0) + break; solock(so); error = ENOPROTOOPT; break;
CVS commit: src/sys/kern
Module Name:src Committed By: pgoyette Date: Mon Apr 15 02:35:28 UTC 2019 Modified Files: src/sys/kern: uipc_socket.c Log Message: Actually update the timeout value for the compability sockops To generate a diff of this commit: cvs rdiff -u -r1.275 -r1.276 src/sys/kern/uipc_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/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.275 src/sys/kern/uipc_socket.c:1.276 --- src/sys/kern/uipc_socket.c:1.275 Mon Apr 15 02:07:11 2019 +++ src/sys/kern/uipc_socket.c Mon Apr 15 02:35:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.275 2019/04/15 02:07:11 pgoyette Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.276 2019/04/15 02:35:28 pgoyette Exp $ */ /* * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.275 2019/04/15 02:07:11 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.276 2019/04/15 02:35:28 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1852,9 +1852,11 @@ sosetopt1(struct socket *so, const struc optval = 1; switch (opt) { + case SO_OSNDTIMEO: case SO_SNDTIMEO: so->so_snd.sb_timeo = optval; break; + case SO_ORCVTIMEO: case SO_RCVTIMEO: so->so_rcv.sb_timeo = optval; break;
CVS commit: src/sys
Module Name:src Committed By: pgoyette Date: Mon Apr 15 02:07:11 UTC 2019 Modified Files: src/sys/compat/common: compat_50_mod.c compat_mod.h files.common src/sys/kern: compat_stub.c uipc_socket.c src/sys/modules/compat_50: Makefile src/sys/sys: compat_stub.h Added Files: src/sys/compat/common: kern_uipc_socket_50.c Log Message: Split the COMPAT_50 socket-timeout stuff out of kern/uipc_socket.c and into its own source file, which is now included in the compat_50 module. (Not sure how this got missed during the original [pgoyette-compat] work) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_50_mod.c \ src/sys/compat/common/files.common cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/compat_mod.h cvs rdiff -u -r0 -r1.1 src/sys/compat/common/kern_uipc_socket_50.c cvs rdiff -u -r1.8 -r1.9 src/sys/kern/compat_stub.c cvs rdiff -u -r1.274 -r1.275 src/sys/kern/uipc_socket.c cvs rdiff -u -r1.3 -r1.4 src/sys/modules/compat_50/Makefile cvs rdiff -u -r1.11 -r1.12 src/sys/sys/compat_stub.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/common/compat_50_mod.c diff -u src/sys/compat/common/compat_50_mod.c:1.2 src/sys/compat/common/compat_50_mod.c:1.3 --- src/sys/compat/common/compat_50_mod.c:1.2 Sun Jan 27 02:08:39 2019 +++ src/sys/compat/common/compat_50_mod.c Mon Apr 15 02:07:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_50_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: compat_50_mod.c,v 1.3 2019/04/15 02:07:11 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.3 2019/04/15 02:07:11 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -87,6 +87,7 @@ compat_50_init(void) vnd_50_init(); rndpseudo_50_init(); rtsock_50_init(); + kern_uipc_socket_50_init(); return error; @@ -107,6 +108,7 @@ compat_50_fini(void) { int error = 0; + kern_uipc_socket_50_fini(); rtsock_50_fini(); rndpseudo_50_fini(); vnd_50_fini(); @@ -152,6 +154,7 @@ compat_50_fini(void) vnd_50_init(); rndpseudo_50_init(); rtsock_50_init(); + kern_uipc_socket_50_init(); return error; } Index: src/sys/compat/common/files.common diff -u src/sys/compat/common/files.common:1.2 src/sys/compat/common/files.common:1.3 --- src/sys/compat/common/files.common:1.2 Sun Jan 27 02:08:39 2019 +++ src/sys/compat/common/files.common Mon Apr 15 02:07:11 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files.common,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ +# $NetBSD: files.common,v 1.3 2019/04/15 02:07:11 pgoyette Exp $ # # Generic utility files, used by various compat options. @@ -85,6 +85,7 @@ file compat/common/vnd_50.c compat_50 file compat/common/clockctl_50.c compat_50 file compat/common/if_spppsubr50.c compat_50 file compat/common/uvm_50.c compat_50 +file compat/common/kern_uipc_socket_50.c compat_50 # Compatibility code for NetBSD 6.0 file compat/common/compat_60_mod.c compat_60 Index: src/sys/compat/common/compat_mod.h diff -u src/sys/compat/common/compat_mod.h:1.3 src/sys/compat/common/compat_mod.h:1.4 --- src/sys/compat/common/compat_mod.h:1.3 Mon Jan 28 15:46:49 2019 +++ src/sys/compat/common/compat_mod.h Mon Apr 15 02:07:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_mod.h,v 1.3 2019/01/28 15:46:49 christos Exp $ */ +/* $NetBSD: compat_mod.h,v 1.4 2019/04/15 02:07:11 pgoyette Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -76,6 +76,8 @@ void rndpseudo_50_init(void); void rndpseudo_50_fini(void); void rtsock_50_init(void); void rtsock_50_fini(void); +void kern_uipc_socket_50_init(void); +void kern_uipc_socket_50_fini(void); #endif #ifdef COMPAT_40 Index: src/sys/kern/compat_stub.c diff -u src/sys/kern/compat_stub.c:1.8 src/sys/kern/compat_stub.c:1.9 --- src/sys/kern/compat_stub.c:1.8 Tue Feb 5 23:28:02 2019 +++ src/sys/kern/compat_stub.c Mon Apr 15 02:07:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.c,v 1.8 2019/02/05 23:28:02 christos Exp $ */ +/* $NetBSD: compat_stub.c,v 1.9 2019/04/15 02:07:11 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -173,11 +173,18 @@ struct if43_cvtcmd_20_hook_t if43_cvtcmd struct tty_ttioctl_43_hook_t tty_ttioctl_43_hook; /* - * uipc_syscalls_40 compatability + * uipc_syscalls_40 compatibility */ struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook; /* + * uipc_socket_50 compatibility + */ +struct uipc_socket_50_setopt1_hook_t uipc_socket_50_setopt1_hook; +struct uipc_socket_50_getopt1_hook_t uipc_socket_50_getopt1_hook; +struct uipc_socket_50_sbts_hook_t uipc_socket_50_sbts_hook; + +/* * uipc_syscalls_50 compatability */ struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook; Index:
CVS commit: src/libexec/ld.elf_so
Module Name:src Committed By: wiz Date: Sun Apr 14 22:09:50 UTC 2019 Modified Files: src/libexec/ld.elf_so: ld.elf_so.1 Log Message: Use more Dv. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/libexec/ld.elf_so/ld.elf_so.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/ld.elf_so.1 diff -u src/libexec/ld.elf_so/ld.elf_so.1:1.18 src/libexec/ld.elf_so/ld.elf_so.1:1.19 --- src/libexec/ld.elf_so/ld.elf_so.1:1.18 Sun Apr 14 20:27:02 2019 +++ src/libexec/ld.elf_so/ld.elf_so.1 Sun Apr 14 22:09:50 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ld.elf_so.1,v 1.18 2019/04/14 20:27:02 maya Exp $ +.\" $NetBSD: ld.elf_so.1,v 1.19 2019/04/14 22:09:50 wiz Exp $ .\" .\" Copyright (c) 2001 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -67,9 +67,12 @@ Each .Xr elf 5 object file may contain information in its dynamic (PT_DYNAMIC) section about which shared objects it requires (often referred to as dependencies). -These dependencies are specified in the optional DT_NEEDED entry within -the dynamic section. -Each DT_NEEDED entry refers to a filename string of +These dependencies are specified in the optional +.Dv DT_NEEDED +entry within the dynamic section. +Each +.Dv DT_NEEDED +entry refers to a filename string of the shared object that is to be searched for. .Pp The linker will search for libraries in three lists of paths: @@ -81,8 +84,11 @@ A user defined list of paths as specifie The use of ld.so.conf should be avoided as the setting of a global search path can present a security risk. .It -A list of paths specified within a shared object using the DT_RPATH and -DT_RUNPATH entries in the dynamic section. +A list of paths specified within a shared object using the +.Dv DT_RPATH +and +.Dv DT_RUNPATH +entries in the dynamic section. This is defined at shared object link time. .It The list of default paths which is set to @@ -91,7 +97,11 @@ The list of default paths which is set t .Pp Dynamic loading via .Xr dlopen 3 -uses the DT_RPATH and DT_RUNPATH entries of the main binary, independently of +uses the +.Dv DT_RPATH +and +.Dv DT_RUNPATH +entries of the main binary, independently of which object the call came from. .Pp .Nm @@ -157,7 +167,11 @@ begins or after the program has complete This gives a shared object an opportunity to perform any extra set-up or completion work. .Pp -The DT_INIT and DT_FINI entries in the dynamic section specify the addresses +The +.Dv DT_INIT +and +.Dv DT_FINI +entries in the dynamic section specify the addresses of the initialization and termination functions, respectively, for the shared object. .Nm
CVS commit: src/libexec/ld.elf_so
Module Name:src Committed By: maya Date: Sun Apr 14 20:27:02 UTC 2019 Modified Files: src/libexec/ld.elf_so: ld.elf_so.1 Log Message: Note that we now search DT_RUNPATH paths as well. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/libexec/ld.elf_so/ld.elf_so.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/ld.elf_so.1 diff -u src/libexec/ld.elf_so/ld.elf_so.1:1.17 src/libexec/ld.elf_so/ld.elf_so.1:1.18 --- src/libexec/ld.elf_so/ld.elf_so.1:1.17 Mon Jul 3 21:35:48 2017 +++ src/libexec/ld.elf_so/ld.elf_so.1 Sun Apr 14 20:27:02 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ld.elf_so.1,v 1.17 2017/07/03 21:35:48 wiz Exp $ +.\" $NetBSD: ld.elf_so.1,v 1.18 2019/04/14 20:27:02 maya Exp $ .\" .\" Copyright (c) 2001 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 17, 2010 +.Dd April 15, 2019 .Dt LD.ELF_SO 1 .Os .Sh NAME @@ -81,8 +81,8 @@ A user defined list of paths as specifie The use of ld.so.conf should be avoided as the setting of a global search path can present a security risk. .It -A list of paths specified within a shared object using a DT_RPATH entry in -the dynamic section. +A list of paths specified within a shared object using the DT_RPATH and +DT_RUNPATH entries in the dynamic section. This is defined at shared object link time. .It The list of default paths which is set to @@ -91,8 +91,8 @@ The list of default paths which is set t .Pp Dynamic loading via .Xr dlopen 3 -uses the DT_RPATH entries of the main binary, independently of which object -the call came from. +uses the DT_RPATH and DT_RUNPATH entries of the main binary, independently of +which object the call came from. .Pp .Nm will expand the following variables if present in the paths:
CVS commit: src/lib/libc/arch/riscv/gdtoa
Module Name:src Committed By: maya Date: Sun Apr 14 19:25:27 UTC 2019 Modified Files: src/lib/libc/arch/riscv/gdtoa: gd_qnan.h Log Message: Provide a definition of quiet NaN for RISC-V, and a reference to where it comes from. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/riscv/gdtoa/gd_qnan.h 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/arch/riscv/gdtoa/gd_qnan.h diff -u src/lib/libc/arch/riscv/gdtoa/gd_qnan.h:1.1 src/lib/libc/arch/riscv/gdtoa/gd_qnan.h:1.2 --- src/lib/libc/arch/riscv/gdtoa/gd_qnan.h:1.1 Fri Sep 19 17:36:25 2014 +++ src/lib/libc/arch/riscv/gdtoa/gd_qnan.h Sun Apr 14 19:25:27 2019 @@ -1,5 +1,19 @@ -/* $NetBSD: gd_qnan.h,v 1.1 2014/09/19 17:36:25 matt Exp $ */ +/* $NetBSD: gd_qnan.h,v 1.2 2019/04/14 19:25:27 maya Exp $ */ -#define f_QNAN 0x7fe0 +/* + * The RISC-V Instruction Set Manual Volume I: User-Level ISA + * Document Version 2.2 + * + * 8.3 NaN Generation and Propagation + * + * The canonical NaN has a positive sign and all significand bits clear except + * the MSB, aka the quiet bit. + */ + +#define f_QNAN 0x7fc0 #define d_QNAN0 0x0 -#define d_QNAN1 0x7ffc +#define d_QNAN1 0x7ff8 +#define ld_QNAN0 0x0 +#define ld_QNAN1 0x0 +#define ld_QNAN2 0x0 +#define ld_QNAN3 0x7fff8000
CVS commit: src/libexec/ld.elf_so
Module Name:src Committed By: christos Date: Sun Apr 14 19:21:37 UTC 2019 Modified Files: src/libexec/ld.elf_so: rtld.c Log Message: undo previous unlock/relock; it is not needed now that we added the tls model declaration to all externs in jemalloc (suggested by joerg@) To generate a diff of this commit: cvs rdiff -u -r1.196 -r1.197 src/libexec/ld.elf_so/rtld.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/rtld.c diff -u src/libexec/ld.elf_so/rtld.c:1.196 src/libexec/ld.elf_so/rtld.c:1.197 --- src/libexec/ld.elf_so/rtld.c:1.196 Fri Apr 12 23:15:25 2019 +++ src/libexec/ld.elf_so/rtld.c Sun Apr 14 15:21:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rtld.c,v 1.196 2019/04/13 03:15:25 christos Exp $ */ +/* $NetBSD: rtld.c,v 1.197 2019/04/14 19:21:37 christos Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -40,7 +40,7 @@ #include #ifndef lint -__RCSID("$NetBSD: rtld.c,v 1.196 2019/04/13 03:15:25 christos Exp $"); +__RCSID("$NetBSD: rtld.c,v 1.197 2019/04/14 19:21:37 christos Exp $"); #endif /* not lint */ #include @@ -1462,9 +1462,7 @@ dl_iterate_phdr(int (*callback)(struct d phdr_info.dlpi_subs = _rtld_objloads - _rtld_objcount; /* XXXlocking: exit point */ - _rtld_shared_exit(); error = callback(_info, sizeof(phdr_info), param); - _rtld_shared_enter(); if (error) break; }
CVS commit: src/external/bsd/jemalloc/include/jemalloc/internal
Module Name:src Committed By: christos Date: Sun Apr 14 19:13:18 UTC 2019 Modified Files: src/external/bsd/jemalloc/include/jemalloc/internal: tsd_malloc_thread_cleanup.h tsd_tls.h Log Message: Declare the tls model in external declarations. Pointed out by joerg. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/external/bsd/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h \ src/external/bsd/jemalloc/include/jemalloc/internal/tsd_tls.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h diff -u src/external/bsd/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h:1.1 src/external/bsd/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h:1.2 --- src/external/bsd/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h:1.1 Mon Mar 4 12:25:09 2019 +++ src/external/bsd/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h Sun Apr 14 15:13:17 2019 @@ -3,8 +3,8 @@ #endif #define JEMALLOC_INTERNAL_TSD_MALLOC_THREAD_CLEANUP_H -extern __thread tsd_t tsd_tls; -extern __thread bool tsd_initialized; +extern __thread tsd_t JEMALLOC_TLS_MODEL tsd_tls; +extern __thread bool JEMALLOC_TLS_MODEL tsd_initialized; extern bool tsd_booted; /* Initialization/cleanup. */ Index: src/external/bsd/jemalloc/include/jemalloc/internal/tsd_tls.h diff -u src/external/bsd/jemalloc/include/jemalloc/internal/tsd_tls.h:1.1 src/external/bsd/jemalloc/include/jemalloc/internal/tsd_tls.h:1.2 --- src/external/bsd/jemalloc/include/jemalloc/internal/tsd_tls.h:1.1 Mon Mar 4 12:25:09 2019 +++ src/external/bsd/jemalloc/include/jemalloc/internal/tsd_tls.h Sun Apr 14 15:13:17 2019 @@ -3,7 +3,7 @@ #endif #define JEMALLOC_INTERNAL_TSD_TLS_H -extern __thread tsd_t tsd_tls; +extern __thread tsd_t JEMALLOC_TLS_MODEL tsd_tls; extern pthread_key_t tsd_tsd; extern bool tsd_booted;
CVS commit: src/sys/ufs/ffs
Module Name:src Committed By: kardel Date: Sun Apr 14 15:55:24 UTC 2019 Modified Files: src/sys/ufs/ffs: ffs_alloc.c Log Message: PR/53990, PR/52380, PR/52102: UFS2 cylinder group inode allocation botch Fix rare allocation botch in ffs_nodealloccg(). Conditions: a) less than #_of_initialized_inodes(cg->cg_initediblk) - inodes_per_filesystem_block are allocated in the cylinder group b) cg->cg_irotor points to a uninterupted run of allocated inodes in the inode bitmap up to the end of dynamically initialized inodes (cg->cg_initediblk) In this case the next inode after this run was returned without initializing the respective inode block. As the block is not initialized these inodes could trigger panics on inode consistency due to old (uninitialized) disk data. In very rare cases data loss could occur when the uninitialized inode block is initialized via the normal mechanism. Further conditions to occur after the above: c) no panic d) no (forced) fsck e) and more than cg->cg_initediblk - inodes_per_filesystem_block allocated inodes. Fix: Always insure allocation always in initialized inode range extending the initialized inode range as needed. Add KASSERTMSG() safeguards. ok hannken@ To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/sys/ufs/ffs/ffs_alloc.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/ufs/ffs/ffs_alloc.c diff -u src/sys/ufs/ffs/ffs_alloc.c:1.163 src/sys/ufs/ffs/ffs_alloc.c:1.164 --- src/sys/ufs/ffs/ffs_alloc.c:1.163 Mon Dec 10 20:48:34 2018 +++ src/sys/ufs/ffs/ffs_alloc.c Sun Apr 14 15:55:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.163 2018/12/10 20:48:34 jdolecek Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.164 2019/04/14 15:55:24 kardel Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.163 2018/12/10 20:48:34 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.164 2019/04/14 15:55:24 kardel Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -1259,7 +1259,7 @@ ffs_nodealloccg(struct inode *ip, int cg struct buf *bp, *ibp; u_int8_t *inosused; int error, start, len, loc, map, i; - int32_t initediblk; + int32_t initediblk, maxiblk, irotor; daddr_t nalloc; struct ufs2_dinode *dp2; const int needswap = UFS_FSNEEDSWAP(fs); @@ -1271,7 +1271,13 @@ ffs_nodealloccg(struct inode *ip, int cg return (0); mutex_exit(>um_lock); ibp = NULL; - initediblk = -1; + if (fs->fs_magic == FS_UFS2_MAGIC) { + initediblk = -1; + } else { + initediblk = fs->fs_ipg; + } + maxiblk = initediblk; + retry: error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, B_MODIFY, ); @@ -1291,7 +1297,8 @@ retry: * Check to see if we need to initialize more inodes. */ if (fs->fs_magic == FS_UFS2_MAGIC && ibp == NULL) { - initediblk = ufs_rw32(cgp->cg_initediblk, needswap); + initediblk = ufs_rw32(cgp->cg_initediblk, needswap); + maxiblk = initediblk; nalloc = fs->fs_ipg - ufs_rw32(cgp->cg_cs.cs_nifree, needswap); if (nalloc + FFS_INOPB(fs) > initediblk && initediblk < ufs_rw32(cgp->cg_niblk, needswap)) { @@ -1307,6 +1314,9 @@ retry: FFS_NOBLK, fs->fs_bsize, false, ); if (error) goto fail; + + maxiblk += FFS_INOPB(fs); + goto retry; } } @@ -1316,14 +1326,22 @@ retry: (fs->fs_old_flags & FS_FLAGS_UPDATED)) cgp->cg_time = ufs_rw64(time_second, needswap); inosused = cg_inosused(cgp, needswap); + if (ipref) { ipref %= fs->fs_ipg; - if (isclr(inosused, ipref)) + /* safeguard to stay in (to be) allocated range */ + if (ipref < maxiblk && isclr(inosused, ipref)) goto gotit; } - start = ufs_rw32(cgp->cg_irotor, needswap) / NBBY; - len = howmany(fs->fs_ipg - ufs_rw32(cgp->cg_irotor, needswap), - NBBY); + + irotor = ufs_rw32(cgp->cg_irotor, needswap); + + KASSERTMSG(irotor < initediblk, "%s: allocation botch: cg=%d, irotor %d" + " out of bounds, initediblk=%d", + __func__, cg, irotor, initediblk); + + start = irotor / NBBY; + len = howmany(maxiblk - irotor, NBBY); loc = skpc(0xff, len, [start]); if (loc == 0) { len = start + 1; @@ -1341,9 +1359,17 @@ retry: if (map == 0) { panic("%s: block not in map: fs=%s", __func__, fs->fs_fsmnt); } + ipref = i * NBBY + ffs(map) - 1; + cgp->cg_irotor = ufs_rw32(ipref, needswap); + gotit: + KASSERTMSG(ipref < maxiblk, "%s: allocation botch: cg=%d attempt to " + "allocate inode index %d beyond max allocated index %d" + " of %d inodes/cg", + __func__, cg, (int)ipref, maxiblk, cgp->cg_niblk); + UFS_WAPBL_REGISTER_INODE(ip->i_ump->um_mountp, cg * fs->fs_ipg + ipref, mode); /*
CVS commit: src/sys/compat/common
Module Name:src Committed By: pgoyette Date: Sun Apr 14 11:35:54 UTC 2019 Modified Files: src/sys/compat/common: vnd_50.c Log Message: Only need to #include sys/vnode.h once To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/vnd_50.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/common/vnd_50.c diff -u src/sys/compat/common/vnd_50.c:1.3 src/sys/compat/common/vnd_50.c:1.4 --- src/sys/compat/common/vnd_50.c:1.3 Fri Mar 1 11:06:56 2019 +++ src/sys/compat/common/vnd_50.c Sun Apr 14 11:35:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vnd_50.c,v 1.3 2019/03/01 11:06:56 pgoyette Exp $ */ +/* $NetBSD: vnd_50.c,v 1.4 2019/04/14 11:35:54 pgoyette Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnd_50.c,v 1.3 2019/03/01 11:06:56 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd_50.c,v 1.4 2019/04/14 11:35:54 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -87,7 +87,6 @@ __KERNEL_RCSID(0, "$NetBSD: vnd_50.c,v 1 #include #include #include -#include #include #include
CVS commit: src/sys/kern
Module Name:src Committed By: maxv Date: Sun Apr 14 09:09:55 UTC 2019 Modified Files: src/sys/kern: uipc_socket.c Log Message: Add more checks, if the values are negative we hit a KASSERT later in the timeout. Reported-by: syzbot+662dbeb526303f458...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.273 -r1.274 src/sys/kern/uipc_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/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.273 src/sys/kern/uipc_socket.c:1.274 --- src/sys/kern/uipc_socket.c:1.273 Mon Apr 8 18:38:45 2019 +++ src/sys/kern/uipc_socket.c Sun Apr 14 09:09:55 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.273 2019/04/08 18:38:45 maxv Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.274 2019/04/14 09:09:55 maxv Exp $ */ /* * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.273 2019/04/08 18:38:45 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.274 2019/04/14 09:09:55 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1841,6 +1841,10 @@ sosetopt1(struct socket *so, const struc if (error) break; + if (tv.tv_sec < 0 || tv.tv_usec < 0 || tv.tv_usec >= 100) { + error = EDOM; + break; + } if (tv.tv_sec > (INT_MAX - tv.tv_usec / tick) / hz) { error = EDOM; break;
CVS commit: src/sys/arch/hppa/hppa
Module Name:src Committed By: skrll Date: Sun Apr 14 08:23:20 UTC 2019 Modified Files: src/sys/arch/hppa/hppa: trap.S Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/arch/hppa/hppa/trap.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/hppa/trap.S diff -u src/sys/arch/hppa/hppa/trap.S:1.69 src/sys/arch/hppa/hppa/trap.S:1.70 --- src/sys/arch/hppa/hppa/trap.S:1.69 Sat Mar 23 13:05:24 2019 +++ src/sys/arch/hppa/hppa/trap.S Sun Apr 14 08:23:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.S,v 1.69 2019/03/23 13:05:24 maxv Exp $ */ +/* $NetBSD: trap.S,v 1.70 2019/04/14 08:23:20 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -98,7 +98,7 @@ #include "opt_multiprocessor.h" #include "opt_cputype.h" -/* +/* * NOTICE: This is not a standalone file. To use it, #include it in * your port's locore.S, like so: * @@ -220,7 +220,7 @@ syscall_entry: ldw CI_PSW(%sr1, %t1), %t1 stw %r1, TF_CR15-TRAPFRAME_SIZEOF(%sr1, %t3) /* eiem ,bc (block copy cache control hint) */ stw %t1, TF_CR22-TRAPFRAME_SIZEOF(%sr1, %t3) /* ipsw */ - + mfsp %sr3, %t1 stw %t1, TF_SR3-TRAPFRAME_SIZEOF(%sr1, %t3) stw %ret0, TF_CR8-TRAPFRAME_SIZEOF(%sr1, %t3) /* pidr1 */ @@ -741,7 +741,7 @@ EXIT(os_toc) ENTRY_NOPROFILE(TLABEL(hpmc),0) ALTENTRY(os_hpmc_cont) ldi T_HPMC, %arg0 - + /* Disable interrupts. */ mtctl %r0, %eiem @@ -865,7 +865,7 @@ LEAF_ENTRY_NOPROFILE(TLABEL(emu)) */ mtctl %arg0, %tr2 mfctl %iir, %arg0 - + /* * If the opcode field in the instruction is 4, indicating a special * function unit SPOP instruction, branch to emulate an sfu. If the @@ -912,7 +912,7 @@ hppa_fpu_emulate: * need to swap out the FPU state of any LWP whose uspace physical * address is in curcpu()->ci_fpu_state. */ - + /* * So far, the CTRAP() macro has saved %r1 in %tr7, and the dispatching * above has saved %arg0 in tr2. Save the other registers that we want @@ -929,7 +929,7 @@ hppa_fpu_emulate: blr 0, %rp b hppa_fpu_swap nop - + /* Restore registers and rfi. */ mfctl %tr5, %rp mfctl %tr4, %arg1 @@ -1015,7 +1015,7 @@ ALTENTRY(hppa_fpu_swap) /* * Assuming that out and in aren't both NULL, we will have to run co- * processor instructions, so we'd better enable it. - * + * * Also, branch if there's no FPU state to swap out. */ mfctl CR_CCR, %r1 @@ -1775,7 +1775,7 @@ EXIT(hpti_l) LEAF_ENTRY_NOPROFILE(pbtlb_l) ; DR_PAGE0 rsm (PSW_R|PSW_I), %t4 - nop ! nop ! nop ! nop + nop ! nop ! nop ! nop ldil L%0xc041, %t1 ldo R%0xc041(%t1), %t1 dep %arg0, 30, 3, %t1
CVS commit: src/usr.sbin/makemandb
Module Name:src Committed By: abhinav Date: Sun Apr 14 07:59:56 UTC 2019 Modified Files: src/usr.sbin/makemandb: apropos-utils.c Log Message: Set the snippet_length field of the callback_args Because of this field not being set, apropos was failing to show snippet when piped to a pager or when used with -p argument. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/makemandb/apropos-utils.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/makemandb/apropos-utils.c diff -u src/usr.sbin/makemandb/apropos-utils.c:1.41 src/usr.sbin/makemandb/apropos-utils.c:1.42 --- src/usr.sbin/makemandb/apropos-utils.c:1.41 Thu Mar 7 22:08:59 2019 +++ src/usr.sbin/makemandb/apropos-utils.c Sun Apr 14 07:59:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: apropos-utils.c,v 1.41 2019/03/07 22:08:59 christos Exp $ */ +/* $NetBSD: apropos-utils.c,v 1.42 2019/04/14 07:59:56 abhinav Exp $ */ /*- * Copyright (c) 2011 Abhinav Upadhyay * All rights reserved. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: apropos-utils.c,v 1.41 2019/03/07 22:08:59 christos Exp $"); +__RCSID("$NetBSD: apropos-utils.c,v 1.42 2019/04/14 07:59:56 abhinav Exp $"); #include #include @@ -699,10 +699,13 @@ execute_search_query(sqlite3 *db, char * name_temp = (const char *) sqlite3_column_text(stmt, 1); callback_args.name_desc = (const char *) sqlite3_column_text(stmt, 2); callback_args.machine = (const char *) sqlite3_column_text(stmt, 3); - if (!args->legacy) + if (!args->legacy) { callback_args.snippet = (const char *) sqlite3_column_text(stmt, 4); - else + callback_args.snippet_length = strlen(callback_args.snippet); + } else { callback_args.snippet = ""; + callback_args.snippet_length = 1; + } if ((slash_ptr = strrchr(name_temp, '/')) != NULL) name_temp = slash_ptr + 1; if (callback_args.machine && callback_args.machine[0]) {
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: skrll Date: Sun Apr 14 07:57:51 UTC 2019 Modified Files: src/sys/arch/evbarm/conf: mk.generic Log Message: Create a RPI compatible image which cn be used with kernel_address=0x1040 in config.txt. XXX alignment requirement needs fixing To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/mk.generic Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/conf/mk.generic diff -u src/sys/arch/evbarm/conf/mk.generic:1.7 src/sys/arch/evbarm/conf/mk.generic:1.8 --- src/sys/arch/evbarm/conf/mk.generic:1.7 Sat Mar 30 17:40:34 2019 +++ src/sys/arch/evbarm/conf/mk.generic Sun Apr 14 07:57:51 2019 @@ -1,4 +1,4 @@ -# $NetBSD: mk.generic,v 1.7 2019/03/30 17:40:34 jmcneill Exp $ +# $NetBSD: mk.generic,v 1.8 2019/04/14 07:57:51 skrll Exp $ .include "$S/arch/arm/nvidia/tegra_xusb-fw.mk" @@ -17,11 +17,16 @@ MKUBOOTIMAGEARGS= -A arm -T kernel_noloa MKUBOOTIMAGEARGS+= -e 0 MKUBOOTIMAGEARGS+= -n "NetBSD/${BOARDTYPE:U${MACHINE_ARCH}} ${_OSRELEASE}" +MKKNLIMG= ${THISARM}/compile/rpi-mkknlimg.sh + SYSTEM_LD_TAIL_EXTRA+=; \ echo ${OBJCOPY} -S -O binary $@ $@.bin; \ ${OBJCOPY} -S -O binary $@ $@.bin; \ echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin $@.ub; \ - ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin $@.ub; + ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin $@.ub; \ + echo ${MKKNLIMG} $@.bin $@.img; \ + ${HOST_SH} ${MKKNLIMG} $@.bin $@.img; EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@} EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@} +EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.img@}