CVS commit: [netbsd-7] src/sys/kern
Module Name:src Committed By: martin Date: Mon Nov 25 15:46:39 UTC 2019 Modified Files: src/sys/kern [netbsd-7]: subr_cprng.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #1714): sys/kern/subr_cprng.c: revision 1.33 Use cprng_strong, not cprng_fast, for sysctl kern.arnd. To generate a diff of this commit: cvs rdiff -u -r1.24.2.2 -r1.24.2.3 src/sys/kern/subr_cprng.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/subr_cprng.c diff -u src/sys/kern/subr_cprng.c:1.24.2.2 src/sys/kern/subr_cprng.c:1.24.2.3 --- src/sys/kern/subr_cprng.c:1.24.2.2 Tue Sep 3 12:20:43 2019 +++ src/sys/kern/subr_cprng.c Mon Nov 25 15:46:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_cprng.c,v 1.24.2.2 2019/09/03 12:20:43 martin Exp $ */ +/* $NetBSD: subr_cprng.c,v 1.24.2.3 2019/11/25 15:46:39 martin Exp $ */ /*- * Copyright (c) 2011-2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.24.2.2 2019/09/03 12:20:43 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.24.2.3 2019/11/25 15:46:39 martin Exp $"); #include #include @@ -508,6 +508,7 @@ cprng_strong_rndsink_callback(void *cont mutex_exit(>cs_lock); } +static ONCE_DECL(sysctl_prng_once); static cprng_strong_t *sysctl_prng; static int @@ -527,10 +528,9 @@ makeprng(void) static int sysctl_kern_urnd(SYSCTLFN_ARGS) { - static ONCE_DECL(control); int v, rv; - RUN_ONCE(, makeprng); + RUN_ONCE(_prng_once, makeprng); rv = cprng_strong(sysctl_prng, , sizeof(v), 0); if (rv == sizeof(v)) { struct sysctlnode node = *rnode; @@ -559,6 +559,7 @@ sysctl_kern_arnd(SYSCTLFN_ARGS) int error; void *v; struct sysctlnode node = *rnode; + size_t n __diagused; switch (*oldlenp) { case 0: @@ -567,8 +568,10 @@ sysctl_kern_arnd(SYSCTLFN_ARGS) if (*oldlenp > 256) { return E2BIG; } + RUN_ONCE(_prng_once, makeprng); v = kmem_alloc(*oldlenp, KM_SLEEP); - cprng_fast(v, *oldlenp); + n = cprng_strong(sysctl_prng, v, *oldlenp, 0); + KASSERT(n == *oldlenp); node.sysctl_data = v; node.sysctl_size = *oldlenp; error = sysctl_lookup(SYSCTLFN_CALL());
CVS commit: [netbsd-7] src/sys/kern
Module Name:src Committed By: martin Date: Mon Nov 25 15:46:39 UTC 2019 Modified Files: src/sys/kern [netbsd-7]: subr_cprng.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #1714): sys/kern/subr_cprng.c: revision 1.33 Use cprng_strong, not cprng_fast, for sysctl kern.arnd. To generate a diff of this commit: cvs rdiff -u -r1.24.2.2 -r1.24.2.3 src/sys/kern/subr_cprng.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Nov 16 16:13:56 UTC 2019 Modified Files: src/sys/dev/usb [netbsd-7]: usb_subr.c usbdi.c usbdi.h Log Message: Pull up following revision(s) (requested by mrg in ticket #1713): sys/dev/usb/usbdi.h: revision 1.97 (via patch) sys/dev/usb/usbdi.c: revision 1.186 (via patch) sys/dev/usb/usb_subr.c: revision 1.239 (via patch) add new usbd_do_request_len() that can allocate a larger than request size buffer. reimplement usbd_do_request_flags() in terms of this. use this for fetching string descriptors. fixes a very strange problem where an axe(4) attaching (either has ugen(4) or axe(4)) would ask for 2 bytes, usb_mem.c would allocate a 2 byte fragment, perform the operation, and sometime shortly afterwards (usually by the time the next allocation is made for this fragment), would become corrupted (usually two bytes were written with 0x0304.) (initial request of 4 bytes also avoids the problem on this device. it really seems like a HC problem -- host should not allow the device to write more than req.wLength! nor should it allow this write to happen after completion.) avoid an (almost) always double-log in usbd_transfer(). To generate a diff of this commit: cvs rdiff -u -r1.196.4.5 -r1.196.4.6 src/sys/dev/usb/usb_subr.c cvs rdiff -u -r1.161.2.4 -r1.161.2.5 src/sys/dev/usb/usbdi.c cvs rdiff -u -r1.90.2.2 -r1.90.2.3 src/sys/dev/usb/usbdi.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/dev/usb/usb_subr.c diff -u src/sys/dev/usb/usb_subr.c:1.196.4.5 src/sys/dev/usb/usb_subr.c:1.196.4.6 --- src/sys/dev/usb/usb_subr.c:1.196.4.5 Wed Aug 8 10:17:11 2018 +++ src/sys/dev/usb/usb_subr.c Sat Nov 16 16:13:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.196.4.5 2018/08/08 10:17:11 martin Exp $ */ +/* $NetBSD: usb_subr.c,v 1.196.4.6 2019/11/16 16:13:56 martin Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.5 2018/08/08 10:17:11 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.6 2019/11/16 16:13:56 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -157,13 +157,20 @@ usbd_get_string_desc(struct usbd_device usbd_status err; int actlen; + /* + * Pass a full-sized buffer to usbd_do_request_len(). At least + * one device has been seen returning additional data beyond the + * provided buffers (2-bytes written shortly after the request + * claims to have completed and returned the 2 byte header, + * corrupting other memory.) + */ req.bmRequestType = UT_READ_DEVICE; req.bRequest = UR_GET_DESCRIPTOR; USETW2(req.wValue, UDESC_STRING, sindex); USETW(req.wIndex, langid); USETW(req.wLength, 2); /* only size byte first */ - err = usbd_do_request_flags(dev, , sdesc, USBD_SHORT_XFER_OK, - , USBD_DEFAULT_TIMEOUT); + err = usbd_do_request_len(dev, , sizeof(*sdesc), sdesc, + USBD_SHORT_XFER_OK, , USBD_DEFAULT_TIMEOUT); if (err) return err; @@ -171,8 +178,8 @@ usbd_get_string_desc(struct usbd_device return USBD_SHORT_XFER; USETW(req.wLength, sdesc->bLength); /* the whole string */ - err = usbd_do_request_flags(dev, , sdesc, USBD_SHORT_XFER_OK, - , USBD_DEFAULT_TIMEOUT); + err = usbd_do_request_len(dev, , sizeof(*sdesc), sdesc, + USBD_SHORT_XFER_OK, , USBD_DEFAULT_TIMEOUT); if (err) return err; @@ -1192,7 +1199,7 @@ usbd_get_initial_ddesc(struct usbd_devic req.bRequest = UR_GET_DESCRIPTOR; USETW2(req.wValue, UDESC_DEVICE, 0); USETW(req.wIndex, 0); - USETW(req.wLength, 64); + USETW(req.wLength, 8); res = usbd_do_request_flags(dev, , buf, USBD_SHORT_XFER_OK, , USBD_DEFAULT_TIMEOUT); if (res) Index: src/sys/dev/usb/usbdi.c diff -u src/sys/dev/usb/usbdi.c:1.161.2.4 src/sys/dev/usb/usbdi.c:1.161.2.5 --- src/sys/dev/usb/usbdi.c:1.161.2.4 Fri Jan 11 15:58:23 2019 +++ src/sys/dev/usb/usbdi.c Sat Nov 16 16:13:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $ */ +/* $NetBSD: usbdi.c,v 1.161.2.5 2019/11/16 16:13:56 martin Exp $ */ /* * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.5 2019/11/16 16:13:56 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -331,6 +331,8 @@ usbd_transfer(struct usbd_xfer *xfer) * accepted by the HCD for some reason. It needs removing * from the pipe queue. */ + USBHIST_LOG(usbdebug, "xfer failed: %s, reinserting", + err, 0, 0, 0); usbd_lock_pipe(pipe); SIMPLEQ_REMOVE_HEAD(>up_queue, ux_next); if (pipe->up_serialise) @@ -1072,13 +1074,23 @@ usbd_status usbd_do_request_flags(struct usbd_device *dev, usb_device_request_t
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Nov 16 16:13:56 UTC 2019 Modified Files: src/sys/dev/usb [netbsd-7]: usb_subr.c usbdi.c usbdi.h Log Message: Pull up following revision(s) (requested by mrg in ticket #1713): sys/dev/usb/usbdi.h: revision 1.97 (via patch) sys/dev/usb/usbdi.c: revision 1.186 (via patch) sys/dev/usb/usb_subr.c: revision 1.239 (via patch) add new usbd_do_request_len() that can allocate a larger than request size buffer. reimplement usbd_do_request_flags() in terms of this. use this for fetching string descriptors. fixes a very strange problem where an axe(4) attaching (either has ugen(4) or axe(4)) would ask for 2 bytes, usb_mem.c would allocate a 2 byte fragment, perform the operation, and sometime shortly afterwards (usually by the time the next allocation is made for this fragment), would become corrupted (usually two bytes were written with 0x0304.) (initial request of 4 bytes also avoids the problem on this device. it really seems like a HC problem -- host should not allow the device to write more than req.wLength! nor should it allow this write to happen after completion.) avoid an (almost) always double-log in usbd_transfer(). To generate a diff of this commit: cvs rdiff -u -r1.196.4.5 -r1.196.4.6 src/sys/dev/usb/usb_subr.c cvs rdiff -u -r1.161.2.4 -r1.161.2.5 src/sys/dev/usb/usbdi.c cvs rdiff -u -r1.90.2.2 -r1.90.2.3 src/sys/dev/usb/usbdi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys/dev/pci
Module Name:src Committed By: martin Date: Thu Nov 14 15:43:59 UTC 2019 Modified Files: src/sys/dev/pci [netbsd-7]: pucdata.c Log Message: Pull up following revision(s) (requested by hauke in ticket #1712): sys/dev/pci/pucdata.c: revision 1.105 The 16C1054 and 16C1058 serial multi-port controllers need a clock multiplier of 8, just like the 16C1050 controller. Verified with an ExSys EX-41388. ryo@ checked back with the hardware his original commit was based on, and confirmed the change. XXX Pull-up to netbsd-{7,8,9} To generate a diff of this commit: cvs rdiff -u -r1.93.4.3 -r1.93.4.4 src/sys/dev/pci/pucdata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys/dev/pci
Module Name:src Committed By: martin Date: Thu Nov 14 15:43:59 UTC 2019 Modified Files: src/sys/dev/pci [netbsd-7]: pucdata.c Log Message: Pull up following revision(s) (requested by hauke in ticket #1712): sys/dev/pci/pucdata.c: revision 1.105 The 16C1054 and 16C1058 serial multi-port controllers need a clock multiplier of 8, just like the 16C1050 controller. Verified with an ExSys EX-41388. ryo@ checked back with the hardware his original commit was based on, and confirmed the change. XXX Pull-up to netbsd-{7,8,9} To generate a diff of this commit: cvs rdiff -u -r1.93.4.3 -r1.93.4.4 src/sys/dev/pci/pucdata.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/pucdata.c diff -u src/sys/dev/pci/pucdata.c:1.93.4.3 src/sys/dev/pci/pucdata.c:1.93.4.4 --- src/sys/dev/pci/pucdata.c:1.93.4.3 Wed Jan 3 21:37:36 2018 +++ src/sys/dev/pci/pucdata.c Thu Nov 14 15:43:59 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pucdata.c,v 1.93.4.3 2018/01/03 21:37:36 snj Exp $ */ +/* $NetBSD: pucdata.c,v 1.93.4.4 2019/11/14 15:43:59 martin Exp $ */ /* * Copyright (c) 1998, 1999 Christopher G. Demetriou. All rights reserved. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.93.4.3 2018/01/03 21:37:36 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.93.4.4 2019/11/14 15:43:59 martin Exp $"); #include #include @@ -2833,10 +2833,10 @@ const struct puc_device_description puc_ { PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1054, 0, 0 }, { 0x, 0x, 0, 0 }, { - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8 }, }, }, @@ -2845,14 +2845,14 @@ const struct puc_device_description puc_ { PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1058, 0, 0 }, { 0x, 0x, 0, 0 }, { - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x20, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x28, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x30, COM_FREQ }, - { PUC_PORT_TYPE_COM, PCI_BAR0, 0x38, COM_FREQ }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x20, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x28, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x30, COM_FREQ * 8 }, + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x38, COM_FREQ * 8 }, }, },
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Mon Nov 4 14:52:15 UTC 2019 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 #1711 To generate a diff of this commit: cvs rdiff -u -r1.109.2.3 -r1.109.2.4 \ src/sys/compat/netbsd32/netbsd32_syscall.h \ src/sys/compat/netbsd32/netbsd32_syscallargs.h cvs rdiff -u -r1.108.2.3 -r1.108.2.4 \ 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.
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Mon Nov 4 14:52:15 UTC 2019 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 #1711 To generate a diff of this commit: cvs rdiff -u -r1.109.2.3 -r1.109.2.4 \ src/sys/compat/netbsd32/netbsd32_syscall.h \ src/sys/compat/netbsd32/netbsd32_syscallargs.h cvs rdiff -u -r1.108.2.3 -r1.108.2.4 \ 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.3 src/sys/compat/netbsd32/netbsd32_syscall.h:1.109.2.4 --- src/sys/compat/netbsd32/netbsd32_syscall.h:1.109.2.3 Fri Nov 6 09:19:24 2015 +++ src/sys/compat/netbsd32/netbsd32_syscall.h Mon Nov 4 14:52:15 2019 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscall.h,v 1.109.2.3 2015/11/06 09:19:24 martin Exp $ */ +/* $NetBSD: netbsd32_syscall.h,v 1.109.2.4 2019/11/04 14:52:15 martin Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp + * created from NetBSD: syscalls.master,v 1.101.2.4 2019/11/04 14:51:31 martin Exp */ #ifndef _NETBSD32_SYS_SYSCALL_H_ @@ -1231,7 +1231,7 @@ /* syscall: "netbsd32_openat" ret: "int" args: "int" "const netbsd32_charp" "int" "..." */ #define NETBSD32_SYS_netbsd32_openat 468 -/* syscall: "netbsd32_readlinkat" ret: "netbsd32_ssize_t" args: "int" "const netbsd32_charp" "netbsd32_charp" "size_t" */ +/* syscall: "netbsd32_readlinkat" ret: "netbsd32_ssize_t" args: "int" "const netbsd32_charp" "netbsd32_charp" "netbsd32_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.2.3 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109.2.4 --- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.109.2.3 Fri Nov 6 09:19:24 2015 +++ src/sys/compat/netbsd32/netbsd32_syscallargs.h Mon Nov 4 14:52:15 2019 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscallargs.h,v 1.109.2.3 2015/11/06 09:19:24 martin Exp $ */ +/* $NetBSD: netbsd32_syscallargs.h,v 1.109.2.4 2019/11/04 14:52:15 martin Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp + * created from NetBSD: syscalls.master,v 1.101.2.4 2019/11/04 14:51:31 martin Exp */ #ifndef _NETBSD32_SYS_SYSCALLARGS_H_ @@ -2416,7 +2416,7 @@ struct netbsd32_readlinkat_args { syscallarg(int) fd; syscallarg(const netbsd32_charp) path; syscallarg(netbsd32_charp) buf; - syscallarg(size_t) bufsize; + syscallarg(netbsd32_size_t) bufsize; }; check_syscall_args(netbsd32_readlinkat) Index: src/sys/compat/netbsd32/netbsd32_syscalls.c diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108.2.3 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108.2.4 --- src/sys/compat/netbsd32/netbsd32_syscalls.c:1.108.2.3 Fri Nov 6 09:19:24 2015 +++ src/sys/compat/netbsd32/netbsd32_syscalls.c Mon Nov 4 14:52:15 2019 @@ -1,14 +1,14 @@ -/* $NetBSD: netbsd32_syscalls.c,v 1.108.2.3 2015/11/06 09:19:24 martin Exp $ */ +/* $NetBSD: netbsd32_syscalls.c,v 1.108.2.4 2019/11/04 14:52:15 martin Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp + * created from NetBSD: syscalls.master,v 1.101.2.4 2019/11/04 14:51:31 martin Exp */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.108.2.3 2015/11/06 09:19:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.108.2.4 2019/11/04 14:52:15 martin 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.2.3 src/sys/compat/netbsd32/netbsd32_sysent.c:1.108.2.4 --- src/sys/compat/netbsd32/netbsd32_sysent.c:1.108.2.3 Fri Nov 6 09:19:24 2015 +++ src/sys/compat/netbsd32/netbsd32_sysent.c Mon Nov 4 14:52:15 2019 @@ -1,14 +1,14 @@ -/* $NetBSD: netbsd32_sysent.c,v 1.108.2.3 2015/11/06 09:19:24 martin Exp $ */ +/* $NetBSD: netbsd32_sysent.c,v 1.108.2.4 2019/11/04 14:52:15 martin Exp $ */ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp + * created from NetBSD: syscalls.master,v 1.101.2.4 2019/11/04 14:51:31 martin Exp */ #include
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Mon Nov 4 14:51:31 UTC 2019 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: syscalls.master Log Message: Pull up following revision(s) (requested by rin in ticket #1711): sys/compat/netbsd32/syscalls.master: revision 1.129 For netbsd32_readlinkat(2), bufsize is netbsd_size_t, not size_t. Since bufsize is the last argument, this affects only LP64EB. XXX pullup to netbsd-9, -8, and -7 To generate a diff of this commit: cvs rdiff -u -r1.101.2.3 -r1.101.2.4 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.
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Mon Nov 4 14:51:31 UTC 2019 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: syscalls.master Log Message: Pull up following revision(s) (requested by rin in ticket #1711): sys/compat/netbsd32/syscalls.master: revision 1.129 For netbsd32_readlinkat(2), bufsize is netbsd_size_t, not size_t. Since bufsize is the last argument, this affects only LP64EB. XXX pullup to netbsd-9, -8, and -7 To generate a diff of this commit: cvs rdiff -u -r1.101.2.3 -r1.101.2.4 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.2.3 src/sys/compat/netbsd32/syscalls.master:1.101.2.4 --- src/sys/compat/netbsd32/syscalls.master:1.101.2.3 Fri Nov 6 09:16:48 2015 +++ src/sys/compat/netbsd32/syscalls.master Mon Nov 4 14:51:31 2019 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.101.2.3 2015/11/06 09:16:48 martin Exp $ + $NetBSD: syscalls.master,v 1.101.2.4 2019/11/04 14:51:31 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 @@ -1016,7 +1016,7 @@ 469 STD { netbsd32_ssize_t|netbsd32||readlinkat(int fd, \ const netbsd32_charp path, \ netbsd32_charp buf, \ - size_t bufsize); } + netbsd32_size_t bufsize); } 470 STD { int|netbsd32||symlinkat(const netbsd32_charp path1, \ int fd, \ const netbsd32_charp path2); }
CVS commit: [netbsd-7] src/sys/netbt
Module Name:src Committed By: martin Date: Sat Sep 28 07:50:23 UTC 2019 Modified Files: src/sys/netbt [netbsd-7]: hci.h hci_event.c Log Message: Pull up following revision(s) (requested by plunky in ticket #1709): sys/netbt/hci_event.c: revision 1.26 sys/netbt/hci.h: revision 1.46 When encrypted connections are configured, verify that the encryption key length has a minimum size when the adaptor supports that. This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506 https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/ To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/netbt/hci.h cvs rdiff -u -r1.23 -r1.23.28.1 src/sys/netbt/hci_event.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys/netbt
Module Name:src Committed By: martin Date: Sat Sep 28 07:50:23 UTC 2019 Modified Files: src/sys/netbt [netbsd-7]: hci.h hci_event.c Log Message: Pull up following revision(s) (requested by plunky in ticket #1709): sys/netbt/hci_event.c: revision 1.26 sys/netbt/hci.h: revision 1.46 When encrypted connections are configured, verify that the encryption key length has a minimum size when the adaptor supports that. This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506 https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/ To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/netbt/hci.h cvs rdiff -u -r1.23 -r1.23.28.1 src/sys/netbt/hci_event.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/netbt/hci.h diff -u src/sys/netbt/hci.h:1.39 src/sys/netbt/hci.h:1.39.2.1 --- src/sys/netbt/hci.h:1.39 Tue Jul 1 05:49:18 2014 +++ src/sys/netbt/hci.h Sat Sep 28 07:50:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $ */ +/* $NetBSD: hci.h,v 1.39.2.1 2019/09/28 07:50:23 martin Exp $ */ /*- * Copyright (c) 2005 Iain Hibbert. @@ -54,7 +54,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $ + * $Id: hci.h,v 1.39.2.1 2019/09/28 07:50:23 martin Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $ */ @@ -1786,6 +1786,17 @@ typedef struct { uint16_t accuracy; /* clock accuracy */ } __packed hci_read_clock_rp; +#define HCI_OCF_READ_ENCRYPTION_KEY_SIZE 0x0008 +#define HCI_CMD_READ_ENCRYPTION_KEY_SIZE 0x1408 +typedef struct { + uint16_t con_handle; /* connection handle */ +} __packed hci_read_encryption_key_size_cp; + +typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t size; /* key size */ +} __packed hci_read_encryption_key_size_rp; /** ** Index: src/sys/netbt/hci_event.c diff -u src/sys/netbt/hci_event.c:1.23 src/sys/netbt/hci_event.c:1.23.28.1 --- src/sys/netbt/hci_event.c:1.23 Wed Jul 27 10:25:09 2011 +++ src/sys/netbt/hci_event.c Sat Sep 28 07:50:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $ */ +/* $NetBSD: hci_event.c,v 1.23.28.1 2019/09/28 07:50:23 martin Exp $ */ /*- * Copyright (c) 2005 Iain Hibbert. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23.28.1 2019/09/28 07:50:23 martin Exp $"); #include #include @@ -63,6 +63,7 @@ static void hci_cmd_read_local_features( static void hci_cmd_read_local_extended_features(struct hci_unit *, struct mbuf *); static void hci_cmd_read_local_ver(struct hci_unit *, struct mbuf *); static void hci_cmd_read_local_commands(struct hci_unit *, struct mbuf *); +static void hci_cmd_read_encryption_key_size(struct hci_unit *, struct mbuf *); static void hci_cmd_reset(struct hci_unit *, struct mbuf *); static void hci_cmd_create_con(struct hci_unit *unit, uint8_t status); @@ -351,6 +352,10 @@ hci_event_command_compl(struct hci_unit hci_cmd_read_local_commands(unit, m); break; + case HCI_CMD_READ_ENCRYPTION_KEY_SIZE: + hci_cmd_read_encryption_key_size(unit, m); + break; + case HCI_CMD_RESET: hci_cmd_reset(unit, m); break; @@ -618,10 +623,11 @@ hci_event_con_compl(struct hci_unit *uni return; } - /* XXX could check auth_enable here */ - - if (ep.encryption_mode) - link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT); + /* + * We purposefully ignore ep.encryption_mode here - if that is set then + * the link will be authenticated and encrypted, but we still want to + * verify the key size and setmode sets the right flags + */ link->hl_state = HCI_LINK_OPEN; link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle)); @@ -772,17 +778,16 @@ hci_event_auth_compl(struct hci_unit *un /* * Encryption Change * - * The encryption status has changed. Basically, we note the change - * then notify the upper layer protocol unless further mode changes - * are pending. - * Note that if encryption gets disabled when it has been requested, - * we will attempt to enable it again.. (its a feature not a bug :) + * The encryption status has changed. Make a note if disabled, or + * check the key size if possible before allowing it is enabled. + * (checking of key size was enabled in 3.0 spec) */ static void hci_event_encryption_change(struct hci_unit *unit, struct mbuf *m) { hci_encryption_change_ep ep; struct hci_link *link; + uint16_t con_handle; int err; if (m->m_pkthdr.len < sizeof(ep)) @@
CVS commit: [netbsd-7] src/sys
Module Name:src Committed By: martin Date: Tue Sep 17 18:07:15 UTC 2019 Modified Files: src/sys/netinet [netbsd-7]: ip_input.c src/sys/netinet6 [netbsd-7]: ip6_input.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1708): sys/netinet6/ip6_input.c: revision 1.209 via patch sys/netinet/ip_input.c: revision 1.390 via patch Packet filters can return an mbuf chain with fragmented headers, so m_pullup() it if needed and remove the KASSERT()s. To generate a diff of this commit: cvs rdiff -u -r1.319.2.1 -r1.319.2.2 src/sys/netinet/ip_input.c cvs rdiff -u -r1.149.2.3 -r1.149.2.4 src/sys/netinet6/ip6_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys
Module Name:src Committed By: martin Date: Tue Sep 17 18:07:15 UTC 2019 Modified Files: src/sys/netinet [netbsd-7]: ip_input.c src/sys/netinet6 [netbsd-7]: ip6_input.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1708): sys/netinet6/ip6_input.c: revision 1.209 via patch sys/netinet/ip_input.c: revision 1.390 via patch Packet filters can return an mbuf chain with fragmented headers, so m_pullup() it if needed and remove the KASSERT()s. To generate a diff of this commit: cvs rdiff -u -r1.319.2.1 -r1.319.2.2 src/sys/netinet/ip_input.c cvs rdiff -u -r1.149.2.3 -r1.149.2.4 src/sys/netinet6/ip6_input.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/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.319.2.1 src/sys/netinet/ip_input.c:1.319.2.2 --- src/sys/netinet/ip_input.c:1.319.2.1 Fri Feb 9 13:37:09 2018 +++ src/sys/netinet/ip_input.c Tue Sep 17 18:07:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.319.2.1 2018/02/09 13:37:09 martin Exp $ */ +/* $NetBSD: ip_input.c,v 1.319.2.2 2019/09/17 18:07:15 martin Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.319.2.1 2018/02/09 13:37:09 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.319.2.2 2019/09/17 18:07:15 martin Exp $"); #include "opt_inet.h" #include "opt_compat_netbsd.h" @@ -526,8 +526,25 @@ ip_input(struct mbuf *m) if (freed || m == NULL) { return; } + if (__predict_false(m->m_len < sizeof (struct ip))) { + if ((m = m_pullup(m, sizeof (struct ip))) == NULL) { +IP_STATINC(IP_STAT_TOOSMALL); +return; + } + } ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; + if (hlen < sizeof(struct ip)) { /* minimum header length */ + IP_STATINC(IP_STAT_BADHLEN); + goto bad; + } + if (hlen > m->m_len) { + if ((m = m_pullup(m, hlen)) == NULL) { +IP_STATINC(IP_STAT_BADHLEN); +return; + } + ip = mtod(m, struct ip *); + } /* * XXX The setting of "srcrt" here is to prevent ip_forward() Index: src/sys/netinet6/ip6_input.c diff -u src/sys/netinet6/ip6_input.c:1.149.2.3 src/sys/netinet6/ip6_input.c:1.149.2.4 --- src/sys/netinet6/ip6_input.c:1.149.2.3 Sun Feb 25 23:17:47 2018 +++ src/sys/netinet6/ip6_input.c Tue Sep 17 18:07:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.149.2.3 2018/02/25 23:17:47 snj Exp $ */ +/* $NetBSD: ip6_input.c,v 1.149.2.4 2019/09/17 18:07:15 martin Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.149.2.3 2018/02/25 23:17:47 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.149.2.4 2019/09/17 18:07:15 martin Exp $"); #include "opt_gateway.h" #include "opt_inet.h" @@ -352,6 +352,14 @@ ip6_input(struct mbuf *m) return; if (m == NULL) return; + if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) { + struct ifnet *inifp = m->m_pkthdr.rcvif; + if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { +IP6_STATINC(IP6_STAT_TOOSMALL); +in6_ifstat_inc(inifp, ifs6_in_hdrerr); +return; + } + } ip6 = mtod(m, struct ip6_hdr *); srcrt = !IN6_ARE_ADDR_EQUAL(, >ip6_dst); }
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Tue Sep 17 18:04:15 UTC 2019 Modified Files: src/sys/dev/usb [netbsd-7]: xhci.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1707): sys/dev/usb/xhci.c: revision 1.113 sys/dev/usb/xhci.c: revision 1.109 match xhci version 3.10. allows properly finding all the USB busses on new ryzen 3 based systems. unfortunately, the USB busses are still non-functional. - fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4 says final TRB for a TD should have this set to '0'. since we currently only generate sinel TRB TDs, set this to 0. XXX: pullup-all from sc.dying To generate a diff of this commit: cvs rdiff -u -r1.23.2.8 -r1.23.2.9 src/sys/dev/usb/xhci.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/usb/xhci.c diff -u src/sys/dev/usb/xhci.c:1.23.2.8 src/sys/dev/usb/xhci.c:1.23.2.9 --- src/sys/dev/usb/xhci.c:1.23.2.8 Sat Aug 25 14:57:35 2018 +++ src/sys/dev/usb/xhci.c Tue Sep 17 18:04:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.23.2.8 2018/08/25 14:57:35 martin Exp $ */ +/* $NetBSD: xhci.c,v 1.23.2.9 2019/09/17 18:04:15 martin Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.8 2018/08/25 14:57:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.9 2019/09/17 18:04:15 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -753,6 +753,8 @@ hexdump(const char *msg, const void *bas static void xhci_id_protocols(struct xhci_softc *sc, bus_size_t ecp) { + XHCIHIST_FUNC(); XHCIHIST_CALLED(); + /* XXX Cache this lot */ const uint32_t w0 = xhci_read_4(sc, ecp); @@ -776,6 +778,7 @@ xhci_id_protocols(struct xhci_softc *sc, case 0x0200: case 0x0300: case 0x0301: + case 0x0310: aprint_debug_dev(sc->sc_dev, " %s ports %d - %d\n", major == 3 ? "ss" : "hs", cpo, cpo + cpc -1); break; @@ -3792,7 +3795,7 @@ xhci_device_ctrl_start(struct usbd_xfer parameter = DMAADDR(dma, 0); KASSERTMSG(len <= 0x1, "len %d", len); status = XHCI_TRB_2_IRQ_SET(0) | - XHCI_TRB_2_TDSZ_SET(1) | + XHCI_TRB_2_TDSZ_SET(0) | XHCI_TRB_2_BYTES_SET(len); control = (isread ? XHCI_TRB_3_DIR_IN : 0) | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_DATA_STAGE) | @@ -3919,7 +3922,7 @@ xhci_device_bulk_start(struct usbd_xfer */ KASSERTMSG(len <= 0x1, "len %d", len); status = XHCI_TRB_2_IRQ_SET(0) | - XHCI_TRB_2_TDSZ_SET(1) | + XHCI_TRB_2_TDSZ_SET(0) | XHCI_TRB_2_BYTES_SET(len); control = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL) | (usbd_xfer_isread(xfer) ? XHCI_TRB_3_ISP_BIT : 0) | @@ -4026,7 +4029,7 @@ xhci_device_intr_start(struct usbd_xfer parameter = DMAADDR(dma, 0); KASSERTMSG(len <= 0x1, "len %d", len); status = XHCI_TRB_2_IRQ_SET(0) | - XHCI_TRB_2_TDSZ_SET(1) | + XHCI_TRB_2_TDSZ_SET(0) | XHCI_TRB_2_BYTES_SET(len); control = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_NORMAL) | (usbd_xfer_isread(xfer) ? XHCI_TRB_3_ISP_BIT : 0) |
CVS commit: [netbsd-7] src/sys
Module Name:src Committed By: martin Date: Tue Sep 3 12:20:43 UTC 2019 Modified Files: src/sys/conf [netbsd-7]: files src/sys/dev [netbsd-7]: rndpseudo.c src/sys/kern [netbsd-7]: subr_cprng.c src/sys/rump/kern/lib/libcrypto [netbsd-7]: Makefile src/sys/rump/librump/rumpkern [netbsd-7]: Makefile.rumpkern src/sys/sys [netbsd-7]: cprng.h Added Files: src/sys/crypto/nist_hash_drbg [netbsd-7]: files.nist_hash_drbg nist_hash_drbg.c nist_hash_drbg.h Removed Files: src/sys/crypto/nist_ctr_drbg [netbsd-7]: files.nist_ctr_drbg nist_ctr_aes_rijndael.h nist_ctr_drbg.c nist_ctr_drbg.h nist_ctr_drbg_aes128.h nist_ctr_drbg_aes256.h nist_ctr_drbg_config.h Log Message: Pull up following revision(s) (requested by riastradh in ticket #1705): sys/crypto/nist_hash_drbg/nist_hash_drbg.c: revision 1.1 sys/crypto/nist_hash_drbg/nist_hash_drbg.h: revision 1.1 sys/rump/kern/lib/libcrypto/Makefile: revision 1.5 sys/crypto/nist_hash_drbg/files.nist_hash_drbg: revision 1.1 sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.176 sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h: file removal sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h: file removal sys/conf/files: revision 1.1238 sys/dev/rndpseudo.c: revision 1.38 sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c: file removal sys/sys/cprng.h: revision 1.13 - 1.15 sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h: file removal sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h: file removal sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg: file removal sys/kern/subr_cprng.c: revision 1.31 sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h: file removal cprng.h: use static __inline for consistency with other include headers and remove an unused function. - Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256. Benefits: - larger seeds -- a 128-bit key alone is not enough for `128-bit security' - better resistance to timing side channels than AES - a better-understood security story (https://eprint.iacr.org/2018/349;>https://eprint.iacr.org/2018/349) - no loss in compliance with US government standards that nobody ever got fired for choosing, at least in the US-dominated western world - no dirty endianness tricks - self-tests Drawbacks: - performance hit: throughput is reduced to about 1/3 in naive measurements => possible to mitigate by using hardware SHA-256 instructions => all you really need is 32 bytes to seed a userland PRNG anyway => if we just used ChaCha this would go away... To generate a diff of this commit: cvs rdiff -u -r1.1096.2.9 -r1.1096.2.10 src/sys/conf/files cvs rdiff -u -r1.1 -r0 src/sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg \ src/sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h cvs rdiff -u -r1.2 -r0 src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h cvs rdiff -u -r0 -r1.1.6.2 src/sys/crypto/nist_hash_drbg/files.nist_hash_drbg \ src/sys/crypto/nist_hash_drbg/nist_hash_drbg.c \ src/sys/crypto/nist_hash_drbg/nist_hash_drbg.h cvs rdiff -u -r1.21.2.1 -r1.21.2.2 src/sys/dev/rndpseudo.c cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/sys/kern/subr_cprng.c cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/rump/kern/lib/libcrypto/Makefile cvs rdiff -u -r1.148 -r1.148.2.1 \ src/sys/rump/librump/rumpkern/Makefile.rumpkern cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/sys/cprng.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys
Module Name:src Committed By: martin Date: Tue Sep 3 12:20:43 UTC 2019 Modified Files: src/sys/conf [netbsd-7]: files src/sys/dev [netbsd-7]: rndpseudo.c src/sys/kern [netbsd-7]: subr_cprng.c src/sys/rump/kern/lib/libcrypto [netbsd-7]: Makefile src/sys/rump/librump/rumpkern [netbsd-7]: Makefile.rumpkern src/sys/sys [netbsd-7]: cprng.h Added Files: src/sys/crypto/nist_hash_drbg [netbsd-7]: files.nist_hash_drbg nist_hash_drbg.c nist_hash_drbg.h Removed Files: src/sys/crypto/nist_ctr_drbg [netbsd-7]: files.nist_ctr_drbg nist_ctr_aes_rijndael.h nist_ctr_drbg.c nist_ctr_drbg.h nist_ctr_drbg_aes128.h nist_ctr_drbg_aes256.h nist_ctr_drbg_config.h Log Message: Pull up following revision(s) (requested by riastradh in ticket #1705): sys/crypto/nist_hash_drbg/nist_hash_drbg.c: revision 1.1 sys/crypto/nist_hash_drbg/nist_hash_drbg.h: revision 1.1 sys/rump/kern/lib/libcrypto/Makefile: revision 1.5 sys/crypto/nist_hash_drbg/files.nist_hash_drbg: revision 1.1 sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.176 sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h: file removal sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h: file removal sys/conf/files: revision 1.1238 sys/dev/rndpseudo.c: revision 1.38 sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c: file removal sys/sys/cprng.h: revision 1.13 - 1.15 sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h: file removal sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h: file removal sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg: file removal sys/kern/subr_cprng.c: revision 1.31 sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h: file removal cprng.h: use static __inline for consistency with other include headers and remove an unused function. - Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256. Benefits: - larger seeds -- a 128-bit key alone is not enough for `128-bit security' - better resistance to timing side channels than AES - a better-understood security story (https://eprint.iacr.org/2018/349;>https://eprint.iacr.org/2018/349) - no loss in compliance with US government standards that nobody ever got fired for choosing, at least in the US-dominated western world - no dirty endianness tricks - self-tests Drawbacks: - performance hit: throughput is reduced to about 1/3 in naive measurements => possible to mitigate by using hardware SHA-256 instructions => all you really need is 32 bytes to seed a userland PRNG anyway => if we just used ChaCha this would go away... To generate a diff of this commit: cvs rdiff -u -r1.1096.2.9 -r1.1096.2.10 src/sys/conf/files cvs rdiff -u -r1.1 -r0 src/sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg \ src/sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h cvs rdiff -u -r1.2 -r0 src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h \ src/sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h cvs rdiff -u -r0 -r1.1.6.2 src/sys/crypto/nist_hash_drbg/files.nist_hash_drbg \ src/sys/crypto/nist_hash_drbg/nist_hash_drbg.c \ src/sys/crypto/nist_hash_drbg/nist_hash_drbg.h cvs rdiff -u -r1.21.2.1 -r1.21.2.2 src/sys/dev/rndpseudo.c cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/sys/kern/subr_cprng.c cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/rump/kern/lib/libcrypto/Makefile cvs rdiff -u -r1.148 -r1.148.2.1 \ src/sys/rump/librump/rumpkern/Makefile.rumpkern cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/sys/cprng.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/conf/files diff -u src/sys/conf/files:1.1096.2.9 src/sys/conf/files:1.1096.2.10 --- src/sys/conf/files:1.1096.2.9 Wed Apr 5 19:54:18 2017 +++ src/sys/conf/files Tue Sep 3 12:20:43 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1096.2.9 2017/04/05 19:54:18 snj Exp $ +# $NetBSD: files,v 1.1096.2.10 2019/09/03 12:20:43 martin Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20100430 @@ -167,8 +167,8 @@ include "crypto/camellia/files.camellia" # General-purpose crypto processing framework. include "opencrypto/files.opencrypto" -# NIST SP800.90 CTR DRBG -include "crypto/nist_ctr_drbg/files.nist_ctr_drbg" +# NIST SP800-90A Hash_DRBG +include "crypto/nist_hash_drbg/files.nist_hash_drbg" # ChaCha-based fast PRNG include "crypto/cprng_fast/files.cprng_fast" Index: src/sys/dev/rndpseudo.c diff -u src/sys/dev/rndpseudo.c:1.21.2.1 src/sys/dev/rndpseudo.c:1.21.2.2 --- src/sys/dev/rndpseudo.c:1.21.2.1 Sun Nov 2 09:47:04 2014 +++ src/sys/dev/rndpseudo.c Tue Sep 3 12:20:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rndpseudo.c,v 1.21.2.1 2014/11/02 09:47:04 martin Exp $ */ +/* $NetBSD:
CVS commit: [netbsd-7] src/sys/miscfs
Module Name:src Committed By: martin Date: Thu Aug 29 16:13:37 UTC 2019 Modified Files: src/sys/miscfs/kernfs [netbsd-7]: kernfs_vnops.c src/sys/miscfs/procfs [netbsd-7]: procfs_vnops.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1703): sys/miscfs/kernfs/kernfs_vnops.c: revision 1.161 sys/miscfs/procfs/procfs_vnops.c: revision 1.207 Add missing operation VOP_GETPAGES() returning EFAULT. Without this operation posix_fadvise(..., POSIX_FADV_WILLNEED) would leave the v_interlock held. Observed by maxv@ To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/miscfs/kernfs/kernfs_vnops.c cvs rdiff -u -r1.191 -r1.191.2.1 src/sys/miscfs/procfs/procfs_vnops.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/miscfs/kernfs/kernfs_vnops.c diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.154 src/sys/miscfs/kernfs/kernfs_vnops.c:1.154.2.1 --- src/sys/miscfs/kernfs/kernfs_vnops.c:1.154 Fri Jul 25 08:20:52 2014 +++ src/sys/miscfs/kernfs/kernfs_vnops.c Thu Aug 29 16:13:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kernfs_vnops.c,v 1.154 2014/07/25 08:20:52 dholland Exp $ */ +/* $NetBSD: kernfs_vnops.c,v 1.154.2.1 2019/08/29 16:13:37 martin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.154 2014/07/25 08:20:52 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.154.2.1 2019/08/29 16:13:37 martin Exp $"); #include #include @@ -172,6 +172,7 @@ int kernfs_print(void *); int kernfs_pathconf(void *); #define kernfs_advlock genfs_einval #define kernfs_bwrite genfs_eopnotsupp +int kernfs_getpages(void *); #define kernfs_putpages genfs_putpages static int kernfs_xread(struct kernfs_node *, int, char **, @@ -219,6 +220,7 @@ const struct vnodeopv_entry_desc kernfs_ { _pathconf_desc, kernfs_pathconf }, /* pathconf */ { _advlock_desc, kernfs_advlock }, /* advlock */ { _bwrite_desc, kernfs_bwrite }, /* bwrite */ + { _getpages_desc, kernfs_getpages }, /* getpages */ { _putpages_desc, kernfs_putpages }, /* putpages */ { NULL, NULL } }; @@ -1171,3 +1173,23 @@ kernfs_symlink(void *v) VOP_ABORTOP(ap->a_dvp, ap->a_cnp); return (EROFS); } + +int +kernfs_getpages(void *v) +{ + struct vop_getpages_args /* { + struct vnode *a_vp; + voff_t a_offset; + struct vm_page **a_m; + int *a_count; + int a_centeridx; + vm_prot_t a_access_type; + int a_advice; + int a_flags; + } */ *ap = v; + + if ((ap->a_flags & PGO_LOCKED) == 0) + mutex_exit(ap->a_vp->v_interlock); + + return (EFAULT); +} Index: src/sys/miscfs/procfs/procfs_vnops.c diff -u src/sys/miscfs/procfs/procfs_vnops.c:1.191 src/sys/miscfs/procfs/procfs_vnops.c:1.191.2.1 --- src/sys/miscfs/procfs/procfs_vnops.c:1.191 Sun Jul 27 16:47:26 2014 +++ src/sys/miscfs/procfs/procfs_vnops.c Thu Aug 29 16:13:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_vnops.c,v 1.191 2014/07/27 16:47:26 hannken Exp $ */ +/* $NetBSD: procfs_vnops.c,v 1.191.2.1 2019/08/29 16:13:37 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.191 2014/07/27 16:47:26 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.191.2.1 2019/08/29 16:13:37 martin Exp $"); #include #include @@ -239,6 +239,7 @@ int procfs_pathconf(void *); #define procfs_islocked genfs_islocked #define procfs_advlock genfs_einval #define procfs_bwrite genfs_eopnotsupp +int procfs_getpages(void *); #define procfs_putpages genfs_null_putpages static int atoi(const char *, size_t); @@ -286,6 +287,7 @@ const struct vnodeopv_entry_desc procfs_ { _islocked_desc, procfs_islocked }, /* islocked */ { _pathconf_desc, procfs_pathconf }, /* pathconf */ { _advlock_desc, procfs_advlock }, /* advlock */ + { _getpages_desc, procfs_getpages }, /* getpages */ { _putpages_desc, procfs_putpages }, /* putpages */ { NULL, NULL } }; @@ -1709,6 +1711,26 @@ procfs_readlink(void *v) return error; } +int +procfs_getpages(void *v) +{ + struct vop_getpages_args /* { + struct vnode *a_vp; + voff_t a_offset; + struct vm_page **a_m; + int *a_count; + int a_centeridx; + vm_prot_t a_access_type; + int a_advice; + int a_flags; + } */ *ap = v; + + if ((ap->a_flags & PGO_LOCKED) == 0) + mutex_exit(ap->a_vp->v_interlock); + + return (EFAULT); +} + /* * convert decimal ascii to int */
CVS commit: [netbsd-7] src/sys/miscfs
Module Name:src Committed By: martin Date: Thu Aug 29 16:13:37 UTC 2019 Modified Files: src/sys/miscfs/kernfs [netbsd-7]: kernfs_vnops.c src/sys/miscfs/procfs [netbsd-7]: procfs_vnops.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1703): sys/miscfs/kernfs/kernfs_vnops.c: revision 1.161 sys/miscfs/procfs/procfs_vnops.c: revision 1.207 Add missing operation VOP_GETPAGES() returning EFAULT. Without this operation posix_fadvise(..., POSIX_FADV_WILLNEED) would leave the v_interlock held. Observed by maxv@ To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/miscfs/kernfs/kernfs_vnops.c cvs rdiff -u -r1.191 -r1.191.2.1 src/sys/miscfs/procfs/procfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys/external/bsd/ipf/netinet
Module Name:src Committed By: martin Date: Fri Aug 9 19:24:22 UTC 2019 Modified Files: src/sys/external/bsd/ipf/netinet [netbsd-7]: fil.c Log Message: Pull up following revision(s) (requested by christos in ticket #1701): sys/external/bsd/ipf/netinet/fil.c: revision 1.30 PR/54443: Edgar Fu�: ipf mistakenly regards UDP packet with checksum field 0x as bad To generate a diff of this commit: cvs rdiff -u -r1.15.2.3 -r1.15.2.4 src/sys/external/bsd/ipf/netinet/fil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys/external/bsd/ipf/netinet
Module Name:src Committed By: martin Date: Fri Aug 9 19:24:22 UTC 2019 Modified Files: src/sys/external/bsd/ipf/netinet [netbsd-7]: fil.c Log Message: Pull up following revision(s) (requested by christos in ticket #1701): sys/external/bsd/ipf/netinet/fil.c: revision 1.30 PR/54443: Edgar Fu�: ipf mistakenly regards UDP packet with checksum field 0x as bad To generate a diff of this commit: cvs rdiff -u -r1.15.2.3 -r1.15.2.4 src/sys/external/bsd/ipf/netinet/fil.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/external/bsd/ipf/netinet/fil.c diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.3 src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.4 --- src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.3 Thu Jun 29 12:24:10 2017 +++ src/sys/external/bsd/ipf/netinet/fil.c Fri Aug 9 19:24:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fil.c,v 1.15.2.3 2017/06/29 12:24:10 sborrill Exp $ */ +/* $NetBSD: fil.c,v 1.15.2.4 2019/08/09 19:24:22 martin Exp $ */ /* * Copyright (C) 2012 by Darren Reed. @@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch; #if !defined(lint) #if defined(__NetBSD__) #include -__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.15.2.3 2017/06/29 12:24:10 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.15.2.4 2019/08/09 19:24:22 martin Exp $"); #else static const char sccsid[] = "@(#)fil.c 1.36 6/5/96 (C) 1993-2000 Darren Reed"; static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $"; @@ -6474,8 +6474,11 @@ ipf_checkl4sum(fr_info_t *fin) /*NOTREACHED*/ } - if (csump != NULL) + if (csump != NULL) { hdrsum = *csump; + if (fin->fin_p == IPPROTO_UDP && hdrsum == 0x) + hdrsum = 0x; + } if (dosum) { sum = fr_cksum(fin, fin->fin_ip, fin->fin_p, fin->fin_dp);
CVS commit: [netbsd-7] src/sys/dev/scsipi
Module Name:src Committed By: martin Date: Fri May 31 08:13:53 UTC 2019 Modified Files: src/sys/dev/scsipi [netbsd-7]: scsipi_ioctl.c Log Message: Pull up following revision(s) (requested by mlelstv in ticket #1698): sys/dev/scsipi/scsipi_ioctl.c: revision 1.72 (via patch) use correct size when copying outgoing sense data. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.67.14.1 src/sys/dev/scsipi/scsipi_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-7] src/sys/dev/scsipi
Module Name:src Committed By: martin Date: Fri May 31 08:13:53 UTC 2019 Modified Files: src/sys/dev/scsipi [netbsd-7]: scsipi_ioctl.c Log Message: Pull up following revision(s) (requested by mlelstv in ticket #1698): sys/dev/scsipi/scsipi_ioctl.c: revision 1.72 (via patch) use correct size when copying outgoing sense data. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.67.14.1 src/sys/dev/scsipi/scsipi_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/dev/scsipi/scsipi_ioctl.c diff -u src/sys/dev/scsipi/scsipi_ioctl.c:1.67 src/sys/dev/scsipi/scsipi_ioctl.c:1.67.14.1 --- src/sys/dev/scsipi/scsipi_ioctl.c:1.67 Thu Apr 19 17:45:20 2012 +++ src/sys/dev/scsipi/scsipi_ioctl.c Fri May 31 08:13:53 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_ioctl.c,v 1.67 2012/04/19 17:45:20 bouyer Exp $ */ +/* $NetBSD: scsipi_ioctl.c,v 1.67.14.1 2019/05/31 08:13:53 martin Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.67 2012/04/19 17:45:20 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.67.14.1 2019/05/31 08:13:53 martin Exp $"); #include "opt_compat_freebsd.h" #include "opt_compat_netbsd.h" @@ -162,14 +162,16 @@ scsipi_user_done(struct scsipi_xfer *xs) SC_DEBUG(periph, SCSIPI_DB3, ("have sense\n")); screq->senselen_used = min(sizeof(xs->sense.scsi_sense), SENSEBUFLEN); - memcpy(screq->sense, >sense.scsi_sense, screq->senselen); + memcpy(screq->sense, >sense.scsi_sense, + screq->senselen_used); screq->retsts = SCCMD_SENSE; break; case XS_SHORTSENSE: SC_DEBUG(periph, SCSIPI_DB3, ("have short sense\n")); screq->senselen_used = min(sizeof(xs->sense.atapi_sense), SENSEBUFLEN); - memcpy(screq->sense, >sense.scsi_sense, screq->senselen); + memcpy(screq->sense, >sense.atapi_sense, + screq->senselen_used); screq->retsts = SCCMD_UNKNOWN; /* XXX need a shortsense here */ break; case XS_DRIVER_STUFFUP:
CVS commit: [netbsd-7] src/sys/ufs/ffs
Module Name:src Committed By: martin Date: Wed May 29 15:53:31 UTC 2019 Modified Files: src/sys/ufs/ffs [netbsd-7]: ffs_alloc.c Log Message: Pull up following revision(s) (requested by kardel in ticket #1697): sys/ufs/ffs/ffs_alloc.c: revision 1.164 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.146.2.1 -r1.146.2.2 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.146.2.1 src/sys/ufs/ffs/ffs_alloc.c:1.146.2.2 --- src/sys/ufs/ffs/ffs_alloc.c:1.146.2.1 Fri Aug 14 05:29:14 2015 +++ src/sys/ufs/ffs/ffs_alloc.c Wed May 29 15:53:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.146.2.1 2015/08/14 05:29:14 msaitoh Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.146.2.2 2019/05/29 15:53:31 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.146.2.1 2015/08/14 05:29:14 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.146.2.2 2019/05/29 15:53:31 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -1283,7 +1283,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); @@ -1295,7 +1295,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, NOCRED, B_MODIFY, ); @@ -1315,7 +1321,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)) { @@ -1331,6 +1338,9 @@ retry: FFS_NOBLK, fs->fs_bsize, false, ); if (error) goto fail; + + maxiblk += FFS_INOPB(fs); + goto retry; } } @@ -1340,14 +1350,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; @@ -1367,9 +1385,17 @@ retry: printf("fs = %s\n", fs->fs_fsmnt); panic("ffs_nodealloccg: block not in map"); } + 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); +
CVS commit: [netbsd-7] src/sys/ufs/ffs
Module Name:src Committed By: martin Date: Wed May 29 15:53:31 UTC 2019 Modified Files: src/sys/ufs/ffs [netbsd-7]: ffs_alloc.c Log Message: Pull up following revision(s) (requested by kardel in ticket #1697): sys/ufs/ffs/ffs_alloc.c: revision 1.164 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.146.2.1 -r1.146.2.2 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.
Re: CVS commit: [netbsd-7] src/sys/kern
On Thu, May 02, 2019 at 09:23:15PM +0200, Kamil Rytarowski wrote: > There was a regression with ATF pipe(2) tests.. I cannot find now the > references, but it could help to the issue triggered by syzkaller as well. bin/54068 -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: CVS commit: [netbsd-7] src/sys/kern
On Thu, May 02, 2019 at 08:59:28PM +0200, Maxime Villard wrote: > > Clean up pipe structure before recycling it. > > Handle half-closed pipes in FIONWRITE and FIONSPACE. > > This fixed this bug [1], right? > > [1] > https://syzkaller.appspot.com/bug?id=d16eb57ee450d86a0d0c02a3ff7e6837da2ab26f No idea. This was to fix a problem with the hanging pipe2_consume ATF test. But looking at the syzkaller trace, it could be caused by the same issue. Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: CVS commit: [netbsd-7] src/sys/kern
On 02.05.2019 20:59, Maxime Villard wrote: > Le 01/05/2019 à 11:48, Martin Husemann a écrit : >> Module Name: src >> Committed By: martin >> Date: Wed May 1 09:48:56 UTC 2019 >> >> Modified Files: >> src/sys/kern [netbsd-7]: sys_pipe.c >> >> Log Message: >> Pull up following revision(s) (requested by mlelstv in ticket #1692): >> >> sys/kern/sys_pipe.c: revision 1.147 >> sys/kern/sys_pipe.c: revision 1.148 >> >> Clean up pipe structure before recycling it. >> >> Handle half-closed pipes in FIONWRITE and FIONSPACE. > > This fixed this bug [1], right? > > [1] > https://syzkaller.appspot.com/bug?id=d16eb57ee450d86a0d0c02a3ff7e6837da2ab26f > There was a regression with ATF pipe(2) tests.. I cannot find now the references, but it could help to the issue triggered by syzkaller as well. signature.asc Description: OpenPGP digital signature
Re: CVS commit: [netbsd-7] src/sys/kern
Le 01/05/2019 à 11:48, Martin Husemann a écrit : Module Name:src Committed By: martin Date: Wed May 1 09:48:56 UTC 2019 Modified Files: src/sys/kern [netbsd-7]: sys_pipe.c Log Message: Pull up following revision(s) (requested by mlelstv in ticket #1692): sys/kern/sys_pipe.c: revision 1.147 sys/kern/sys_pipe.c: revision 1.148 Clean up pipe structure before recycling it. Handle half-closed pipes in FIONWRITE and FIONSPACE. This fixed this bug [1], right? [1] https://syzkaller.appspot.com/bug?id=d16eb57ee450d86a0d0c02a3ff7e6837da2ab26f
Re: CVS commit: [netbsd-7] src/sys/net/npf
On Sun, 21 May 2017 08:08:34 +0900 (JST), Takahiro Kambe wrote: > By comparing code with current, one line seems to missing. > > Index: sys/net/npf/npf_inet.c > === > RCS file: /cvsroot/src/sys/net/npf/npf_inet.c,v > retrieving revision 1.32.2.1 > diff -u -r1.32.2.1 npf_inet.c > --- sys/net/npf/npf_inet.c12 May 2017 05:32:12 - 1.32.2.1 > +++ sys/net/npf/npf_inet.c20 May 2017 23:06:17 - > @@ -51,6 +51,7 @@ > > #include > #include > +#include > #include > #include > #include Confirmed. hauke -- Hauke FathErnst-Ludwig-Straße 15 64625 Bensheim Germany
Re: CVS commit: [netbsd-7] src/sys/net/npf
In messageon Wed, 17 May 2017 13:22:39 +0200, Hauke Fath wrote: > [properly re-sent to source-changes-d -- it was cribbed from the web > list archive] > > > The pull-up > >> Pull up following revision(s) (requested by jnemeth in ticket #1394): >> sys/net/npf/npf_inet.c: revisions 1.34, 1.35 via patch >> sys/net/npf/npf_mbuf.c: revision 1.16 >> sys/net/npf/npf_nat.c: revision 1.40 >> minimal changes necessary to link into an INET6-less kernel. >> -- >> fixup misplaced #endif > > leads to > > [...] > --- npf_nat.o --- > /u/netbsd-builds/7/amd64/tools/bin/x86_64--netbsd-gcc -mcmodel=kernel > -mno-red-zone -mno-mmx -mno-sse -mno-avx -msoft-float -ffreestanding > -fno-zero-initialized-in-bss -O2 -fno-omit-frame-pointer > -fstack-protector -Wstack-protector --param ssp-buffer-size=1 > -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main > -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes > -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow > -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign > -Wno-attributes -Wextra -Wno-unused-parameter -Wold-style-definition > -Wno-sign-compare --sysroot=/u/netbsd-builds/7/amd64/destdir -Damd64 > -Dx86_64 -I. -I/public/netbsd-7/sys/../common/include > -I/public/netbsd-7/sys/arch -I/public/netbsd-7/sys -nostdinc > -DCHILD_MAX=1024 -DOPEN_MAX=1024 -DIPSEC_ESP -DIPSEC_NAT_T > -DMAXUSERS=64 -D_KERNEL -D_KERNEL_OPT -std=gnu99 > -I/public/netbsd-7/sys/lib/libkern/../../../common/lib/libc/quad > -I/public/netbsd-7/sys/lib/libkern/../../../common/lib/libc/string > -I/public/netbsd-7/sys/lib/libkern/../../../common/lib/libc/arch/x86_64/string > -D_FORTIFY_SOURCE=2 -I/public/netbsd-7/sys/../common/include > -I/public/netbsd-7/sys/external/bsd/acpica/dist/include -c > /public/netbsd-7/sys/net/npf/npf_nat.c > --- npf_inet.o --- > /public/netbsd-7/sys/net/npf/npf_inet.c: In function 'npf_addr_dump': > /public/netbsd-7/sys/net/npf/npf_inet.c:759:2: error: implicit > declaration of function 'ip6_sprintf' > [-Werror=implicit-function-declaration] > return ip6_sprintf(addr); > ^ > /public/netbsd-7/sys/net/npf/npf_inet.c:759:2: error: return makes > pointer from integer without a cast [-Werror] > cc1: all warnings being treated as errors > *** [npf_inet.o] Error code 1 By comparing code with current, one line seems to missing. Index: sys/net/npf/npf_inet.c === RCS file: /cvsroot/src/sys/net/npf/npf_inet.c,v retrieving revision 1.32.2.1 diff -u -r1.32.2.1 npf_inet.c --- sys/net/npf/npf_inet.c 12 May 2017 05:32:12 - 1.32.2.1 +++ sys/net/npf/npf_inet.c 20 May 2017 23:06:17 - @@ -51,6 +51,7 @@ #include #include +#include #include #include #include -- Takahiro Kambe
Re: CVS commit: [netbsd-7] src/sys/net/npf
[properly re-sent to source-changes-d -- it was cribbed from the web list archive] The pull-up Pull up following revision(s) (requested by jnemeth in ticket #1394): sys/net/npf/npf_inet.c: revisions 1.34, 1.35 via patch sys/net/npf/npf_mbuf.c: revision 1.16 sys/net/npf/npf_nat.c: revision 1.40 minimal changes necessary to link into an INET6-less kernel. -- fixup misplaced #endif leads to [...] --- npf_nat.o --- /u/netbsd-builds/7/amd64/tools/bin/x86_64--netbsd-gcc -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -mno-avx -msoft-float -ffreestanding -fno-zero-initialized-in-bss -O2 -fno-omit-frame-pointer -fstack-protector -Wstack-protector --param ssp-buffer-size=1 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wextra -Wno-unused-parameter -Wold-style-definition -Wno-sign-compare --sysroot=/u/netbsd-builds/7/amd64/destdir -Damd64 -Dx86_64 -I. -I/public/netbsd-7/sys/../common/include -I/public/netbsd-7/sys/arch -I/public/netbsd-7/sys -nostdinc -DCHILD_MAX=1024 -DOPEN_MAX=1024 -DIPSEC_ESP -DIPSEC_NAT_T -DMAXUSERS=64 -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I/public/netbsd-7/sys/lib/libkern/../../../common/lib/libc/quad -I/public/netbsd-7/sys/lib/libkern/../../../common/lib/libc/string -I/public/netbsd-7/sys/lib/libkern/../../../common/lib/libc/arch/x86_64/string -D_FORTIFY_SOURCE=2 -I/public/netbsd-7/sys/../common/include -I/public/netbsd-7/sys/external/bsd/acpica/dist/include -c /public/netbsd-7/sys/net/npf/npf_nat.c --- npf_inet.o --- /public/netbsd-7/sys/net/npf/npf_inet.c: In function 'npf_addr_dump': /public/netbsd-7/sys/net/npf/npf_inet.c:759:2: error: implicit declaration of function 'ip6_sprintf' [-Werror=implicit-function-declaration] return ip6_sprintf(addr); ^ /public/netbsd-7/sys/net/npf/npf_inet.c:759:2: error: return makes pointer from integer without a cast [-Werror] cc1: all warnings being treated as errors *** [npf_inet.o] Error code 1 which, I guess, didn't show up in a build because we do not have a (standard) kernel config file that includes npf(4). Any reason why -current should not default GENERIC to npf? Cheerio, hauke -- The ASCII Ribbon CampaignHauke Fath () No HTML/RTF in email Institut für Nachrichtentechnik /\ No Word docs in email TU Darmstadt Respect for open standards Ruf +49-6151-16-21344
Re: CVS commit: [netbsd-7] src/sys/sys
Hi. On 2016/03/07 17:59, Takeshi Nakayama wrote: "SAITOH Masanobu"wrote Module Name:src Committed By: msaitoh Date: Mon Mar 7 08:08:52 UTC 2016 Modified Files: src/sys/sys [netbsd-7]: exec_elf.h Log Message: Pullup the following revision (requested by htodd in ticket #1132): sys/sys/exec_elf.h 1.143 Add definition of EM_IAMCU. This change fixes build break caused by ticket 1126. Wrong commit message? This is for 1.153 not 1.143. Sorry. Yo're right. I'll fix the commit message and doc/CHANGES-7.1 -- Takeshi Nakayama -- --- SAITOH Masanobu (msai...@execsw.org msai...@netbsd.org)
Re: CVS commit: [netbsd-7] src/sys/sys
>>> "SAITOH Masanobu"wrote > Module Name: src > Committed By: msaitoh > Date: Mon Mar 7 08:08:52 UTC 2016 > > Modified Files: > src/sys/sys [netbsd-7]: exec_elf.h > > Log Message: > Pullup the following revision (requested by htodd in ticket #1132): > > sys/sys/exec_elf.h1.143 > > Add definition of EM_IAMCU. This change fixes build break caused by > ticket 1126. Wrong commit message? This is for 1.153 not 1.143. -- Takeshi Nakayama
Re: CVS commit: [netbsd-7] src/sys
Hi, On 2015/11/05 02:46, Jeff Rizzo wrote: Module Name:src Committed By: riz Date: Wed Nov 4 17:46:21 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: files.netbsd32 netbsd32.h netbsd32_conv.h netbsd32_syscall.h netbsd32_syscallargs.h netbsd32_syscalls.c netbsd32_sysent.c syscalls.master src/sys/nfs [netbsd-7]: nfs_syscalls.c nfs_var.h Added Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_nfssvc.c If conf file doesn't have options NFSSERVER, build fails on amd64: netbsd32_sysent.o:(.data+0x9b8): undefined reference to `netbsd32_nfssvc' Should compat/netbsd32/syscalls.master be same as in HEAD? Thanks, -- t-hash
Re: CVS commit: [netbsd-7] src/sys/dev/pci
On 2015/04/19 15:45, Jeff Rizzo wrote: Module Name:src Committed By: riz Date: Sun Apr 19 06:45:17 UTC 2015 Modified Files: src/sys/dev/pci [netbsd-7]: files.pci src/sys/dev/pci/ixgbe [netbsd-7]: ixgbe.c ixgbe.h ixgbe_82598.c ixgbe_82599.c ixgbe_api.c ixgbe_api.h ixgbe_common.c ixgbe_common.h ixgbe_mbx.c ixgbe_mbx.h ixgbe_osdep.h ixgbe_phy.c ixgbe_phy.h ixgbe_type.h ixgbe_vf.c ixgbe_vf.h ixv.c ixv.h missing newly added ixgbe_8259[89].h and ixgbe_x540.[ch] ? Log Message: Apply patch (requested by msaitoh in ticket #697): sys/dev/pci/files.pci 1.375 via patch sys/dev/pci/ixgbe/ixgbe.c 1.24-1.27 via patch sys/dev/pci/ixgbe/ixgbe.h 1.4-1.6 via patch sys/dev/pci/ixgbe/ixgbe_82598.c 1.2-1.3 via patch sys/dev/pci/ixgbe/ixgbe_82598.h 1.1-1.2 via patch sys/dev/pci/ixgbe/ixgbe_82599.c 1.6-1.8 via patch sys/dev/pci/ixgbe/ixgbe_82599.h 1.1 via patch sys/dev/pci/ixgbe/ixgbe_api.c 1.5-1.6 via patch sys/dev/pci/ixgbe/ixgbe_api.h 1.2-1.3 via patch sys/dev/pci/ixgbe/ixgbe_common.c1.3-1.4 via patch sys/dev/pci/ixgbe/ixgbe_common.h1.2-1.3 via patch sys/dev/pci/ixgbe/ixgbe_mbx.c 1.2-1.3 via patch sys/dev/pci/ixgbe/ixgbe_mbx.h 1.2-1.3 via patch sys/dev/pci/ixgbe/ixgbe_osdep.h 1.4-1.6 via patch sys/dev/pci/ixgbe/ixgbe_phy.c 1.3-1.4 via patch sys/dev/pci/ixgbe/ixgbe_phy.h 1.2-1.3 via patch sys/dev/pci/ixgbe/ixgbe_type.h 1.8-1.9 via patch sys/dev/pci/ixgbe/ixgbe_vf.c1.2-1.3 via patch sys/dev/pci/ixgbe/ixgbe_vf.h1.3-1.4 via patch sys/dev/pci/ixgbe/ixgbe_x540.c 1.1-1.2 via patch sys/dev/pci/ixgbe/ixgbe_x540.h 1.1 via patch sys/dev/pci/ixgbe/ixv.c 1.5-1.7 via patch sys/dev/pci/ixgbe/ixv.h 1.4-1.5 via patch Synchronize our ixg(4) driver up to FreeBSD r243716: - Add X540 support. - Add TSO6 support. - Add 100BaseTX support. - The max size in dma tag is changed from 65535 to 262140 (IXGBE_TSO_SIZE). The value is the same as other *BSDs. The change might cause a address space shortage (ixgbe_dmamap_create() might fail) on some machines. - Show 1000Base-SX correctly. - Fix if_baudrate from 1G to 10G. - Fix a bug that ifconfig -z (SOICZIFDATA) doesn't work. - Fix a lot of bugs. - Improve performance. [msaitoh, ticket #697] -- t-hash
Re: CVS commit: [netbsd-7] src/sys/dev/i2c
Thank you for pulling up! On 2015/04/14 13:24, Soren Jacobsen wrote: Module Name:src Committed By: snj Date: Tue Apr 14 04:24:58 UTC 2015 Modified Files: src/sys/dev/i2c [netbsd-7]: ds1307.c ds1307reg.h Log Message: Pull up following revision(s) (requested by nonaka in ticket #672): sys/dev/i2c/ds1307.c: revisions 1.19, 1.20 sys/dev/i2c/ds1307reg.h: revision 1.5 - support DS3231 ( more or less a DS3232 without NVRAM it seems ) - support the DS3231's temperature sensor -- Initialize a variable that gcc thinks might be used uninitialized. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.18.2.1 src/sys/dev/i2c/ds1307.c cvs rdiff -u -r1.4 -r1.4.14.1 src/sys/dev/i2c/ds1307reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. -- t-hash
Re: CVS commit: [netbsd-7] src/sys/dev
On Fri, Jan 02, 2015 at 08:09:51AM +, John Klos wrote: Module Name: src Committed By: jklos Date: Fri Jan 2 08:09:51 UTC 2015 Modified Files: src/sys/dev/dec [netbsd-7]: dzkbd.c lk201_ws.c lk201var.h src/sys/dev/tc [netbsd-7]: zskbd.c Log Message: Patches from Björn Johannessonto fix DEC LK201 keyboards. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.26.12.1 src/sys/dev/dec/dzkbd.c cvs rdiff -u -r1.8 -r1.8.38.1 src/sys/dev/dec/lk201_ws.c cvs rdiff -u -r1.6 -r1.6.138.1 src/sys/dev/dec/lk201var.h cvs rdiff -u -r1.17 -r1.17.38.1 src/sys/dev/tc/zskbd.c Committed to wrong branch? Jonathan Kollasch
Re: CVS commit: [netbsd-7] src/sys/arch/x86/x86
On Oct 30, 6:58pm, Martin Husemann wrote: } } Module Name: src } Committed By: martin } Date: Thu Oct 30 18:58:45 UTC 2014 } } Modified Files: } src/sys/arch/x86/x86 [netbsd-7]: identcpu.c } } Log Message: } Pull up following revision(s) (requested by riz in ticket #171): } sys/arch/x86/x86/identcpu.c: revision 1.46 } sys/arch/x86/x86/identcpu.c: revision 1.47 } Force x86_xsave_features to 0 when running under XEN. } This prevents the use of xsave and xrstor thus fixing } the problem in PR/49150. The basic problem is that the way AMD } implements those instructions means that information can leak } between domains so XEN treats them as privileged. As discovered by riz, and noted with 1.47, the issue isn't just restricted to AMD CPUs. Of course, riz did discover the issue with an Intel CPU on an aws instance running an ancient version of Xen, so the issue may be related to that (the ancient version of Xen). }-- End of excerpt from Martin Husemann