svn commit: r343675 - stable/12/libexec/rc
Author: avos Date: Sat Feb 2 04:19:35 2019 New Revision: 343675 URL: https://svnweb.freebsd.org/changeset/base/343675 Log: MFC r343499: rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used They will stop it automatically ('Interface wlan0 is down, dhclient exiting'); use /etc/rc.d/dhclient stop command only when none of them is used. Modified: stable/12/libexec/rc/network.subr Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/network.subr == --- stable/12/libexec/rc/network.subr Sat Feb 2 04:15:16 2019 (r343674) +++ stable/12/libexec/rc/network.subr Sat Feb 2 04:19:35 2019 (r343675) @@ -257,9 +257,7 @@ ifconfig_down() elif hostapif $1; then /etc/rc.d/hostapd stop $1 _cfg=0 - fi - - if dhcpif $1; then + elif dhcpif $1; then /etc/rc.d/dhclient stop $1 _cfg=0 fi ___ 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: r343673 - head/sys/vm
Author: mav Date: Sat Feb 2 04:11:59 2019 New Revision: 343673 URL: https://svnweb.freebsd.org/changeset/base/343673 Log: Fix integer math overflow in UMA hash_alloc(). 512GB of ZFS ABD ARC means abd_chunk zone of 128M 4KB items. To manage them UMA tries to allocate 2GB hash table, which size does not fit into the int variable, causing later allocation failure, which makes ARC shrink back below the 512GB, not letting it to use more RAM. With this change I easily reached >700GB ARC size on 768GB RAM machine. MFC after:1 week Sponsored by: iXsystems, Inc. Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Fri Feb 1 23:16:59 2019(r343672) +++ head/sys/vm/uma_core.c Sat Feb 2 04:11:59 2019(r343673) @@ -623,7 +623,7 @@ static int hash_alloc(struct uma_hash *hash) { int oldsize; - int alloc; + size_t alloc; oldsize = hash->uh_hashsize; ___ 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: r343676 - stable/11/etc
Author: avos Date: Sat Feb 2 04:21:00 2019 New Revision: 343676 URL: https://svnweb.freebsd.org/changeset/base/343676 Log: MFC r343499: rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used They will stop it automatically ('Interface wlan0 is down, dhclient exiting'); use /etc/rc.d/dhclient stop command only when none of them is used. Modified: stable/11/etc/network.subr Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/network.subr == --- stable/11/etc/network.subr Sat Feb 2 04:19:35 2019(r343675) +++ stable/11/etc/network.subr Sat Feb 2 04:21:00 2019(r343676) @@ -257,9 +257,7 @@ ifconfig_down() elif hostapif $1; then /etc/rc.d/hostapd stop $1 _cfg=0 - fi - - if dhcpif $1; then + elif dhcpif $1; then /etc/rc.d/dhclient stop $1 _cfg=0 fi ___ 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: r343674 - in head/sys: conf powerpc/powernv powerpc/pseries
Author: jhibbits Date: Sat Feb 2 04:15:16 2019 New Revision: 343674 URL: https://svnweb.freebsd.org/changeset/base/343674 Log: powerpc/powernv: Add a driver for the POWER9 XIVE interrupt controller The XIVE (External Interrupt Virtualization Engine) is a new interrupt controller present in IBM's POWER9 processor. It's a very powerful, very complex device using queues and shared memory to improve interrupt dispatch performance in a virtualized environment. This yields a ~10% performance improvment over the XICS emulation mode, measured in both buildworld, and 'dd' from nvme to /dev/null. Currently, this only supports native access. MFC after:1 month Added: head/sys/powerpc/powernv/xive.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/powernv/opal.h head/sys/powerpc/powernv/platform_powernv.c head/sys/powerpc/pseries/xics.c Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Sat Feb 2 04:11:59 2019(r343673) +++ head/sys/conf/files.powerpc Sat Feb 2 04:15:16 2019(r343674) @@ -201,6 +201,7 @@ powerpc/powernv/opalcall.S optionalpowernv powerpc/powernv/platform_powernv.c optionalpowernv powerpc/powernv/powernv_centaur.c optionalpowernv powerpc/powernv/powernv_xscom.coptionalpowernv +powerpc/powernv/xive.c optionalpowernv powerpc/powerpc/altivec.c optionalpowerpc | powerpc64 powerpc/powerpc/autoconf.c standard powerpc/powerpc/bus_machdep.c standard Modified: head/sys/powerpc/powernv/opal.h == --- head/sys/powerpc/powernv/opal.h Sat Feb 2 04:11:59 2019 (r343673) +++ head/sys/powerpc/powernv/opal.h Sat Feb 2 04:15:16 2019 (r343674) @@ -82,6 +82,20 @@ int opal_call(uint64_t token, ...); #defineOPAL_INT_SET_MFRR 125 #defineOPAL_PCI_TCE_KILL 126 #defineOPAL_XIVE_RESET 128 +#defineOPAL_XIVE_GET_IRQ_INFO 129 +#defineOPAL_XIVE_GET_IRQ_CONFIG130 +#defineOPAL_XIVE_SET_IRQ_CONFIG131 +#defineOPAL_XIVE_GET_QUEUE_INFO132 +#defineOPAL_XIVE_SET_QUEUE_INFO133 +#defineOPAL_XIVE_DONATE_PAGE 134 +#defineOPAL_XIVE_ALLOCATE_VP_BLOCK 135 +#defineOPAL_XIVE_FREE_VP_BLOCK 136 +#defineOPAL_XIVE_GET_VP_INFO 137 +#defineOPAL_XIVE_SET_VP_INFO 138 +#defineOPAL_XIVE_ALLOCATE_IRQ 139 +#defineOPAL_XIVE_FREE_IRQ 140 +#defineOPAL_XIVE_SYNC 141 +#defineOPAL_XIVE_DUMP 142 #defineOPAL_SENSOR_GROUP_CLEAR 156 #defineOPAL_SENSOR_READ_U64162 #defineOPAL_SENSOR_GROUP_ENABLE163 @@ -114,6 +128,18 @@ int opal_call(uint64_t token, ...); #defineOPAL_BUSY_EVENT -12 #defineOPAL_ASYNC_COMPLETION -15 #defineOPAL_EMPTY -16 +#defineOPAL_XIVE_PROVISIONING -31 +#defineOPAL_XIVE_FREE_ACTIVE -32 + +#defineOPAL_XIVE_XICS_MODE_EMU 0 +#defineOPAL_XIVE_XICS_MODE_EXP 1 + +#defineOPAL_XIVE_VP_ENABLED0x0001 +#defineOPAL_XIVE_VP_SINGLE_ESCALATION 0x0002 + +#defineOPAL_XIVE_EQ_ENABLED0x0001 +#defineOPAL_XIVE_EQ_ALWAYS_NOTIFY 0x0002 +#defineOPAL_XIVE_EQ_ESCALATE 0x0004 struct opal_msg { uint32_t msg_type; Modified: head/sys/powerpc/powernv/platform_powernv.c == --- head/sys/powerpc/powernv/platform_powernv.c Sat Feb 2 04:11:59 2019 (r343673) +++ head/sys/powerpc/powernv/platform_powernv.c Sat Feb 2 04:15:16 2019 (r343674) @@ -59,7 +59,8 @@ __FBSDID("$FreeBSD$"); extern void *ap_pcpu; #endif -extern void xicp_smp_cpu_startup(void); +void (*powernv_smp_ap_extra_init)(void); + static int powernv_probe(platform_t); static int powernv_attach(platform_t); void powernv_mem_regions(platform_t, struct mem_region *phys, int *physsz, @@ -473,7 +474,8 @@ static void powernv_smp_ap_init(platform_t platform) { - xicp_smp_cpu_startup(); + if (powernv_smp_ap_extra_init != NULL) + powernv_smp_ap_extra_init(); } static void Added: head/sys/powerpc/powernv/xive.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/xive.c Sat Feb 2 04:15:16 2019 (r343674) @@ -0,0 +1,764 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2019
svn commit: r343672 - head/libexec/rtld-elf/i386
Author: vangyzen Date: Fri Feb 1 23:16:59 2019 New Revision: 343672 URL: https://svnweb.freebsd.org/changeset/base/343672 Log: rtld: pacify -Wmaybe-uninitialized from gcc6 Sponsored by: Dell EMC Isilon Modified: head/libexec/rtld-elf/i386/reloc.c Modified: head/libexec/rtld-elf/i386/reloc.c == --- head/libexec/rtld-elf/i386/reloc.c Fri Feb 1 23:15:54 2019 (r343671) +++ head/libexec/rtld-elf/i386/reloc.c Fri Feb 1 23:16:59 2019 (r343672) @@ -146,6 +146,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int } else cache = NULL; + /* Appease some compilers. */ + symval = 0; + def = NULL; + rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize); for (rel = obj->rel; rel < rellim; rel++) { switch (ELF_R_TYPE(rel->r_info)) { ___ 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: r343671 - head/lib/msun
Author: vangyzen Date: Fri Feb 1 23:15:54 2019 New Revision: 343671 URL: https://svnweb.freebsd.org/changeset/base/343671 Log: libm: squelch -Woverflow from gcc6 Sponsored by: Dell EMC Isilon Modified: head/lib/msun/Makefile Modified: head/lib/msun/Makefile == --- head/lib/msun/Makefile Fri Feb 1 23:04:45 2019(r343670) +++ head/lib/msun/Makefile Fri Feb 1 23:15:54 2019(r343671) @@ -108,6 +108,15 @@ COMMON_SRCS+= catrigl.c \ s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \ s_scalbnl.c s_sinl.c s_sincosl.c \ s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c +# Work around this warning from gcc 6: +# lib/msun/ld80/e_powl.c:275:1: error: floating constant exceeds range of +# 'long double' [-Werror=overflow] +# if( y >= LDBL_MAX ) +# See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067 +.include +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 6 +CFLAGS.e_powl.c+= -Wno-error=overflow +.endif .endif # C99 complex functions ___ 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: r343670 - in head/sys: dev/qlnx/qlnxe dev/qlnx/qlnxr modules/qlnx/qlnxr
Author: cem Date: Fri Feb 1 23:04:45 2019 New Revision: 343670 URL: https://svnweb.freebsd.org/changeset/base/343670 Log: qlnxr(4), qlnxe(4): Unbreak gcc build Remove redundant definitions and conditionalize Clang-specific CFLAGS. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/qlnx/qlnxe/qlnx_rdma.h head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c head/sys/modules/qlnx/qlnxr/Makefile Modified: head/sys/dev/qlnx/qlnxe/qlnx_rdma.h == --- head/sys/dev/qlnx/qlnxe/qlnx_rdma.h Fri Feb 1 22:24:14 2019 (r343669) +++ head/sys/dev/qlnx/qlnxe/qlnx_rdma.h Fri Feb 1 23:04:45 2019 (r343670) @@ -51,8 +51,6 @@ typedef struct qlnx_rdma_if qlnx_rdma_if_t; extern int qlnx_rdma_register_if(qlnx_rdma_if_t *rdma_if); extern int qlnx_rdma_deregister_if(qlnx_rdma_if_t *rdma_if); -extern int qlnx_rdma_ll2_set_mac_filter(void *rdma_ctx, uint8_t *old_mac_address, -uint8_t *new_mac_address); #define QLNX_NUM_CNQ 1 Modified: head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c == --- head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c Fri Feb 1 22:24:14 2019 (r343669) +++ head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c Fri Feb 1 23:04:45 2019 (r343670) @@ -74,16 +74,6 @@ __FBSDID("$FreeBSD$"); ((unsigned char *))[2], \ ((unsigned char *))[3] -struct ib_srq *qlnxr_create_srq(struct ib_pd *, - struct ib_srq_init_attr *, - struct ib_udata *); - -int qlnxr_destroy_srq(struct ib_srq *); - -int qlnxr_modify_srq(struct ib_srq *, - struct ib_srq_attr *, - enum ib_srq_attr_mask, - struct ib_udata *); static int qlnxr_check_srq_params(struct ib_pd *ibpd, struct qlnxr_dev *dev, @@ -99,19 +89,6 @@ static int qlnxr_alloc_srq_kernel_params(struct qlnxr_srq *srq, struct qlnxr_dev *dev, struct ib_srq_init_attr *init_attr); - -extern enum _ecore_status_t -ecore_rdma_modify_srq(void *rdma_cxt, - struct ecore_rdma_modify_srq_in_params *in_params); - -extern enum _ecore_status_t -ecore_rdma_destroy_srq(void *rdma_cxt, - struct ecore_rdma_destroy_srq_in_params *in_params); - -extern enum _ecore_status_t -ecore_rdma_create_srq(void *rdma_cxt, - struct ecore_rdma_create_srq_in_params *in_params, - struct ecore_rdma_create_srq_out_params *out_params); static int Modified: head/sys/modules/qlnx/qlnxr/Makefile == --- head/sys/modules/qlnx/qlnxr/MakefileFri Feb 1 22:24:14 2019 (r343669) +++ head/sys/modules/qlnx/qlnxr/MakefileFri Feb 1 23:04:45 2019 (r343670) @@ -62,12 +62,14 @@ CFLAGS+= -DINET6 -DINET CWARNEXTRA += -Wno-cast-qual CWARNEXTRA += -Wno-unused-function +.if ${COMPILER_TYPE} == "clang" CWARNEXTRA += -Wno-gnu-variable-sized-type-not-at-end +.endif CWARNEXTRA += -Wno-missing-prototypes -CWARNEXTRA += -Wno-constant-conversion +CWARNEXTRA += ${NO_WCONSTANT_CONVERSION} CWARNEXTRA += -Wno-format -CWARNEXTRA += -Wno-shift-sign-overflow +CWARNEXTRA += ${NO_WSHIFT_COUNT_OVERFLOW} CWARNEXTRA += -Wno-empty-body CFLAGS += -DQLNX_DEBUG ___ 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: r343669 - head/contrib/elftoolchain/readelf
Author: emaste Date: Fri Feb 1 22:24:14 2019 New Revision: 343669 URL: https://svnweb.freebsd.org/changeset/base/343669 Log: readelf: decode FreeBSD note types Decode NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and NT_FREEBSD_FEATURE_CTL. Reviewed by: brooks, kib (earlier) MFC after:2 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D19054 Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c == --- head/contrib/elftoolchain/readelf/readelf.c Fri Feb 1 21:09:36 2019 (r343668) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Feb 1 22:24:14 2019 (r343669) @@ -313,6 +313,8 @@ static void dump_mips_specific_info(struct readelf *re static void dump_notes(struct readelf *re); static void dump_notes_content(struct readelf *re, const char *buf, size_t sz, off_t off); +static void dump_notes_data(const char *name, uint32_t type, const char *buf, +size_t sz); static void dump_svr4_hash(struct section *s); static void dump_svr4_hash64(struct readelf *re, struct section *s); static void dump_gnu_hash(struct readelf *re, struct section *s); @@ -3486,12 +3488,58 @@ dump_notes(struct readelf *re) } } +static struct flag_desc note_feature_ctl_flags[] = { + { NT_FREEBSD_FCTL_ASLR_DISABLE, "ASLR_DISABLE" }, + { 0, NULL } +}; + static void +dump_notes_data(const char *name, uint32_t type, const char *buf, size_t sz) +{ + size_t i; + const uint32_t *ubuf; + + /* Note data is at least 4-byte aligned. */ + if (((uintptr_t)buf & 3) != 0) { + warnx("bad note data alignment"); + goto unknown; + } + ubuf = (const uint32_t *)(const void *)buf; + + if (strcmp(name, "FreeBSD") == 0) { + switch (type) { + case NT_FREEBSD_ABI_TAG: + if (sz != 4) + goto unknown; + printf(" ABI tag: %u\n", ubuf[0]); + return; + /* NT_FREEBSD_NOINIT_TAG carries no data, treat as unknown. */ + case NT_FREEBSD_ARCH_TAG: + if (sz != 4) + goto unknown; + printf(" Arch tag: %x\n", ubuf[0]); + return; + case NT_FREEBSD_FEATURE_CTL: + if (sz != 4) + goto unknown; + printf(" Features:"); + dump_flags(note_feature_ctl_flags, ubuf[0]); + printf("\n"); + return; + } + } +unknown: + printf(" description data:"); + for (i = 0; i < sz; i++) + printf(" %02x", (unsigned char)buf[i]); + printf("\n"); +} + +static void dump_notes_content(struct readelf *re, const char *buf, size_t sz, off_t off) { Elf_Note *note; const char *end, *name; - uint32_t i; printf("\nNotes at offset %#010jx with length %#010jx:\n", (uintmax_t) off, (uintmax_t) sz); @@ -3523,10 +3571,7 @@ dump_notes_content(struct readelf *re, const char *buf printf(" %-13s %#010jx", name, (uintmax_t) note->n_descsz); printf(" %s\n", note_type(name, re->ehdr.e_type, note->n_type)); - printf(" description data:"); - for (i = 0; i < note->n_descsz; i++) - printf(" %02x", (unsigned char)buf[i]); - printf("\n"); + dump_notes_data(name, note->n_type, buf, note->n_descsz); buf += roundup2(note->n_descsz, 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: r343668 - head/sys/i386/i386
Author: kib Date: Fri Feb 1 21:09:36 2019 New Revision: 343668 URL: https://svnweb.freebsd.org/changeset/base/343668 Log: Disable boot-time memory test on i386 be default. With the current 24G memory limit for GENERIC, the boot time test causes quite visible delay, amplified by the default debug.late_console = 0. The comment text is copied from the same setting explanation for amd64. Suggested by: bde Discussed with: emaste Sponsored by: The FreeBSD Foundation MFC after:2 months Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c == --- head/sys/i386/i386/machdep.cFri Feb 1 20:46:47 2019 (r343667) +++ head/sys/i386/i386/machdep.cFri Feb 1 21:09:36 2019 (r343668) @@ -2005,13 +2005,15 @@ physmap_done: Maxmem = atop(physmap[physmap_idx + 1]); /* -* By default enable the memory test on real hardware, and disable -* it if we appear to be running in a VM. This avoids touching all -* pages unnecessarily, which doesn't matter on real hardware but is -* bad for shared VM hosts. Use a general name so that -* one could eventually do more with the code than just disable it. +* The boot memory test is disabled by default, as it takes a +* significant amount of time on large-memory systems, and is +* unfriendly to virtual machines as it unnecessarily touches all +* pages. +* +* A general name is used as the code may be extended to support +* additional tests beyond the current "page present" test. */ - memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; + memtest = 0; TUNABLE_ULONG_FETCH("hw.memtest.tests", ); if (atop(physmap[physmap_idx + 1]) != Maxmem && ___ 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: r343667 - head/sys/x86/x86
Author: kib Date: Fri Feb 1 20:46:47 2019 New Revision: 343667 URL: https://svnweb.freebsd.org/changeset/base/343667 Log: x86: correctly limit max memory resource address.. CPU and buses can manage up to the limit reported by cpu_maxphyaddr, so set mem_rman to the value returned by cpu_getmaxphyaddr(). For the PAE mode, it was missed both when rman_res_t was increased to uintmax_t, and from the PAE merge commit. When importing smaps or dump_avail chunks into memory rman, do not blindly ignore resources which ends above the limit, chomp them instead if start is below the limit. The same change was already done to i386 add_physmap_entry(). Based on the submission by: bde MFC after:2 months Modified: head/sys/x86/x86/nexus.c Modified: head/sys/x86/x86/nexus.c == --- head/sys/x86/x86/nexus.cFri Feb 1 20:42:49 2019(r343666) +++ head/sys/x86/x86/nexus.cFri Feb 1 20:46:47 2019(r343667) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -269,11 +270,7 @@ nexus_init_resources(void) panic("nexus_init_resources port_rman"); mem_rman.rm_start = 0; -#ifndef PAE - mem_rman.rm_end = BUS_SPACE_MAXADDR; -#else - mem_rman.rm_end = ((1ULL << cpu_maxphyaddr) - 1); -#endif + mem_rman.rm_end = cpu_getmaxphyaddr(); mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; if (rman_init(_rman) @@ -787,6 +784,7 @@ ram_attach(device_t dev) { struct bios_smap *smapbase, *smap, *smapend; struct resource *res; + rman_res_t length; vm_paddr_t *p; caddr_t kmdp; uint32_t smapsize; @@ -807,16 +805,12 @@ ram_attach(device_t dev) if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0) continue; -#ifdef __i386__ - /* -* Resources use long's to track resources, so -* we can't include memory regions above 4GB. -*/ - if (smap->base > ~0ul) + if (smap->base > mem_rman.rm_end) continue; -#endif + length = smap->base + smap->length > mem_rman.rm_end ? + mem_rman.rm_end - smap->base : smap->length; error = bus_set_resource(dev, SYS_RES_MEMORY, rid, - smap->base, smap->length); + smap->base, length); if (error) panic( "ram_attach: resource %d failed set with %d", @@ -841,16 +835,12 @@ ram_attach(device_t dev) * segment is 0. */ for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) { -#ifdef PAE - /* -* Resources use long's to track resources, so we can't -* include memory regions above 4GB. -*/ - if (p[0] > ~0ul) + if (p[0] > mem_rman.rm_end) break; -#endif + length = (p[1] > mem_rman.rm_end ? mem_rman.rm_end : p[1]) - + p[0]; error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0], - p[1] - p[0]); + length); if (error) panic("ram_attach: resource %d failed set with %d", rid, error); ___ 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: r343666 - in head/sys/dev/cxgbe: . common
Author: np Date: Fri Feb 1 20:42:49 2019 New Revision: 343666 URL: https://svnweb.freebsd.org/changeset/base/343666 Log: cxgbe(4): Improved error reporting and diagnostics. "slow" interrupt handler: - Expand the list of INT_CAUSE registers known to the driver. - Add decode information for many more bits but decouple it from the rest of intr_info so that it is entirely optional. - Call t4_fatal_err exactly once, and from the top level PL intr handler. t4_fatal_err: - Use t4_shutdown_adapter from the common code to stop the adapter. - Stop servicing slow interrupts after the first fatal one. Driver/firmware interaction: - CH_DUMP_MBOX: note whether the mailbox being dumped is a command or a reply or something else. - Log the raw value of pcie_fw for some errors. - Use correct log levels (debug vs. error). Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hFri Feb 1 20:28:15 2019 (r343665) +++ head/sys/dev/cxgbe/adapter.hFri Feb 1 20:42:49 2019 (r343666) @@ -155,7 +155,7 @@ enum { CHK_MBOX_ACCESS = (1 << 2), MASTER_PF = (1 << 3), ADAP_SYSCTL_CTX = (1 << 4), - /* TOM_INIT_DONE= (1 << 5), No longer used */ + ADAP_ERR= (1 << 5), BUF_PACKING_OK = (1 << 6), IS_VF = (1 << 7), @@ -175,6 +175,7 @@ enum { DF_LOAD_FW_ANYTIME = (1 << 1), /* Allow LOAD_FW after init */ DF_DISABLE_TCB_CACHE= (1 << 2), /* Disable TCB cache (T6+) */ DF_DISABLE_CFG_RETRY= (1 << 3), /* Disable fallback config */ + DF_VERBOSE_SLOWINTR = (1 << 4), /* Chatty slow intr handler */ }; #define IS_DOOMED(vi) ((vi)->flags & DOOMED) @@ -932,24 +933,6 @@ struct adapter { #define TXQ_LOCK_ASSERT_OWNED(txq) EQ_LOCK_ASSERT_OWNED(&(txq)->eq) #define TXQ_LOCK_ASSERT_NOTOWNED(txq) EQ_LOCK_ASSERT_NOTOWNED(&(txq)->eq) -#define CH_DUMP_MBOX(sc, mbox, data_reg) \ - do { \ - if (sc->debug_flags & DF_DUMP_MBOX) { \ - log(LOG_NOTICE, \ - "%s mbox %u: %016llx %016llx %016llx %016llx " \ - "%016llx %016llx %016llx %016llx\n", \ - device_get_nameunit(sc->dev), mbox, \ - (unsigned long long)t4_read_reg64(sc, data_reg), \ - (unsigned long long)t4_read_reg64(sc, data_reg + 8), \ - (unsigned long long)t4_read_reg64(sc, data_reg + 16), \ - (unsigned long long)t4_read_reg64(sc, data_reg + 24), \ - (unsigned long long)t4_read_reg64(sc, data_reg + 32), \ - (unsigned long long)t4_read_reg64(sc, data_reg + 40), \ - (unsigned long long)t4_read_reg64(sc, data_reg + 48), \ - (unsigned long long)t4_read_reg64(sc, data_reg + 56)); \ - } \ - } while (0) - #define for_each_txq(vi, iter, q) \ for (q = >pi->adapter->sge.txq[vi->first_txq], iter = 0; \ iter < vi->ntxq; ++iter, ++q) @@ -1103,6 +1086,38 @@ t4_use_ldst(struct adapter *sc) #else return (0); #endif +} + +static inline void +CH_DUMP_MBOX(struct adapter *sc, int mbox, const int reg, +const char *msg, const __be64 *const p, const bool err) +{ + + if (!(sc->debug_flags & DF_DUMP_MBOX) && !err) + return; + if (p != NULL) { + log(err ? LOG_ERR : LOG_DEBUG, + "%s: mbox %u %s %016llx %016llx %016llx %016llx " + "%016llx %016llx %016llx %016llx\n", + device_get_nameunit(sc->dev), mbox, msg, + (long long)be64_to_cpu(p[0]), (long long)be64_to_cpu(p[1]), + (long long)be64_to_cpu(p[2]), (long long)be64_to_cpu(p[3]), + (long long)be64_to_cpu(p[4]), (long long)be64_to_cpu(p[5]), + (long long)be64_to_cpu(p[6]), (long long)be64_to_cpu(p[7])); + } else { + log(err ? LOG_ERR : LOG_DEBUG, + "%s: mbox %u %s %016llx %016llx %016llx %016llx " + "%016llx %016llx %016llx %016llx\n", + device_get_nameunit(sc->dev), mbox, msg, + (long long)t4_read_reg64(sc, reg), + (long long)t4_read_reg64(sc, reg + 8), + (long long)t4_read_reg64(sc, reg + 16), + (long long)t4_read_reg64(sc, reg + 24), + (long long)t4_read_reg64(sc, reg + 32), + (long long)t4_read_reg64(sc, reg + 40), +
svn commit: r343665 - head/contrib/elftoolchain/readelf
Author: emaste Date: Fri Feb 1 20:28:15 2019 New Revision: 343665 URL: https://svnweb.freebsd.org/changeset/base/343665 Log: readelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding Fewer lines of code and more maintainable. Reviewed by: brooks, kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D19053 Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c == --- head/contrib/elftoolchain/readelf/readelf.c Fri Feb 1 18:19:33 2019 (r343664) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Feb 1 20:28:15 2019 (r343665) @@ -220,6 +220,11 @@ struct mips_option { const char *desc; }; +struct flag_desc { + uint64_t flag; + const char *desc; +}; + static void add_dumpop(struct readelf *re, size_t si, const char *sn, int op, int t); static const char *aeabi_adv_simd_arch(uint64_t simd); @@ -293,8 +298,7 @@ static void dump_dwarf_ranges_foreach(struct readelf * static void dump_dwarf_str(struct readelf *re); static void dump_eflags(struct readelf *re, uint64_t e_flags); static void dump_elf(struct readelf *re); -static void dump_dt_flags_val(uint64_t d_val); -static void dump_dt_flags_1_val(uint64_t d_val); +static void dump_flags(struct flag_desc *fd, uint64_t flags); static void dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab); static void dump_dynamic(struct readelf *re); static void dump_liblist(struct readelf *re); @@ -2723,6 +2727,58 @@ dump_arch_dyn_val(struct readelf *re, GElf_Dyn *dyn) } static void +dump_flags(struct flag_desc *desc, uint64_t val) +{ + struct flag_desc *fd; + + for (fd = desc; fd->flag != 0; fd++) { + if (val & fd->flag) { + val &= ~fd->flag; + printf(" %s", fd->desc); + } + } + if (val != 0) + printf(" unknown (0x%jx)", (uintmax_t)val); +} + +static struct flag_desc dt_flags[] = { + { DF_ORIGIN,"ORIGIN" }, + { DF_SYMBOLIC, "SYMBOLIC" }, + { DF_TEXTREL, "TEXTREL" }, + { DF_BIND_NOW, "BIND_NOW" }, + { DF_STATIC_TLS,"STATIC_TLS" }, + { 0, NULL } +}; + +static struct flag_desc dt_flags_1[] = { + { DF_1_BIND_NOW,"NOW" }, + { DF_1_GLOBAL, "GLOBAL" }, + { 0x4, "GROUP" }, + { DF_1_NODELETE,"NODELETE" }, + { DF_1_LOADFLTR,"LOADFLTR" }, + { 0x20, "INITFIRST" }, + { DF_1_NOOPEN, "NOOPEN" }, + { DF_1_ORIGIN, "ORIGIN" }, + { 0x100,"DIRECT" }, + { DF_1_INTERPOSE, "INTERPOSE" }, + { DF_1_NODEFLIB,"NODEFLIB" }, + { 0x1000, "NODUMP" }, + { 0x2000, "CONFALT" }, + { 0x4000, "ENDFILTEE" }, + { 0x8000, "DISPRELDNE" }, + { 0x1, "DISPRELPND" }, + { 0x2, "NODIRECT" }, + { 0x4, "IGNMULDEF" }, + { 0x8, "NOKSYMS" }, + { 0x10, "NOHDR" }, + { 0x20, "EDITED" }, + { 0x40, "NORELOC" }, + { 0x80, "SYMINTPOSE" }, + { 0x100,"GLOBAUDIT" }, + { 0, NULL } +}; + +static void dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab) { const char *name; @@ -2807,146 +2863,14 @@ dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32 printf(" %s\n", timestamp(dyn->d_un.d_val)); break; case DT_FLAGS: - dump_dt_flags_val(dyn->d_un.d_val); + dump_flags(dt_flags, dyn->d_un.d_val); break; case DT_FLAGS_1: - dump_dt_flags_1_val(dyn->d_un.d_val); + dump_flags(dt_flags_1, dyn->d_un.d_val); break; default: printf("\n"); } -} - -static void -dump_dt_flags_val(uint64_t d_val) -{ - if (d_val & 0x1) { - d_val ^= 0x1; - printf(" ORIGIN"); - } - if (d_val & 0x2) { - d_val ^= 0x2; - printf(" SYMBOLIC"); - } - if (d_val & 0x4) { - d_val ^= 0x4; - printf(" TEXTREL"); - } - if (d_val & 0x8) { - d_val ^= 0x8; - printf(" BIND_NOW"); - } - if (d_val & 0x10) { - d_val ^= 0x10; - printf(" STATIC_TLS"); - } - if (d_val) - printf(" %jx", (uintmax_t)d_val); - printf("\n"); -} - -static void -dump_dt_flags_1_val(uint64_t d_val) -{ - if (d_val & 0x1) { - d_val ^= 0x1; - printf("
svn commit: r343664 - stable/12/sys/vm
Author: markj Date: Fri Feb 1 18:19:33 2019 New Revision: 343664 URL: https://svnweb.freebsd.org/changeset/base/343664 Log: MFC r343353: Correct uma_prealloc()'s use of domainset iterators after r339925. Modified: stable/12/sys/vm/uma_core.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/uma_core.c == --- stable/12/sys/vm/uma_core.c Fri Feb 1 16:07:49 2019(r343663) +++ stable/12/sys/vm/uma_core.c Fri Feb 1 18:19:33 2019(r343664) @@ -236,7 +236,7 @@ static void *pcpu_page_alloc(uma_zone_t, vm_size_t, in static void *startup_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); static void page_free(void *, vm_size_t, uint8_t); static void pcpu_page_free(void *, vm_size_t, uint8_t); -static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int, int); +static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int, int, int); static void cache_drain(uma_zone_t); static void bucket_drain(uma_zone_t, uma_bucket_t); static void bucket_cache_drain(uma_zone_t zone); @@ -1050,20 +1050,22 @@ zone_drain(uma_zone_t zone) * otherwise the keg will be left unlocked. * * Arguments: - * wait Shall we wait? + * flags Wait flags for the item initialization routine + * aflags Wait flags for the slab allocation * * Returns: * The slab that was allocated or NULL if there is no memory and the * caller specified M_NOWAIT. */ static uma_slab_t -keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int wait) +keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, +int aflags) { uma_alloc allocf; uma_slab_t slab; unsigned long size; uint8_t *mem; - uint8_t flags; + uint8_t sflags; int i; KASSERT(domain >= 0 && domain < vm_ndomains, @@ -1076,7 +1078,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom slab = NULL; mem = NULL; if (keg->uk_flags & UMA_ZONE_OFFPAGE) { - slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, wait); + slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, aflags); if (slab == NULL) goto out; } @@ -1089,16 +1091,16 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom */ if ((keg->uk_flags & UMA_ZONE_MALLOC) == 0) - wait |= M_ZERO; + aflags |= M_ZERO; else - wait &= ~M_ZERO; + aflags &= ~M_ZERO; if (keg->uk_flags & UMA_ZONE_NODUMP) - wait |= M_NODUMP; + aflags |= M_NODUMP; /* zone is passed for legacy reasons. */ size = keg->uk_ppera * PAGE_SIZE; - mem = allocf(zone, size, domain, , wait); + mem = allocf(zone, size, domain, , aflags); if (mem == NULL) { if (keg->uk_flags & UMA_ZONE_OFFPAGE) zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE); @@ -1118,7 +1120,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom slab->us_keg = keg; slab->us_data = mem; slab->us_freecount = keg->uk_ipers; - slab->us_flags = flags; + slab->us_flags = sflags; slab->us_domain = domain; BIT_FILL(SLAB_SETSIZE, >us_free); #ifdef INVARIANTS @@ -1128,7 +1130,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom if (keg->uk_init != NULL) { for (i = 0; i < keg->uk_ipers; i++) if (keg->uk_init(slab->us_data + (keg->uk_rsize * i), - keg->uk_size, wait) != 0) + keg->uk_size, flags) != 0) break; if (i != keg->uk_ipers) { keg_free_slab(keg, slab, i); @@ -2770,7 +2772,7 @@ restart: msleep(keg, >uk_lock, PVM, "keglimit", 0); continue; } - slab = keg_alloc_slab(keg, zone, domain, aflags); + slab = keg_alloc_slab(keg, zone, domain, flags, aflags); /* * If we got a slab here it's safe to mark it partially used * and return. We assume that the caller is going to remove @@ -3665,7 +3667,7 @@ uma_prealloc(uma_zone_t zone, int items) uma_domain_t dom; uma_slab_t slab; uma_keg_t keg; - int domain, flags, slabs; + int aflags, domain, slabs; keg = zone_first_keg(zone); if (keg == NULL) @@ -3674,17 +3676,27 @@ uma_prealloc(uma_zone_t zone, int items) slabs = items / keg->uk_ipers; if (slabs * keg->uk_ipers < items) slabs++; - flags = M_WAITOK; - vm_domainset_iter_policy_ref_init(, >uk_dr, , ); while (slabs-- > 0) { - slab = keg_alloc_slab(keg, zone, domain, flags); - if (slab ==
svn commit: r343663 - head/sys/teken
Author: bde Date: Fri Feb 1 16:07:49 2019 New Revision: 343663 URL: https://svnweb.freebsd.org/changeset/base/343663 Log: Fix function keys for syscons in cons25 mode (vidcontrol -T cons25). kbd(4) (but only documented in atkbd(4)) maintains a table of strings for 96 function keys. Using teken broke this 9+ years ago for the most usable first 12 function keys and for 10 cursor keys, by supplying its own non-programmable strings so that the keyboard driver's strings are not used. Fix this by supplying NULL in the teken layer for syscons in cons25 mode so that the the strings are found in the kbd(4) layer. vt needs more changes to use kbd(4)'s tables. Teken's cons25 table is still needed to supply nonempty strings for vt in cons25 mode. Keep using teken's xterm tables for both syscons and vt in xterm mode. Function keys should at least default to xterm values in xterm mode, and kbd(4) doesn't support this. teken_set_cons25() sets a sticky flag to ask for the fix, and space is reserved for another new flag. vt should set this flag when it uses kbd(4)'s tables. PR: 226553 (for vt) Modified: head/sys/teken/teken.c Modified: head/sys/teken/teken.c == --- head/sys/teken/teken.c Fri Feb 1 15:38:20 2019(r343662) +++ head/sys/teken/teken.c Fri Feb 1 16:07:49 2019(r343663) @@ -58,6 +58,7 @@ #defineTS_CONS25 0x0040 /* cons25 emulation. */ #defineTS_INSTRING 0x0080 /* Inside string. */ #defineTS_CURSORKEYS 0x0100 /* Cursor keys mode. */ +#defineTS_CONS25KEYS 0x0400 /* Fuller cons25 emul (fix function keys). */ /* Character that blanks a cell. */ #defineBLANK ' ' @@ -411,7 +412,7 @@ void teken_set_cons25(teken_t *t) { - t->t_stateflags |= TS_CONS25; + t->t_stateflags |= TS_CONS25 | TS_CONS25KEYS; } /* @@ -722,6 +723,9 @@ teken_get_sequence(const teken_t *t, unsigned int k) { /* Cons25 mode. */ + if ((t->t_stateflags & (TS_CONS25 | TS_CONS25KEYS)) == + (TS_CONS25 | TS_CONS25KEYS)) + return (NULL); /* Don't override good kbd(4) strings. */ if (t->t_stateflags & TS_CONS25 && k < sizeof special_strings_cons25 / sizeof(char *)) return (special_strings_cons25[k]); ___ 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: r343662 - svnadmin/conf
Author: jtl Date: Fri Feb 1 15:38:20 2019 New Revision: 343662 URL: https://svnweb.freebsd.org/changeset/base/343662 Log: Add bz@ as a co-mentor for thj@. Approved by: core (implicit) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Fri Feb 1 12:33:00 2019(r343661) +++ svnadmin/conf/mentors Fri Feb 1 15:38:20 2019(r343662) @@ -33,6 +33,6 @@ ram ken Co-mentor: mav rgrimesphk Co-mentor: bde slavashkib Co-mentor: hselasky slmken Co-mentor: scottl, ambrisko -thjjtl +thjjtl Co-mentor: bz tmunro mjg Co-mentor: allanjude wosch cem ___ 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: r343661 - in head/sys/netinet: . tcp_stacks
Author: tuexen Date: Fri Feb 1 12:33:00 2019 New Revision: 343661 URL: https://svnweb.freebsd.org/changeset/base/343661 Log: When handling SYN-ACK segments in the SYN-RCVD state, set tp->snd_wnd consistently. This inconsistency was observed when working on the bug reported in PR 235256, although it does not fix the reported issue. The fix for the PR will be a separate commit. PR: 235256 Reviewed by: rrs@, Richard Scheffenegger MFC after:3 days Sponsored by: Netflix, Inc. Differential Revision:https://reviews.freebsd.org/D19033 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cFri Feb 1 12:24:56 2019 (r343660) +++ head/sys/netinet/tcp_input.cFri Feb 1 12:33:00 2019 (r343661) @@ -2385,8 +2385,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == (TF_RCVD_SCALE|TF_REQ_SCALE)) { tp->rcv_scale = tp->request_r_scale; - tp->snd_wnd = tiwin; } + tp->snd_wnd = tiwin; /* * Make transitions: * SYN-RECEIVED -> ESTABLISHED Modified: head/sys/netinet/tcp_stacks/rack.c == --- head/sys/netinet/tcp_stacks/rack.c Fri Feb 1 12:24:56 2019 (r343660) +++ head/sys/netinet/tcp_stacks/rack.c Fri Feb 1 12:33:00 2019 (r343661) @@ -5433,6 +5433,7 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st tp->ts_recent_age = tcp_ts_getticks(); tp->ts_recent = to->to_tsval; } + tp->snd_wnd = tiwin; /* * If the ACK bit is off: if in SYN-RECEIVED state or SENDSYN flag * is on (half-synchronized state), then queue data for later @@ -5440,7 +5441,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st */ if ((thflags & TH_ACK) == 0) { if (IS_FASTOPEN(tp->t_flags)) { - tp->snd_wnd = tiwin; cc_conn_init(tp); } return (rack_process_data(m, th, so, tp, drop_hdrlen, tlen, @@ -5452,7 +5452,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st if ((tp->t_flags & (TF_RCVD_SCALE | TF_REQ_SCALE)) == (TF_RCVD_SCALE | TF_REQ_SCALE)) { tp->rcv_scale = tp->request_r_scale; - tp->snd_wnd = tiwin; } /* * Make transitions: SYN-RECEIVED -> ESTABLISHED SYN-RECEIVED* -> ___ 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: r343660 - stable/11/sys/dev/virtio/network
Author: vmaffione Date: Fri Feb 1 12:24:56 2019 New Revision: 343660 URL: https://svnweb.freebsd.org/changeset/base/343660 Log: MFC r343552 vtnet: fix typo in vtnet_free_taskqueues Because of a typo, the code was mistakenly resetting the vtnrx_vq pointer rather than vtntx_tq. Reviewed by:bryanv Differential Revision: https://reviews.freebsd.org/D19015 Modified: stable/11/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/virtio/network/if_vtnet.c == --- stable/11/sys/dev/virtio/network/if_vtnet.c Fri Feb 1 12:22:48 2019 (r343659) +++ stable/11/sys/dev/virtio/network/if_vtnet.c Fri Feb 1 12:24:56 2019 (r343660) @@ -2742,7 +2742,7 @@ vtnet_free_taskqueues(struct vtnet_softc *sc) rxq = >vtnet_rxqs[i]; if (rxq->vtnrx_tq != NULL) { taskqueue_free(rxq->vtnrx_tq); - rxq->vtnrx_vq = NULL; + rxq->vtnrx_tq = NULL; } txq = >vtnet_txqs[i]; ___ 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: r343659 - stable/12/sys/dev/virtio/network
Author: vmaffione Date: Fri Feb 1 12:22:48 2019 New Revision: 343659 URL: https://svnweb.freebsd.org/changeset/base/343659 Log: MFC r343552 vtnet: fix typo in vtnet_free_taskqueues Because of a typo, the code was mistakenly resetting the vtnrx_vq pointer rather than vtntx_tq. Reviewed by:bryanv Differential Revision: https://reviews.freebsd.org/D19015 Modified: stable/12/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/virtio/network/if_vtnet.c == --- stable/12/sys/dev/virtio/network/if_vtnet.c Fri Feb 1 10:09:54 2019 (r343658) +++ stable/12/sys/dev/virtio/network/if_vtnet.c Fri Feb 1 12:22:48 2019 (r343659) @@ -2748,7 +2748,7 @@ vtnet_free_taskqueues(struct vtnet_softc *sc) rxq = >vtnet_rxqs[i]; if (rxq->vtnrx_tq != NULL) { taskqueue_free(rxq->vtnrx_tq); - rxq->vtnrx_vq = NULL; + rxq->vtnrx_tq = NULL; } txq = >vtnet_txqs[i]; ___ 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: r343656 - in stable/12/sys/dev/usb: . quirk
Author: hselasky Date: Fri Feb 1 10:08:34 2019 New Revision: 343656 URL: https://svnweb.freebsd.org/changeset/base/343656 Log: MFC r343453: Add new USB quirk. PR: 235202 Differential Revision:https://reviews.freebsd.org/D18917 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c == --- stable/12/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:06:49 2019 (r343655) +++ stable/12/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:08:34 2019 (r343656) @@ -141,6 +141,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(CORSAIR, K70_RGB, 0x, 0x, UQ_KBD_BOOTPROTO), /* Quirk for Corsair STRAFE Gaming keyboard */ USB_QUIRK(CORSAIR, STRAFE, 0x, 0x, UQ_KBD_BOOTPROTO), + USB_QUIRK(CORSAIR, STRAFE2, 0x, 0x, UQ_KBD_BOOTPROTO), /* umodem(4) device quirks */ USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), Modified: stable/12/sys/dev/usb/usbdevs == --- stable/12/sys/dev/usb/usbdevs Fri Feb 1 10:06:49 2019 (r343655) +++ stable/12/sys/dev/usb/usbdevs Fri Feb 1 10:08:34 2019 (r343656) @@ -1572,7 +1572,8 @@ product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC product CORSAIR K600x0a60 Corsair Vengeance K60 keyboard product CORSAIR K700x1b09 Corsair Vengeance K70 keyboard product CORSAIR K70_RGB0x1b13 Corsair K70 RGB Keyboard -product CORSAIR STRAFE 0x1b15 Cossair STRAFE Gaming keyboard +product CORSAIR STRAFE 0x1b15 Corsair STRAFE Gaming keyboard +product CORSAIR STRAFE20x1b44 Corsair STRAFE Gaming keyboard /* Creative products */ product CREATIVE NOMAD_II 0x1002 Nomad II MP3 player ___ 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: r343655 - in stable/11/sys/compat/linuxkpi/common: include/linux src
Author: hselasky Date: Fri Feb 1 10:06:49 2019 New Revision: 343655 URL: https://svnweb.freebsd.org/changeset/base/343655 Log: MFC r343451: Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h == --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.hFri Feb 1 10:05:50 2019(r343654) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.hFri Feb 1 10:06:49 2019(r343655) @@ -71,7 +71,7 @@ struct pci_device_id { #definePCI_BASE_CLASS_BRIDGE 0x06 #definePCI_CLASS_BRIDGE_ISA0x0601 -#definePCI_ANY_ID (-1) +#definePCI_ANY_ID -1U #definePCI_VENDOR_ID_APPLE 0x106b #definePCI_VENDOR_ID_ASUSTEK 0x1043 #definePCI_VENDOR_ID_ATI 0x1002 Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c == --- stable/11/sys/compat/linuxkpi/common/src/linux_pci.cFri Feb 1 10:05:50 2019(r343654) +++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.cFri Feb 1 10:06:49 2019(r343655) @@ -82,14 +82,21 @@ linux_pci_find(device_t dev, const struct pci_device_i struct pci_driver *pdrv; uint16_t vendor; uint16_t device; + uint16_t subvendor; + uint16_t subdevice; vendor = pci_get_vendor(dev); device = pci_get_device(dev); + subvendor = pci_get_subvendor(dev); + subdevice = pci_get_subdevice(dev); spin_lock(_lock); list_for_each_entry(pdrv, _drivers, links) { for (id = pdrv->id_table; id->vendor != 0; id++) { - if (vendor == id->vendor && device == id->device) { + if (vendor == id->vendor && + (PCI_ANY_ID == id->device || device == id->device) && + (PCI_ANY_ID == id->subvendor || subvendor == id->subvendor) && + (PCI_ANY_ID == id->subdevice || subdevice == id->subdevice)) { *idp = id; spin_unlock(_lock); return (pdrv); @@ -145,8 +152,8 @@ linux_pci_attach(device_t dev) pdev->dev.bsddev = dev; INIT_LIST_HEAD(>dev.irqents); pdev->devfn = PCI_DEVFN(pci_get_slot(dev), pci_get_function(dev)); - pdev->device = id->device; - pdev->vendor = id->vendor; + pdev->device = dinfo->cfg.device; + pdev->vendor = dinfo->cfg.vendor; pdev->subsystem_vendor = dinfo->cfg.subvendor; pdev->subsystem_device = dinfo->cfg.subdevice; pdev->class = pci_get_class(dev); ___ 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: r343658 - in stable/10/sys/dev/usb: . quirk
Author: hselasky Date: Fri Feb 1 10:09:54 2019 New Revision: 343658 URL: https://svnweb.freebsd.org/changeset/base/343658 Log: MFC r343453: Add new USB quirk. PR: 235202 Differential Revision:https://reviews.freebsd.org/D18917 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c == --- stable/10/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:09:13 2019 (r343657) +++ stable/10/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:09:54 2019 (r343658) @@ -140,6 +140,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(CORSAIR, K70_RGB, 0x, 0x, UQ_KBD_BOOTPROTO), /* Quirk for Corsair STRAFE Gaming keyboard */ USB_QUIRK(CORSAIR, STRAFE, 0x, 0x, UQ_KBD_BOOTPROTO), + USB_QUIRK(CORSAIR, STRAFE2, 0x, 0x, UQ_KBD_BOOTPROTO), /* umodem(4) device quirks */ USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), Modified: stable/10/sys/dev/usb/usbdevs == --- stable/10/sys/dev/usb/usbdevs Fri Feb 1 10:09:13 2019 (r343657) +++ stable/10/sys/dev/usb/usbdevs Fri Feb 1 10:09:54 2019 (r343658) @@ -1520,7 +1520,8 @@ product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC product CORSAIR K600x0a60 Corsair Vengeance K60 keyboard product CORSAIR K700x1b09 Corsair Vengeance K70 keyboard product CORSAIR K70_RGB0x1b13 Corsair K70 RGB Keyboard -product CORSAIR STRAFE 0x1b15 Cossair STRAFE Gaming keyboard +product CORSAIR STRAFE 0x1b15 Corsair STRAFE Gaming keyboard +product CORSAIR STRAFE20x1b44 Corsair STRAFE Gaming keyboard /* Creative products */ product CREATIVE NOMAD_II 0x1002 Nomad II MP3 player ___ 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: r343653 - stable/11/sys/netpfil/pf
Author: kp Date: Fri Feb 1 10:04:54 2019 New Revision: 343653 URL: https://svnweb.freebsd.org/changeset/base/343653 Log: MFC r343418: pf: Fix use-after-free of counters When cleaning up a vnet we free the counters in V_pf_default_rule and V_pf_status from shutdown_pf(), but we can still use them later, for example through pf_purge_expired_src_nodes(). Free them as the very last operation, as they rely on nothing else themselves. PR: 235097 Modified: stable/11/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/pf/pf_ioctl.c == --- stable/11/sys/netpfil/pf/pf_ioctl.c Fri Feb 1 10:04:53 2019 (r343652) +++ stable/11/sys/netpfil/pf/pf_ioctl.c Fri Feb 1 10:04:54 2019 (r343653) @@ -3721,20 +3721,6 @@ shutdown_pf(void) /* status does not use malloced mem so no need to cleanup */ /* fingerprints and interfaces have their own cleanup code */ - - /* Free counters last as we updated them during shutdown. */ - counter_u64_free(V_pf_default_rule.states_cur); - counter_u64_free(V_pf_default_rule.states_tot); - counter_u64_free(V_pf_default_rule.src_nodes); - - for (int i = 0; i < PFRES_MAX; i++) - counter_u64_free(V_pf_status.counters[i]); - for (int i = 0; i < LCNT_MAX; i++) - counter_u64_free(V_pf_status.lcounters[i]); - for (int i = 0; i < FCNT_MAX; i++) - counter_u64_free(V_pf_status.fcounters[i]); - for (int i = 0; i < SCNT_MAX; i++) - counter_u64_free(V_pf_status.scounters[i]); } while(0); return (error); @@ -3972,6 +3958,20 @@ pf_unload_vnet(void) pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); + + /* Free counters last as we updated them during shutdown. */ + counter_u64_free(V_pf_default_rule.states_cur); + counter_u64_free(V_pf_default_rule.states_tot); + counter_u64_free(V_pf_default_rule.src_nodes); + + for (int i = 0; i < PFRES_MAX; i++) + counter_u64_free(V_pf_status.counters[i]); + for (int i = 0; i < LCNT_MAX; i++) + counter_u64_free(V_pf_status.lcounters[i]); + for (int i = 0; i < FCNT_MAX; i++) + counter_u64_free(V_pf_status.fcounters[i]); + for (int i = 0; i < SCNT_MAX; i++) + counter_u64_free(V_pf_status.scounters[i]); } static int ___ 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: r343657 - in stable/11/sys/dev/usb: . quirk
Author: hselasky Date: Fri Feb 1 10:09:13 2019 New Revision: 343657 URL: https://svnweb.freebsd.org/changeset/base/343657 Log: MFC r343453: Add new USB quirk. PR: 235202 Differential Revision:https://reviews.freebsd.org/D18917 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c == --- stable/11/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:08:34 2019 (r343656) +++ stable/11/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:09:13 2019 (r343657) @@ -140,6 +140,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(CORSAIR, K70_RGB, 0x, 0x, UQ_KBD_BOOTPROTO), /* Quirk for Corsair STRAFE Gaming keyboard */ USB_QUIRK(CORSAIR, STRAFE, 0x, 0x, UQ_KBD_BOOTPROTO), + USB_QUIRK(CORSAIR, STRAFE2, 0x, 0x, UQ_KBD_BOOTPROTO), /* umodem(4) device quirks */ USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), Modified: stable/11/sys/dev/usb/usbdevs == --- stable/11/sys/dev/usb/usbdevs Fri Feb 1 10:08:34 2019 (r343656) +++ stable/11/sys/dev/usb/usbdevs Fri Feb 1 10:09:13 2019 (r343657) @@ -1524,7 +1524,8 @@ product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC product CORSAIR K600x0a60 Corsair Vengeance K60 keyboard product CORSAIR K700x1b09 Corsair Vengeance K70 keyboard product CORSAIR K70_RGB0x1b13 Corsair K70 RGB Keyboard -product CORSAIR STRAFE 0x1b15 Cossair STRAFE Gaming keyboard +product CORSAIR STRAFE 0x1b15 Corsair STRAFE Gaming keyboard +product CORSAIR STRAFE20x1b44 Corsair STRAFE Gaming keyboard /* Creative products */ product CREATIVE NOMAD_II 0x1002 Nomad II MP3 player ___ 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: r343651 - stable/12/sys/netinet6
Author: hselasky Date: Fri Feb 1 09:18:44 2019 New Revision: 343651 URL: https://svnweb.freebsd.org/changeset/base/343651 Log: Build fix for missing NET_EPOCH_XXX() dependencies after r343650. This patch is to be reverted when the relevant changes are MFC'ed. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_mcast.c stable/12/sys/netinet6/in6_var.h stable/12/sys/netinet6/mld6.c Modified: stable/12/sys/netinet6/in6_mcast.c == --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:08:19 2019 (r343650) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:18:44 2019 (r343651) @@ -420,9 +420,9 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr IN6_MULTI_LOCK_ASSERT(); IN6_MULTI_LIST_LOCK(); IF_ADDR_WLOCK(ifp); - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); inm = in6m_lookup_locked(ifp, group); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); if (inm != NULL) { /* Modified: stable/12/sys/netinet6/in6_var.h == --- stable/12/sys/netinet6/in6_var.hFri Feb 1 09:08:19 2019 (r343650) +++ stable/12/sys/netinet6/in6_var.hFri Feb 1 09:18:44 2019 (r343651) @@ -722,8 +722,6 @@ static __inline struct in6_multi * in6m_ifmultiaddr_get_inm(struct ifmultiaddr *ifma) { - NET_EPOCH_ASSERT(); - return ((ifma->ifma_addr->sa_family != AF_INET6 || (ifma->ifma_flags & IFMA_F_ENQUEUED) == 0) ? NULL : ifma->ifma_protospec); Modified: stable/12/sys/netinet6/mld6.c == --- stable/12/sys/netinet6/mld6.c Fri Feb 1 09:08:19 2019 (r343650) +++ stable/12/sys/netinet6/mld6.c Fri Feb 1 09:18:44 2019 (r343651) @@ -556,7 +556,7 @@ mld_ifdetach(struct ifnet *ifp, struct in6_multi_head * Extract list of in6_multi associated with the detaching ifp * which the PF_INET6 layer is about to release. */ - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); CK_STAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link) { inm = in6m_ifmultiaddr_get_inm(ifma); if (inm == NULL) @@ -576,7 +576,7 @@ mld_ifdetach(struct ifnet *ifp, struct in6_multi_head } } } - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); IF_ADDR_WUNLOCK(ifp); MLD_UNLOCK(); } @@ -1411,7 +1411,7 @@ mld_fasttimo_vnet(struct in6_multi_head *inmh) } IF_ADDR_WLOCK(ifp); - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); CK_STAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link) { inm = in6m_ifmultiaddr_get_inm(ifma); if (inm == NULL) @@ -1449,7 +1449,7 @@ mld_fasttimo_vnet(struct in6_multi_head *inmh) mld_dispatch_queue(, 0); break; } - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); } out_locked: @@ -1685,7 +1685,7 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) ifp = mli->mli_ifp; IF_ADDR_WLOCK(ifp); - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); CK_STAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link) { inm = in6m_ifmultiaddr_get_inm(ifma); if (inm == NULL) @@ -1721,7 +1721,7 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) break; } } - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); IF_ADDR_WUNLOCK(ifp); in6m_release_list_deferred(); } ___ 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: r343654 - in stable/12/sys/compat/linuxkpi/common: include/linux src
Author: hselasky Date: Fri Feb 1 10:05:50 2019 New Revision: 343654 URL: https://svnweb.freebsd.org/changeset/base/343654 Log: MFC r343451: Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h == --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.hFri Feb 1 10:04:54 2019(r343653) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.hFri Feb 1 10:05:50 2019(r343654) @@ -71,7 +71,7 @@ struct pci_device_id { #definePCI_BASE_CLASS_BRIDGE 0x06 #definePCI_CLASS_BRIDGE_ISA0x0601 -#definePCI_ANY_ID (-1) +#definePCI_ANY_ID -1U #definePCI_VENDOR_ID_APPLE 0x106b #definePCI_VENDOR_ID_ASUSTEK 0x1043 #definePCI_VENDOR_ID_ATI 0x1002 Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c == --- stable/12/sys/compat/linuxkpi/common/src/linux_pci.cFri Feb 1 10:04:54 2019(r343653) +++ stable/12/sys/compat/linuxkpi/common/src/linux_pci.cFri Feb 1 10:05:50 2019(r343654) @@ -82,14 +82,21 @@ linux_pci_find(device_t dev, const struct pci_device_i struct pci_driver *pdrv; uint16_t vendor; uint16_t device; + uint16_t subvendor; + uint16_t subdevice; vendor = pci_get_vendor(dev); device = pci_get_device(dev); + subvendor = pci_get_subvendor(dev); + subdevice = pci_get_subdevice(dev); spin_lock(_lock); list_for_each_entry(pdrv, _drivers, links) { for (id = pdrv->id_table; id->vendor != 0; id++) { - if (vendor == id->vendor && device == id->device) { + if (vendor == id->vendor && + (PCI_ANY_ID == id->device || device == id->device) && + (PCI_ANY_ID == id->subvendor || subvendor == id->subvendor) && + (PCI_ANY_ID == id->subdevice || subdevice == id->subdevice)) { *idp = id; spin_unlock(_lock); return (pdrv); @@ -145,8 +152,8 @@ linux_pci_attach(device_t dev) pdev->dev.bsddev = dev; INIT_LIST_HEAD(>dev.irqents); pdev->devfn = PCI_DEVFN(pci_get_slot(dev), pci_get_function(dev)); - pdev->device = id->device; - pdev->vendor = id->vendor; + pdev->device = dinfo->cfg.device; + pdev->vendor = dinfo->cfg.vendor; pdev->subsystem_vendor = dinfo->cfg.subvendor; pdev->subsystem_device = dinfo->cfg.subdevice; pdev->class = pci_get_class(dev); ___ 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: r343652 - stable/12/sys/netpfil/pf
Author: kp Date: Fri Feb 1 10:04:53 2019 New Revision: 343652 URL: https://svnweb.freebsd.org/changeset/base/343652 Log: MFC r343418: pf: Fix use-after-free of counters When cleaning up a vnet we free the counters in V_pf_default_rule and V_pf_status from shutdown_pf(), but we can still use them later, for example through pf_purge_expired_src_nodes(). Free them as the very last operation, as they rely on nothing else themselves. PR: 235097 Modified: stable/12/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/pf/pf_ioctl.c == --- stable/12/sys/netpfil/pf/pf_ioctl.c Fri Feb 1 09:18:44 2019 (r343651) +++ stable/12/sys/netpfil/pf/pf_ioctl.c Fri Feb 1 10:04:53 2019 (r343652) @@ -3989,20 +3989,6 @@ shutdown_pf(void) /* status does not use malloced mem so no need to cleanup */ /* fingerprints and interfaces have their own cleanup code */ - - /* Free counters last as we updated them during shutdown. */ - counter_u64_free(V_pf_default_rule.states_cur); - counter_u64_free(V_pf_default_rule.states_tot); - counter_u64_free(V_pf_default_rule.src_nodes); - - for (int i = 0; i < PFRES_MAX; i++) - counter_u64_free(V_pf_status.counters[i]); - for (int i = 0; i < LCNT_MAX; i++) - counter_u64_free(V_pf_status.lcounters[i]); - for (int i = 0; i < FCNT_MAX; i++) - counter_u64_free(V_pf_status.fcounters[i]); - for (int i = 0; i < SCNT_MAX; i++) - counter_u64_free(V_pf_status.scounters[i]); } while(0); return (error); @@ -4232,6 +4218,20 @@ pf_unload_vnet(void) pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); + + /* Free counters last as we updated them during shutdown. */ + counter_u64_free(V_pf_default_rule.states_cur); + counter_u64_free(V_pf_default_rule.states_tot); + counter_u64_free(V_pf_default_rule.src_nodes); + + for (int i = 0; i < PFRES_MAX; i++) + counter_u64_free(V_pf_status.counters[i]); + for (int i = 0; i < LCNT_MAX; i++) + counter_u64_free(V_pf_status.lcounters[i]); + for (int i = 0; i < FCNT_MAX; i++) + counter_u64_free(V_pf_status.fcounters[i]); + for (int i = 0; i < SCNT_MAX; i++) + counter_u64_free(V_pf_status.scounters[i]); } static 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: r343649 - stable/12/sys/netinet6
Author: hselasky Date: Fri Feb 1 09:07:27 2019 New Revision: 343649 URL: https://svnweb.freebsd.org/changeset/base/343649 Log: MFC r343394: When detaching a network interface drain the workqueue freeing the inm's because the destructor will access the if_ioctl() callback in the ifnet pointer which is about to be freed. This prevents use-after-free. PR: 233535 Differential Revision:https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by:ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_ifattach.c stable/12/sys/netinet6/in6_mcast.c stable/12/sys/netinet6/in6_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_ifattach.c == --- stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:06:40 2019 (r343648) +++ stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:07:27 2019 (r343649) @@ -882,6 +882,13 @@ in6_purgemaddrs(struct ifnet *ifp) IN6_MULTI_LIST_UNLOCK(); IN6_MULTI_UNLOCK(); in6m_release_list_deferred(); + + /* +* Make sure all multicast deletions invoking if_ioctl() are +* completed before returning. Else we risk accessing a freed +* ifnet structure pointer. +*/ + in6m_release_wait(); } void Modified: stable/12/sys/netinet6/in6_mcast.c == --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:06:40 2019 (r343648) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:07:27 2019 (r343649) @@ -585,6 +585,14 @@ in6m_release_list_deferred(struct in6_multi_head *inmh } void +in6m_release_wait(void) +{ + + /* Wait for all jobs to complete. */ + gtaskqueue_drain_all(free_gtask.gt_taskqueue); +} + +void in6m_disconnect(struct in6_multi *inm) { struct ifnet *ifp; Modified: stable/12/sys/netinet6/in6_var.h == --- stable/12/sys/netinet6/in6_var.hFri Feb 1 09:06:40 2019 (r343648) +++ stable/12/sys/netinet6/in6_var.hFri Feb 1 09:07:27 2019 (r343649) @@ -810,6 +810,7 @@ voidin6m_print(const struct in6_multi *); intin6m_record_source(struct in6_multi *, const struct in6_addr *); void in6m_release_deferred(struct in6_multi *); void in6m_release_list_deferred(struct in6_multi_head *); +void in6m_release_wait(void); void ip6_freemoptions(struct ip6_moptions *); intip6_getmoptions(struct inpcb *, struct sockopt *); intip6_setmoptions(struct inpcb *, struct sockopt *); ___ 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: r343647 - stable/12/sys/netinet6
Author: hselasky Date: Fri Feb 1 09:05:41 2019 New Revision: 343647 URL: https://svnweb.freebsd.org/changeset/base/343647 Log: MFC r343392: Fix duplicate acquiring of refcount when joining IPv6 multicast groups. This was observed by starting and stopping rpcbind(8) multiple times. PR: 233535 Differential Revision:https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by:ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_mcast.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_mcast.c == --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 08:10:26 2019 (r343646) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:05:41 2019 (r343647) @@ -2178,7 +2178,10 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop IN6_MULTI_UNLOCK(); goto out_im6o_free; } - in6m_acquire(inm); + /* +* NOTE: Refcount from in6_joingroup_locked() +* is protecting membership. +*/ imo->im6o_membership[idx] = inm; } else { CTR1(KTR_MLD, "%s: merge inm state", __func__); ___ 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: r343650 - stable/12/sys/netinet6
Author: hselasky Date: Fri Feb 1 09:08:19 2019 New Revision: 343650 URL: https://svnweb.freebsd.org/changeset/base/343650 Log: MFC r343395: Fix refcounting leaks in IPv6 MLD code leading to loss of IPv6 connectivity. Looking at past changes in this area like r337866, some refcounting bugs have been introduced, one by one. For example like calling in6m_disconnect() and in6m_rele_locked() in mld_v1_process_group_timer() where previously no disconnect nor refcount decrement was done. Calling in6m_disconnect() when it shouldn't causes IPv6 solitation to no longer work, because all the multicast addresses receiving the solitation messages are now deleted from the network interface. This patch reverts some recent changes while improving the MLD refcounting and concurrency model after the MLD code was converted to using EPOCH(9). List changes: - All CK_STAILQ_FOREACH() macros are now properly enclosed into EPOCH(9) sections. This simplifies assertion of locking inside in6m_ifmultiaddr_get_inm(). - Corrected bad use of in6m_disconnect() leading to loss of IPv6 connectivity for MLD v1. - Factored out checks for valid inm structure into in6m_ifmultiaddr_get_inm(). PR: 233535 Differential Revision:https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by:ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_ifattach.c stable/12/sys/netinet6/in6_mcast.c stable/12/sys/netinet6/in6_var.h stable/12/sys/netinet6/mld6.c stable/12/sys/netinet6/mld6_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_ifattach.c == --- stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:07:27 2019 (r343649) +++ stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:08:19 2019 (r343650) @@ -852,36 +852,15 @@ in6_tmpaddrtimer(void *arg) static void in6_purgemaddrs(struct ifnet *ifp) { - struct in6_multi_headpurgeinms; - struct in6_multi*inm; - struct ifmultiaddr *ifma, *next; + struct in6_multi_head inmh; - SLIST_INIT(); + SLIST_INIT(); IN6_MULTI_LOCK(); IN6_MULTI_LIST_LOCK(); - IF_ADDR_WLOCK(ifp); - /* -* Extract list of in6_multi associated with the detaching ifp -* which the PF_INET6 layer is about to release. -*/ - restart: - CK_STAILQ_FOREACH_SAFE(ifma, >if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) - continue; - inm = (struct in6_multi *)ifma->ifma_protospec; - in6m_disconnect(inm); - in6m_rele_locked(, inm); - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } - } - IF_ADDR_WUNLOCK(ifp); - mld_ifdetach(ifp); + mld_ifdetach(ifp, ); IN6_MULTI_LIST_UNLOCK(); IN6_MULTI_UNLOCK(); - in6m_release_list_deferred(); + in6m_release_list_deferred(); /* * Make sure all multicast deletions invoking if_ioctl() are Modified: stable/12/sys/netinet6/in6_mcast.c == --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:07:27 2019 (r343649) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:08:19 2019 (r343650) @@ -190,7 +190,6 @@ static SYSCTL_NODE(_net_inet6_ip6_mcast, OID_AUTO, fil CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ip6_mcast_filters, "Per-interface stack-wide source filters"); -int ifma6_restart = 0; #ifdef KTR /* * Inline function which wraps assertions for a valid ifp. @@ -405,6 +404,7 @@ static int in6_getmulti(struct ifnet *ifp, const struct in6_addr *group, struct in6_multi **pinm) { + struct epoch_tracker et; struct sockaddr_in6 gsin6; struct ifmultiaddr *ifma; struct in6_multi*inm; @@ -420,7 +420,10 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr IN6_MULTI_LOCK_ASSERT(); IN6_MULTI_LIST_LOCK(); IF_ADDR_WLOCK(ifp); + NET_EPOCH_ENTER(et); inm = in6m_lookup_locked(ifp, group); + NET_EPOCH_EXIT(et); + if (inm != NULL) { /* * If we already joined this group, just bump the @@ -593,7 +596,7 @@ in6m_release_wait(void) } void -in6m_disconnect(struct in6_multi *inm) +in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm) { struct ifnet *ifp; struct ifaddr *ifa; @@ -601,10 +604,12 @@ in6m_disconnect(struct in6_multi *inm) struct in6_multi_mship *imm, *imm_tmp; struct ifmultiaddr
svn commit: r343648 - stable/12/sys/netinet6
Author: hselasky Date: Fri Feb 1 09:06:40 2019 New Revision: 343648 URL: https://svnweb.freebsd.org/changeset/base/343648 Log: MFC r343393: Add debugging sysctl to disable incoming MLD v2 messages similar to the existing sysctl for MLD v1 messages. PR: 233535 Differential Revision:https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by:ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/mld6.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/mld6.c == --- stable/12/sys/netinet6/mld6.c Fri Feb 1 09:05:41 2019 (r343647) +++ stable/12/sys/netinet6/mld6.c Fri Feb 1 09:06:40 2019 (r343648) @@ -243,6 +243,10 @@ static int mld_v1enable = 1; SYSCTL_INT(_net_inet6_mld, OID_AUTO, v1enable, CTLFLAG_RWTUN, _v1enable, 0, "Enable fallback to MLDv1"); +static int mld_v2enable = 1; +SYSCTL_INT(_net_inet6_mld, OID_AUTO, v2enable, CTLFLAG_RWTUN, +_v2enable, 0, "Enable MLDv2"); + static int mld_use_allow = 1; SYSCTL_INT(_net_inet6_mld, OID_AUTO, use_allow, CTLFLAG_RWTUN, _use_allow, 0, "Use ALLOW/BLOCK for RFC 4604 SSM joins/leaves"); @@ -816,7 +820,12 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6 char ip6tbuf[INET6_ADDRSTRLEN]; #endif - is_general_query = 0; + if (!mld_v2enable) { + CTR3(KTR_MLD, "ignore v2 query src %s on ifp %p(%s)", + ip6_sprintf(ip6tbuf, >ip6_src), + ifp, if_name(ifp)); + return (0); + } /* * RFC3810 Section 6.2: MLD queries must originate from @@ -828,6 +837,8 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6 ifp, if_name(ifp)); return (0); } + + is_general_query = 0; CTR2(KTR_MLD, "input v2 query on ifp %p(%s)", ifp, if_name(ifp)); ___ 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: r343646 - head/sys/netinet
Author: glebius Date: Fri Feb 1 08:10:26 2019 New Revision: 343646 URL: https://svnweb.freebsd.org/changeset/base/343646 Log: Repair siftr(4): PFIL_IN and PFIL_OUT are defines of some value, relying on them having particular values can break things. Modified: head/sys/netinet/siftr.c Modified: head/sys/netinet/siftr.c == --- head/sys/netinet/siftr.cFri Feb 1 07:48:37 2019(r343645) +++ head/sys/netinet/siftr.cFri Feb 1 08:10:26 2019(r343646) @@ -172,8 +172,11 @@ static MALLOC_DEFINE(M_SIFTR_HASHNODE, "siftr_hashnode struct pkt_node { /* Timestamp of pkt as noted in the pfil hook. */ struct timeval tval; - /* Direction pkt is travelling; either PFIL_IN or PFIL_OUT. */ - uint8_t direction; + /* Direction pkt is travelling. */ + enum { + DIR_IN = 0, + DIR_OUT = 1, + } direction; /* IP version pkt_node relates to; either INP_IPV4 or INP_IPV6. */ uint8_t ipver; /* Hash of the pkt which triggered the log message. */ @@ -286,11 +289,7 @@ static struct alq *siftr_alq = NULL; static struct mtx siftr_pkt_queue_mtx; static struct mtx siftr_pkt_mgr_mtx; static struct thread *siftr_pkt_manager_thr = NULL; -/* - * pfil.h defines PFIL_IN as 1 and PFIL_OUT as 2, - * which we use as an index into this array. - */ -static char direction[3] = {'\0', 'i','o'}; +static char direction[2] = {'i','o'}; /* Required function prototypes. */ static int siftr_sysctl_enabled_handler(SYSCTL_HANDLER_ARGS); @@ -409,7 +408,7 @@ siftr_process_pkt(struct pkt_node * pkt_node) LIST_INSERT_HEAD(counter_list, hash_node, nodes); } else { /* Malloc failed. */ - if (pkt_node->direction == PFIL_IN) + if (pkt_node->direction == DIR_IN) ss->nskip_in_malloc++; else ss->nskip_out_malloc++; @@ -812,7 +811,7 @@ siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, INP_RUNLOCK(inp); pn->ipver = ipver; - pn->direction = dir; + pn->direction = (dir == PFIL_IN ? DIR_IN : DIR_OUT); /* * Significantly more accurate than using getmicrotime(), but slower! ___ 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: r343645 - head/sys/contrib/ipfilter/netinet
Author: glebius Date: Fri Feb 1 07:48:37 2019 New Revision: 343645 URL: https://svnweb.freebsd.org/changeset/base/343645 Log: Unbreak call to ipf_check(): it expects the out parameter to be 0 or 1. Pointy hat to:glebius Reported by: cy Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c == --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Feb 1 06:19:12 2019(r343644) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Feb 1 07:48:37 2019(r343645) @@ -135,8 +135,8 @@ ipf_check_wrapper(struct mbuf **mp, struct ifnet *ifp, pfil_return_t rv; CURVNET_SET(ifp->if_vnet); - rv = ipf_check(_ipfmain, ip, ip->ip_hl << 2, ifp, (flags & PFIL_OUT), - mp); + rv = ipf_check(_ipfmain, ip, ip->ip_hl << 2, ifp, + !!(flags & PFIL_OUT), mp); CURVNET_RESTORE(); return (rv == 0 ? PFIL_PASS : PFIL_DROPPED); } @@ -150,7 +150,7 @@ ipf_check_wrapper6(struct mbuf **mp, struct ifnet *ifp CURVNET_SET(ifp->if_vnet); rv = ipf_check(_ipfmain, mtod(*mp, struct ip *), - sizeof(struct ip6_hdr), ifp, (flags & PFIL_OUT), mp); + sizeof(struct ip6_hdr), ifp, !!(flags & PFIL_OUT), mp); CURVNET_RESTORE(); return (rv == 0 ? PFIL_PASS : PFIL_DROPPED); ___ 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: r343636 - head/sbin/pfilctl
On Fri, 1 Feb 2019, Gleb Smirnoff wrote: Log: Hopefully fix compilation by other compilers. You mean "Hopefully fix compilation by compilers whose -Wnested-externs support is not broken". bsd.sys.mk sets -Wnested-externs at WARNS >= 6 and also -Wredundant-decls to inhibit the engineering and style bug of declaring extern variables outside of header files. Certain compilers whose -Wnested-includes is broken also have a broken -Wredundant-decls. The brokenness is typically to silently ignore these flags. Even adding -pedantic doesn't fix this in certain compilers. Modified: head/sbin/pfilctl/pfilctl.c == --- head/sbin/pfilctl/pfilctl.c Fri Feb 1 00:33:17 2019(r343635) +++ head/sbin/pfilctl/pfilctl.c Fri Feb 1 00:34:18 2019(r343636) @@ -94,9 +94,8 @@ main(int argc __unused, char *argv[] __unused) static void help(void) { - extern char *__progname; - fprintf(stderr, "usage: %s (heads|hooks|link|unlink)\n", __progname); + fprintf(stderr, "usage: %s (heads|hooks|link|unlink)\n", getprogname()); exit(0); } Here __progname is an implementation detail, and it is intentionally not declared in a header file. Bad code like the above was chummy with the implementation and declared it as part of the chumminess. Compilers with non-broken -Wnested-includes used to be more common and detected this bug. If __progname were declared in an included header files, then compilers with a non-broken -Wredundant-decls would detect another bug. The change is to use the correct API. This function has many other style bugs. Normal programs spell help() as usage(). Even this program still prints "usage: " and not "help: ". There are a lot of style rules for usage(), and one is to normally use a hard-coded name for the program and not use getprogname() or argv[0], or even warnx(). warnx() would do the same thing as a normal usage(), except it would print "%s: usage:" instead of "usage: %s", where %s is getprogname() for warnx() and a hard-coded name for normal usage(). The warnx() order is better but is not traditional. However, some programs like this one get different features according to the program name given by argv[0]. rm is a good example of how to do this, and this program is a bad example of how to do this. rm has 2 name, rm and unlink. It starts by taking the basename of argv[0] (hackishly using strrchr(3) instead of basename(3)). Then it prints separate usage messages for rm and unlink using hard coded names for both. It could be improved by only printing the usage message for the current name. This program starts by not taking the basename of argv[0], so it fails to find the correct program if argv[0] has a path prefix. It has 4 alternative names where rm has only 2, and it uses the style bug of !strcmp() to search its table where rm uses strcmp() == 0. Later it prints a wrong usage message. The usage message should have 4 alternative hard-coded program names following by options relevant to each name (as in rm), or only the usage relative to the current name. Instead it has the current name followed by the syntax error of repeating one of of the possible names, and no options. The man page gives normally formatted syntax, as for rm. Usage messages should be checked to be lexically identical to man page synopses after removing "usage: " and leading whitespace. man(1) limits line lengths, and it is important for usage() to limit line lengths identically exept for the "usage: " prefix, for readability and for easy comparison. man(1) wraps long lines and comparison is too difficult if usage() wraps differently. man(1) leaves a large left margin and a small right margin, and that is enough for the margin given by "usage: ". One reason to hard-code names in usage() is that they have to be hard- coded in the man page. The action has to be the same as in the man page, _especially_ for programs like rm and unlink where the name affects the action. Otherwise, the only thing that using the dynamic name does is to slightly de-obfuscate obfuscations and security attacks like "ln /bin/rm $HOME/bin/ls". getprogname(3) is documented to "manipulate" the name of the program, but no details of the manipulation are documented. It actually returns __progname. __progname is set in too many different ways: - csu uses a manually inlined version of strrchr() to find the base name - rtld uses __progname = obj_rtld.path in 2 places and basename(argv[0]) in 1 places. The 2 places seem to be missing taking the base name. - setprogname() uses strrchr() to find the base name - using basename() is usually worse than the home made methods for most uses. basename() has extras like converting NULL and "" to "." and removing trailing slashes. The extras make it non-reentrant. basename() was fixed in 4.4BSD or earlier to allocate memory and take a const char * arg, but was later broken