svn commit: r300661 - in stable/10: share/man/man4 sys/conf sys/dev/ioat sys/modules sys/modules/ioat tools/tools/ioat
Author: mav Date: Wed May 25 07:09:54 2016 New Revision: 300661 URL: https://svnweb.freebsd.org/changeset/base/300661 Log: MFC ioat(4) driver in its present state. Added: stable/10/sys/dev/ioat/ stable/10/sys/dev/ioat/ioat.c (contents, props changed) stable/10/sys/dev/ioat/ioat.h (contents, props changed) stable/10/sys/dev/ioat/ioat_hw.h (contents, props changed) stable/10/sys/dev/ioat/ioat_internal.h (contents, props changed) stable/10/sys/dev/ioat/ioat_test.c (contents, props changed) stable/10/sys/dev/ioat/ioat_test.h (contents, props changed) stable/10/sys/modules/ioat/ stable/10/sys/modules/ioat/Makefile (contents, props changed) stable/10/tools/tools/ioat/ stable/10/tools/tools/ioat/Makefile (contents, props changed) stable/10/tools/tools/ioat/ioatcontrol.8 (contents, props changed) stable/10/tools/tools/ioat/ioatcontrol.c (contents, props changed) Modified: stable/10/share/man/man4/Makefile stable/10/sys/conf/files.amd64 stable/10/sys/modules/Makefile Modified: stable/10/share/man/man4/Makefile == --- stable/10/share/man/man4/Makefile Wed May 25 06:55:53 2016 (r300660) +++ stable/10/share/man/man4/Makefile Wed May 25 07:09:54 2016 (r300661) @@ -199,6 +199,7 @@ MAN=aac.4 \ intpm.4 \ intro.4 \ ${_io.4} \ + ${_ioat.4} \ ip.4 \ ip6.4 \ ipfirewall.4 \ @@ -797,6 +798,7 @@ MLINKS+=lindev.4 full.4 .if ${MACHINE_CPUARCH} == "amd64" _if_ntb.4= if_ntb.4 +_ioat.4= ioat.4 _ntb.4=ntb.4 _ntb_hw.4= ntb_hw.4 _qlxge.4= qlxge.4 Modified: stable/10/sys/conf/files.amd64 == --- stable/10/sys/conf/files.amd64 Wed May 25 06:55:53 2016 (r300660) +++ stable/10/sys/conf/files.amd64 Wed May 25 07:09:54 2016 (r300661) @@ -203,6 +203,8 @@ dev/if_ndis/if_ndis_pccard.coptionalnd dev/if_ndis/if_ndis_pci.c optionalndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optionalndis usb dev/io/iodev.c optionalio +dev/ioat/ioat.coptionalioat pci +dev/ioat/ioat_test.c optionalioat pci dev/ipmi/ipmi.coptionalipmi dev/ipmi/ipmi_acpi.c optionalipmi acpi dev/ipmi/ipmi_isa.coptionalipmi isa Added: stable/10/sys/dev/ioat/ioat.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/ioat/ioat.c Wed May 25 07:09:54 2016 (r300661) @@ -0,0 +1,2091 @@ +/*- + * Copyright (C) 2012 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ioat.h" +#include "ioat_hw.h" +#include "ioat_internal.h" + +#ifndefBUS_SPACE_MAXADDR_40BIT +#defineBUS_SPACE_MAXADDR_40BIT 0xFFULL +#endif +#defineIOAT_INTR_TIMO (hz / 10) +#defineIOAT_REFLK (&ioat->submit_lock) + +static int ioat_probe(device_t device); +static int ioat_attach(device_t device); +static int ioat_detach(device_t device); +static int ioat_setup_intr(struct ioat_softc *ioat); +static int ioat_teardown_intr(struct ioat_softc *ioat); +static int ioat3_att
svn commit: r300662 - head/lib/libc/gen
Author: truckman Date: Wed May 25 07:13:53 2016 New Revision: 300662 URL: https://svnweb.freebsd.org/changeset/base/300662 Log: Fix Coverity CID 1016714 Resource leak in process_file_actions_entry() Don't leak a file descriptor of _dup2() fails (shouldn't happen). Reported by: Coverity CID: 1016714 MFC after:1 week Modified: head/lib/libc/gen/posix_spawn.c Modified: head/lib/libc/gen/posix_spawn.c == --- head/lib/libc/gen/posix_spawn.c Wed May 25 07:09:54 2016 (r300661) +++ head/lib/libc/gen/posix_spawn.c Wed May 25 07:13:53 2016 (r300662) @@ -140,7 +140,7 @@ process_spawnattr(const posix_spawnattr_ static int process_file_actions_entry(posix_spawn_file_actions_entry_t *fae) { - int fd; + int fd, saved_errno; switch (fae->fae_action) { case FAE_OPEN: @@ -149,8 +149,11 @@ process_file_actions_entry(posix_spawn_f if (fd < 0) return (errno); if (fd != fae->fae_fildes) { - if (_dup2(fd, fae->fae_fildes) == -1) - return (errno); + if (_dup2(fd, fae->fae_fildes) == -1) { + saved_errno = errno; + (void)_close(fd); + return (saved_errno); + } if (_close(fd) != 0) { if (errno == EBADF) return (EBADF); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300663 - stable/10/share/man/man4
Author: mav Date: Wed May 25 07:14:52 2016 New Revision: 300663 URL: https://svnweb.freebsd.org/changeset/base/300663 Log: Add ioat.4 missed in r300661. Added: stable/10/share/man/man4/ioat.4 (contents, props changed) Added: stable/10/share/man/man4/ioat.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/ioat.4 Wed May 25 07:14:52 2016 (r300663) @@ -0,0 +1,334 @@ +.\" Copyright (c) 2015 EMC / Isilon Storage Division +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 3, 2016 +.Dt IOAT 4 +.Os +.Sh NAME +.Nm I/OAT +.Nd Intel I/O Acceleration Technology +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following line in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ioat" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ioat_load="YES" +.Ed +.Pp +In +.Xr loader.conf 5 : +.Pp +.Cd hw.ioat.force_legacy_interrupts=0 +.Pp +In +.Xr loader.conf 5 or +.Xr sysctl.conf 5 : +.Pp +.Cd hw.ioat.enable_ioat_test=0 +.Cd hw.ioat.debug_level=0 +(only critical errors; maximum of 3) +.Pp +.Ft typedef void +.Fn (*bus_dmaengine_callback_t) "void *arg" "int error" +.Pp +.Ft bus_dmaengine_t +.Fn ioat_get_dmaengine "uint32_t channel_index" +.Ft void +.Fn ioat_put_dmaengine "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_get_hwversion "bus_dmaengine_t dmaengine" +.Ft size_t +.Fn ioat_get_max_io_size "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_set_interrupt_coalesce "bus_dmaengine_t dmaengine" "uint16_t delay" +.Ft uint16_t +.Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine" +.Ft void +.Fn ioat_acquire "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_acquire_reserve "bus_dmaengine_t dmaengine" "uint32_t n" "int mflags" +.Ft void +.Fn ioat_release "bus_dmaengine_t dmaengine" +.Ft struct bus_dmadesc * +.Fo ioat_copy +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst" +.Fa "bus_addr_t src" +.Fa "bus_size_t len" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_copy_8k_aligned +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst1" +.Fa "bus_addr_t dst2" +.Fa "bus_addr_t src1" +.Fa "bus_addr_t src2" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_copy_crc +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst" +.Fa "bus_addr_t src" +.Fa "bus_size_t len" +.Fa "uint32_t *initialseed" +.Fa "bus_addr_t crcptr" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_crc +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t src" +.Fa "bus_size_t len" +.Fa "uint32_t *initialseed" +.Fa "bus_addr_t crcptr" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_blockfill +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst" +.Fa "uint64_t fillpattern" +.Fa "bus_size_t len" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * +.Fo ioat_null +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Sh DESCRIPTION +The +.Nm +driver provides a kernel API to a variety of DMA engines on some Intel server +platforms. +.Pp +There is a number of DMA channels per CPU package. +(Typically 4 or 8.) +Each may
svn commit: r300664 - head/lib/libcompat/4.3
Author: truckman Date: Wed May 25 07:26:22 2016 New Revision: 300664 URL: https://svnweb.freebsd.org/changeset/base/300664 Log: Fix Coverity CID 978183 Resource leak in rexec(). Close the socket if connect() fails to avoid leaking it. Reported by: Coverity CID: 978183 MFC after:1 week Modified: head/lib/libcompat/4.3/rexec.c Modified: head/lib/libcompat/4.3/rexec.c == --- head/lib/libcompat/4.3/rexec.c Wed May 25 07:14:52 2016 (r300663) +++ head/lib/libcompat/4.3/rexec.c Wed May 25 07:26:22 2016 (r300664) @@ -330,6 +330,7 @@ retry: goto retry; } perror(hp->h_name); + (void) close(s); return (-1); } port = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300665 - head/lib/libfetch
Author: truckman Date: Wed May 25 07:39:48 2016 New Revision: 300665 URL: https://svnweb.freebsd.org/changeset/base/300665 Log: Don't leak addrinfo in fetch_bind() Reported by: Coverity CID: 1225038 MFC after:1 week Modified: head/lib/libfetch/common.c Modified: head/lib/libfetch/common.c == --- head/lib/libfetch/common.c Wed May 25 07:26:22 2016(r300664) +++ head/lib/libfetch/common.c Wed May 25 07:39:48 2016(r300665) @@ -256,8 +256,11 @@ fetch_bind(int sd, int af, const char *a if ((err = getaddrinfo(addr, NULL, &hints, &res0)) != 0) return (-1); for (res = res0; res; res = res->ai_next) - if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) + if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) { + freeaddrinfo(res0); return (0); + } + freeaddrinfo(res0); return (-1); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300666 - head/lib/libfetch
Author: truckman Date: Wed May 25 07:43:32 2016 New Revision: 300666 URL: https://svnweb.freebsd.org/changeset/base/300666 Log: Call closedir() before returning from fetchListFile() to avoid a leak. Reported by: Coverity CID: 1016697 MFC after:1 week Modified: head/lib/libfetch/file.c Modified: head/lib/libfetch/file.c == --- head/lib/libfetch/file.cWed May 25 07:39:48 2016(r300665) +++ head/lib/libfetch/file.cWed May 25 07:43:32 2016(r300666) @@ -149,5 +149,6 @@ fetchListFile(struct url *u, const char fetch_add_entry(&ue, &size, &len, de->d_name, &us); } + closedir(dir); return (ue); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300667 - head/sys/dev/usb
Author: hselasky Date: Wed May 25 07:48:36 2016 New Revision: 300667 URL: https://svnweb.freebsd.org/changeset/base/300667 Log: Check for signals when locking the USB enumeration thread from userspace, so that USB applications can be killed if an enumeration thread should be stuck for various reasons. MFC after:1 week Modified: head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h Modified: head/sys/dev/usb/usb_dev.c == --- head/sys/dev/usb/usb_dev.c Wed May 25 07:43:32 2016(r300666) +++ head/sys/dev/usb/usb_dev.c Wed May 25 07:48:36 2016(r300667) @@ -228,7 +228,7 @@ usb_ref_device(struct usb_cdev_privdata * We need to grab the enumeration SX-lock before * grabbing the FIFO refs to avoid deadlock at detach! */ - crd->do_unlock = usbd_enum_lock(cpd->udev); + crd->do_unlock = usbd_enum_lock_sig(cpd->udev); mtx_lock(&usb_ref_lock); @@ -236,6 +236,12 @@ usb_ref_device(struct usb_cdev_privdata * Set "is_uref" after grabbing the default SX lock */ crd->is_uref = 1; + + /* check for signal */ + if (crd->do_unlock > 1) { + crd->do_unlock = 0; + goto error; + } } /* check if we are doing an open */ Modified: head/sys/dev/usb/usb_device.c == --- head/sys/dev/usb/usb_device.c Wed May 25 07:43:32 2016 (r300666) +++ head/sys/dev/usb/usb_device.c Wed May 25 07:48:36 2016 (r300667) @@ -2740,7 +2740,7 @@ usbd_device_attached(struct usb_device * /* * The following function locks enumerating the given USB device. If * the lock is already grabbed this function returns zero. Else a - * non-zero value is returned. + * a value of one is returned. */ uint8_t usbd_enum_lock(struct usb_device *udev) @@ -2759,6 +2759,27 @@ usbd_enum_lock(struct usb_device *udev) return (1); } +#if USB_HAVE_UGEN +/* + * This function is the same like usbd_enum_lock() except a value of + * 255 is returned when a signal is pending: + */ +uint8_t +usbd_enum_lock_sig(struct usb_device *udev) +{ + if (sx_xlocked(&udev->enum_sx)) + return (0); + if (sx_xlock_sig(&udev->enum_sx)) + return (255); + if (sx_xlock_sig(&udev->sr_sx)) { + sx_xunlock(&udev->enum_sx); + return (255); + } + mtx_lock(&Giant); + return (1); +} +#endif + /* The following function unlocks enumerating the given USB device. */ void Modified: head/sys/dev/usb/usb_device.h == --- head/sys/dev/usb/usb_device.h Wed May 25 07:43:32 2016 (r300666) +++ head/sys/dev/usb/usb_device.h Wed May 25 07:48:36 2016 (r300667) @@ -314,6 +314,9 @@ voidusb_set_device_state(struct usb_dev enum usb_dev_state usb_get_device_state(struct usb_device *); uint8_tusbd_enum_lock(struct usb_device *); +#if USB_HAVE_UGEN +uint8_tusbd_enum_lock_sig(struct usb_device *); +#endif void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300668 - stable/10/tools/tools/ioat
Author: mav Date: Wed May 25 08:09:14 2016 New Revision: 300668 URL: https://svnweb.freebsd.org/changeset/base/300668 Log: Fix build on stable/10. Modified: stable/10/tools/tools/ioat/Makefile Modified: stable/10/tools/tools/ioat/Makefile == --- stable/10/tools/tools/ioat/Makefile Wed May 25 07:48:36 2016 (r300667) +++ stable/10/tools/tools/ioat/Makefile Wed May 25 08:09:14 2016 (r300668) @@ -4,6 +4,7 @@ PROG= ioatcontrol MAN= ioatcontrol.8 CFLAGS+= -I${.CURDIR:H:H:H}/sys/dev/ioat WARNS?=6 -LIBADD=util +#LIBADD= util +LDADD= -lutil .include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300669 - head/usr.sbin/pmcstat
Author: ed Date: Wed May 25 08:45:03 2016 New Revision: 300669 URL: https://svnweb.freebsd.org/changeset/base/300669 Log: Make code compile when basename() is POSIX compliant. The POSIX basename() function is allowed to modify its input buffer, which means its argument is "char *". Pull a copy of the input string before computing the base. Reviewed by: jtl Differential Revision:https://reviews.freebsd.org/D6465 Modified: head/usr.sbin/pmcstat/pmcpl_gprof.c Modified: head/usr.sbin/pmcstat/pmcpl_gprof.c == --- head/usr.sbin/pmcstat/pmcpl_gprof.c Wed May 25 08:09:14 2016 (r300668) +++ head/usr.sbin/pmcstat/pmcpl_gprof.c Wed May 25 08:45:03 2016 (r300669) @@ -310,8 +310,9 @@ pmcstat_callgraph_do_gmon_arcs(void) void pmcpl_gmon_initimage(struct pmcstat_image *pi) { + const char *execpath; int count, nlen; - char *sn; + char *sn, *snbuf; char name[NAME_MAX]; /* @@ -321,9 +322,11 @@ pmcpl_gmon_initimage(struct pmcstat_imag * `basename(path)`+ "~" + NNN + ".gmon" till we get a free * entry. */ - if ((sn = basename(pmcstat_string_unintern(pi->pi_execpath))) == NULL) - err(EX_OSERR, "ERROR: Cannot process \"%s\"", - pmcstat_string_unintern(pi->pi_execpath)); + execpath = pmcstat_string_unintern(pi->pi_execpath); + if ((snbuf = strdup(execpath)) == NULL) + err(EX_OSERR, "ERROR: Cannot copy \"%s\"", execpath); + if ((sn = basename(snbuf)) == NULL) + err(EX_OSERR, "ERROR: Cannot process \"%s\"", execpath); nlen = strlen(sn); nlen = min(nlen, (int) (sizeof(name) - sizeof(".gmon"))); @@ -355,6 +358,7 @@ pmcpl_gmon_initimage(struct pmcstat_imag } } while (count > 0); } + free(snbuf); LIST_INIT(&pi->pi_gmlist); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300670 - head/sys/net
Author: n_hibma Date: Wed May 25 09:00:05 2016 New Revision: 300670 URL: https://svnweb.freebsd.org/changeset/base/300670 Log: Change net.link.log_promisc_mode_change to a read-only tunable PR: 166255 Submitted by: eugen.grosbein.net Obtained from:hselasky MFC after:3 days Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Wed May 25 08:45:03 2016(r300669) +++ head/sys/net/if.c Wed May 25 09:00:05 2016(r300670) @@ -115,7 +115,7 @@ SYSCTL_INT(_net_link, OID_AUTO, log_link /* Log promiscuous mode change events */ static int log_promisc_mode_change = 1; -SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RW, +SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RDTUN, &log_promisc_mode_change, 1, "log promiscuous mode change events"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300671 - in head/sys/compat/linuxkpi/common: include/linux src
Author: hselasky Date: Wed May 25 09:04:06 2016 New Revision: 300671 URL: https://svnweb.freebsd.org/changeset/base/300671 Log: Add checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can run after a panic(). This for example allows a LinuxKPI based graphics stack to receive prints during a panic. Obtained from:kmacy @ MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h head/sys/compat/linuxkpi/common/include/linux/wait.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h == --- head/sys/compat/linuxkpi/common/include/linux/sched.h Wed May 25 09:00:05 2016(r300670) +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Wed May 25 09:04:06 2016(r300671) @@ -91,7 +91,7 @@ CTASSERT(sizeof(((struct thread *)0)->td do { \ void *c;\ \ - if (cold) \ + if (cold || SCHEDULER_STOPPED())\ break; \ c = curthread; \ sleepq_lock(c); \ Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h == --- head/sys/compat/linuxkpi/common/include/linux/wait.hWed May 25 09:00:05 2016(r300670) +++ head/sys/compat/linuxkpi/common/include/linux/wait.hWed May 25 09:04:06 2016(r300671) @@ -31,6 +31,7 @@ #ifndef_LINUX_WAIT_H_ #define_LINUX_WAIT_H_ +#include #include #include #include @@ -81,6 +82,8 @@ do { \ void *c = &(q).wchan; \ if (!(cond)) { \ for (;;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ @@ -100,6 +103,8 @@ do { \ _error = 0; \ if (!(cond)) { \ for (; _error == 0;) { \ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ @@ -123,6 +128,8 @@ do { \ \ if (!(cond)) { \ for (; __rc == 0;) {\ + if (unlikely(SCHEDULER_STOPPED())) \ + break; \ sleepq_lock(c); \ if (cond) { \ sleepq_release(c); \ Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c == --- head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 09:00:05 2016(r300670) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 09:04:06 2016(r300671) @@ -1093,6 +1093,8 @@ linux_complete_common(struct completion long linux_wait_for_common(struct completion *c, int flags) { + if (unlikely(SCHEDULER_STOPPED())) + return (0); if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; @@ -1123,6 +1125,9 @@ linux_wait_for_timeout_common(struct com { long end = jiffies + timeout; + if (unlikely(SCHEDULER_STOPPED())) + return (0); + if (flags != 0) flags = SL
svn commit: r300673 - stable/10/sys/vm
Author: kib Date: Wed May 25 10:04:53 2016 New Revision: 300673 URL: https://svnweb.freebsd.org/changeset/base/300673 Log: MFC r300432: Giant is dropped by mi_startup() before passing the control to swapper. Modified: stable/10/sys/vm/vm_glue.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_glue.c == --- stable/10/sys/vm/vm_glue.c Wed May 25 10:02:14 2016(r300672) +++ stable/10/sys/vm/vm_glue.c Wed May 25 10:04:53 2016(r300673) @@ -732,8 +732,6 @@ faultin(p) * This swapin algorithm attempts to swap-in processes only if there * is enough space for them. Of course, if a process waits for a long * time, it will be swapped in anyway. - * - * Giant is held on entry. */ void swapper(void) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300674 - head/sys/arm/arm
Author: skra Date: Wed May 25 10:09:23 2016 New Revision: 300674 URL: https://svnweb.freebsd.org/changeset/base/300674 Log: Add more info about the issue fixed in r298460. Rephrase some sentences and fix grammar. No functional change. Suggested by: alc Reviewed by: alc Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c == --- head/sys/arm/arm/pmap-v6.c Wed May 25 10:04:53 2016(r300673) +++ head/sys/arm/arm/pmap-v6.c Wed May 25 10:09:23 2016(r300674) @@ -3302,10 +3302,16 @@ pmap_update_pte1_action(void *arg) * Change pte1 on current pmap. * Note that kernel pte1 must be changed on all pmaps. * - * By ARM ARM manual, the behaviour is UNPREDICABLE when two or more TLB - * entries map same VA. It's a problem when either promotion or demotion - * is being done. The pte1 update and appropriate TLB flush must be done - * atomically in general. + * According to the architecture reference manual published by ARM, + * the behaviour is UNPREDICTABLE when two or more TLB entries map the same VA. + * According to this manual, UNPREDICTABLE behaviours must never happen in + * a viable system. In contrast, on x86 processors, it is not specified which + * TLB entry mapping the virtual address will be used, but the MMU doesn't + * generate a bogus translation the way it does on Cortex-A8 rev 2 (Beaglebone + * Black). + * + * It's a problem when either promotion or demotion is being done. The pte1 + * update and appropriate TLB flush must be done atomically in general. */ static void pmap_change_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va, @@ -3329,8 +3335,9 @@ pmap_change_pte1(pmap_t pmap, pt1_entry_ * Use break-before-make approach for changing userland * mappings. It can cause L1 translation aborts on other * cores in SMP case. So, special treatment is implemented -* in pmap_fault(). Interrups are disabled here to make it -* without any interruption as quick as possible. +* in pmap_fault(). To reduce the likelihood that another core +* will be affected by the broken mapping, disable interrupts +* until the mapping change is completed. */ cspr = disable_interrupts(PSR_I | PSR_F); pte1_clear(pte1p); @@ -6355,9 +6362,9 @@ pmap_fault(pmap_t pmap, vm_offset_t far, PMAP_LOCK(pmap); #ifdef SMP /* -* Special treatment due to break-before-make approach done when +* Special treatment is due to break-before-make approach done when * pte1 is updated for userland mapping during section promotion or -* demotion. If not catched here, pmap_enter() can find a section +* demotion. If not caught here, pmap_enter() can find a section * mapping on faulting address. That is not allowed. */ if (idx == FAULT_TRAN_L1 && usermode && cp15_ats1cur_check(far) == 0) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300675 - head/contrib/elftoolchain/libdwarf
Author: br Date: Wed May 25 11:58:55 2016 New Revision: 300675 URL: https://svnweb.freebsd.org/changeset/base/300675 Log: Add relocation support for RISC-V. Reviewed by: emaste Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision:https://reviews.freebsd.org/D6559 Modified: head/contrib/elftoolchain/libdwarf/libdwarf.h head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Modified: head/contrib/elftoolchain/libdwarf/libdwarf.h == --- head/contrib/elftoolchain/libdwarf/libdwarf.h Wed May 25 10:09:23 2016(r300674) +++ head/contrib/elftoolchain/libdwarf/libdwarf.h Wed May 25 11:58:55 2016(r300675) @@ -440,6 +440,7 @@ enum Dwarf_ISA { DW_ISA_X86, DW_ISA_X86_64, DW_ISA_AARCH64, + DW_ISA_RISCV, DW_ISA_MAX }; Modified: head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c == --- head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Wed May 25 10:09:23 2016(r300674) +++ head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Wed May 25 11:58:55 2016(r300675) @@ -54,6 +54,8 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, return (R_ARM_ABS32); case DW_ISA_MIPS: return (is64 ? R_MIPS_64 : R_MIPS_32); + case DW_ISA_RISCV: + return (is64 ? R_RISCV_64 : R_RISCV_32); case DW_ISA_IA64: return (is64 ? R_IA_64_DIR64LSB : R_IA_64_DIR32LSB); default: @@ -106,6 +108,12 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, D else if (rel_type == R_MIPS_64) return (8); break; + case EM_RISCV: + if (rel_type == R_RISCV_32) + return (4); + else if (rel_type == R_RISCV_64) + return (8); + break; case EM_IA_64: if (rel_type == R_IA_64_SECREL32LSB) return (4); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300676 - in head/sys: dev/cxgbe/iw_cxgbe dev/mlx5/mlx5_core ofed/drivers/infiniband/core ofed/drivers/infiniband/debug ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/hw/mthca ...
Author: hselasky Date: Wed May 25 12:03:21 2016 New Revision: 300676 URL: https://svnweb.freebsd.org/changeset/base/300676 Log: Prepare for activation of LinuxKPI module parameters as read-only tunable SYSCTL's. Linux module parameters are associated with the module they belong to. FreeBSD does not share this concept of a parent module. Instead add macros which define the prefix to use for the module parameters in the LinuxKPI consumers. While at it convert all "bool" LinuxKPI module parameters to "byte" type, because we don't have a "bool" type of SYSCTL in FreeBSD. Sponsored by: Mellanox Technologies MFC after:1 week Modified: head/sys/dev/cxgbe/iw_cxgbe/provider.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/ofed/drivers/infiniband/core/cma.c head/sys/ofed/drivers/infiniband/core/mad.c head/sys/ofed/drivers/infiniband/core/multicast.c head/sys/ofed/drivers/infiniband/core/umem.c head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c head/sys/ofed/drivers/infiniband/debug/memtrack.c head/sys/ofed/drivers/infiniband/hw/mlx4/main.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_catas.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h head/sys/ofed/drivers/infiniband/util/madeye.c head/sys/ofed/drivers/net/mlx4/catas.c head/sys/ofed/drivers/net/mlx4/en_main.c head/sys/ofed/drivers/net/mlx4/en_tx.c head/sys/ofed/drivers/net/mlx4/fw.c head/sys/ofed/drivers/net/mlx4/main.c head/sys/ofed/drivers/net/mlx4/port.c Modified: head/sys/dev/cxgbe/iw_cxgbe/provider.c == --- head/sys/dev/cxgbe/iw_cxgbe/provider.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/dev/cxgbe/iw_cxgbe/provider.c Wed May 25 12:03:21 2016 (r300676) @@ -32,6 +32,8 @@ #include __FBSDID("$FreeBSD$"); +#defineLINUXKPI_PARAM_PREFIX iw_cxgbe_ + #include "opt_inet.h" #ifdef TCP_OFFLOAD Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed May 25 12:03:21 2016 (r300676) @@ -25,6 +25,8 @@ * $FreeBSD$ */ +#defineLINUXKPI_PARAM_PREFIX mlx5_ + #include #include #include Modified: head/sys/ofed/drivers/infiniband/core/cma.c == --- head/sys/ofed/drivers/infiniband/core/cma.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/core/cma.c Wed May 25 12:03:21 2016 (r300676) @@ -34,6 +34,8 @@ * SOFTWARE. */ +#defineLINUXKPI_PARAM_PREFIX ibcore_ + #include #include #include Modified: head/sys/ofed/drivers/infiniband/core/mad.c == --- head/sys/ofed/drivers/infiniband/core/mad.c Wed May 25 11:58:55 2016 (r300675) +++ head/sys/ofed/drivers/infiniband/core/mad.c Wed May 25 12:03:21 2016 (r300676) @@ -33,6 +33,9 @@ * SOFTWARE. * */ + +#defineLINUXKPI_PARAM_PREFIX ibcore_ + #include #include #include Modified: head/sys/ofed/drivers/infiniband/core/multicast.c == --- head/sys/ofed/drivers/infiniband/core/multicast.c Wed May 25 11:58:55 2016(r300675) +++ head/sys/ofed/drivers/infiniband/core/multicast.c Wed May 25 12:03:21 2016(r300676) @@ -30,6 +30,8 @@ * SOFTWARE. */ +#defineLINUXKPI_PARAM_PREFIX ibcore_ + #include #include #include Modified: head/sys/ofed/drivers/infiniband/core/umem.c == --- head/sys/ofed/drivers/infiniband/core/umem.cWed May 25 11:58:55 2016(r300675) +++ head/sys/ofed/drivers/infiniband/core/umem.cWed May 25 12:03:21 2016(r300676) @@ -32,6 +32,8 @@ * SOFTWARE. */ +#defineLINUXKPI_PARAM_PREFIX ibcore_ + #include #include #include Modified: head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c == --- head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Wed May 25 11:58:55 2016(r300675) +++ head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Wed May 25 12:03:21 2016(r300676) @@ -33,6 +33,8 @@ * SOFTWARE. */ +#defineLINUXKPI_PARAM_PREFIX ibcore_ + #include #include #include Modified: head/sys/ofed/drivers/infiniband/debug/memtrack.c == --- head/sys/ofed/drivers/infiniband/debug/memtrack.c Wed M
svn commit: r300677 - in head/sys/compat/linuxkpi/common: include/linux src
Author: hselasky Date: Wed May 25 12:12:14 2016 New Revision: 300677 URL: https://svnweb.freebsd.org/changeset/base/300677 Log: Implement Linux module parameters as read-only tunable SYSCTLs. Bool module parameters are no longer supported, because there is no equivalent in FreeBSD. There are two macros available which control the behaviour of the LinuxKPI module parameters: - LINUXKPI_PARAM_PARENT allows the consumer to set the SYSCTL parent where the modules parameters will be created. - LINUXKPI_PARAM_PREFIX defines a parameter name prefix, which is added to all created module parameters. Sponsored by: Mellanox Technologies MFC after:1 week Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h == --- head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Wed May 25 12:03:21 2016(r300676) +++ head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Wed May 25 12:12:14 2016(r300677) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,204 +31,84 @@ #ifndef_LINUX_MODULEPARAM_H_ #define_LINUX_MODULEPARAM_H_ -#include - -/* - * These are presently not hooked up to anything. In linux the parameters - * can be set when modules are loaded. On FreeBSD these could be mapped - * to kenv in the future. - */ -struct kernel_param; - -typedef int (*param_set_fn)(const char *val, struct kernel_param *kp); -typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); - -struct kernel_param { - const char *name; - u16 perm; - u16 flags; - param_set_fnset; - param_get_fnget; - union { - void*arg; - struct kparam_string*str; - struct kparam_array *arr; - } un; -}; - -#defineKPARAM_ISBOOL 2 - -struct kparam_string { - unsigned int maxlen; - char *string; -}; - -struct kparam_array -{ - unsigned intmax; - unsigned int*num; - param_set_fnset; - param_get_fnget; - unsigned intelemsize; - void*elem; -}; - -static inline void -param_sysinit(struct kernel_param *param) -{ -} - -#definemodule_param_call(name, set, get, arg, perm) \ - static struct kernel_param __param_##name = \ - { #name, perm, 0, set, get, { arg } }; \ - SYSINIT(name##_param_sysinit, SI_SUB_DRIVERS, SI_ORDER_FIRST, \ - param_sysinit, &__param_##name); - -#definemodule_param_string(name, string, len, perm) - -#definemodule_param_named(name, var, type, mode) \ - module_param_call(name, param_set_##type, param_get_##type, &var, mode) - -#definemodule_param(var, type, mode) \ - module_param_named(var, var, type, mode) - -#define module_param_array(var, type, addr_argc, mode) \ -module_param_named(var, var, type, mode) - -#defineMODULE_PARM_DESC(name, desc) - -static inline int -param_set_byte(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_byte(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_short(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_short(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_ushort(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_ushort(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_int(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_int(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_uint(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_uint(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_long(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline int -param_get_long(char *buffer, struct kernel_param *kp) -{ - - return 0; -} - - -static inline int -param_set_ulong(const char *val, struct kernel_param *kp) -{ - - return 0; -} - -static inline i
svn commit: r300678 - head/usr.bin/whois
Author: fanf Date: Wed May 25 13:09:06 2016 New Revision: 300678 URL: https://svnweb.freebsd.org/changeset/base/300678 Log: Send whois queries for gov.uk names to JANET. Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c == --- head/usr.bin/whois/whois.c Wed May 25 12:12:14 2016(r300677) +++ head/usr.bin/whois/whois.c Wed May 25 13:09:06 2016(r300678) @@ -101,6 +101,7 @@ static struct { { "-RIPE", RNICHOST }, /* Nominet's whois server doesn't return referrals to JANET */ { ".ac.uk", "ac.uk" QNICHOST_TAIL }, + { ".gov.uk", "ac.uk" QNICHOST_TAIL }, { "", IANAHOST }, /* default */ { NULL, NULL } /* safety belt */ }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299393 - in head: . share/mk
On 05/11/16 00:32, John Baldwin wrote: Author: jhb Date: Tue May 10 22:32:23 2016 New Revision: 299393 URL: https://svnweb.freebsd.org/changeset/base/299393 Log: Change the default installation directory for modules to /boot/modules. Kernel installs always override KMODDIR when installing modules, so this default setting is only used for standalone module builds. Many out-of-tree modules manually override KMODDIR already to avoid placing modules in /boot/kernel. This now makes that behavior the default. Discussed on: arch@ Reviewed by: imp Relnotes: yes Modified: head/UPDATING head/share/mk/bsd.own.mk Modified: head/UPDATING == --- head/UPDATING Tue May 10 22:28:06 2016(r299392) +++ head/UPDATING Tue May 10 22:32:23 2016(r299393) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160510: + Kernel modules compiled outside of a kernel build now default to + installing to /boot/modules instead of /boot/kernel. Many kernel + modules built this way (such as those in ports) already overrode + KMODDIR explicitly to install into /boot/modules. However, + manually building and installing a module from /sys/modules will + now install to /boot/modules instead of /boot/kernel. + 20160414: The CAM I/O scheduler has been committed to the kernel. There should be no user visible impact. This does enable NCQ Trim on ada SSDs. While the Modified: head/share/mk/bsd.own.mk == --- head/share/mk/bsd.own.mkTue May 10 22:28:06 2016(r299392) +++ head/share/mk/bsd.own.mkTue May 10 22:32:23 2016(r299393) @@ -165,11 +165,7 @@ BINGRP?= wheel BINMODE?= 555 NOBINMODE?=444 -.if defined(MODULES_WITH_WORLD) KMODDIR?= /boot/modules -.else -KMODDIR?= /boot/kernel -.endif KMODOWN?= ${BINOWN} KMODGRP?= ${BINGRP} KMODMODE?= ${BINMODE} Just a small nit: There is a comment in bsd.own.mk which needs updating too: # # KMODDIR Base path for loadable kernel modules # (see kld(4)). [/boot/kernel] --HPS ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300679 - head/sys/netinet
Author: tuexen Date: Wed May 25 13:48:26 2016 New Revision: 300679 URL: https://svnweb.freebsd.org/changeset/base/300679 Log: Count packets as not being delivered only if they are neither processed by a kernel handler nor by a raw socket. MFC after:1 week Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c == --- head/sys/netinet/raw_ip.c Wed May 25 13:09:06 2016(r300678) +++ head/sys/netinet/raw_ip.c Wed May 25 13:48:26 2016(r300679) @@ -132,6 +132,8 @@ int (*ip_rsvp_vif)(struct socket *, stru void (*ip_rsvp_force_done)(struct socket *); #endif /* INET */ +extern struct protosw inetsw[]; + u_long rip_sendspace = 9216; SYSCTL_ULONG(_net_inet_raw, OID_AUTO, maxdgram, CTLFLAG_RW, &rip_sendspace, 0, "Maximum outgoing raw IP datagram size"); @@ -411,9 +413,11 @@ rip_input(struct mbuf **mp, int *offp, i IPSTAT_INC(ips_delivered); INP_RUNLOCK(last); } else { + if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) { + IPSTAT_INC(ips_noproto); + IPSTAT_DEC(ips_delivered); + } m_freem(m); - IPSTAT_INC(ips_noproto); - IPSTAT_DEC(ips_delivered); } return (IPPROTO_DONE); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300680 - in head: contrib/netbsd-tests/lib/libc/gen contrib/netbsd-tests/lib/libc/sys lib/libc/riscv lib/libc/riscv/sys
Author: br Date: Wed May 25 14:08:21 2016 New Revision: 300680 URL: https://svnweb.freebsd.org/changeset/base/300680 Log: Remove legacy brk and sbrk from RISC-V. Discussed with: andrew Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Deleted: head/lib/libc/riscv/sys/brk.S head/lib/libc/riscv/sys/sbrk.S Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c head/lib/libc/riscv/Symbol.map head/lib/libc/riscv/sys/Makefile.inc Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c == --- head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Wed May 25 13:48:26 2016(r300679) +++ head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Wed May 25 14:08:21 2016(r300680) @@ -111,7 +111,8 @@ ATF_TC_BODY(seekdir_basic, tc) closedir(dp); } -#ifndef __aarch64__ /* There is no sbrk on AArch64 */ +/* There is no sbrk on AArch64 and RISC-V */ +#if !defined(__aarch64__) && !defined(__riscv__) ATF_TC(telldir_leak); ATF_TC_HEAD(telldir_leak, tc) { @@ -161,7 +162,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, seekdir_basic); -#ifndef __aarch64__ +#if !defined(__aarch64__) && !defined(__riscv__) ATF_TP_ADD_TC(tp, telldir_leak); #endif Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cWed May 25 13:48:26 2016(r300679) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cWed May 25 14:08:21 2016(r300680) @@ -176,7 +176,7 @@ ATF_TC_BODY(mlock_err, tc) unsigned long vmin = 0; size_t len = sizeof(vmin); #endif -#ifndef __aarch64__ +#if !defined(__aarch64__) && !defined(__riscv__) void *invalid_ptr; #endif int null_errno = ENOMEM;/* error expected for NULL */ @@ -214,7 +214,8 @@ ATF_TC_BODY(mlock_err, tc) errno = 0; ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); -#ifndef __aarch64__ /* There is no sbrk on AArch64 */ +/* There is no sbrk on AArch64 and RISC-V */ +#if !defined(__aarch64__) && !defined(__riscv__) /* * Try to create a pointer to an unmapped page - first after current * brk will likely do. Modified: head/lib/libc/riscv/Symbol.map == --- head/lib/libc/riscv/Symbol.map Wed May 25 13:48:26 2016 (r300679) +++ head/lib/libc/riscv/Symbol.map Wed May 25 14:08:21 2016 (r300680) @@ -28,8 +28,6 @@ FBSD_1.0 { ntohl; ntohs; vfork; - brk; - sbrk; makecontext; }; Modified: head/lib/libc/riscv/sys/Makefile.inc == --- head/lib/libc/riscv/sys/Makefile.incWed May 25 13:48:26 2016 (r300679) +++ head/lib/libc/riscv/sys/Makefile.incWed May 25 14:08:21 2016 (r300680) @@ -3,10 +3,8 @@ SRCS+= trivial-vdso_tc.c #MDASM= ptrace.S -MDASM= brk.S \ - cerror.S \ +MDASM= cerror.S \ pipe.S \ - sbrk.S \ shmat.S \ sigreturn.S \ syscall.S \ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300681 - stable/10/usr.sbin/camdd
Author: ken Date: Wed May 25 14:30:33 2016 New Revision: 300681 URL: https://svnweb.freebsd.org/changeset/base/300681 Log: MFC r300224: r300224 | ken | 2016-05-19 13:13:43 -0600 (Thu, 19 May 2016) | 12 lines Adjust a couple of error cases in camdd(8). usr.sbin/camdd/camdd.c: In camdd_probe_file(), fix an error case after fstat where we were bailing out and leaving two lines of cleanup code unexecuted. Instead, just goto bailout_error. In camdd_probe_pass(), fail if the sector size is 0. Sponsored by: Spectra Logic Modified: stable/10/usr.sbin/camdd/camdd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/camdd/camdd.c == --- stable/10/usr.sbin/camdd/camdd.cWed May 25 14:08:21 2016 (r300680) +++ stable/10/usr.sbin/camdd/camdd.cWed May 25 14:30:33 2016 (r300681) @@ -1079,9 +1079,7 @@ camdd_probe_file(int fd, struct camdd_io retval = fstat(fd, &file_dev->sb); if (retval != 0) { warn("Cannot stat %s", dev->device_name); - goto bailout; - camdd_free_dev(dev); - dev = NULL; + goto bailout_error; } if (S_ISREG(file_dev->sb.st_mode)) { file_dev->file_type = CAMDD_FILE_REG; @@ -1383,6 +1381,11 @@ camdd_probe_pass(struct cam_device *cam_ block_len = scsi_4btoul(rcaplong.length); rcap_done: + if (block_len == 0) { + warnx("Sector size for %s%u is 0, cannot continue", + cam_dev->device_name, cam_dev->dev_unit_num); + goto bailout_error; + } bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300682 - in stable/10: lib/libmt usr.bin/mt
Author: ken Date: Wed May 25 15:10:07 2016 New Revision: 300682 URL: https://svnweb.freebsd.org/changeset/base/300682 Log: MFC r300327: r300327 | ken | 2016-05-20 13:30:52 -0600 (Fri, 20 May 2016) | 11 lines Add the density code for LTO-7 to libmt and the mt(1) man page. The density code and bits per mm values were obtained from an actual drive density report. The number of tracks were obtained from an LTO-7 hardware announcement on IBM's web site. Sponsored by: Spectra Logic Modified: stable/10/lib/libmt/mtlib.c stable/10/usr.bin/mt/mt.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libmt/mtlib.c == --- stable/10/lib/libmt/mtlib.c Wed May 25 14:30:33 2016(r300681) +++ stable/10/lib/libmt/mtlib.c Wed May 25 15:10:07 2016(r300682) @@ -643,6 +643,7 @@ static struct densities { { 0x55, 20670, 525018, "3592A5 (unencrypted)" }, { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, + { 0x5C, 19107, 485318, "LTO-7" }, { 0x71, 11800, 299720, "3592A1 (encrypted)" }, { 0x72, 11800, 299720, "3592A2 (encrypted)" }, { 0x73, 13452, 341681, "3592A3 (encrypted)" }, Modified: stable/10/usr.bin/mt/mt.1 == --- stable/10/usr.bin/mt/mt.1 Wed May 25 14:30:33 2016(r300681) +++ stable/10/usr.bin/mt/mt.1 Wed May 25 15:10:07 2016(r300682) @@ -29,7 +29,7 @@ .\"@(#)mt.18.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 3, 2014 +.Dd May 20, 2016 .Dt MT 1 .Os .Sh NAME @@ -517,6 +517,7 @@ Value WidthTracksDensity 0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted) 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 +0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 0x71 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (encrypted) 0x72 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (encrypted) 0x73 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (encrypted) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300683 - head/lib/libc/regex
Author: pfg Date: Wed May 25 15:35:23 2016 New Revision: 300683 URL: https://svnweb.freebsd.org/changeset/base/300683 Log: libc: regexec(3) adjustment. Change the behavior of when REG_STARTEND is combined with REG_NOTBOL. From the original posting[1]: "Enable the assumption that pmatch[0].rm_so is a continuation offset to a string and allows us to do a proper assessment of the character in regards to it's word position ('^' or '\<'), without risking going into unallocated memory." This change makes us similar to how glibc handles REG_STARTEND | REG_NOTBOL, and is closely related to a soon-to-land fix to sed. Special thanks to Martijn van Duren and Ingo Schwarze for working out some consistent behaviour. Differential Revision:https://reviews.freebsd.org/D6257 Taken from: openbsd-tech 2016-05-24 [1] (Martijn van Duren) Relnotes: yes MFC after:1 month Modified: head/lib/libc/regex/engine.c head/lib/libc/regex/regex.3 Modified: head/lib/libc/regex/engine.c == --- head/lib/libc/regex/engine.cWed May 25 15:10:07 2016 (r300682) +++ head/lib/libc/regex/engine.cWed May 25 15:35:23 2016 (r300683) @@ -786,7 +786,7 @@ fast( struct match *m, ASSIGN(fresh, st); SP("start", st, *p); coldp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* @@ -891,7 +891,7 @@ slow( struct match *m, SP("sstart", st, *p); st = step(m->g, startst, stopst, st, NOTHING, st); matchp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* Modified: head/lib/libc/regex/regex.3 == --- head/lib/libc/regex/regex.3 Wed May 25 15:10:07 2016(r300682) +++ head/lib/libc/regex/regex.3 Wed May 25 15:35:23 2016(r300683) @@ -32,7 +32,7 @@ .\"@(#)regex.3 8.4 (Berkeley) 3/20/94 .\" $FreeBSD$ .\" -.Dd August 17, 2005 +.Dd May 25, 2016 .Dt REGEX 3 .Os .Sh NAME @@ -235,11 +235,16 @@ The argument is the bitwise OR of zero or more of the following flags: .Bl -tag -width REG_STARTEND .It Dv REG_NOTBOL -The first character of -the string -is not the beginning of a line, so the -.Ql ^\& -anchor should not match before it. +The first character of the string is treated as the continuation +of a line. +This means that the anchors +.Ql ^\& , +.Ql [[:<:]] , +and +.Ql \e< +do not match before it; but see +.Dv REG_STARTEND +below. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_NOTEOL @@ -247,19 +252,16 @@ The NUL terminating the string does not end a line, so the .Ql $\& -anchor should not match before it. +anchor does not match before it. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_STARTEND The string is considered to start at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_so -and to have a terminating NUL located at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_eo -(there need not actually be a NUL at that location), +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_so +and to end before the byte located at +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_eo , regardless of the value of .Fa nmatch . See below for the definition of @@ -271,13 +273,37 @@ compatible with but not specified by .St -p1003.2 , and should be used with caution in software intended to be portable to other systems. -Note that a non-zero -.Va rm_so -does not imply -.Dv REG_NOTBOL ; -.Dv REG_STARTEND -affects only the location of the string, -not how it is matched. +.Pp +Without +.Dv REG_NOTBOL , +the position +.Fa rm_so +is considered the beginning of a line, such that +.Ql ^ +matches before it, and the beginning of a word if there is a word +character at this position, such that +.Ql [[:<:]] +and +.Ql \e< +match before it. +.Pp +With +.Dv REG_NOTBOL , +the character at position +.Fa rm_so +is treated as the continuation of a line, and if +.Fa rm_so +is greater than 0, the preceding character is taken into consideration. +If the preceding character is a newline and the regular expression was compiled +with +.Dv REG_NEWLINE , +.Ql ^ +matches before the string; if the preceding character is not a word character +but the string starts with a word character, +.Ql [[:<:]] +and +.Ql \e< +match before the string. .El .Pp See ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300684 - head/usr.bin/sed
Author: pfg Date: Wed May 25 15:42:39 2016 New Revision: 300684 URL: https://svnweb.freebsd.org/changeset/base/300684 Log: sed: convert sed to use REG_STARTEND more explicitly. Summarizing the findings in the OpenBSD list: This solves a reproduceable issue with very recent Mesa where REG_NOTBOL combined with a match at the begin of the string causes our regex library to treat the word as not begin of word. Thanks to Martijn van Duren and Ingo Schwarze for taking the time to solve this in the least invasive way. PR: 209352, 209387 Taken from: openbsd-tech (Martijn van Duren) MFC after:1 month Modified: head/usr.bin/sed/process.c Modified: head/usr.bin/sed/process.c == --- head/usr.bin/sed/process.c Wed May 25 15:35:23 2016(r300683) +++ head/usr.bin/sed/process.c Wed May 25 15:42:39 2016(r300684) @@ -71,7 +71,8 @@ static inline int applies(struct s_comm static void do_tr(struct s_tr *); static void flush_appends(void); static void lputs(char *, size_t); -static int regexec_e(regex_t *, const char *, int, int, size_t); +static int regexec_e(regex_t *, const char *, int, int, size_t, +size_t); static void regsub(SPACE *, char *, char *); static int substitute(struct s_command *); @@ -281,7 +282,7 @@ new:if (!nflag && !pd) * (lastline, linenumber, ps). */ #defineMATCH(a) \ - ((a)->type == AT_RE ? regexec_e((a)->u.r, ps, 0, 1, psl) : \ + ((a)->type == AT_RE ? regexec_e((a)->u.r, ps, 0, 1, 0, psl) : \ (a)->type == AT_LINE ? linenum == (a)->u.l : lastline()) /* @@ -381,6 +382,7 @@ substitute(struct s_command *cp) regex_t *re; regoff_t slen; int lastempty, n; + size_t le = 0; char *s; s = ps; @@ -392,7 +394,7 @@ substitute(struct s_command *cp) linenum, fname, cp->u.s->maxbref); } } - if (!regexec_e(re, s, 0, 0, psl)) + if (!regexec_e(re, s, 0, 0, 0, psl)) return (0); SS.len = 0; /* Clean substitute space. */ @@ -402,28 +404,30 @@ substitute(struct s_command *cp) do { /* Copy the leading retained string. */ - if (n <= 1 && match[0].rm_so) - cspace(&SS, s, match[0].rm_so, APPEND); + if (n <= 1 && match[0].rm_so - le) + cspace(&SS, s, match[0].rm_so - le, APPEND); /* Skip zero-length matches right after other matches. */ - if (lastempty || match[0].rm_so || + if (lastempty || (match[0].rm_so - le) || match[0].rm_so != match[0].rm_eo) { if (n <= 1) { /* Want this match: append replacement. */ - regsub(&SS, s, cp->u.s->new); + regsub(&SS, ps, cp->u.s->new); if (n == 1) n = -1; } else { /* Want a later match: append original. */ - if (match[0].rm_eo) - cspace(&SS, s, match[0].rm_eo, APPEND); + if (match[0].rm_eo - le) + cspace(&SS, s, match[0].rm_eo - le, + APPEND); n--; } } /* Move past this match. */ - s += match[0].rm_eo; - slen -= match[0].rm_eo; + s += (match[0].rm_eo - le); + slen -= (match[0].rm_eo - le); + le = match[0].rm_eo; /* * After a zero-length match, advance one byte, @@ -434,13 +438,15 @@ substitute(struct s_command *cp) slen = -1; else slen--; - if (*s != '\0') + if (*s != '\0') { cspace(&SS, s++, 1, APPEND); + le++; + } lastempty = 1; } else lastempty = 0; - } while (n >= 0 && slen >= 0 && regexec_e(re, s, REG_NOTBOL, 0, slen)); + } while (n >= 0 && slen >= 0 && regexec_e(re, ps, 0, 0, le, psl)); /* Did not find the requested number of matches. */ if (n > 1) @@ -652,7 +658,7 @@ lputs(char *s, size_t len) static int regexec_e(regex_t *preg, const char *string, int
svn commit: r300685 - head/sbin/camcontrol
Author: truckman Date: Wed May 25 15:43:01 2016 New Revision: 300685 URL: https://svnweb.freebsd.org/changeset/base/300685 Log: Fix a couple of new instances of a false positive Coverity buffer overflow defect. Use the new CCB_CLEAR_ALL_EXCEPT_HDR() macro instead of the calling bzero() on the pointer to the header used as an array and indexed by 1. Don't leak a buffer after executing "goto restart_report" by overwriting its pointer with the results of another calloc(). Be sure to clear the buffer before reusing it. (CID 1356042) Reported by: Coverity CID: 1356022, 1356034, 1356023, 1356035, 1356042 Reviewed by: ken Modified: head/sbin/camcontrol/epc.c head/sbin/camcontrol/zone.c Modified: head/sbin/camcontrol/epc.c == --- head/sbin/camcontrol/epc.c Wed May 25 15:42:39 2016(r300684) +++ head/sbin/camcontrol/epc.c Wed May 25 15:43:01 2016(r300685) @@ -633,8 +633,7 @@ epc(struct cam_device *device, int argc, goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(ccb); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { Modified: head/sbin/camcontrol/zone.c == --- head/sbin/camcontrol/zone.c Wed May 25 15:42:39 2016(r300684) +++ head/sbin/camcontrol/zone.c Wed May 25 15:43:01 2016(r300685) @@ -347,8 +347,7 @@ zone(struct cam_device *device, int argc goto bailout; } - bzero(&(&ccb->ccb_h)[1], - sizeof(union ccb) - sizeof(struct ccb_hdr)); + CCB_CLEAR_ALL_EXCEPT_HDR(ccb); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { @@ -484,7 +483,8 @@ restart_report: sector_count = ZAC_ATA_SECTOR_COUNT(alloc_len); protocol = AP_PROTO_DMA; } else { - cdb_storage = calloc(cdb_storage_len, 1); + if (cdb_storage == NULL) + cdb_storage = calloc(cdb_storage_len, 1); if (cdb_storage == NULL) err(1, "couldn't allocate memory"); @@ -662,6 +662,8 @@ restart_report: if (zp_status == ZONE_PRINT_MORE_DATA) { bzero(ccb, sizeof(*ccb)); first_pass = 0; + if (cdb_storage != NULL) + bzero(cdb_storage, cdb_storage_len); goto restart_report; } else if (zp_status == ZONE_PRINT_ERROR) error = 1; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300686 - head/sbin/camcontrol
Author: truckman Date: Wed May 25 15:49:29 2016 New Revision: 300686 URL: https://svnweb.freebsd.org/changeset/base/300686 Log: Fix a couple of Coverity Unintended sign extension sign extension defects. When shifting an unsigned byte into the upper 8 bits of an int and the resulting value is greater than 0x7FF, the result will be sign extended when converting to a 64 bit unsigned long. Fix by casting to (uint64_t) before the shift. Reported by: Coverity CID: 1356044, 1356045 Reviewed by: ken Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Wed May 25 15:43:01 2016 (r300685) +++ head/sbin/camcontrol/camcontrol.c Wed May 25 15:49:29 2016 (r300686) @@ -5188,7 +5188,7 @@ get_ata_status(struct cam_device *dev, u desc->count_7_0; *lba = ((uint64_t)desc->lba_47_40 << 40) | ((uint64_t)desc->lba_39_32 << 32) | - (desc->lba_31_24 << 24) | + ((uint64_t)desc->lba_31_24 << 24) | (desc->lba_23_16 << 16) | (desc->lba_15_8 << 8) | desc->lba_7_0; @@ -5249,7 +5249,7 @@ get_ata_status(struct cam_device *dev, u (res->lba_low); if (res->flags & CAM_ATAIO_48BIT) { *count |= (res->sector_count_exp << 8); - *lba |= (res->lba_low_exp << 24) | + *lba |= ((uint64_t)res->lba_low_exp << 24) | ((uint64_t)res->lba_mid_exp << 32) | ((uint64_t)res->lba_high_exp << 40); } else { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r300685 - head/sbin/camcontrol
On 25 May, To: src-committ...@freebsd.org wrote: > Author: truckman > Date: Wed May 25 15:43:01 2016 > New Revision: 300685 > URL: https://svnweb.freebsd.org/changeset/base/300685 > > Log: > Fix a couple of new instances of a false positive Coverity buffer > overflow defect. Use the new CCB_CLEAR_ALL_EXCEPT_HDR() macro > instead of the calling bzero() on the pointer to the header used > as an array and indexed by 1. > > Don't leak a buffer after executing "goto restart_report" by > overwriting its pointer with the results of another calloc(). > Be sure to clear the buffer before reusing it. (CID 1356042) > > Reported by:Coverity > CID:1356022, 1356034, 1356023, 1356035, 1356042 > Reviewed by:ken Differential Revision: https://reviews.freebsd.org/D6558 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r300686 - head/sbin/camcontrol
On 25 May, To: src-committ...@freebsd.org wrote: > Author: truckman > Date: Wed May 25 15:49:29 2016 > New Revision: 300686 > URL: https://svnweb.freebsd.org/changeset/base/300686 > > Log: > Fix a couple of Coverity Unintended sign extension sign extension > defects. When shifting an unsigned byte into the upper 8 bits of > an int and the resulting value is greater than 0x7FF, the result > will be sign extended when converting to a 64 bit unsigned long. > Fix by casting to (uint64_t) before the shift. > > Reported by:Coverity > CID:1356044, 1356045 > Reviewed by:ken Differential Revision: https://reviews.freebsd.org/D6557 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300687 - head/sys/netinet
Author: tuexen Date: Wed May 25 15:54:21 2016 New Revision: 300687 URL: https://svnweb.freebsd.org/changeset/base/300687 Log: Send an ICMP packet indicating destination unreachable/protocol unreachable if we don't handle the packet in the kernel and not in userspace. MFC after:1 week Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c == --- head/sys/netinet/raw_ip.c Wed May 25 15:49:29 2016(r300686) +++ head/sys/netinet/raw_ip.c Wed May 25 15:54:21 2016(r300687) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef IPSEC #include @@ -416,8 +417,10 @@ rip_input(struct mbuf **mp, int *offp, i if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) { IPSTAT_INC(ips_noproto); IPSTAT_DEC(ips_delivered); + icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PROTOCOL, 0, 0); + } else { + m_freem(m); } - m_freem(m); } return (IPPROTO_DONE); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300689 - head/lib/libc/riscv/sys
Author: br Date: Wed May 25 16:38:10 2016 New Revision: 300689 URL: https://svnweb.freebsd.org/changeset/base/300689 Log: Do not generate code for sbrk syscall -- sbrk support was removed. Pointed out by: andrew Modified: head/lib/libc/riscv/sys/Makefile.inc Modified: head/lib/libc/riscv/sys/Makefile.inc == --- head/lib/libc/riscv/sys/Makefile.incWed May 25 16:04:50 2016 (r300688) +++ head/lib/libc/riscv/sys/Makefile.incWed May 25 16:38:10 2016 (r300689) @@ -15,6 +15,7 @@ NOASM=break.o \ exit.o \ getlogin.o \ openbsd_poll.o \ + sbrk.o \ sstk.o \ vfork.o \ yield.o ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300691 - head/libexec/rtld-elf
Author: kib Date: Wed May 25 18:10:44 2016 New Revision: 300691 URL: https://svnweb.freebsd.org/changeset/base/300691 Log: Fix issues found by Coverity in the rtld-elf.c:gethints(). Check that the dirlist path string specification does not cause overflow and is fully contained in the hints file. Check that the dirlist string is nul-terminated. Make 'hdr' static variable, so that hdr.dirlistlen is available when hints cached value is used on next function calls. Reset hdr.dirlistlen to zero if error was detected, so that allocations use reasonable size. Use 'hints', and not 'p' in the body, since p is only initialized on the first call. Reported and reviewed by: truckman (previous version) Sponsored by: The FreeBSD Foundation CIDs: 1006503, 1006504, 1006676, 1008488, 1007263 MFC after:2 weeks Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cWed May 25 17:10:10 2016 (r300690) +++ head/libexec/rtld-elf/rtld.cWed May 25 18:10:44 2016 (r300691) @@ -1667,14 +1667,16 @@ static const char * gethints(bool nostdlib) { static char *hints, *filtered_path; - struct elfhints_hdr hdr; + static struct elfhints_hdr hdr; struct fill_search_info_args sargs, hargs; struct dl_serinfo smeta, hmeta, *SLPinfo, *hintinfo; struct dl_serpath *SLPpath, *hintpath; char *p; + struct stat hint_stat; unsigned int SLPndx, hintndx, fndx, fcount; int fd; size_t flen; + uint32_t dl; bool skip; /* First call, read the hints file */ @@ -1684,19 +1686,38 @@ gethints(bool nostdlib) if ((fd = open(ld_elf_hints_path, O_RDONLY | O_CLOEXEC)) == -1) return (NULL); + + /* +* Check of hdr.dirlistlen value against type limit +* intends to pacify static analyzers. Further +* paranoia leads to checks that dirlist is fully +* contained in the file range. +*/ if (read(fd, &hdr, sizeof hdr) != sizeof hdr || hdr.magic != ELFHINTS_MAGIC || - hdr.version != 1) { + hdr.version != 1 || hdr.dirlistlen > UINT_MAX / 2 || + fstat(fd, &hint_stat) == -1) { +cleanup1: close(fd); + hdr.dirlistlen = 0; return (NULL); } + dl = hdr.strtab; + if (dl + hdr.dirlist < dl) + goto cleanup1; + dl += hdr.dirlist; + if (dl + hdr.dirlistlen < dl) + goto cleanup1; + dl += hdr.dirlistlen; + if (dl > hint_stat.st_size) + goto cleanup1; p = xmalloc(hdr.dirlistlen + 1); + if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 || read(fd, p, hdr.dirlistlen + 1) != - (ssize_t)hdr.dirlistlen + 1) { + (ssize_t)hdr.dirlistlen + 1 || p[hdr.dirlistlen] != '\0') { free(p); - close(fd); - return (NULL); + goto cleanup1; } hints = p; close(fd); @@ -1729,7 +1750,7 @@ gethints(bool nostdlib) hargs.serinfo = &hmeta; path_enumerate(ld_standard_library_path, fill_search_info, &sargs); - path_enumerate(p, fill_search_info, &hargs); + path_enumerate(hints, fill_search_info, &hargs); SLPinfo = xmalloc(smeta.dls_size); hintinfo = xmalloc(hmeta.dls_size); @@ -1748,7 +1769,7 @@ gethints(bool nostdlib) hargs.strspace = (char *)&hintinfo->dls_serpath[hmeta.dls_cnt]; path_enumerate(ld_standard_library_path, fill_search_info, &sargs); - path_enumerate(p, fill_search_info, &hargs); + path_enumerate(hints, fill_search_info, &hargs); /* * Now calculate the difference between two sets, by excluding ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300692 - head/bin/ed
Author: truckman Date: Wed May 25 18:38:30 2016 New Revision: 300692 URL: https://svnweb.freebsd.org/changeset/base/300692 Log: Close the input FILE * in read_file() and the output FILE * in write_file() if read_stream() or write_stream() fails to avoid leaking the FILE. Reported by: Coverity CID: 977702 Reviewed by: pfg MFC after:1 week Differential Revision:https://reviews.freebsd.org/D6554 Modified: head/bin/ed/io.c Modified: head/bin/ed/io.c == --- head/bin/ed/io.cWed May 25 18:10:44 2016(r300691) +++ head/bin/ed/io.cWed May 25 18:38:30 2016(r300692) @@ -36,20 +36,24 @@ read_file(char *fn, long n) { FILE *fp; long size; - + int cs; fp = (*fn == '!') ? popen(fn + 1, "r") : fopen(strip_escapes(fn), "r"); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot open input file"; return ERR; - } else if ((size = read_stream(fp, n)) < 0) - return ERR; -else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { + } + if ((size = read_stream(fp, n)) < 0) { + fprintf(stderr, "%s: %s\n", fn, strerror(errno)); + errmsg = "error reading input file"; + } + if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot close input file"; - return ERR; } + if (size < 0 || cs < 0) + return ERR; if (!scripted) fprintf(stdout, "%lu\n", size); return current_addr - n; @@ -143,19 +147,24 @@ write_file(char *fn, const char *mode, l { FILE *fp; long size; + int cs; fp = (*fn == '!') ? popen(fn+1, "w") : fopen(strip_escapes(fn), mode); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot open output file"; return ERR; - } else if ((size = write_stream(fp, n, m)) < 0) - return ERR; -else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { + } + if ((size = write_stream(fp, n, m)) < 0) { + fprintf(stderr, "%s: %s\n", fn, strerror(errno)); + errmsg = "error writing output file"; + } + if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot close output file"; - return ERR; } + if (size < 0 || cs < 0) + return ERR; if (!scripted) fprintf(stdout, "%lu\n", size); return n ? m - n + 1 : 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300694 - in head/sys: arm/arm arm/include arm/mv kern sys
Author: ian Date: Wed May 25 19:44:26 2016 New Revision: 300694 URL: https://svnweb.freebsd.org/changeset/base/300694 Log: Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn't have ACLE support built in. The ACLE (ARM C Language Extensions) defines a set of standardized symbols which indicate the architecture version and features available. ACLE support is built in to modern compilers (both clang and gcc), but absent from gcc prior to 4.4. ARM (the company) provides the acle-compat.h header file to define the right symbols for older versions of gcc. Basically, acle-compat.h does for arm about the same thing cdefs.h does for freebsd: defines standardized macros that work no matter which compiler you use. If ARM hadn't provided this file we would have ended up with a big #ifdef __arm__ section in cdefs.h with our own compatibility shims. Remove #include from the zillion other places (an ever-growing list) that it appears. Since style(9) requires sys/types.h or sys/param.h early in the include list, and both of those lead to including cdefs.h, only a couple special cases still need to include acle-compat.h directly. Loves it: imp Modified: head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/bus_space_base.c head/sys/arm/arm/copystr.S head/sys/arm/arm/cpu_asm-v6.S head/sys/arm/arm/cpufunc.c head/sys/arm/arm/disassem.c head/sys/arm/arm/elf_machdep.c head/sys/arm/arm/exception.S head/sys/arm/arm/fiq.c head/sys/arm/arm/fusu.S head/sys/arm/arm/genassym.c head/sys/arm/arm/locore-v6.S head/sys/arm/arm/machdep.c head/sys/arm/arm/mem.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/stdatomic.c head/sys/arm/arm/swtch-v4.S head/sys/arm/arm/swtch-v6.S head/sys/arm/arm/sys_machdep.c head/sys/arm/arm/trap-v6.c head/sys/arm/arm/vm_machdep.c head/sys/arm/include/armreg.h head/sys/arm/include/asm.h head/sys/arm/include/atomic.h head/sys/arm/include/bus.h head/sys/arm/include/cpu-v4.h head/sys/arm/include/cpu-v6.h head/sys/arm/include/cpu.h head/sys/arm/include/db_machdep.h head/sys/arm/include/machdep.h head/sys/arm/include/param.h head/sys/arm/include/pcpu.h head/sys/arm/include/pmap.h head/sys/arm/include/sf_buf.h head/sys/arm/include/sysarch.h head/sys/arm/include/sysreg.h head/sys/arm/include/vm.h head/sys/arm/mv/mv_machdep.c head/sys/kern/imgact_elf.c head/sys/kern/subr_devmap.c head/sys/sys/cdefs.h Modified: head/sys/arm/arm/bcopyinout.S == --- head/sys/arm/arm/bcopyinout.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/bcopyinout.S Wed May 25 19:44:26 2016 (r300694) @@ -38,7 +38,6 @@ #include "assym.s" -#include #include #include Modified: head/sys/arm/arm/bcopyinout_xscale.S == --- head/sys/arm/arm/bcopyinout_xscale.SWed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/bcopyinout_xscale.SWed May 25 19:44:26 2016 (r300694) @@ -38,8 +38,6 @@ #include __FBSDID("$FreeBSD$"); -#include - .syntax unified .text .align 2 Modified: head/sys/arm/arm/bus_space_base.c == --- head/sys/arm/arm/bus_space_base.c Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/bus_space_base.c Wed May 25 19:44:26 2016 (r300694) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "opt_platform.h" Modified: head/sys/arm/arm/copystr.S == --- head/sys/arm/arm/copystr.S Wed May 25 19:41:48 2016(r300693) +++ head/sys/arm/arm/copystr.S Wed May 25 19:44:26 2016(r300694) @@ -39,7 +39,6 @@ */ #include "assym.s" -#include #include #include __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpu_asm-v6.S == --- head/sys/arm/arm/cpu_asm-v6.S Wed May 25 19:41:48 2016 (r300693) +++ head/sys/arm/arm/cpu_asm-v6.S Wed May 25 19:44:26 2016 (r300694) @@ -28,7 +28,6 @@ */ #include "assym.s" -#include #include #include #include Modified: head/sys/arm/arm/cpufunc.c == --- head/sys/arm/arm/cpufunc.c Wed May 25 19:41:48 2016(r300693) +++ head/sys/arm/arm/cpufunc.c Wed May 25 19:44:26 2016(r300694) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/arm/disassem.c == --- head/sys/arm/arm/disassem.c Wed May 25 19:41:48 2016
svn commit: r300696 - vendor/elftoolchain/dist/elfcopy
Author: emaste Date: Wed May 25 20:49:19 2016 New Revision: 300696 URL: https://svnweb.freebsd.org/changeset/base/300696 Log: Import ELF Tool Chain snapshot at revision 3477 From http://svn.code.sf.net/p/elftoolchain/code/ Modified: vendor/elftoolchain/dist/elfcopy/pe.c Modified: vendor/elftoolchain/dist/elfcopy/pe.c == --- vendor/elftoolchain/dist/elfcopy/pe.c Wed May 25 20:11:26 2016 (r300695) +++ vendor/elftoolchain/dist/elfcopy/pe.c Wed May 25 20:49:19 2016 (r300696) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: pe.c 3312 2016-01-10 09:23:51Z kaiwang27 $"); +ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $"); /* Convert ELF object to Portable Executable (PE). */ void @@ -54,7 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, PE_Buffer *pb; const char *name; size_t indx; - int elferr, i; + int elferr; if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64) po = PE_O_PE32P; @@ -175,7 +175,7 @@ create_pe(struct elfcopy *ecp, int ifd, psh.sh_addr = sh.sh_addr; psh.sh_virtsize = sh.sh_size; if (sh.sh_type != SHT_NOBITS) - psh.sh_rawsize = sh.sh_size; + psh.sh_rawsize = roundup(sh.sh_size, poh.oh_filealign); else psh.sh_char |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; @@ -190,12 +190,6 @@ create_pe(struct elfcopy *ecp, int ifd, IMAGE_SCN_CNT_CODE; if ((sh.sh_flags & SHF_ALLOC) && (psh.sh_char & 0xF0) == 0) psh.sh_char |= IMAGE_SCN_CNT_INITIALIZED_DATA; - for (i = 0xE; i > 0; i--) { - if (sh.sh_addralign & (1U << (i - 1))) { - psh.sh_char |= i << 20; - break; - } - } /* Mark relocation section "discardable". */ if (strcmp(name, ".reloc") == 0) @@ -213,8 +207,12 @@ create_pe(struct elfcopy *ecp, int ifd, } pb->pb_align = 1; pb->pb_off = 0; - pb->pb_size = sh.sh_size; - pb->pb_buf = d->d_buf; + pb->pb_size = roundup(sh.sh_size, poh.oh_filealign); + if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) { + warn("calloc failed"); + continue; + } + memcpy(pb->pb_buf, d->d_buf, sh.sh_size); } elferr = elf_errno(); if (elferr != 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300697 - vendor/elftoolchain/elftoolchain-r3477
Author: emaste Date: Wed May 25 20:50:05 2016 New Revision: 300697 URL: https://svnweb.freebsd.org/changeset/base/300697 Log: Tag ELF Tool Chain r3477 Added: vendor/elftoolchain/elftoolchain-r3477/ - copied from r300696, vendor/elftoolchain/dist/ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300698 - in head: contrib/elftoolchain/elfcopy lib/libelftc
Author: emaste Date: Wed May 25 20:56:30 2016 New Revision: 300698 URL: https://svnweb.freebsd.org/changeset/base/300698 Log: Update to ELF Tool Chain r3477 This fixes a EFI/PE header issue that prevented elfcopy-produced .efi files from working with Secure Boot: Make sure section raw size is always padded to multiple of FileAlignment from the optional header, as requested by the PE specification. This change should reduce the diff between PE image generated by Binutils objcopy and elftoolchain elfcopy. Submitted by: kaiw Reported by: ambrisko Modified: head/contrib/elftoolchain/elfcopy/pe.c head/lib/libelftc/elftc_version.c Directory Properties: head/contrib/elftoolchain/ (props changed) Modified: head/contrib/elftoolchain/elfcopy/pe.c == --- head/contrib/elftoolchain/elfcopy/pe.c Wed May 25 20:50:05 2016 (r300697) +++ head/contrib/elftoolchain/elfcopy/pe.c Wed May 25 20:56:30 2016 (r300698) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: pe.c 3312 2016-01-10 09:23:51Z kaiwang27 $"); +ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $"); /* Convert ELF object to Portable Executable (PE). */ void @@ -54,7 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, PE_Buffer *pb; const char *name; size_t indx; - int elferr, i; + int elferr; if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64) po = PE_O_PE32P; @@ -175,7 +175,7 @@ create_pe(struct elfcopy *ecp, int ifd, psh.sh_addr = sh.sh_addr; psh.sh_virtsize = sh.sh_size; if (sh.sh_type != SHT_NOBITS) - psh.sh_rawsize = sh.sh_size; + psh.sh_rawsize = roundup(sh.sh_size, poh.oh_filealign); else psh.sh_char |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; @@ -190,12 +190,6 @@ create_pe(struct elfcopy *ecp, int ifd, IMAGE_SCN_CNT_CODE; if ((sh.sh_flags & SHF_ALLOC) && (psh.sh_char & 0xF0) == 0) psh.sh_char |= IMAGE_SCN_CNT_INITIALIZED_DATA; - for (i = 0xE; i > 0; i--) { - if (sh.sh_addralign & (1U << (i - 1))) { - psh.sh_char |= i << 20; - break; - } - } /* Mark relocation section "discardable". */ if (strcmp(name, ".reloc") == 0) @@ -213,8 +207,12 @@ create_pe(struct elfcopy *ecp, int ifd, } pb->pb_align = 1; pb->pb_off = 0; - pb->pb_size = sh.sh_size; - pb->pb_buf = d->d_buf; + pb->pb_size = roundup(sh.sh_size, poh.oh_filealign); + if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) { + warn("calloc failed"); + continue; + } + memcpy(pb->pb_buf, d->d_buf, sh.sh_size); } elferr = elf_errno(); if (elferr != 0) Modified: head/lib/libelftc/elftc_version.c == --- head/lib/libelftc/elftc_version.c Wed May 25 20:50:05 2016 (r300697) +++ head/lib/libelftc/elftc_version.c Wed May 25 20:56:30 2016 (r300698) @@ -6,5 +6,5 @@ const char * elftc_version(void) { - return "elftoolchain r3475M"; + return "elftoolchain r3477M"; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300699 - head/sys/netinet
Author: tuexen Date: Wed May 25 22:16:11 2016 New Revision: 300699 URL: https://svnweb.freebsd.org/changeset/base/300699 Log: When sending in ICMP response to an SCTP packet, * include the SCTP common header, if possible * include the first 8 bytes of the INIT chunk, if possible This provides the necesary information for the receiver of the ICMP packet to process it. MFC after:1 week Modified: head/sys/netinet/ip_icmp.c Modified: head/sys/netinet/ip_icmp.c == --- head/sys/netinet/ip_icmp.c Wed May 25 20:56:30 2016(r300698) +++ head/sys/netinet/ip_icmp.c Wed May 25 22:16:11 2016(r300699) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -249,6 +250,34 @@ icmp_error(struct mbuf *n, int type, int goto freeit; icmpelen = max(tcphlen, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); + } else if (oip->ip_p == IPPROTO_SCTP) { + struct sctphdr *sh; + struct sctp_chunkhdr *ch; + + if (ntohs(oip->ip_len) < oiphlen + sizeof(struct sctphdr)) + goto stdreply; + if (oiphlen + sizeof(struct sctphdr) > n->m_len && + n->m_next == NULL) + goto stdreply; + if (n->m_len < oiphlen + sizeof(struct sctphdr) && + (n = m_pullup(n, oiphlen + sizeof(struct sctphdr))) == NULL) + goto freeit; + icmpelen = max(sizeof(struct sctphdr), + min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); + sh = (struct sctphdr *)((caddr_t)oip + oiphlen); + if (ntohl(sh->v_tag) == 0 && + ntohs(oip->ip_len) >= oiphlen + sizeof(struct sctphdr) + 8 && + (n->m_len >= oiphlen + sizeof(struct sctphdr) + 8 || +n->m_next != NULL)) { + if (n->m_len < oiphlen + sizeof(struct sctphdr) + 8 && + (n = m_pullup(n, oiphlen + sizeof(struct sctphdr) + 8)) == NULL) + goto freeit; + ch = (struct sctp_chunkhdr *)(sh + 1); + if (ch->chunk_type == SCTP_INITIATION) { + icmpelen = max(sizeof(struct sctphdr) + 8, + min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); + } + } } else stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300700 - head/sys/amd64/amd64
Author: jkim Date: Wed May 25 23:06:52 2016 New Revision: 300700 URL: https://svnweb.freebsd.org/changeset/base/300700 Log: Both Clang and GCC cannot generate efficient reserve_pv_entries(). http://docs.freebsd.org/cgi/mid.cgi?552BFEB2.8040407 Re-implement it entirely in inline assembly not to let compilers do silly spilling to memory. For non-POPCNT case, use newly added bit_count(3). Reported by: alc Reviewed by: alc, kib Differential Revision:https://reviews.freebsd.org/D6541 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Wed May 25 22:16:11 2016(r300699) +++ head/sys/amd64/amd64/pmap.c Wed May 25 23:06:52 2016(r300700) @@ -104,6 +104,7 @@ __FBSDID("$FreeBSD$"); #include "opt_vm.h" #include +#include #include #include #include @@ -585,7 +586,7 @@ static caddr_t crashdumpmap; static voidfree_pv_chunk(struct pv_chunk *pc); static voidfree_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp); -static int popcnt_pc_map_elem_pq(uint64_t elem); +static int popcnt_pc_map_pq(uint64_t *map); static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp); static voidreserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp); @@ -3126,7 +3127,7 @@ retry: } /* - * Returns the number of one bits within the given PV chunk map element. + * Returns the number of one bits within the given PV chunk map. * * The erratas for Intel processors state that "POPCNT Instruction May * Take Longer to Execute Than Expected". It is believed that the @@ -3142,12 +3143,15 @@ retry: * 6th Gen Core: SKL029 */ static int -popcnt_pc_map_elem_pq(uint64_t elem) +popcnt_pc_map_pq(uint64_t *map) { - u_long result; + u_long result, tmp; - __asm __volatile("xorl %k0,%k0;popcntq %1,%0" - : "=&r" (result) : "rm" (elem)); + __asm __volatile("xorl %k0,%k0;popcntq %2,%0;" + "xorl %k1,%k1;popcntq %3,%1;addl %k1,%k0;" + "xorl %k1,%k1;popcntq %4,%1;addl %k1,%k0" + : "=&r" (result), "=&r" (tmp) + : "m" (map[0]), "m" (map[1]), "m" (map[2])); return (result); } @@ -3179,17 +3183,12 @@ retry: avail = 0; TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { #ifndef __POPCNT__ - if ((cpu_feature2 & CPUID2_POPCNT) == 0) { - free = bitcount64(pc->pc_map[0]); - free += bitcount64(pc->pc_map[1]); - free += bitcount64(pc->pc_map[2]); - } else + if ((cpu_feature2 & CPUID2_POPCNT) == 0) + bit_count((bitstr_t *)pc->pc_map, 0, + sizeof(pc->pc_map) * NBBY, &free); + else #endif - { - free = popcnt_pc_map_elem_pq(pc->pc_map[0]); - free += popcnt_pc_map_elem_pq(pc->pc_map[1]); - free += popcnt_pc_map_elem_pq(pc->pc_map[2]); - } + free = popcnt_pc_map_pq(pc->pc_map); if (free == 0) break; avail += free; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300701 - in head/sys: arm/arm arm/include sys
Author: ian Date: Thu May 26 00:03:23 2016 New Revision: 300701 URL: https://svnweb.freebsd.org/changeset/base/300701 Log: Disable alignment faults on armv6, adjust various alignment-related macros to match the new state of affairs. The hardware we support has always been able to do unaligned accesses, we've just never enabled it until now. This brings FreeBSD into line with all the other major OSes, and should help with the growing volume of 3rd-party software that assumes unaligned access will just work on armv6 and armv7. Modified: head/sys/arm/arm/locore-v6.S head/sys/arm/include/_align.h head/sys/arm/include/_types.h head/sys/arm/include/param.h head/sys/sys/param.h Modified: head/sys/arm/arm/locore-v6.S == --- head/sys/arm/arm/locore-v6.SWed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/arm/locore-v6.SThu May 26 00:03:23 2016 (r300701) @@ -129,12 +129,12 @@ ASENTRY_NP(_start) */ 1: bic r7, #CPU_CONTROL_DC_ENABLE + bic r7, #CPU_CONTROL_AFLT_ENABLE bic r7, #CPU_CONTROL_MMU_ENABLE bic r7, #CPU_CONTROL_IC_ENABLE bic r7, #CPU_CONTROL_BPRD_ENABLE bic r7, #CPU_CONTROL_SW_ENABLE orr r7, #CPU_CONTROL_UNAL_ENABLE - orr r7, #CPU_CONTROL_AFLT_ENABLE orr r7, #CPU_CONTROL_VECRELOC mcr CP15_SCTLR(r7) DSB @@ -453,12 +453,12 @@ ASENTRY_NP(mpentry) /* Setup core, disable all caches. */ mrc CP15_SCTLR(r0) bic r0, #CPU_CONTROL_MMU_ENABLE + bic r0, #CPU_CONTROL_AFLT_ENABLE bic r0, #CPU_CONTROL_DC_ENABLE bic r0, #CPU_CONTROL_IC_ENABLE bic r0, #CPU_CONTROL_BPRD_ENABLE bic r0, #CPU_CONTROL_SW_ENABLE orr r0, #CPU_CONTROL_UNAL_ENABLE - orr r0, #CPU_CONTROL_AFLT_ENABLE orr r0, #CPU_CONTROL_VECRELOC mcr CP15_SCTLR(r0) DSB Modified: head/sys/arm/include/_align.h == --- head/sys/arm/include/_align.h Wed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/include/_align.h Thu May 26 00:03:23 2016 (r300701) @@ -46,7 +46,11 @@ * is sufficient for any data type, pointer or numeric. The resulting type * is equivelent to arm's uintptr_t (but is purposely spelled "unsigned" here). */ +#if __ARM_ARCH >= 6 +#define_ALIGNBYTES (sizeof(int) - 1) +#else #define_ALIGNBYTES (sizeof(long long) - 1) +#endif #define_ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) #endif /* !_ARM_INCLUDE__ALIGN_H_ */ Modified: head/sys/arm/include/_types.h == --- head/sys/arm/include/_types.h Wed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/include/_types.h Thu May 26 00:03:23 2016 (r300701) @@ -43,6 +43,10 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#if __ARM_ARCH >= 6 +#define __NO_STRICT_ALIGNMENT +#endif + /* * Basic types upon which most other types are built. */ Modified: head/sys/arm/include/param.h == --- head/sys/arm/include/param.hWed May 25 23:06:52 2016 (r300700) +++ head/sys/arm/include/param.hThu May 26 00:03:23 2016 (r300701) @@ -90,8 +90,16 @@ * is valid to fetch data elements of type t from on this architecture. * This does not reflect the optimal alignment, just the possibility * (within reasonable limits). + * + * armv4 and v5 require alignment to the type's size. armv6 and later require + * that an 8-byte type be aligned to at least a 4-byte boundary; access to + * smaller types can be unaligned. */ +#if __ARM_ARCH >= 6 +#defineALIGNED_POINTER(p, t) (((sizeof(t) != 8) || ((unsigned)(p) & 3) == 0)) +#else #defineALIGNED_POINTER(p, t) unsigned)(p)) & (sizeof(t)-1)) == 0) +#endif /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/sys/param.h == --- head/sys/sys/param.hWed May 25 23:06:52 2016(r300700) +++ head/sys/sys/param.hThu May 26 00:03:23 2016(r300701) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100112 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100113 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all
svn commit: r300702 - head/sys/dev/bhnd/cores/chipc
Author: adrian Date: Thu May 26 00:43:08 2016 New Revision: 300702 URL: https://svnweb.freebsd.org/changeset/base/300702 Log: [bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping table. This adds support for automatically configuring bhnd_chipc bus children with associated resources, using an internal 'hints' table based directly on Michael Zhilin's chipc resource mapping work. The bhnd_sprom_chipc driver has been converted to use DEVICE_IDENTIFY() with the new resource table. This should be nearly drop-in compatible with the child device drivers in D6250. Submitted by: Landon Fuller Reviewed by: Michael Zhilin Differential Revision:https://reviews.freebsd.org/D6525 Modified: head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/chipcreg.h Modified: head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c == --- head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.cThu May 26 00:03:23 2016(r300701) +++ head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.cThu May 26 00:43:08 2016(r300702) @@ -46,9 +46,23 @@ __FBSDID("$FreeBSD$"); #include #include -#include "bhnd_chipc_if.h" #include "bhnd_nvram_if.h" +#include "chipc.h" + +static void +chipc_sprom_identify(driver_t *driver, device_t parent) +{ + if (bhnd_chipc_nvram_src(parent) != BHND_NVRAM_SRC_SPROM) + return; + + if (device_find_child(parent, "bhnd_nvram", 0) != NULL) + return; + + if (BUS_ADD_CHILD(parent, 0, "bhnd_nvram", 0) == NULL) + device_printf(parent, "add bhnd_nvram failed\n"); +} + static int chipc_sprom_probe(device_t dev) { @@ -87,6 +101,7 @@ chipc_sprom_attach(device_t dev) static device_method_t chipc_sprom_methods[] = { /* Device interface */ + DEVMETHOD(device_identify, chipc_sprom_identify), DEVMETHOD(device_probe, chipc_sprom_probe), DEVMETHOD(device_attach,chipc_sprom_attach), DEVMETHOD_END Modified: head/sys/dev/bhnd/cores/chipc/chipc.c == --- head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:03:23 2016 (r300701) +++ head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:43:08 2016 (r300702) @@ -98,6 +98,32 @@ static struct bhnd_device_quirk chipc_qu BHND_DEVICE_QUIRK_END }; + +static const struct chipc_hint { + const char *name; + int unit; + int type; + int rid; + rman_res_t base; /* relative to parent resource */ + rman_res_t size; + u_intport; /* ignored if SYS_RES_IRQ */ + u_intregion; +} chipc_hints[] = { + // FIXME: cfg/spi port1.1 mapping on siba(4) SoCs + /* device unittyperid base sizeport,region */ + { "bhnd_nvram", 0, SYS_RES_MEMORY, 0, CHIPC_SPROM_OTP, CHIPC_SPROM_OTP_SIZE, 0,0 }, + { "uart", 0, SYS_RES_MEMORY, 0, CHIPC_UART0_BASE, CHIPC_UART_SIZE,0,0 }, + { "uart", 0, SYS_RES_IRQ, 0, 0, RM_MAX_END }, + { "uart", 1, SYS_RES_MEMORY, 0, CHIPC_UART1_BASE, CHIPC_UART_SIZE,0,0 }, + { "uart", 1, SYS_RES_IRQ, 0, 0, RM_MAX_END }, + { "spi",0, SYS_RES_MEMORY, 0, 0, RM_MAX_END, 1,1 }, + { "spi",0, SYS_RES_MEMORY, 1, CHIPC_SFLASH_BASE, CHIPC_SFLASH_SIZE, 0,0 }, + { "cfi",0, SYS_RES_MEMORY, 0, 0, RM_MAX_END, 1,1}, + { "cfi",0, SYS_RES_MEMORY, 1, CHIPC_SFLASH_BASE, CHIPC_SFLASH_SIZE, 0,0 }, + { NULL } +}; + + static int chipc_try_activate_resource( struct chipc_softc *sc, device_t child, int type, int rid, struct resource *r, @@ -106,7 +132,6 @@ static int chipc_try_activate_resourc static int chipc_read_caps(struct chipc_softc *sc, struct chipc_caps *caps); -static int chipc_nvram_attach(struct chipc_softc *sc); static bhnd_nvram_src_t chipc_nvram_identify(struct chipc_softc *sc); static bool chipc_should_enable_sprom( struct chipc_softc *sc); @@ -210,12 +235,11 @@ chipc_attach(device_t dev) if (bootverbose) chipc_print_caps(sc->dev, &sc->caps); - /*
svn commit: r300703 - head/sys/dev/bhnd/cores/chipc
Author: adrian Date: Thu May 26 00:44:16 2016 New Revision: 300703 URL: https://svnweb.freebsd.org/changeset/base/300703 Log: [bhnd] Fix release of uninitialized SPROM shadow in chipc detach. This was triggering a panic on detach; the SPROM shadow is now maintained by the bhnd_sprom_chipc driver, and should be removed from chipc. Submitted by: Landon Fuller Differential Revision:https://reviews.freebsd.org/D6548 Modified: head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/chipcvar.h Modified: head/sys/dev/bhnd/cores/chipc/chipc.c == --- head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:43:08 2016 (r300702) +++ head/sys/dev/bhnd/cores/chipc/chipc.c Thu May 26 00:44:16 2016 (r300703) @@ -269,7 +269,6 @@ chipc_detach(device_t dev) chipc_release_region(sc, sc->core_region, RF_ALLOCATED|RF_ACTIVE); chipc_free_rman(sc); - bhnd_sprom_fini(&sc->sprom); CHIPC_LOCK_DESTROY(sc); Modified: head/sys/dev/bhnd/cores/chipc/chipcvar.h == --- head/sys/dev/bhnd/cores/chipc/chipcvar.hThu May 26 00:43:08 2016 (r300702) +++ head/sys/dev/bhnd/cores/chipc/chipcvar.hThu May 26 00:44:16 2016 (r300703) @@ -186,12 +186,8 @@ struct chipc_softc { bhnd_nvram_src_t nvram_src; /**< identified NVRAM source */ struct mtx mtx; /**< state mutex. */ - - struct bhnd_spromsprom; /**< OTP/SPROM shadow, if any */ - size_t sprom_refcnt; /**< SPROM hardware refcount */ - + size_t sprom_refcnt; /**< SPROM pin enable refcount */ struct rman mem_rman; /**< port memory manager */ - STAILQ_HEAD(, chipc_region) mem_regions;/**< memory allocation records */ }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300704 - head/sys/dev/flash
Author: adrian Date: Thu May 26 01:19:13 2016 New Revision: 300704 URL: https://svnweb.freebsd.org/changeset/base/300704 Log: [mx25l] add Winbond w25x64 support. PR: https://github.com/freebsd/freebsd/pull/16 Submitted by: https://github.com/epipenau Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c == --- head/sys/dev/flash/mx25l.c Thu May 26 00:44:16 2016(r300703) +++ head/sys/dev/flash/mx25l.c Thu May 26 01:19:13 2016(r300704) @@ -124,6 +124,7 @@ struct mx25l_flash_ident flash_devices[] /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ { "w25x32", 0xef, 0x3016, 64 * 1024, 64, FL_ERASE_4K }, + { "w25x64", 0xef, 0x3017, 64 * 1024, 128, FL_ERASE_4K }, { "w25q32", 0xef, 0x4016, 64 * 1024, 64, FL_ERASE_4K }, { "w25q64", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, { "w25q64bv", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300705 - head/usr.bin/fortune/unstr
Author: truckman Date: Thu May 26 01:33:24 2016 New Revision: 300705 URL: https://svnweb.freebsd.org/changeset/base/300705 Log: Avoid buffer overflow when copying the input file name and appending .dat. Check the return value from fread() to be sure that it was successful. Reported by: Coverity CID: 1006709, 1009452 MFC after:1 week Modified: head/usr.bin/fortune/unstr/unstr.c Modified: head/usr.bin/fortune/unstr/unstr.c == --- head/usr.bin/fortune/unstr/unstr.c Thu May 26 01:19:13 2016 (r300704) +++ head/usr.bin/fortune/unstr/unstr.c Thu May 26 01:33:24 2016 (r300705) @@ -86,13 +86,19 @@ main(int argc, char *argv[]) exit(1); } Infile = argv[1]; - strcpy(Datafile, Infile); - strcat(Datafile, ".dat"); + if ((size_t)snprintf(Datafile, sizeof(Datafile), "%s.dat", Infile) >= + sizeof(Datafile)) + errx(1, "%s name too long", Infile); if ((Inf = fopen(Infile, "r")) == NULL) err(1, "%s", Infile); if ((Dataf = fopen(Datafile, "r")) == NULL) err(1, "%s", Datafile); - fread((char *)&tbl, sizeof(tbl), 1, Dataf); + if (fread((char *)&tbl, sizeof(tbl), 1, Dataf) != 1) { + if (feof(Dataf)) + errx(1, "%s read EOF", Datafile); + else + err(1, "%s read", Datafile); + } tbl.str_version = be32toh(tbl.str_version); tbl.str_numstr = be32toh(tbl.str_numstr); tbl.str_longlen = be32toh(tbl.str_longlen); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300706 - head/usr.sbin/tzsetup
Author: truckman Date: Thu May 26 01:45:04 2016 New Revision: 300706 URL: https://svnweb.freebsd.org/changeset/base/300706 Log: Avoid buffer overflow or truncation when constructing path_zoneinfo_file. Reported by: Coverity CID: 1011160 MFC after:1 week Modified: head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/tzsetup/tzsetup.c == --- head/usr.sbin/tzsetup/tzsetup.c Thu May 26 01:33:24 2016 (r300705) +++ head/usr.sbin/tzsetup/tzsetup.c Thu May 26 01:45:04 2016 (r300706) @@ -838,7 +838,9 @@ install_zoneinfo(const char *zoneinfo) FILE*f; charpath_zoneinfo_file[MAXPATHLEN]; - sprintf(path_zoneinfo_file, "%s/%s", path_zoneinfo, zoneinfo); + if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file), + "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file)) + errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo); rv = install_zoneinfo_file(path_zoneinfo_file); /* Save knowledge for later */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300707 - head/sys/dev/sdhci
Author: ian Date: Thu May 26 02:55:41 2016 New Revision: 300707 URL: https://svnweb.freebsd.org/changeset/base/300707 Log: Add a convenience macro that masks all the bits related to clock divisors in all versions of the sdhci spec (the HI bits are just unused reserved bits in earlier versions). Modified: head/sys/dev/sdhci/sdhci.h Modified: head/sys/dev/sdhci/sdhci.h == --- head/sys/dev/sdhci/sdhci.h Thu May 26 01:45:04 2016(r300706) +++ head/sys/dev/sdhci/sdhci.h Thu May 26 02:55:41 2016(r300707) @@ -153,6 +153,9 @@ #define SDHCI_CLOCK_CARD_EN 0x0004 #define SDHCI_CLOCK_INT_STABLE0x0002 #define SDHCI_CLOCK_INT_EN0x0001 +#define SDHCI_DIVIDERS_MASK \ +((SDHCI_DIVIDER_MASK << SDHCI_DIVIDER_SHIFT) | \ +(SDHCI_DIVIDER_HI_MASK << SDHCI_DIVIDER_HI_SHIFT)) #define SDHCI_TIMEOUT_CONTROL 0x2E ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300708 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu May 26 03:50:52 2016 New Revision: 300708 URL: https://svnweb.freebsd.org/changeset/base/300708 Log: hyperv: Rework guest id settings according to Hyper-V spec MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D6553 Modified: head/sys/dev/hyperv/vmbus/hv_hv.c head/sys/dev/hyperv/vmbus/hyperv_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_hv.c == --- head/sys/dev/hyperv/vmbus/hv_hv.c Thu May 26 02:55:41 2016 (r300707) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Thu May 26 03:50:52 2016 (r300708) @@ -52,34 +52,24 @@ __FBSDID("$FreeBSD$"); #defineHYPERV_INTERFACE0x31237648 /* HV#1 */ -/* - * The guest OS needs to register the guest ID with the hypervisor. - * The guest ID is a 64 bit entity and the structure of this ID is - * specified in the Hyper-V specification: - * - * http://msdn.microsoft.com/en-us/library/windows/ - * hardware/ff542653%28v=vs.85%29.aspx - * - * While the current guideline does not specify how FreeBSD guest ID(s) - * need to be generated, our plan is to publish the guidelines for - * FreeBSD and other guest operating systems that currently are hosted - * on Hyper-V. The implementation here conforms to this yet - * unpublished guidelines. - * - * Bit(s) - * 63- Indicates if the OS is Open Source or not; 1 is Open Source - * 62:56 - Os Type: FreeBSD is 0x02 - * 55:48 - Distro specific identification - * 47:16 - FreeBSD kernel version number - * 15:0 - Distro specific identification - */ -#define HYPERV_GUESTID_OSS (0x1ULL << 63) -#define HYPERV_GUESTID_FREEBSD (0x02ULL << 56) -#define HYPERV_GUESTID(id) \ - (HYPERV_GUESTID_OSS | HYPERV_GUESTID_FREEBSD | \ -(((uint64_t)(((id) & 0xff) >> 16)) << 48) |\ -(((uint64_t)__FreeBSD_version) << 16) |\ -((uint64_t)((id) & 0x00))) +#define HYPERV_FREEBSD_BUILD 0ULL +#define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) +#define HYPERV_FREEBSD_OSID0ULL + +#define MSR_HV_GUESTID_BUILD_FREEBSD \ + (HYPERV_FREEBSD_BUILD & MSR_HV_GUESTID_BUILD_MASK) +#define MSR_HV_GUESTID_VERSION_FREEBSD \ + ((HYPERV_FREEBSD_VERSION << MSR_HV_GUESTID_VERSION_SHIFT) & \ +MSR_HV_GUESTID_VERSION_MASK) +#define MSR_HV_GUESTID_OSID_FREEBSD\ + ((HYPERV_FREEBSD_OSID << MSR_HV_GUESTID_OSID_SHIFT) & \ +MSR_HV_GUESTID_OSID_MASK) + +#define MSR_HV_GUESTID_FREEBSD \ + (MSR_HV_GUESTID_BUILD_FREEBSD | \ +MSR_HV_GUESTID_VERSION_FREEBSD | \ +MSR_HV_GUESTID_OSID_FREEBSD | \ +MSR_HV_GUESTID_OSTYPE_FREEBSD) struct hypercall_ctx { void*hc_addr; @@ -321,8 +311,8 @@ hyperv_init(void *dummy __unused) return; } - /* Write guest id */ - wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_GUESTID(0)); + /* Set guest id */ + wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); if (hyperv_features & HV_FEATURE_MSR_TIME_REFCNT) { /* Register virtual timecount */ Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h == --- head/sys/dev/hyperv/vmbus/hyperv_reg.h Thu May 26 02:55:41 2016 (r300707) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Thu May 26 03:50:52 2016 (r300708) @@ -29,6 +29,20 @@ #ifndef _HYPERV_REG_H_ #define _HYPERV_REG_H_ +#define MSR_HV_GUEST_OS_ID 0x4000 +#define MSR_HV_GUESTID_BUILD_MASK 0xULL +#define MSR_HV_GUESTID_VERSION_MASK0xULL +#define MSR_HV_GUESTID_VERSION_SHIFT 16 +#define MSR_HV_GUESTID_OSID_MASK 0x00ffULL +#define MSR_HV_GUESTID_OSID_SHIFT 48 +#define MSR_HV_GUESTID_OSTYPE_MASK 0x7f00ULL +#define MSR_HV_GUESTID_OSTYPE_SHIFT56 +#define MSR_HV_GUESTID_OPENSRC 0x8000ULL +#define MSR_HV_GUESTID_OSTYPE_LINUX\ + ((0x01ULL << MSR_HV_GUESTID_OSTYPE_SHIFT) | MSR_HV_GUESTID_OPENSRC) +#define MSR_HV_GUESTID_OSTYPE_FREEBSD \ + ((0x02ULL << MSR_HV_GUESTID_OSTYPE_SHIFT) | MSR_HV_GUESTID_OPENSRC) + #define MSR_HV_HYPERCALL 0x4001 #define MSR_HV_HYPERCALL_ENABLE0x0001ULL #define MSR_HV_HYPERCALL_RSVD_MASK 0x0ffeULL ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300709 - head/sys/arm/freescale/imx
Author: ian Date: Thu May 26 03:55:27 2016 New Revision: 300709 URL: https://svnweb.freebsd.org/changeset/base/300709 Log: Another round of changes to add compatibility with the older ESHDC variety of hardware. Mostly this focuses on the big changes needed for setting the bus clock, because ESDHC is SDHCI v2.0 and USDHC is 3.0, and the number, location, and interpretation of clock divisor bits is vastly different between the two. This doesn't get the device all the way to functioning on ESDHC hardware yet, but it's much closer, now getting through all the card detection and negotiation of capabilties and speed (but it eventually hangs on what appears to be a missing interrupt). Another missing chunk of code for handling ESDHC's 32 bit command-and-mode register using sdhci's pair of 16 bit writes is added. This also does some leading whitespace cleanups and sorts some softc struct members by size, and adds some comments (because when do I ever touch code without adding comments?). Modified: head/sys/arm/freescale/imx/imx_sdhci.c Modified: head/sys/arm/freescale/imx/imx_sdhci.c == --- head/sys/arm/freescale/imx/imx_sdhci.c Thu May 26 03:50:52 2016 (r300708) +++ head/sys/arm/freescale/imx/imx_sdhci.c Thu May 26 03:55:27 2016 (r300709) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -74,12 +75,12 @@ struct imx_sdhci_softc { struct callout r1bfix_callout; sbintime_t r1bfix_timeout_at; uint32_tbaseclk_hz; - uint32_tsdclockreg_freq_bits; uint32_tcmd_and_mode; uint32_tr1bfix_intmask; + boolean_t force_card_present; + uint16_tsdclockreg_freq_bits; uint8_t r1bfix_type; uint8_t hwtype; - boolean_t force_card_present; }; #defineR1BFIX_NONE 0 /* No fix needed at next interrupt. */ @@ -90,6 +91,12 @@ struct imx_sdhci_softc { #defineHWTYPE_ESDHC1 /* imx5x and earlier. */ #defineHWTYPE_USDHC2 /* imx6. */ +/* + * Freescale-specific registers, or in some cases the layout of bits within the + * sdhci-defined register is different on Freescale. These names all begin with + * SDHC_ (not SDHCI_). + */ + #defineSDHC_WTMK_LVL 0x44/* Watermark Level register. */ #defineUSDHC_MIX_CONTROL 0x48/* Mix(ed) Control register. */ #defineSDHC_VEND_SPEC 0xC0/* Vendor-specific register. */ @@ -138,11 +145,20 @@ struct imx_sdhci_softc { #define SDHC_PROT_CDTL (1 << 6) #define SDHC_PROT_CDSS (1 << 7) +#defineSDHC_SYS_CTRL 0x2c #defineSDHC_INT_STATUS 0x30 +/* + * The clock enable bits exist in different registers for ESDHC vs USDHC, but + * they are the same bits in both cases. The divisor values go into the + * standard sdhci clock register, but in different bit positions and meanings + than the sdhci spec values. + */ #defineSDHC_CLK_IPGEN (1 << 0) #defineSDHC_CLK_HCKEN (1 << 1) #defineSDHC_CLK_PEREN (1 << 2) +#defineSDHC_CLK_SDCLKEN(1 << 3) +#defineSDHC_CLK_ENABLE_MASK0x000f #defineSDHC_CLK_DIVISOR_MASK 0x00f0 #defineSDHC_CLK_DIVISOR_SHIFT 4 #defineSDHC_CLK_PRESCALE_MASK 0xff00 @@ -156,7 +172,8 @@ static struct ofw_compat_data compat_dat {NULL, HWTYPE_NONE}, }; -static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable); +static uint16_t imx_sdhc_get_clock(struct imx_sdhci_softc *sc); +static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val); static void imx_sdhci_r1bfix_func(void *arg); static inline uint32_t @@ -186,7 +203,7 @@ imx_sdhci_read_1(device_t dev, struct sd */ if (off == SDHCI_HOST_CONTROL) { wrk32 = RD4(sc, SDHC_PROT_CTRL); -val32 = wrk32 & (SDHCI_CTRL_LED | SDHCI_CTRL_CARD_DET | + val32 = wrk32 & (SDHCI_CTRL_LED | SDHCI_CTRL_CARD_DET | SDHCI_CTRL_FORCE_CARD); switch (wrk32 & SDHC_PROT_WIDTH_MASK) { case SDHC_PROT_WIDTH_1BIT: @@ -204,7 +221,7 @@ imx_sdhci_read_1(device_t dev, struct sd /* Value is already 0. */ break; case SDHC_PROT_ADMA1: -/* This value is deprecated, should never appear. */ + /* This value is deprecated, should never appear. */ break; case SDHC_PROT_ADMA2: val32 |= SDHCI_CTRL_ADMA2; @@ -221,7 +238
svn commit: r300710 - head/sys/dev/spibus
Author: adrian Date: Thu May 26 06:35:11 2016 New Revision: 300710 URL: https://svnweb.freebsd.org/changeset/base/300710 Log: [spibus] add initial placeholders for transfer mode and frequency. This doesn't yet implement it in the controllers or the transfer calls, but it's a start. Obtained from:loos (frequency), ray/zrouter (transfer mode) Modified: head/sys/dev/spibus/spibus.c head/sys/dev/spibus/spibusvar.h Modified: head/sys/dev/spibus/spibus.c == --- head/sys/dev/spibus/spibus.cThu May 26 03:55:27 2016 (r300709) +++ head/sys/dev/spibus/spibus.cThu May 26 06:35:11 2016 (r300710) @@ -105,6 +105,7 @@ spibus_print_child(device_t dev, device_ retval += bus_print_child_header(dev, child); retval += printf(" at cs %d", devi->cs); + retval += printf(" mode %d", devi->mode); retval += bus_print_child_footer(dev, child); return (retval); @@ -117,6 +118,7 @@ spibus_probe_nomatch(device_t bus, devic device_printf(bus, ""); printf(" at cs %d\n", devi->cs); + printf(" mode %d", devi->mode); return; } @@ -149,6 +151,11 @@ spibus_read_ivar(device_t bus, device_t case SPIBUS_IVAR_CS: *(uint32_t *)result = devi->cs; break; + case SPIBUS_IVAR_MODE: + *(uint32_t *)result = devi->mode; + break; + case SPIBUS_IVAR_CLOCK: + *(uint32_t *)result = devi->clock; } return (0); } @@ -179,7 +186,9 @@ spibus_hinted_child(device_t bus, const child = BUS_ADD_CHILD(bus, 0, dname, dunit); devi = SPIBUS_IVAR(child); + devi->mode = SPIBUS_MODE_NONE; resource_int_value(dname, dunit, "cs", &devi->cs); + resource_int_value(dname, dunit, "mode", &devi->mode); } static int Modified: head/sys/dev/spibus/spibusvar.h == --- head/sys/dev/spibus/spibusvar.h Thu May 26 03:55:27 2016 (r300709) +++ head/sys/dev/spibus/spibusvar.h Thu May 26 06:35:11 2016 (r300710) @@ -34,13 +34,22 @@ struct spibus_softc device_tdev; }; +#defineSPIBUS_MODE_NONE0 +#defineSPIBUS_MODE_CPHA1 +#defineSPIBUS_MODE_CPOL2 +#defineSPIBUS_MODE_CPOL_CPHA 3 + struct spibus_ivar { uint32_tcs; + uint32_tmode; + uint32_tclock; }; enum { - SPIBUS_IVAR_CS /* chip select that we're on */ + SPIBUS_IVAR_CS, /* chip select that we're on */ + SPIBUS_IVAR_MODE, /* SPI mode (0-3) */ + SPIBUS_IVAR_CLOCK, /* maximum clock freq for device */ }; #define SPIBUS_ACCESSOR(A, B, T) \ @@ -52,6 +61,8 @@ spibus_get_ ## A(device_t dev, T *t) } SPIBUS_ACCESSOR(cs,CS, uint32_t) +SPIBUS_ACCESSOR(mode, MODE, uint32_t) +SPIBUS_ACCESSOR(clock, CLOCK, uint32_t) extern driver_t spibus_driver; extern devclass_t spibus_devclass; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300711 - head/sys/dev/spibus
Author: adrian Date: Thu May 26 06:36:58 2016 New Revision: 300711 URL: https://svnweb.freebsd.org/changeset/base/300711 Log: [spibus] add missing break. Pointy hat to: me Modified: head/sys/dev/spibus/spibus.c Modified: head/sys/dev/spibus/spibus.c == --- head/sys/dev/spibus/spibus.cThu May 26 06:35:11 2016 (r300710) +++ head/sys/dev/spibus/spibus.cThu May 26 06:36:58 2016 (r300711) @@ -156,6 +156,7 @@ spibus_read_ivar(device_t bus, device_t break; case SPIBUS_IVAR_CLOCK: *(uint32_t *)result = devi->clock; + break; } return (0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300712 - head/sys/dev/spibus
Author: adrian Date: Thu May 26 06:37:33 2016 New Revision: 300712 URL: https://svnweb.freebsd.org/changeset/base/300712 Log: [spibus] implement maximum clock frequency lookup from ofw. Obtained from:loos Modified: head/sys/dev/spibus/ofw_spibus.c Modified: head/sys/dev/spibus/ofw_spibus.c == --- head/sys/dev/spibus/ofw_spibus.cThu May 26 06:36:58 2016 (r300711) +++ head/sys/dev/spibus/ofw_spibus.cThu May 26 06:37:33 2016 (r300712) @@ -78,7 +78,7 @@ ofw_spibus_attach(device_t dev) struct spibus_softc *sc = device_get_softc(dev); struct ofw_spibus_devinfo *dinfo; phandle_t child; - pcell_t paddr; + pcell_t clock, paddr; device_t childdev; sc->dev = dev; @@ -103,6 +103,14 @@ ofw_spibus_attach(device_t dev) } /* +* Get the maximum clock frequency for device, zero means +* use the default bus speed. +*/ + if (OF_getencprop(child, "spi-max-frequency", &clock, + sizeof(clock)) == -1) + clock = 0; + + /* * Now set up the SPI and OFW bus layer devinfo and add it * to the bus. */ @@ -111,6 +119,7 @@ ofw_spibus_attach(device_t dev) if (dinfo == NULL) continue; dinfo->opd_dinfo.cs = paddr; + dinfo->opd_dinfo.clock = clock; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"