svn commit: r355169 - in head/sys: kern vm
Author: jeff Date: Thu Nov 28 07:49:25 2019 New Revision: 355169 URL: https://svnweb.freebsd.org/changeset/base/355169 Log: Garbage collect the mostly unused us_keg field. Use appropriately named union members in vm_page.h to store the zone and slab. Remove some nearby dead code. Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D22564 Modified: head/sys/kern/kern_malloc.c head/sys/vm/uma_core.c head/sys/vm/uma_int.h head/sys/vm/vm_page.h Modified: head/sys/kern/kern_malloc.c == --- head/sys/kern/kern_malloc.c Thu Nov 28 05:40:15 2019(r355168) +++ head/sys/kern/kern_malloc.c Thu Nov 28 07:49:25 2019(r355169) @@ -738,6 +738,7 @@ free_dbg(void **addrp, struct malloc_type *mtp) void free(void *addr, struct malloc_type *mtp) { + uma_zone_t zone; uma_slab_t slab; u_long size; @@ -749,17 +750,17 @@ free(void *addr, struct malloc_type *mtp) if (addr == NULL) return; - slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK)); + vtozoneslab((vm_offset_t)addr & (~UMA_SLAB_MASK), &zone, &slab); if (slab == NULL) panic("free: address %p(%p) has not been allocated.\n", addr, (void *)((u_long)addr & (~UMA_SLAB_MASK))); if (!(slab->us_flags & UMA_SLAB_MALLOC)) { - size = slab->us_keg->uk_size; + size = zone->uz_size; #ifdef INVARIANTS free_save_type(addr, mtp, size); #endif - uma_zfree_arg(LIST_FIRST(&slab->us_keg->uk_zones), addr, slab); + uma_zfree_arg(zone, addr, slab); } else { size = slab->us_size; uma_large_free(slab); @@ -770,6 +771,7 @@ free(void *addr, struct malloc_type *mtp) void free_domain(void *addr, struct malloc_type *mtp) { + uma_zone_t zone; uma_slab_t slab; u_long size; @@ -782,18 +784,17 @@ free_domain(void *addr, struct malloc_type *mtp) if (addr == NULL) return; - slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK)); + vtozoneslab((vm_offset_t)addr & (~UMA_SLAB_MASK), &zone, &slab); if (slab == NULL) panic("free_domain: address %p(%p) has not been allocated.\n", addr, (void *)((u_long)addr & (~UMA_SLAB_MASK))); if (!(slab->us_flags & UMA_SLAB_MALLOC)) { - size = slab->us_keg->uk_size; + size = zone->uz_size; #ifdef INVARIANTS free_save_type(addr, mtp, size); #endif - uma_zfree_domain(LIST_FIRST(&slab->us_keg->uk_zones), - addr, slab); + uma_zfree_domain(zone, addr, slab); } else { size = slab->us_size; uma_large_free(slab); @@ -807,6 +808,7 @@ free_domain(void *addr, struct malloc_type *mtp) void * realloc(void *addr, size_t size, struct malloc_type *mtp, int flags) { + uma_zone_t zone; uma_slab_t slab; unsigned long alloc; void *newaddr; @@ -834,7 +836,7 @@ realloc(void *addr, size_t size, struct malloc_type *m slab = NULL; alloc = redzone_get_size(addr); #else - slab = vtoslab((vm_offset_t)addr & ~(UMA_SLAB_MASK)); + vtozoneslab((vm_offset_t)addr & (~UMA_SLAB_MASK), &zone, &slab); /* Sanity check */ KASSERT(slab != NULL, @@ -842,7 +844,7 @@ realloc(void *addr, size_t size, struct malloc_type *m /* Get the size of the original block */ if (!(slab->us_flags & UMA_SLAB_MALLOC)) - alloc = slab->us_keg->uk_size; + alloc = zone->uz_size; else alloc = slab->us_size; Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Thu Nov 28 05:40:15 2019(r355168) +++ head/sys/vm/uma_core.c Thu Nov 28 07:49:25 2019(r355169) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002-2005, 2009, 2013 Jeffrey Roberson + * Copyright (c) 2002-2019 Jeffrey Roberson * Copyright (c) 2004, 2005 Bosko Milekic * Copyright (c) 2004-2006 Robert N. M. Watson * All rights reserved. @@ -275,7 +275,6 @@ static uma_bucket_t bucket_alloc(uma_zone_t zone, void static void bucket_free(uma_zone_t zone, uma_bucket_t, void *); static void bucket_zone_drain(void); static uma_bucket_t zone_alloc_bucket(uma_zone_t, void *, int, int); -static uma_slab_t zone_fetch_slab(uma_zone_t, uma_keg_t, int, int); static void *slab_alloc_item(uma_keg_t keg, uma_slab_t slab); static void slab_free_item(uma_zone_t zone, uma_slab_t slab, void *item); static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, @@ -1210,9 +1209,9 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom if (keg->uk_flags & UM
svn commit: r355168 - head/stand/efi/libefi
Author: imp Date: Thu Nov 28 05:40:15 2019 New Revision: 355168 URL: https://svnweb.freebsd.org/changeset/base/355168 Log: Also turn of teken for RB_MULTIPLE RB_MULTIPLE without RB_SERIAL set is valid, and means 'Video first, then serial' to the kernel (so kernel messages go to both, but /etc/rc uses video console (this should be fixed, btw, but another day)). Check for RB_MULTIPLE as well as RB_SERIAL where we want to to serial things. This means we'll use the old code for emulation in these situations, which is likely best since we're outputing to both and the old code is ligher weight allowing both to keep up w/o weird scrolling things. Modified: head/stand/efi/libefi/efi_console.c Modified: head/stand/efi/libefi/efi_console.c == --- head/stand/efi/libefi/efi_console.c Thu Nov 28 05:40:10 2019 (r355167) +++ head/stand/efi/libefi/efi_console.c Thu Nov 28 05:40:15 2019 (r355168) @@ -824,9 +824,13 @@ efi_cons_update_mode(void) * terminal emulator for efi text mode to support the menu. * While teken is too expensive to be used on serial console, the * pre-teken emulator is light enough to be used on serial console. +* +* When doing multiple consoles (both serial and video), +* also just use the old emulator. RB_MULTIPLE also implies +* we're using a serial console. */ mode = parse_uefi_con_out(); - if ((mode & RB_SERIAL) == 0) { + if ((mode & (RB_SERIAL | RB_MULTIPLE)) == 0) { if (buffer != NULL) { if (tp.tp_row == rows && tp.tp_col == cols) return (true); @@ -998,7 +1002,11 @@ efi_cons_putchar(int c) { unsigned char ch = c; - if ((mode & RB_SERIAL) != 0) { + /* +* Don't use Teken when we're doing pure serial, or a multiple console +* with video "primary" because that's also serial. +*/ + if ((mode & (RB_SERIAL | RB_MULTIPLE)) != 0) { input_byte(ch); return; } ___ 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: r355167 - head/stand/efi/loader
Author: imp Date: Thu Nov 28 05:40:10 2019 New Revision: 355167 URL: https://svnweb.freebsd.org/changeset/base/355167 Log: Remove comment. We're just going to the next node here. Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c == --- head/stand/efi/loader/main.cThu Nov 28 04:15:16 2019 (r355166) +++ head/stand/efi/loader/main.cThu Nov 28 05:40:10 2019 (r355167) @@ -741,7 +741,7 @@ parse_uefi_con_out(void) */ pci_pending = true; } - node = NextDevicePathNode(node); /* Skip the end node */ + node = NextDevicePathNode(node); } if (pci_pending && vid_seen == 0) vid_seen = ++seen; ___ 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: r355164 - in head: . share/man/man4 sys/amd64/conf sys/conf sys/dev/trm sys/i386/conf sys/modules sys/modules/trm
> Author: scottl > Date: Thu Nov 28 02:32:17 2019 > New Revision: 355164 > URL: https://svnweb.freebsd.org/changeset/base/355164 > > Log: > Remove the trm(4) driver > > Differential Revision: https://reviews.freebsd.org/D22575 Deprecation notice to merge to stable/{12,11}? Relnotes entry? > Deleted: > head/share/man/man4/trm.4 > head/sys/dev/trm/ > head/sys/modules/trm/ > Modified: > head/ObsoleteFiles.inc > head/share/man/man4/Makefile > head/sys/amd64/conf/GENERIC > head/sys/conf/NOTES > head/sys/conf/files > head/sys/i386/conf/GENERIC > head/sys/modules/Makefile > > Modified: head/ObsoleteFiles.inc > == > --- head/ObsoleteFiles.incThu Nov 28 02:28:12 2019(r355163) > +++ head/ObsoleteFiles.incThu Nov 28 02:32:17 2019(r355164) > @@ -38,6 +38,8 @@ > # xargs -n1 | sort | uniq -d; > # done > > +# 20191128: Removal of trm(4) > +OLD_FILES+=usr/share/man/man4/trm.4.gz > # 20191121: Removal of sio(4) > OLD_FILES+=usr/share/man/man4/sio.4.gz > # 20191105: picobsd(8), et al, removed. > > Modified: head/share/man/man4/Makefile > == > --- head/share/man/man4/Makefile Thu Nov 28 02:28:12 2019 > (r355163) > +++ head/share/man/man4/Makefile Thu Nov 28 02:32:17 2019 > (r355164) > @@ -522,7 +522,6 @@ MAN= aac.4 \ > ti.4 \ > timecounters.4 \ > ${_tpm.4} \ > - trm.4 \ > tty.4 \ > tun.4 \ > twa.4 \ > > Modified: head/sys/amd64/conf/GENERIC > == > --- head/sys/amd64/conf/GENERIC Thu Nov 28 02:28:12 2019 > (r355163) > +++ head/sys/amd64/conf/GENERIC Thu Nov 28 02:32:17 2019 > (r355164) > @@ -150,7 +150,6 @@ devicempt # LSI-Logic > MPT-Fusion > device mps # LSI-Logic MPT-Fusion 2 > device mpr # LSI-Logic MPT-Fusion 3 > device sym # NCR/Symbios Logic > -device trm # Tekram DC395U/UW/F DC315U > adapters > device isci# Intel C600 SAS controller > device ocs_fc # Emulex FC adapters > device pvscsi # VMware PVSCSI > > Modified: head/sys/conf/NOTES > == > --- head/sys/conf/NOTES Thu Nov 28 02:28:12 2019(r355163) > +++ head/sys/conf/NOTES Thu Nov 28 02:32:17 2019(r355164) > @@ -1511,7 +1511,6 @@ options > TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK) > # 53C810, 53C810A, 53C815, 53C825, 53C825A, 53C860, 53C875, > # 53C876, 53C885, 53C895, 53C895A, 53C896, 53C897, 53C1510D, > # 53C1010-33, 53C1010-66. > -# trm: Tekram DC395U/UW/F DC315U adapters. > > device ahc > device ahd > @@ -1538,7 +1537,6 @@ device mpr # LSI-Logic > MPT-Fusion 3 > device mps # LSI-Logic MPT-Fusion 2 > device mpt # LSI-Logic MPT-Fusion > device sym > -device trm > > # The aic7xxx driver will attempt to use memory mapped I/O for all PCI > # controllers that have it configured only if this option is set. > Unfortunately, > > Modified: head/sys/conf/files > == > --- head/sys/conf/files Thu Nov 28 02:28:12 2019(r355163) > +++ head/sys/conf/files Thu Nov 28 02:32:17 2019(r355164) > @@ -3144,7 +3144,6 @@ dev/tcp_log/tcp_log_dev.c optional tcp_blackbox > inet | > dev/tdfx/tdfx_linux.coptional tdfx_linux tdfx compat_linux > dev/tdfx/tdfx_pci.c optional tdfx pci > dev/ti/if_ti.c optional ti pci > -dev/trm/trm.coptional trm > dev/twa/tw_cl_init.c optional twa \ > compile-with "${NORMAL_C} -I$S/dev/twa" > dev/twa/tw_cl_intr.c optional twa \ > > Modified: head/sys/i386/conf/GENERIC > == > --- head/sys/i386/conf/GENERICThu Nov 28 02:28:12 2019 > (r355163) > +++ head/sys/i386/conf/GENERICThu Nov 28 02:32:17 2019 > (r355164) > @@ -136,7 +136,6 @@ devicempt # LSI-Logic > MPT-Fusion > device mps # LSI-Logic MPT-Fusion 2 > device mpr # LSI-Logic MPT-Fusion 3 > device sym # NCR/Symbios Logic > -device trm # Tekram DC395U/UW/F DC315U > adapters > devi
Re: svn commit: r355166 - head/sys/vm
Thank you. mea culpa. Jeff On Thu, 28 Nov 2019, Ryan Libby wrote: Author: rlibby Date: Thu Nov 28 04:15:16 2019 New Revision: 355166 URL: https://svnweb.freebsd.org/changeset/base/355166 Log: uma: move sysctl vm.uma defn out from under INVARIANTS Fix non-INVARIANTS builds after r355149. Reported by: Michael Butler Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D22588 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Thu Nov 28 02:40:12 2019(r355165) +++ head/sys/vm/uma_core.c Thu Nov 28 04:15:16 2019(r355166) @@ -297,7 +297,6 @@ static bool uma_dbg_zskip(uma_zone_t zone, void *mem); static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item); static void uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *item); -SYSCTL_NODE(_vm, OID_AUTO, uma, CTLFLAG_RW, 0, "Universal Memory Allocator"); static SYSCTL_NODE(_vm, OID_AUTO, debug, CTLFLAG_RD, 0, "Memory allocation debugging"); @@ -315,6 +314,8 @@ SYSCTL_COUNTER_U64(_vm_debug, OID_AUTO, skipped, CTLFL #endif SYSINIT(uma_startup3, SI_SUB_VM_CONF, SI_ORDER_SECOND, uma_startup3, NULL); + +SYSCTL_NODE(_vm, OID_AUTO, uma, CTLFLAG_RW, 0, "Universal Memory Allocator"); SYSCTL_PROC(_vm, OID_AUTO, zone_count, CTLFLAG_RD|CTLTYPE_INT, 0, 0, sysctl_vm_zone_count, "I", "Number of UMA zones"); ___ 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: r355166 - head/sys/vm
Author: rlibby Date: Thu Nov 28 04:15:16 2019 New Revision: 355166 URL: https://svnweb.freebsd.org/changeset/base/355166 Log: uma: move sysctl vm.uma defn out from under INVARIANTS Fix non-INVARIANTS builds after r355149. Reported by: Michael Butler Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D22588 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Thu Nov 28 02:40:12 2019(r355165) +++ head/sys/vm/uma_core.c Thu Nov 28 04:15:16 2019(r355166) @@ -297,7 +297,6 @@ static bool uma_dbg_zskip(uma_zone_t zone, void *mem); static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item); static void uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *item); -SYSCTL_NODE(_vm, OID_AUTO, uma, CTLFLAG_RW, 0, "Universal Memory Allocator"); static SYSCTL_NODE(_vm, OID_AUTO, debug, CTLFLAG_RD, 0, "Memory allocation debugging"); @@ -315,6 +314,8 @@ SYSCTL_COUNTER_U64(_vm_debug, OID_AUTO, skipped, CTLFL #endif SYSINIT(uma_startup3, SI_SUB_VM_CONF, SI_ORDER_SECOND, uma_startup3, NULL); + +SYSCTL_NODE(_vm, OID_AUTO, uma, CTLFLAG_RW, 0, "Universal Memory Allocator"); SYSCTL_PROC(_vm, OID_AUTO, zone_count, CTLFLAG_RD|CTLTYPE_INT, 0, 0, sysctl_vm_zone_count, "I", "Number of UMA zones"); ___ 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: r355165 - head/sys/dev/ntb/ntb_hw
Author: mav Date: Thu Nov 28 02:40:12 2019 New Revision: 355165 URL: https://svnweb.freebsd.org/changeset/base/355165 Log: Make DMAR allow Intel NTB device to access its own BAR0. I have no good explanation why it happens, but I found that in B2B mode at least Xeon v4 NTB leaks accesses to its configuration memory at BAR0 originated from the link side to its host side. DMAR predictably blocks those, making access to remote scratchpad registers in B2B mode impossible. This change creates identity mapping in DMAR covering the BAR0 addresses, making the NTB work fine with DMAR enabled. It seems like allowing single 4KB range at 32KB offset may be enough, but I don't see a reason to be so specific. MFC after:1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 02:32:17 2019 (r355164) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 02:40:12 2019 (r355165) @@ -219,6 +219,9 @@ struct ntb_softc { struct ntb_pci_bar_info *peer_lapic_bar; struct callout peer_msix_work; + bus_dma_tag_t bar0_dma_tag; + bus_dmamap_tbar0_dma_map; + struct callout heartbeat_timer; struct callout lr_timer; @@ -791,6 +794,29 @@ intel_ntb_map_pci_bars(struct ntb_softc *ntb) if (rc != 0) goto out; + /* +* At least on Xeon v4 NTB device leaks to host some remote side +* BAR0 writes supposed to update scratchpad registers. I am not +* sure why it happens, but it may be related to the fact that +* on a link side BAR0 is 32KB, while on a host side it is 64KB. +* Without this hack DMAR blocks those accesses as not allowed. +*/ + if (bus_dma_tag_create(bus_get_dma_tag(ntb->device), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + bar->size, 1, bar->size, 0, NULL, NULL, &ntb->bar0_dma_tag)) { + device_printf(ntb->device, "Unable to create BAR0 tag\n"); + return (ENOMEM); + } + if (bus_dmamap_create(ntb->bar0_dma_tag, 0, &ntb->bar0_dma_map)) { + device_printf(ntb->device, "Unable to create BAR0 map\n"); + return (ENOMEM); + } + if (bus_dma_dmar_load_ident(ntb->bar0_dma_tag, ntb->bar0_dma_map, + bar->pbase, bar->size, 0)) { + device_printf(ntb->device, "Unable to load BAR0 map\n"); + return (ENOMEM); + } + bar = &ntb->bar_info[NTB_B2B_BAR_1]; bar->pci_resource_id = PCIR_BAR(2); rc = map_memory_window_bar(ntb, bar); @@ -943,6 +969,12 @@ intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) struct ntb_pci_bar_info *bar; int i; + if (ntb->bar0_dma_map != NULL) { + bus_dmamap_unload(ntb->bar0_dma_tag, ntb->bar0_dma_map); + bus_dmamap_destroy(ntb->bar0_dma_tag, ntb->bar0_dma_map); + } + if (ntb->bar0_dma_tag != NULL) + bus_dma_tag_destroy(ntb->bar0_dma_tag); for (i = 0; i < NTB_MAX_BARS; i++) { bar = &ntb->bar_info[i]; if (bar->pci_resource != NULL) ___ 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: r355164 - in head: . share/man/man4 sys/amd64/conf sys/conf sys/dev/trm sys/i386/conf sys/modules sys/modules/trm
Author: scottl Date: Thu Nov 28 02:32:17 2019 New Revision: 355164 URL: https://svnweb.freebsd.org/changeset/base/355164 Log: Remove the trm(4) driver Differential Revision:https://reviews.freebsd.org/D22575 Deleted: head/share/man/man4/trm.4 head/sys/dev/trm/ head/sys/modules/trm/ Modified: head/ObsoleteFiles.inc head/share/man/man4/Makefile head/sys/amd64/conf/GENERIC head/sys/conf/NOTES head/sys/conf/files head/sys/i386/conf/GENERIC head/sys/modules/Makefile Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Thu Nov 28 02:28:12 2019(r355163) +++ head/ObsoleteFiles.inc Thu Nov 28 02:32:17 2019(r355164) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20191128: Removal of trm(4) +OLD_FILES+=usr/share/man/man4/trm.4.gz # 20191121: Removal of sio(4) OLD_FILES+=usr/share/man/man4/sio.4.gz # 20191105: picobsd(8), et al, removed. Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileThu Nov 28 02:28:12 2019 (r355163) +++ head/share/man/man4/MakefileThu Nov 28 02:32:17 2019 (r355164) @@ -522,7 +522,6 @@ MAN=aac.4 \ ti.4 \ timecounters.4 \ ${_tpm.4} \ - trm.4 \ tty.4 \ tun.4 \ twa.4 \ Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Thu Nov 28 02:28:12 2019(r355163) +++ head/sys/amd64/conf/GENERIC Thu Nov 28 02:32:17 2019(r355164) @@ -150,7 +150,6 @@ device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 device mpr # LSI-Logic MPT-Fusion 3 device sym # NCR/Symbios Logic -device trm # Tekram DC395U/UW/F DC315U adapters device isci# Intel C600 SAS controller device ocs_fc # Emulex FC adapters device pvscsi # VMware PVSCSI Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Thu Nov 28 02:28:12 2019(r355163) +++ head/sys/conf/NOTES Thu Nov 28 02:32:17 2019(r355164) @@ -1511,7 +1511,6 @@ options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK) # 53C810, 53C810A, 53C815, 53C825, 53C825A, 53C860, 53C875, # 53C876, 53C885, 53C895, 53C895A, 53C896, 53C897, 53C1510D, # 53C1010-33, 53C1010-66. -# trm: Tekram DC395U/UW/F DC315U adapters. device ahc device ahd @@ -1538,7 +1537,6 @@ devicempr # LSI-Logic MPT-Fusion 3 device mps # LSI-Logic MPT-Fusion 2 device mpt # LSI-Logic MPT-Fusion device sym -device trm # The aic7xxx driver will attempt to use memory mapped I/O for all PCI # controllers that have it configured only if this option is set. Unfortunately, Modified: head/sys/conf/files == --- head/sys/conf/files Thu Nov 28 02:28:12 2019(r355163) +++ head/sys/conf/files Thu Nov 28 02:32:17 2019(r355164) @@ -3144,7 +3144,6 @@ dev/tcp_log/tcp_log_dev.c optional tcp_blackbox inet | dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux dev/tdfx/tdfx_pci.coptional tdfx pci dev/ti/if_ti.c optional ti pci -dev/trm/trm.c optional trm dev/twa/tw_cl_init.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_cl_intr.c optional twa \ Modified: head/sys/i386/conf/GENERIC == --- head/sys/i386/conf/GENERIC Thu Nov 28 02:28:12 2019(r355163) +++ head/sys/i386/conf/GENERIC Thu Nov 28 02:32:17 2019(r355164) @@ -136,7 +136,6 @@ device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 device mpr # LSI-Logic MPT-Fusion 3 device sym # NCR/Symbios Logic -device trm # Tekram DC395U/UW/F DC315U adapters device isci# Intel C600 SAS controller device pvscsi # VMware PVSCSI Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Thu Nov 28 02:28:12 2019(r355163) +++ head/sys/modules/Makefile Thu Nov 28 02:32:17 2019(r355164) @@ -352,7 +352,6 @@ SUBDIR= \ tmpfs \
svn commit: r355163 - head/sys/dev/ntb/ntb_hw
Author: mav Date: Thu Nov 28 02:28:12 2019 New Revision: 355163 URL: https://svnweb.freebsd.org/changeset/base/355163 Log: Make the code slightly more compact. There should be no functional change. MFC after:1 week Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 02:19:41 2019 (r355162) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 02:28:12 2019 (r355163) @@ -782,37 +782,42 @@ bar_get_xlat_params(struct ntb_softc *ntb, enum ntb_ba static int intel_ntb_map_pci_bars(struct ntb_softc *ntb) { + struct ntb_pci_bar_info *bar; int rc; - ntb->bar_info[NTB_CONFIG_BAR].pci_resource_id = PCIR_BAR(0); - rc = map_mmr_bar(ntb, &ntb->bar_info[NTB_CONFIG_BAR]); + bar = &ntb->bar_info[NTB_CONFIG_BAR]; + bar->pci_resource_id = PCIR_BAR(0); + rc = map_mmr_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].pci_resource_id = PCIR_BAR(2); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_1]); + bar = &ntb->bar_info[NTB_B2B_BAR_1]; + bar->pci_resource_id = PCIR_BAR(2); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].psz_off = XEON_PBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].ssz_off = XEON_SBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off = XEON_PBAR2XLAT_OFFSET; + bar->psz_off = XEON_PBAR23SZ_OFFSET; + bar->ssz_off = XEON_SBAR23SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR2XLAT_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pci_resource_id = PCIR_BAR(4); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_2]); + bar = &ntb->bar_info[NTB_B2B_BAR_2]; + bar->pci_resource_id = PCIR_BAR(4); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_2].psz_off = XEON_PBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].ssz_off = XEON_SBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pbarxlat_off = XEON_PBAR4XLAT_OFFSET; + bar->psz_off = XEON_PBAR4SZ_OFFSET; + bar->ssz_off = XEON_SBAR4SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR4XLAT_OFFSET; if (!HAS_FEATURE(ntb, NTB_SPLIT_BAR)) goto out; - ntb->bar_info[NTB_B2B_BAR_3].pci_resource_id = PCIR_BAR(5); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_3]); - ntb->bar_info[NTB_B2B_BAR_3].psz_off = XEON_PBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].ssz_off = XEON_SBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].pbarxlat_off = XEON_PBAR5XLAT_OFFSET; + bar = &ntb->bar_info[NTB_B2B_BAR_3]; + bar->pci_resource_id = PCIR_BAR(5); + rc = map_memory_window_bar(ntb, bar); + bar->psz_off = XEON_PBAR5SZ_OFFSET; + bar->ssz_off = XEON_SBAR5SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR5XLAT_OFFSET; out: if (rc != 0) @@ -935,15 +940,14 @@ map_memory_window_bar(struct ntb_softc *ntb, struct nt static void intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) { - struct ntb_pci_bar_info *current_bar; + struct ntb_pci_bar_info *bar; int i; for (i = 0; i < NTB_MAX_BARS; i++) { - current_bar = &ntb->bar_info[i]; - if (current_bar->pci_resource != NULL) + bar = &ntb->bar_info[i]; + if (bar->pci_resource != NULL) bus_release_resource(ntb->device, SYS_RES_MEMORY, - current_bar->pci_resource_id, - current_bar->pci_resource); + bar->pci_resource_id, bar->pci_resource); } } ___ 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: r355162 - stable/12/sys/arm64/linux
Author: emaste Date: Thu Nov 28 02:19:41 2019 New Revision: 355162 URL: https://svnweb.freebsd.org/changeset/base/355162 Log: MFC r354341: arm64 linuxulator: default to RW stack (no X) This matches Linux's default arm64 data / stack permissions. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/arm64/linux/linux_sysvec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/linux/linux_sysvec.c == --- stable/12/sys/arm64/linux/linux_sysvec.cThu Nov 28 02:18:51 2019 (r355161) +++ stable/12/sys/arm64/linux/linux_sysvec.cThu Nov 28 02:19:41 2019 (r355162) @@ -380,7 +380,7 @@ struct sysentvec elf_linux_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack= USRSTACK, .sv_psstrings = PS_STRINGS, /* XXX */ - .sv_stackprot = VM_PROT_ALL, /* XXX */ + .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_strings = linux_copyout_strings, .sv_setregs = linux_exec_setregs, .sv_fixlimit= NULL, ___ 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: r355161 - head/sys/rpc/rpcsec_gss
Author: rmacklem Date: Thu Nov 28 02:18:51 2019 New Revision: 355161 URL: https://svnweb.freebsd.org/changeset/base/355161 Log: Change r355157 to make svc_rpc_gss_lifetime_max a static. MFC after:2 weeks Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c == --- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cThu Nov 28 02:18:19 2019 (r355160) +++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cThu Nov 28 02:18:51 2019 (r355161) @@ -173,7 +173,6 @@ struct svc_rpc_gss_cookedcred { #define CLIENT_MAX 1024 u_int svc_rpc_gss_client_max = CLIENT_MAX; u_int svc_rpc_gss_client_hash_size = CLIENT_HASH_SIZE; -u_int svc_rpc_gss_lifetime_max = 0; SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC"); SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS"); @@ -186,6 +185,7 @@ SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_hash, CTLF &svc_rpc_gss_client_hash_size, 0, "Size of rpc-gss client hash table"); +static u_int svc_rpc_gss_lifetime_max = 0; SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, lifetime_max, CTLFLAG_RW, &svc_rpc_gss_lifetime_max, 0, "Maximum lifetime (seconds) of rpc-gss clients"); ___ 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: r355160 - stable/12/crypto/openssh
Author: emaste Date: Thu Nov 28 02:18:19 2019 New Revision: 355160 URL: https://svnweb.freebsd.org/changeset/base/355160 Log: MFC r354897: sshd: make getpwclass wrapper MON_ISAUTH not MON_AUTH In r339216 a privsep wrapper was added for login_getpwclass to address PR 231172. Unfortunately the change used the MON_AUTH flag in the wrapper, and MON_AUTH includes MON_AUTHDECIDE which triggers an auth_log() on each invocation. getpwclass() does not participate in the authentication decision, so should be MON_ISAUTH instead. PR: 234793 Submitted by: Henry Hu Reviewed by: Yuichiro NAITO MFC after:1 week Modified: stable/12/crypto/openssh/monitor.c Directory Properties: stable/12/ (props changed) Modified: stable/12/crypto/openssh/monitor.c == --- stable/12/crypto/openssh/monitor.c Thu Nov 28 02:15:45 2019 (r355159) +++ stable/12/crypto/openssh/monitor.c Thu Nov 28 02:18:19 2019 (r355160) @@ -193,7 +193,7 @@ struct mon_table mon_dispatch_proto20[] = { #endif {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, #ifdef HAVE_LOGIN_CAP -{MONITOR_REQ_GETPWCLASS, MON_AUTH, mm_answer_login_getpwclass}, +{MONITOR_REQ_GETPWCLASS, MON_ISAUTH, mm_answer_login_getpwclass}, #endif {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, ___ 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: r355159 - stable/11/sys/dev/cfi
Author: emaste Date: Thu Nov 28 02:15:45 2019 New Revision: 355159 URL: https://svnweb.freebsd.org/changeset/base/355159 Log: MFC r355101, r355104: cfi: check for inter overflow in cfi_devioctl Reported by: Pietro Oliva Security: Possible OOB read in root-only ioctl Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/dev/cfi/cfi_dev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cfi/cfi_dev.c == --- stable/11/sys/dev/cfi/cfi_dev.c Thu Nov 28 02:12:33 2019 (r355158) +++ stable/11/sys/dev/cfi/cfi_dev.c Thu Nov 28 02:15:45 2019 (r355159) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -278,7 +279,8 @@ cfi_devioctl(struct cdev *dev, u_long cmd, caddr_t dat rq = (struct cfiocqry *)data; if (rq->offset >= sc->sc_size / sc->sc_width) return (ESPIPE); - if (rq->offset + rq->count > sc->sc_size / sc->sc_width) + if (rq->offset > ULONG_MAX - rq->count || + rq->offset + rq->count > sc->sc_size / sc->sc_width) return (ENOSPC); while (!error && rq->count--) { ___ 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: r355158 - stable/12/sys/dev/cfi
Author: emaste Date: Thu Nov 28 02:12:33 2019 New Revision: 355158 URL: https://svnweb.freebsd.org/changeset/base/355158 Log: MFC r355101, r355104: cfi: check for inter overflow in cfi_devioctl Reported by: Pietro Oliva Security: Possible OOB read in root-only ioctl Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/dev/cfi/cfi_dev.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cfi/cfi_dev.c == --- stable/12/sys/dev/cfi/cfi_dev.c Thu Nov 28 02:05:31 2019 (r355157) +++ stable/12/sys/dev/cfi/cfi_dev.c Thu Nov 28 02:12:33 2019 (r355158) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -280,7 +281,8 @@ cfi_devioctl(struct cdev *dev, u_long cmd, caddr_t dat rq = (struct cfiocqry *)data; if (rq->offset >= sc->sc_size / sc->sc_width) return (ESPIPE); - if (rq->offset + rq->count > sc->sc_size / sc->sc_width) + if (rq->offset > ULONG_MAX - rq->count || + rq->offset + rq->count > sc->sc_size / sc->sc_width) return (ENOSPC); while (!error && rq->count--) { ___ 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: r355157 - head/sys/rpc/rpcsec_gss
Author: rmacklem Date: Thu Nov 28 02:05:31 2019 New Revision: 355157 URL: https://svnweb.freebsd.org/changeset/base/355157 Log: Add a cap on credential lifetime for Kerberized NFS. The kernel RPCSEC_GSS code sets the credential (called a client) lifetime to the lifetime of the Kerberos ticket, which is typically several hours. As such, when a user's credentials change such as being added to a new group, it can take several hours for this change to be recognized by the NFS server. This patch adds a sysctl called kern.rpc.gss.lifetime_max which can be set by a sysadmin to put a cap on the time to expire for the credentials, so that a sysadmin can reduce the timeout. It also fixes a bug, where time_uptime is added twice when GSS_C_INDEFINITE is returned for a lifetime. This has no effect in practice, sine Kerberos never does this. Tested by:p...@lysator.liu.se PR: 242132 Submitted by: p...@lysator.liu.se MFC after:2 weeks Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c == --- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cThu Nov 28 00:46:33 2019 (r355156) +++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cThu Nov 28 02:05:31 2019 (r355157) @@ -173,6 +173,7 @@ struct svc_rpc_gss_cookedcred { #define CLIENT_MAX 1024 u_int svc_rpc_gss_client_max = CLIENT_MAX; u_int svc_rpc_gss_client_hash_size = CLIENT_HASH_SIZE; +u_int svc_rpc_gss_lifetime_max = 0; SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC"); SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS"); @@ -185,6 +186,10 @@ SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_hash, CTLF &svc_rpc_gss_client_hash_size, 0, "Size of rpc-gss client hash table"); +SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, lifetime_max, CTLFLAG_RW, +&svc_rpc_gss_lifetime_max, 0, +"Maximum lifetime (seconds) of rpc-gss clients"); + static u_int svc_rpc_gss_client_count; SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_count, CTLFLAG_RD, &svc_rpc_gss_client_count, 0, @@ -956,8 +961,15 @@ svc_rpc_gss_accept_sec_context(struct svc_rpc_gss_clie * that out). */ if (cred_lifetime == GSS_C_INDEFINITE) - cred_lifetime = time_uptime + 24*60*60; + cred_lifetime = 24*60*60; + /* +* Cap cred_lifetime if sysctl kern.rpc.gss.lifetime_max is set. +*/ + if (svc_rpc_gss_lifetime_max > 0 && cred_lifetime > + svc_rpc_gss_lifetime_max) + cred_lifetime = svc_rpc_gss_lifetime_max; + client->cl_expiration = time_uptime + cred_lifetime; /* ___ 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: r355156 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Thu Nov 28 00:46:33 2019 New Revision: 355156 URL: https://svnweb.freebsd.org/changeset/base/355156 Log: Include fin, the packet information structure (fr_info_t), in the l4sums DTrace probe, making more information available for the diagnosis of IPv6 checksum errors. MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Thu Nov 28 00:46:03 2019 (r355155) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Nov 28 00:46:33 2019 (r355156) @@ -6742,7 +6742,7 @@ ipf_checkl4sum(fin) FR_DEBUG(("checkl4sum: %hx != %hx\n", sum, hdrsum)); } #endif - DT2(l4sums, u_short, hdrsum, u_short, sum); + DT3(l4sums, u_short, hdrsum, u_short, sum, fr_info_t *, fin); #ifdef USE_INET6 if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { #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"
svn commit: r355155 - head/contrib/openbsm/bin/auditd
Author: cem Date: Thu Nov 28 00:46:03 2019 New Revision: 355155 URL: https://svnweb.freebsd.org/changeset/base/355155 Log: auditd(8): fix long-standing uninitialized memory use bug The bogus use could lead to an infinite loop depending on how fast the audit_warn script to execute. By fixing read(2) interruptibility, d060887 (r335899) revealed another bug in auditd_wait_for_events. When read is interrupted by SIGCHLD, auditd_reap_children will always return with errno set to ECHILD. But auditd_wait_for_events checks errno after that point, expecting it to be unchanged since read. As a result, it calls auditd_handle_trigger with bogus stack garbage. The result is the error message "Got unknown trigger 48." Fix by simply ignoring errno at that point; there's only one value it could've possibly had, thanks to the check up above. The best part is we've had a fix for this for like 18 months and just never merged it. Merge it now. PR: 234209 Reported by: Marie Helene Kvello-Aune (2018-12) Submitted by: asomers (2018-07) Reviewed by: me (in OpenBSM) Obtained from:OpenBSM X-MFC-With: r335899 Security: ¯\_(ツ)_/¯ Differential Revision:https://github.com/openbsm/openbsm/pull/45 Modified: head/contrib/openbsm/bin/auditd/auditd_fbsd.c Modified: head/contrib/openbsm/bin/auditd/auditd_fbsd.c == --- head/contrib/openbsm/bin/auditd/auditd_fbsd.c Thu Nov 28 00:42:55 2019(r355154) +++ head/contrib/openbsm/bin/auditd/auditd_fbsd.c Thu Nov 28 00:46:03 2019(r355155) @@ -241,7 +241,7 @@ auditd_wait_for_events(void) auditd_config_controls(); } - if ((num == -1) && (errno == EINTR)) + if (num == -1) continue; if (num == 0) { auditd_log_err("%s: read EOF", __FUNCTION__); ___ 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: r355154 - stable/11/sys/dev/ioat
Author: mav Date: Thu Nov 28 00:42:55 2019 New Revision: 355154 URL: https://svnweb.freebsd.org/changeset/base/355154 Log: MFC r354703: Pass more reasonable WAIT flags to bus_dma(9) calls. Modified: stable/11/sys/dev/ioat/ioat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ioat/ioat.c == --- stable/11/sys/dev/ioat/ioat.c Thu Nov 28 00:42:45 2019 (r355153) +++ stable/11/sys/dev/ioat/ioat.c Thu Nov 28 00:42:55 2019 (r355154) @@ -487,13 +487,14 @@ ioat3_attach(device_t device) &ioat->comp_update_tag); error = bus_dmamem_alloc(ioat->comp_update_tag, - (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, + &ioat->comp_update_map); if (ioat->comp_update == NULL) return (ENOMEM); error = bus_dmamap_load(ioat->comp_update_tag, ioat->comp_update_map, ioat->comp_update, sizeof(uint64_t), ioat_comp_update_map, ioat, - 0); + BUS_DMA_NOWAIT); if (error != 0) return (error); @@ -514,7 +515,7 @@ ioat3_attach(device_t device) return (error); error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc, - ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_WAITOK); + ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_NOWAIT); if (error) return (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: r355153 - stable/12/sys/dev/ioat
Author: mav Date: Thu Nov 28 00:42:45 2019 New Revision: 355153 URL: https://svnweb.freebsd.org/changeset/base/355153 Log: MFC r354703: Pass more reasonable WAIT flags to bus_dma(9) calls. Modified: stable/12/sys/dev/ioat/ioat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ioat/ioat.c == --- stable/12/sys/dev/ioat/ioat.c Thu Nov 28 00:41:42 2019 (r355152) +++ stable/12/sys/dev/ioat/ioat.c Thu Nov 28 00:42:45 2019 (r355153) @@ -497,13 +497,14 @@ ioat3_attach(device_t device) &ioat->comp_update_tag); error = bus_dmamem_alloc(ioat->comp_update_tag, - (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map); + (void **)&ioat->comp_update, BUS_DMA_ZERO | BUS_DMA_WAITOK, + &ioat->comp_update_map); if (ioat->comp_update == NULL) return (ENOMEM); error = bus_dmamap_load(ioat->comp_update_tag, ioat->comp_update_map, ioat->comp_update, sizeof(uint64_t), ioat_comp_update_map, ioat, - 0); + BUS_DMA_NOWAIT); if (error != 0) return (error); @@ -524,7 +525,7 @@ ioat3_attach(device_t device) return (error); error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc, - ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_WAITOK); + ringsz, ioat_dmamap_cb, &ioat->hw_desc_bus_addr, BUS_DMA_NOWAIT); if (error) return (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: r355152 - in stable/11/sys/dev/ntb: . ntb_hw
Author: mav Date: Thu Nov 28 00:41:42 2019 New Revision: 355152 URL: https://svnweb.freebsd.org/changeset/base/355152 Log: MFC r354702: Make ntb(4) send bus_get_dma_tag() requests to parent buses passing real bus' child pointers instead of grandchilds. DMAR does not like requests from devices not parented directly by PCI. Modified: stable/11/sys/dev/ntb/ntb.c stable/11/sys/dev/ntb/ntb.h stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/ntb.c == --- stable/11/sys/dev/ntb/ntb.c Thu Nov 28 00:40:42 2019(r355151) +++ stable/11/sys/dev/ntb/ntb.c Thu Nov 28 00:41:42 2019(r355152) @@ -205,6 +205,13 @@ ntb_print_child(device_t dev, device_t child) return (retval); } +bus_dma_tag_t +ntb_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + void ntb_link_event(device_t dev) { Modified: stable/11/sys/dev/ntb/ntb.h == --- stable/11/sys/dev/ntb/ntb.h Thu Nov 28 00:40:42 2019(r355151) +++ stable/11/sys/dev/ntb/ntb.h Thu Nov 28 00:41:42 2019(r355152) @@ -39,6 +39,7 @@ int ntb_unregister_device(device_t ntb); int ntb_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); int ntb_print_child(device_t dev, device_t child); +bus_dma_tag_t ntb_get_dma_tag(device_t bus, device_t child); /* * ntb_link_event() - notify driver context of a change in link status Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 00:40:42 2019 (r355151) +++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 00:41:42 2019 (r355152) @@ -3088,6 +3088,7 @@ static device_method_t ntb_intel_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_link_is_up, intel_ntb_link_is_up), DEVMETHOD(ntb_link_enable, intel_ntb_link_enable), Modified: stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c == --- stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Nov 28 00:40:42 2019 (r355151) +++ stable/11/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Nov 28 00:41:42 2019 (r355152) @@ -1009,6 +1009,7 @@ static device_method_t ntb_plx_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_link_is_up, ntb_plx_link_is_up), DEVMETHOD(ntb_link_enable, ntb_plx_link_enable), ___ 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: r355151 - in stable/12/sys/dev/ntb: . ntb_hw
Author: mav Date: Thu Nov 28 00:40:42 2019 New Revision: 355151 URL: https://svnweb.freebsd.org/changeset/base/355151 Log: MFC r354702: Make ntb(4) send bus_get_dma_tag() requests to parent buses passing real bus' child pointers instead of grandchilds. DMAR does not like requests from devices not parented directly by PCI. Modified: stable/12/sys/dev/ntb/ntb.c stable/12/sys/dev/ntb/ntb.h stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb.c == --- stable/12/sys/dev/ntb/ntb.c Thu Nov 28 00:37:43 2019(r355150) +++ stable/12/sys/dev/ntb/ntb.c Thu Nov 28 00:40:42 2019(r355151) @@ -205,6 +205,13 @@ ntb_print_child(device_t dev, device_t child) return (retval); } +bus_dma_tag_t +ntb_get_dma_tag(device_t bus, device_t child) +{ + + return (bus_get_dma_tag(bus)); +} + void ntb_link_event(device_t dev) { Modified: stable/12/sys/dev/ntb/ntb.h == --- stable/12/sys/dev/ntb/ntb.h Thu Nov 28 00:37:43 2019(r355150) +++ stable/12/sys/dev/ntb/ntb.h Thu Nov 28 00:40:42 2019(r355151) @@ -39,6 +39,7 @@ int ntb_unregister_device(device_t ntb); int ntb_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); int ntb_print_child(device_t dev, device_t child); +bus_dma_tag_t ntb_get_dma_tag(device_t bus, device_t child); /* * ntb_link_event() - notify driver context of a change in link status Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c == --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Thu Nov 28 00:37:43 2019 (r355150) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_amd.c Thu Nov 28 00:40:42 2019 (r355151) @@ -1266,6 +1266,7 @@ static device_method_t ntb_amd_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_port_number, amd_ntb_port_number), Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 00:37:43 2019 (r355150) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Nov 28 00:40:42 2019 (r355151) @@ -3123,6 +3123,7 @@ static device_method_t ntb_intel_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_port_number, intel_ntb_port_number), DEVMETHOD(ntb_peer_port_count, intel_ntb_peer_port_count), Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c == --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Nov 28 00:37:43 2019 (r355150) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Nov 28 00:40:42 2019 (r355151) @@ -1052,6 +1052,7 @@ static device_method_t ntb_plx_methods[] = { /* Bus interface */ DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), + DEVMETHOD(bus_get_dma_tag, ntb_get_dma_tag), /* NTB interface */ DEVMETHOD(ntb_port_number, ntb_plx_port_number), DEVMETHOD(ntb_peer_port_count, ntb_plx_peer_port_count), ___ 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: r355150 - head/sys/ufs/ffs
Author: chs Date: Thu Nov 28 00:37:43 2019 New Revision: 355150 URL: https://svnweb.freebsd.org/changeset/base/355150 Log: As part of creating a snapshot, set fs->fs_fmod to 0 in the snapshot image because nothing ever changes this field for read-only mounts and we want to verify that it is still 0 when we unmount. Reviewed by: mckusick Approved by: mckusick (mentor) Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_snapshot.c Modified: head/sys/ufs/ffs/ffs_snapshot.c == --- head/sys/ufs/ffs/ffs_snapshot.c Thu Nov 28 00:19:09 2019 (r355149) +++ head/sys/ufs/ffs/ffs_snapshot.c Thu Nov 28 00:37:43 2019 (r355150) @@ -803,6 +803,7 @@ out1: brelse(nbp); } else { loc = blkoff(fs, fs->fs_sblockloc); + copy_fs->fs_fmod = 0; copy_fs->fs_ckhash = ffs_calc_sbhash(copy_fs); bcopy((char *)copy_fs, &nbp->b_data[loc], (u_int)fs->fs_sbsize); bawrite(nbp); ___ 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: r355149 - head/sys/vm
Author: jeff Date: Thu Nov 28 00:19:09 2019 New Revision: 355149 URL: https://svnweb.freebsd.org/changeset/base/355149 Log: Implement a sysctl tree for uma zones to assist in debugging and provide more statistcs than are exported via the ABI stable vmstat interface. Rename uz_count to uz_bucket_size because even I was confused by the name after returning to the source years later. Reviewed by: rlibby Differential Revision:https://reviews.freebsd.org/D22554 Modified: head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Wed Nov 27 23:19:06 2019(r355148) +++ head/sys/vm/uma_core.c Thu Nov 28 00:19:09 2019(r355149) @@ -119,6 +119,7 @@ static uma_zone_t hashzone; int uma_align_cache = 64 - 1; static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets"); +static MALLOC_DEFINE(M_UMA, "UMA", "UMA Misc"); /* * Are we allowed to allocate buckets? @@ -258,8 +259,8 @@ static void zone_dtor(void *, int, void *); static int zero_init(void *, int, int); static void keg_small_init(uma_keg_t keg); static void keg_large_init(uma_keg_t keg); -static void zone_foreach(void (*zfunc)(uma_zone_t)); -static void zone_timeout(uma_zone_t zone); +static void zone_foreach(void (*zfunc)(uma_zone_t, void *), void *); +static void zone_timeout(uma_zone_t zone, void *); static int hash_alloc(struct uma_hash *, u_int); static int hash_expand(struct uma_hash *, struct uma_hash *); static void hash_free(struct uma_hash *hash); @@ -285,10 +286,10 @@ static void uma_zero_item(void *, uma_zone_t); static bool cache_alloc(uma_zone_t, uma_cache_t, void *, int); static bool cache_free(uma_zone_t, uma_cache_t, void *, void *, int); -void uma_print_zone(uma_zone_t); -void uma_print_stats(void); static int sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS); static int sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS); +static int sysctl_handle_uma_zone_allocs(SYSCTL_HANDLER_ARGS); +static int sysctl_handle_uma_zone_frees(SYSCTL_HANDLER_ARGS); #ifdef INVARIANTS static bool uma_dbg_kskip(uma_keg_t keg, void *mem); @@ -296,6 +297,7 @@ static bool uma_dbg_zskip(uma_zone_t zone, void *mem); static void uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item); static void uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *item); +SYSCTL_NODE(_vm, OID_AUTO, uma, CTLFLAG_RW, 0, "Universal Memory Allocator"); static SYSCTL_NODE(_vm, OID_AUTO, debug, CTLFLAG_RD, 0, "Memory allocation debugging"); @@ -458,7 +460,7 @@ bucket_alloc(uma_zone_t zone, void *udata, int flags) } if ((uintptr_t)udata & UMA_ZFLAG_CACHEONLY) flags |= M_NOVM; - ubz = bucket_zone_lookup(zone->uz_count); + ubz = bucket_zone_lookup(zone->uz_bucket_size); if (ubz->ubz_zone == zone && (ubz + 1)->ubz_entries != 0) ubz++; bucket = uma_zalloc_arg(ubz->ubz_zone, udata, flags); @@ -575,7 +577,7 @@ static void uma_timeout(void *unused) { bucket_enable(); - zone_foreach(zone_timeout); + zone_foreach(zone_timeout, NULL); /* Reschedule this event */ callout_reset(&uma_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); @@ -605,7 +607,7 @@ zone_domain_update_wss(uma_zone_domain_t zdom) * Returns nothing. */ static void -zone_timeout(uma_zone_t zone) +zone_timeout(uma_zone_t zone, void *unused) { uma_keg_t keg; u_int slabs; @@ -845,19 +847,20 @@ cache_drain(uma_zone_t zone) } static void -cache_shrink(uma_zone_t zone) +cache_shrink(uma_zone_t zone, void *unused) { if (zone->uz_flags & UMA_ZFLAG_INTERNAL) return; ZONE_LOCK(zone); - zone->uz_count = (zone->uz_count_min + zone->uz_count) / 2; + zone->uz_bucket_size = + (zone->uz_bucket_size_min + zone->uz_bucket_size) / 2; ZONE_UNLOCK(zone); } static void -cache_drain_safe_cpu(uma_zone_t zone) +cache_drain_safe_cpu(uma_zone_t zone, void *unused) { uma_cache_t cache; uma_bucket_t b1, b2, b3; @@ -920,9 +923,9 @@ pcpu_cache_drain_safe(uma_zone_t zone) * Polite bucket sizes shrinking was not enouth, shrink aggressively. */ if (zone) - cache_shrink(zone); + cache_shrink(zone, NULL); else - zone_foreach(cache_shrink); + zone_foreach(cache_shrink, NULL); CPU_FOREACH(cpu) { thread_lock(curthread); @@ -930,9 +933,9 @@ pcpu_cache_drain_safe(uma_zone_t zone) thread_unlock(curthread); if (zone) - cache_drain_safe_cpu(zone); + cache_drain_safe_cpu(zone, NULL); else - zone_foreach(cache_drain_safe_cpu); + zone_foreach(cache_drain_safe_cpu, NULL); } thread_lock(curthread);
svn commit: r355148 - head/sys/vm
Author: jeff Date: Wed Nov 27 23:19:06 2019 New Revision: 355148 URL: https://svnweb.freebsd.org/changeset/base/355148 Log: Refactor uma_zfree_arg into several functions to make control flow more clear and icache usage cleaner. Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D22491 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Wed Nov 27 21:00:44 2019(r355147) +++ head/sys/vm/uma_core.c Wed Nov 27 23:19:06 2019(r355148) @@ -283,6 +283,7 @@ static int zone_import(uma_zone_t, void **, int, int, static void zone_release(uma_zone_t, void **, int); static void uma_zero_item(void *, uma_zone_t); static bool cache_alloc(uma_zone_t, uma_cache_t, void *, int); +static bool cache_free(uma_zone_t, uma_cache_t, void *, void *, int); void uma_print_zone(uma_zone_t); void uma_print_stats(void); @@ -2466,6 +2467,17 @@ bucket_pop(uma_zone_t zone, uma_cache_t cache, uma_buc return (item); } +static inline void +bucket_push(uma_zone_t zone, uma_cache_t cache, uma_bucket_t bucket, +void *item) +{ + KASSERT(bucket->ub_bucket[bucket->ub_cnt] == NULL, + ("uma_zfree: Freeing to non free bucket index.")); + bucket->ub_bucket[bucket->ub_cnt] = item; + bucket->ub_cnt++; + cache->uc_frees++; +} + static void * item_ctor(uma_zone_t zone, void *udata, int flags, void *item) { @@ -3158,12 +3170,7 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata { uma_cache_t cache; uma_bucket_t bucket; - uma_zone_domain_t zdom; - int cpu, domain; -#ifdef UMA_XDOMAIN - int itemdomain; -#endif - bool lockfail; + int cpu, domain, itemdomain; /* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA); @@ -3196,11 +3203,6 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata if (zone->uz_sleepers > 0) goto zfree_item; -#ifdef UMA_XDOMAIN - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) - itemdomain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); -#endif - /* * If possible, free to the per-CPU cache. There are two * requirements for safe access to the per-CPU cache: (1) the thread @@ -3212,175 +3214,187 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata * current cache; when we re-acquire the critical section, we must * detect and handle migration if it has occurred. */ -zfree_restart: + domain = itemdomain = 0; critical_enter(); - cpu = curcpu; - cache = &zone->uz_cpu[cpu]; - -zfree_start: - domain = PCPU_GET(domain); + do { + cpu = curcpu; + cache = &zone->uz_cpu[cpu]; + bucket = cache->uc_allocbucket; #ifdef UMA_XDOMAIN - if ((zone->uz_flags & UMA_ZONE_NUMA) == 0) - itemdomain = domain; + if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) { + itemdomain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); + domain = PCPU_GET(domain); + } + if ((zone->uz_flags & UMA_ZONE_NUMA) != 0 && + domain != itemdomain) { + bucket = cache->uc_crossbucket; + } else #endif + + /* +* Try to free into the allocbucket first to give LIFO ordering +* for cache-hot datastructures. Spill over into the freebucket +* if necessary. Alloc will swap them if one runs dry. +*/ + if (bucket == NULL || bucket->ub_cnt >= bucket->ub_entries) + bucket = cache->uc_freebucket; + if (__predict_true(bucket != NULL && + bucket->ub_cnt < bucket->ub_entries)) { + bucket_push(zone, cache, bucket, item); + critical_exit(); + return; + } + } while (cache_free(zone, cache, udata, item, itemdomain)); + critical_exit(); + /* -* Try to free into the allocbucket first to give LIFO ordering -* for cache-hot datastructures. Spill over into the freebucket -* if necessary. Alloc will swap them if one runs dry. +* If nothing else caught this, we'll just do an internal free. */ +zfree_item: + zone_free_item(zone, item, udata, SKIP_DTOR); +} + +static void +zone_free_bucket(uma_zone_t zone, uma_bucket_t bucket, void *udata, +int domain, int itemdomain) +{ + uma_zone_domain_t zdom; + #ifdef UMA_XDOMAIN - if (domain != itemdomain) { - bucket = cache->uc_crossbucket; - } else -#endif - { - bucket = cache->uc_allocbucket; -
svn commit: r355147 - head/sys/vm
Author: dougm Date: Wed Nov 27 21:00:44 2019 New Revision: 355147 URL: https://svnweb.freebsd.org/changeset/base/355147 Log: Inline some splay helper functions to improve performance on a micro-benchmark. Reviewed by: markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D22544 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cWed Nov 27 20:33:53 2019(r355146) +++ head/sys/vm/vm_map.cWed Nov 27 21:00:44 2019(r355147) @@ -1069,53 +1069,48 @@ vm_map_entry_pred(vm_map_entry_t entry) * the subsequent call to vm_map_splay_merge, rely on the start and end address * values in &map->header. */ -static vm_map_entry_t +static __always_inline vm_map_entry_t vm_map_splay_split(vm_map_t map, vm_offset_t addr, vm_size_t length, -vm_map_entry_t *out_llist, vm_map_entry_t *out_rlist) +vm_map_entry_t *llist, vm_map_entry_t *rlist) { - vm_map_entry_t llist, rlist, root, y; + vm_map_entry_t root, y; - llist = rlist = &map->header; + *llist = *rlist = &map->header; root = map->root; while (root != NULL && root->max_free >= length) { - KASSERT(llist->end <= root->start && root->end <= rlist->start, + KASSERT((*llist)->end <= root->start && + root->end <= (*rlist)->start, ("%s: root not within tree bounds", __func__)); if (addr < root->start) { - SPLAY_LEFT_STEP(root, y, rlist, + SPLAY_LEFT_STEP(root, y, *rlist, y->max_free >= length && addr < y->start); } else if (addr >= root->end) { - SPLAY_RIGHT_STEP(root, y, llist, + SPLAY_RIGHT_STEP(root, y, *llist, y->max_free >= length && addr >= y->end); } else break; } - *out_llist = llist; - *out_rlist = rlist; return (root); } -static void -vm_map_splay_findnext(vm_map_entry_t root, vm_map_entry_t *iolist) +static __always_inline void +vm_map_splay_findnext(vm_map_entry_t root, vm_map_entry_t *rlist) { - vm_map_entry_t rlist, y; + vm_map_entry_t hi, y; - root = root->right; - rlist = *iolist; - while (root != NULL) - SPLAY_LEFT_STEP(root, y, rlist, true); - *iolist = rlist; + hi = root->right; + while (hi != NULL) + SPLAY_LEFT_STEP(hi, y, *rlist, true); } -static void -vm_map_splay_findprev(vm_map_entry_t root, vm_map_entry_t *iolist) +static __always_inline void +vm_map_splay_findprev(vm_map_entry_t root, vm_map_entry_t *llist) { - vm_map_entry_t llist, y; + vm_map_entry_t lo, y; - root = root->left; - llist = *iolist; - while (root != NULL) - SPLAY_RIGHT_STEP(root, y, llist, true); - *iolist = llist; + lo = root->left; + while (lo != NULL) + SPLAY_RIGHT_STEP(lo, y, *llist, true); } static inline void @@ -1270,30 +1265,22 @@ vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry KASSERT(root != NULL, ("vm_map_entry_unlink: unlink object not mapped")); + vm_map_splay_findprev(root, &llist); vm_map_splay_findnext(root, &rlist); - switch (op) { - case UNLINK_MERGE_NEXT: + if (op == UNLINK_MERGE_NEXT) { rlist->start = root->start; rlist->offset = root->offset; - y = root->left; + } + if (llist != &map->header) { + root = llist; + llist = root->right; + root->right = NULL; + } else if (rlist != &map->header) { root = rlist; rlist = root->left; - root->left = y; - break; - case UNLINK_MERGE_NONE: - vm_map_splay_findprev(root, &llist); - if (llist != &map->header) { - root = llist; - llist = root->right; - root->right = NULL; - } else if (rlist != &map->header) { - root = rlist; - rlist = root->left; - root->left = NULL; - } else - root = NULL; - break; - } + root->left = NULL; + } else + root = NULL; y = entry->next; y->prev = entry->prev; y->prev->next = y; @@ -1322,8 +1309,7 @@ vm_map_entry_resize(vm_map_t map, vm_map_entry_t entry VM_MAP_ASSERT_LOCKED(map); root = vm_map_splay_split(map, entry->start, 0, &llist, &rlist); - KASSERT(root != NULL, - ("%s: resize object not mapped", __func__)); + KASSERT(root != NULL, ("%s: resize object no
Re: svn commit: r355146 - head/sys/kern
On Wed, Nov 27, 2019 at 08:33:53PM +, Konstantin Belousov wrote: > Author: kib > Date: Wed Nov 27 20:33:53 2019 > New Revision: 355146 > URL: https://svnweb.freebsd.org/changeset/base/355146 Ease the life of PTRACE_SYSCALL users when debuggee sleeps in sigsuspend(2) and sig{timed,}wait(2). If PT_TO_SCE or PT_TO_SCX were issued after the target already entered sleep in sigsuspend(2) or sigtimedwait(2), there is no debugging events generated until a relevant signal is delivered. As result, debugger hangs waiting for an event. Introduce spurious EINTR returned in that situations to help debugger to gain control earlier. [Sorry] > > Log: > Requested and tested by:kevans > Reviewed by:kevans (previous version), markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D22546 > > Modified: > head/sys/kern/kern_sig.c > > Modified: head/sys/kern/kern_sig.c > == > --- head/sys/kern/kern_sig.c Wed Nov 27 20:33:49 2019(r355145) > +++ head/sys/kern/kern_sig.c Wed Nov 27 20:33:53 2019(r355146) > @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -1252,11 +1253,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, > int error, sig, timo, timevalid = 0; > struct timespec rts, ets, ts; > struct timeval tv; > + bool traced; > > p = td->td_proc; > error = 0; > ets.tv_sec = 0; > ets.tv_nsec = 0; > + traced = false; > > if (timeout != NULL) { > if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 10) { > @@ -1309,6 +1312,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, > timo = 0; > } > > + if (traced) { > + error = EINTR; > + break; > + } > + > error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); > > if (timeout != NULL) { > @@ -1320,6 +1328,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, > error = 0; > } > } > + > + /* > + * If PTRACE_SCE or PTRACE_SCX were set after > + * userspace entered the syscall, return spurious > + * EINTR after wait was done. Only do this as last > + * resort after rechecking for possible queued signals > + * and expired timeouts. > + */ > + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) > + traced = true; > } > > new_block = saved_mask; > @@ -1532,6 +1550,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) > has_sig += postsig(sig); > } > mtx_unlock(&p->p_sigacts->ps_mtx); > + > + /* > + * If PTRACE_SCE or PTRACE_SCX were set after > + * userspace entered the syscall, return spurious > + * EINTR. > + */ > + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) > + has_sig += 1; > } > PROC_UNLOCK(p); > td->td_errno = EINTR; ___ 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: r355146 - head/sys/kern
Author: kib Date: Wed Nov 27 20:33:53 2019 New Revision: 355146 URL: https://svnweb.freebsd.org/changeset/base/355146 Log: Requested and tested by: kevans Reviewed by: kevans (previous version), markj Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D22546 Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c == --- head/sys/kern/kern_sig.cWed Nov 27 20:33:49 2019(r355145) +++ head/sys/kern/kern_sig.cWed Nov 27 20:33:53 2019(r355146) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1252,11 +1253,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, int error, sig, timo, timevalid = 0; struct timespec rts, ets, ts; struct timeval tv; + bool traced; p = td->td_proc; error = 0; ets.tv_sec = 0; ets.tv_nsec = 0; + traced = false; if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 10) { @@ -1309,6 +1312,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, timo = 0; } + if (traced) { + error = EINTR; + break; + } + error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); if (timeout != NULL) { @@ -1320,6 +1328,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, error = 0; } } + + /* +* If PTRACE_SCE or PTRACE_SCX were set after +* userspace entered the syscall, return spurious +* EINTR after wait was done. Only do this as last +* resort after rechecking for possible queued signals +* and expired timeouts. +*/ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + traced = true; } new_block = saved_mask; @@ -1532,6 +1550,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) has_sig += postsig(sig); } mtx_unlock(&p->p_sigacts->ps_mtx); + + /* +* If PTRACE_SCE or PTRACE_SCX were set after +* userspace entered the syscall, return spurious +* EINTR. +*/ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR; ___ 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: r355145 - head/sys/arm64/arm64
Author: alc Date: Wed Nov 27 20:33:49 2019 New Revision: 355145 URL: https://svnweb.freebsd.org/changeset/base/355145 Log: There is no reason why we need to pin the underlying thread to its current processor in pmap_invalidate_{all,page,range}(). These functions are using an instruction that broadcasts the TLB invalidation to every processor, so even if a thread migrates in the middle of one of these functions every processor will still perform the required TLB invalidations. Reviewed by: andrew, markj MFC after:10 days Differential Revision:https://reviews.freebsd.org/D22502 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Wed Nov 27 20:32:53 2019(r355144) +++ head/sys/arm64/arm64/pmap.c Wed Nov 27 20:33:49 2019(r355145) @@ -1043,7 +1043,6 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { uint64_t r; - sched_pin(); dsb(ishst); if (pmap == kernel_pmap) { r = atop(va); @@ -1054,11 +1053,10 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) } dsb(ish); isb(); - sched_unpin(); } static __inline void -pmap_invalidate_range_nopin(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { uint64_t end, r, start; @@ -1080,20 +1078,10 @@ pmap_invalidate_range_nopin(pmap_t pmap, vm_offset_t s } static __inline void -pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) -{ - - sched_pin(); - pmap_invalidate_range_nopin(pmap, sva, eva); - sched_unpin(); -} - -static __inline void pmap_invalidate_all(pmap_t pmap) { uint64_t r; - sched_pin(); dsb(ishst); if (pmap == kernel_pmap) { __asm __volatile("tlbi vmalle1is"); @@ -1103,7 +1091,6 @@ pmap_invalidate_all(pmap_t pmap) } dsb(ish); isb(); - sched_unpin(); } /* @@ -3114,7 +3101,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent * lookup the physical address. */ pmap_clear_bits(pte, ATTR_DESCR_VALID); - pmap_invalidate_range_nopin(pmap, va, va + size); + pmap_invalidate_range(pmap, va, va + size); /* Create the new mapping */ pmap_store(pte, newpte); ___ 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: r355144 - head/sys/dev/iwm
Author: markj Date: Wed Nov 27 20:32:53 2019 New Revision: 355144 URL: https://svnweb.freebsd.org/changeset/base/355144 Log: iwm(4): Remove _mvm from the namespace. This was inherited from iwlwifi, which drives devices supported by both iwn(4) and iwm(4) in FreeBSD. In iwm(4) _mvm is meaningless, so remove it. OpenBSD made the same change a long time ago. No functional change intended. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_binding.c head/sys/dev/iwm/if_iwm_binding.h head/sys/dev/iwm/if_iwm_constants.h head/sys/dev/iwm/if_iwm_fw.c head/sys/dev/iwm/if_iwm_led.c head/sys/dev/iwm/if_iwm_led.h head/sys/dev/iwm/if_iwm_mac_ctxt.c head/sys/dev/iwm/if_iwm_mac_ctxt.h head/sys/dev/iwm/if_iwm_phy_ctxt.c head/sys/dev/iwm/if_iwm_phy_ctxt.h head/sys/dev/iwm/if_iwm_power.c head/sys/dev/iwm/if_iwm_power.h head/sys/dev/iwm/if_iwm_scan.c head/sys/dev/iwm/if_iwm_scan.h head/sys/dev/iwm/if_iwm_sf.c head/sys/dev/iwm/if_iwm_sf.h head/sys/dev/iwm/if_iwm_sta.c head/sys/dev/iwm/if_iwm_sta.h head/sys/dev/iwm/if_iwm_time_event.c head/sys/dev/iwm/if_iwm_time_event.h head/sys/dev/iwm/if_iwm_util.c head/sys/dev/iwm/if_iwm_util.h head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Wed Nov 27 20:32:31 2019(r355143) +++ head/sys/dev/iwm/if_iwm.c Wed Nov 27 20:32:53 2019(r355144) @@ -231,10 +231,10 @@ struct iwm_nvm_section { uint8_t *data; }; -#define IWM_MVM_UCODE_ALIVE_TIMEOUThz -#define IWM_MVM_UCODE_CALIB_TIMEOUT(2*hz) +#define IWM_UCODE_ALIVE_TIMEOUThz +#define IWM_UCODE_CALIB_TIMEOUT(2*hz) -struct iwm_mvm_alive_data { +struct iwm_alive_data { int valid; uint32_t scd_base_addr; }; @@ -263,7 +263,7 @@ static void iwm_disable_interrupts(struct iwm_softc *) static voidiwm_ict_reset(struct iwm_softc *); static int iwm_allow_mcast(struct ieee80211vap *, struct iwm_softc *); static voidiwm_stop_device(struct iwm_softc *); -static voidiwm_mvm_nic_config(struct iwm_softc *); +static voidiwm_nic_config(struct iwm_softc *); static int iwm_nic_rx_init(struct iwm_softc *); static int iwm_nic_tx_init(struct iwm_softc *); static int iwm_nic_init(struct iwm_softc *); @@ -317,23 +317,23 @@ static intiwm_pcie_load_given_ucode(struct iwm_softc static int iwm_start_fw(struct iwm_softc *, const struct iwm_fw_img *); static int iwm_send_tx_ant_cfg(struct iwm_softc *, uint8_t); static int iwm_send_phy_cfg_cmd(struct iwm_softc *); -static int iwm_mvm_load_ucode_wait_alive(struct iwm_softc *, +static int iwm_load_ucode_wait_alive(struct iwm_softc *, enum iwm_ucode_type); -static int iwm_run_init_mvm_ucode(struct iwm_softc *, int); -static int iwm_mvm_config_ltr(struct iwm_softc *sc); +static int iwm_run_init_ucode(struct iwm_softc *, int); +static int iwm_config_ltr(struct iwm_softc *sc); static int iwm_rx_addbuf(struct iwm_softc *, int, int); -static voidiwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, +static voidiwm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *); static int iwm_get_noise(struct iwm_softc *, - const struct iwm_mvm_statistics_rx_non_phy *); -static voidiwm_mvm_handle_rx_statistics(struct iwm_softc *, + const struct iwm_statistics_rx_non_phy *); +static voidiwm_handle_rx_statistics(struct iwm_softc *, struct iwm_rx_packet *); -static booliwm_mvm_rx_mpdu(struct iwm_softc *, struct mbuf *, +static booliwm_rx_mpdu(struct iwm_softc *, struct mbuf *, uint32_t, bool); -static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, +static int iwm_rx_tx_cmd_single(struct iwm_softc *, struct iwm_rx_packet *, struct iwm_node *); -static voidiwm_mvm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *); +static voidiwm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *); static voidiwm_cmd_done(struct iwm_softc *, struct iwm_rx_packet *); #if 0 static voidiwm_update_sched(struct iwm_softc *, int, int, uint8_t, @@ -346,7 +346,7 @@ static int iwm_tx(struct iwm_softc *, struct mbuf *, struct ieee80211_node *, int); static int iwm_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); -static int iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_vap *); +static int iwm_update_quotas(struct iwm_softc *, struct iwm_vap *); static int iwm_auth(struct ieee80211vap *, struct iwm_softc *); static
svn commit: r355143 - head/sys/dev/iwm
Author: markj Date: Wed Nov 27 20:32:31 2019 New Revision: 355143 URL: https://svnweb.freebsd.org/changeset/base/355143 Log: iwm(4): Fix version string formatting. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Wed Nov 27 20:08:42 2019(r355142) +++ head/sys/dev/iwm/if_iwm.c Wed Nov 27 20:32:31 2019(r355143) @@ -851,7 +851,7 @@ iwm_read_firmware(struct iwm_softc *sc) goto parse_out; } snprintf(sc->sc_fwver, sizeof(sc->sc_fwver), - "%d.%d.%d", + "%u.%u.%u", le32toh(((const uint32_t *)tlv_data)[0]), le32toh(((const uint32_t *)tlv_data)[1]), le32toh(((const uint32_t *)tlv_data)[2])); ___ 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: r355142 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Wed Nov 27 20:08:42 2019 New Revision: 355142 URL: https://svnweb.freebsd.org/changeset/base/355142 Log: Move ipf_pcksum6() to its rightful place, in ip_fil_freebsd.c. This FreeBSD-only function should live in the O/S specific source file. This essentially reverts r349929 Now that ipftest and ipfreplay are disabled in FreeBSD 11-stable. MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil.h head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Wed Nov 27 20:08:39 2019 (r355141) +++ head/sys/contrib/ipfilter/netinet/fil.c Wed Nov 27 20:08:42 2019 (r355142) @@ -179,10 +179,6 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); -#ifdef USE_INET6 -static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10277,46 +10273,5 @@ ipf_inet6_mask_del(bits, mask, mtab) } mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); -} - -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ -#ifdef _KERNEL - struct mbuf *m; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0x; - } - - return(in6_cksum(m, ip6->ip6_nxt, off, len)); -#else - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -#endif } #endif Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h == --- head/sys/contrib/ipfilter/netinet/ip_fil.h Wed Nov 27 20:08:39 2019 (r355141) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Wed Nov 27 20:08:42 2019 (r355142) @@ -1839,6 +1839,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern voidipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c == --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Wed Nov 27 20:08:39 2019(r355141) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Wed Nov 27 20:08:42 2019(r355142) @@ -1453,3 +1453,48 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0x; return sum2; } + +#ifdef USE_INET6 +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ +#ifdef _KERNEL + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0x; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +#else + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +#endif +} +#endif ___ 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: r355141 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Wed Nov 27 20:08:39 2019 New Revision: 355141 URL: https://svnweb.freebsd.org/changeset/base/355141 Log: Save a little stack by removing a used once intermediate variable. MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Wed Nov 27 20:08:35 2019 (r355140) +++ head/sys/contrib/ipfilter/netinet/fil.c Wed Nov 27 20:08:39 2019 (r355141) @@ -10288,15 +10288,13 @@ ipf_pcksum6(fin, ip6, off, len) { #ifdef _KERNEL struct mbuf *m; - int sum; m = fin->fin_m; if (m->m_len < sizeof(struct ip6_hdr)) { return 0x; } - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); + return(in6_cksum(m, ip6->ip6_nxt, off, len)); #else u_short *sp; u_int sum; ___ 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: r355140 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Wed Nov 27 20:08:35 2019 New Revision: 355140 URL: https://svnweb.freebsd.org/changeset/base/355140 Log: Remove redundant #ifdef'd function definitions. MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Wed Nov 27 20:00:44 2019 (r355139) +++ head/sys/contrib/ipfilter/netinet/fil.c Wed Nov 27 20:08:35 2019 (r355140) @@ -10279,7 +10279,6 @@ ipf_inet6_mask_del(bits, mask, mtab) ASSERT(mtab->imt6_max >= 0); } -#ifdef _KERNEL static u_int ipf_pcksum6(fin, ip6, off, len) fr_info_t *fin; @@ -10287,6 +10286,7 @@ ipf_pcksum6(fin, ip6, off, len) u_int32_t off; u_int32_t len; { +#ifdef _KERNEL struct mbuf *m; int sum; @@ -10297,15 +10297,7 @@ ipf_pcksum6(fin, ip6, off, len) sum = in6_cksum(m, ip6->ip6_nxt, off, len); return(sum); -} #else -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ u_short *sp; u_int sum; @@ -10327,6 +10319,6 @@ ipf_pcksum6(fin, ip6, off, len) sum += *sp++; sum += *sp++; return(ipf_pcksum(fin, off, sum)); -} #endif +} #endif ___ 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: r355139 - head/sys/dev/bwn
Author: brooks Date: Wed Nov 27 20:00:44 2019 New Revision: 355139 URL: https://svnweb.freebsd.org/changeset/base/355139 Log: Fix a logic bug when "mask" contains a ?: operator. Newer versions of clang warn that '&' evaluates before '?:'. Reviewed by: markj MFC after:3 days Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D22573 Modified: head/sys/dev/bwn/if_bwnvar.h Modified: head/sys/dev/bwn/if_bwnvar.h == --- head/sys/dev/bwn/if_bwnvar.hWed Nov 27 19:57:17 2019 (r355138) +++ head/sys/dev/bwn/if_bwnvar.hWed Nov 27 20:00:44 2019 (r355139) @@ -129,7 +129,7 @@ struct bwn_mac; mac->mac_phy.phy_maskset(mac, offset, mask, 0); \ } else \ BWN_PHY_WRITE(mac, offset, \ - BWN_PHY_READ(mac, offset) & mask); \ + BWN_PHY_READ(mac, offset) & (mask));\ } while (0) #defineBWN_PHY_COPY(mac, dst, src) do { \ KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \ ___ 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: r355138 - in head/sys/x86: include iommu x86
Author: kib Date: Wed Nov 27 19:57:17 2019 New Revision: 355138 URL: https://svnweb.freebsd.org/changeset/base/355138 Log: bus_dma_dmar_load_ident(9): load identity mapping into the map. Requested, reviewed and tested by:mav Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D22559 Modified: head/sys/x86/include/bus_dma.h head/sys/x86/iommu/busdma_dmar.c head/sys/x86/iommu/intel_ctx.c head/sys/x86/iommu/intel_dmar.h head/sys/x86/iommu/intel_gas.c head/sys/x86/x86/busdma_machdep.c Modified: head/sys/x86/include/bus_dma.h == --- head/sys/x86/include/bus_dma.h Wed Nov 27 19:49:55 2019 (r355137) +++ head/sys/x86/include/bus_dma.h Wed Nov 27 19:57:17 2019 (r355138) @@ -193,6 +193,8 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t #ifdef _KERNEL bool bus_dma_dmar_set_buswide(device_t dev); +int bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, +vm_paddr_t start, vm_size_t length, int flags); #endif #endif /* !_X86_BUS_DMA_H_ */ Modified: head/sys/x86/iommu/busdma_dmar.c == --- head/sys/x86/iommu/busdma_dmar.cWed Nov 27 19:49:55 2019 (r355137) +++ head/sys/x86/iommu/busdma_dmar.cWed Nov 27 19:57:17 2019 (r355138) @@ -973,3 +973,66 @@ dmar_fini_busdma(struct dmar_unit *unit) taskqueue_free(unit->delayed_taskqueue); unit->delayed_taskqueue = NULL; } + +int +bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1, +vm_paddr_t start, vm_size_t length, int flags) +{ + struct bus_dma_tag_common *tc; + struct bus_dma_tag_dmar *tag; + struct bus_dmamap_dmar *map; + struct dmar_ctx *ctx; + struct dmar_domain *domain; + struct dmar_map_entry *entry; + vm_page_t *ma; + vm_size_t i; + int error; + bool waitok; + + MPASS((start & PAGE_MASK) == 0); + MPASS((length & PAGE_MASK) == 0); + MPASS(length > 0); + MPASS(start + length >= start); + MPASS((flags & ~(BUS_DMA_NOWAIT | BUS_DMA_NOWRITE)) == 0); + + tc = (struct bus_dma_tag_common *)dmat; + if (tc->impl != &bus_dma_dmar_impl) + return (0); + + tag = (struct bus_dma_tag_dmar *)dmat; + ctx = tag->ctx; + domain = ctx->domain; + map = (struct bus_dmamap_dmar *)map1; + waitok = (flags & BUS_DMA_NOWAIT) != 0; + + entry = dmar_gas_alloc_entry(domain, waitok ? 0 : DMAR_PGF_WAITOK); + if (entry == NULL) + return (ENOMEM); + entry->start = start; + entry->end = start + length; + ma = malloc(sizeof(vm_page_t) * atop(length), M_TEMP, waitok ? + M_WAITOK : M_NOWAIT); + if (ma == NULL) { + dmar_gas_free_entry(domain, entry); + return (ENOMEM); + } + for (i = 0; i < atop(length); i++) { + ma[i] = vm_page_getfake(entry->start + PAGE_SIZE * i, + VM_MEMATTR_DEFAULT); + } + error = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | + ((flags & BUS_DMA_NOWRITE) ? 0 : DMAR_MAP_ENTRY_WRITE), + waitok ? DMAR_GM_CANWAIT : 0, ma); + if (error == 0) { + DMAR_DOMAIN_LOCK(domain); + TAILQ_INSERT_TAIL(&map->map_entries, entry, dmamap_link); + entry->flags |= DMAR_MAP_ENTRY_MAP; + DMAR_DOMAIN_UNLOCK(domain); + } else { + dmar_domain_unload_entry(entry, true); + } + for (i = 0; i < atop(length); i++) + vm_page_putfake(ma[i]); + free(ma, M_TEMP); + return (error); +} Modified: head/sys/x86/iommu/intel_ctx.c == --- head/sys/x86/iommu/intel_ctx.c Wed Nov 27 19:49:55 2019 (r355137) +++ head/sys/x86/iommu/intel_ctx.c Wed Nov 27 19:57:17 2019 (r355138) @@ -279,7 +279,7 @@ domain_init_rmrr(struct dmar_domain *domain, device_t } error1 = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | DMAR_MAP_ENTRY_WRITE, - DMAR_GM_CANWAIT, ma); + DMAR_GM_CANWAIT | DMAR_GM_RMRR, ma); /* * Non-failed RMRR entries are owned by context rb * tree. Get rid of the failed entry, but do not stop Modified: head/sys/x86/iommu/intel_dmar.h == --- head/sys/x86/iommu/intel_dmar.h Wed Nov 27 19:49:55 2019 (r355137) +++ head/sys/x86/iommu/intel_dmar.h Wed Nov 27 19:57:17 2019 (r355138) @@ -391,6 +391,7 @@ bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int #defineDMAR_GM_CANWAIT 0x0001 #defineD
svn commit: r355137 - head/sys/vm
Author: rlibby Date: Wed Nov 27 19:49:55 2019 New Revision: 355137 URL: https://svnweb.freebsd.org/changeset/base/355137 Log: uma: trash memory when ctor/dtor supplied too On INVARIANTS kernels, UMA has a use-after-free detection mechanism. This mechanism previously required that all of the ctor/dtor/uminit/fini arguments to uma_zcreate() be NULL in order to function. Now, it only requires that uminit and fini be NULL; now, the trash ctor and dtor will be called in addition to any supplied ctor or dtor. Also do a little refactoring for readability of the resulting logic. This enables use-after-free detection for more zones, and will allow for simplification of some callers that worked around the previous restriction (see kern_mbuf.c). Reviewed by: jeff, markj Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D20722 Modified: head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Wed Nov 27 19:34:33 2019(r355136) +++ head/sys/vm/uma_core.c Wed Nov 27 19:49:55 2019(r355137) @@ -1869,6 +1869,11 @@ zone_ctor(void *mem, int size, void *udata, int flags) for (i = 0; i < vm_ndomains; i++) TAILQ_INIT(&zone->uz_domain[i].uzd_buckets); +#ifdef INVARIANTS + if (arg->uminit == trash_init && arg->fini == trash_fini) + zone->uz_flags |= UMA_ZFLAG_TRASH; +#endif + /* * This is a pure cache zone, no kegs. */ @@ -2302,14 +2307,17 @@ uma_zcreate(const char *name, size_t size, uma_ctor ct args.fini = fini; #ifdef INVARIANTS /* -* If a zone is being created with an empty constructor and -* destructor, pass UMA constructor/destructor which checks for -* memory use after free. +* Inject procedures which check for memory use after free if we are +* allowed to scramble the memory while it is not allocated. This +* requires that: UMA is actually able to access the memory, no init +* or fini procedures, no dependency on the initial value of the +* memory, and no (legitimate) use of the memory after free. Note, +* the ctor and dtor do not need to be empty. +* +* XXX UMA_ZONE_OFFPAGE. */ if ((!(flags & (UMA_ZONE_ZINIT | UMA_ZONE_NOFREE))) && - ctor == NULL && dtor == NULL && uminit == NULL && fini == NULL) { - args.ctor = trash_ctor; - args.dtor = trash_dtor; + uminit == NULL && fini == NULL) { args.uminit = trash_init; args.fini = trash_fini; } @@ -2462,15 +2470,14 @@ static void * item_ctor(uma_zone_t zone, void *udata, int flags, void *item) { #ifdef INVARIANTS - int skipdbg; + bool skipdbg; skipdbg = uma_dbg_zskip(zone, item); - if (zone->uz_ctor != NULL && - (!skipdbg || zone->uz_ctor != trash_ctor || - zone->uz_dtor != trash_dtor) && -#else - if (__predict_false(zone->uz_ctor != NULL) && + if (!skipdbg && (zone->uz_flags & UMA_ZFLAG_TRASH) != 0 && + zone->uz_ctor != trash_ctor) + trash_ctor(item, zone->uz_size, udata, flags); #endif + if (__predict_false(zone->uz_ctor != NULL) && zone->uz_ctor(item, zone->uz_size, udata, flags) != 0) { counter_u64_add(zone->uz_fails, 1); zone_free_item(zone, item, udata, SKIP_DTOR | SKIP_CNT); @@ -2486,6 +2493,31 @@ item_ctor(uma_zone_t zone, void *udata, int flags, voi return (item); } +static inline void +item_dtor(uma_zone_t zone, void *item, void *udata, enum zfreeskip skip) +{ +#ifdef INVARIANTS + bool skipdbg; + + skipdbg = uma_dbg_zskip(zone, item); + if (skip == SKIP_NONE && !skipdbg) { + if ((zone->uz_flags & UMA_ZONE_MALLOC) != 0) + uma_dbg_free(zone, udata, item); + else + uma_dbg_free(zone, NULL, item); + } +#endif + if (skip < SKIP_DTOR) { + if (zone->uz_dtor != NULL) + zone->uz_dtor(item, zone->uz_size, udata); +#ifdef INVARIANTS + if (!skipdbg && (zone->uz_flags & UMA_ZFLAG_TRASH) != 0 && + zone->uz_dtor != trash_dtor) + trash_dtor(item, zone->uz_size, udata); +#endif + } +} + /* See uma.h */ void * uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) @@ -2523,6 +2555,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags if (zone->uz_ctor != NULL && zone->uz_ctor(item, zone->uz_size, udata, flags) != 0) { + counter_u64_add(zone->uz_fails, 1); zone->uz_fini(item, zone->uz_si
svn commit: r355136 - in stable/12/sys/arm64: arm64 include
Author: alc Date: Wed Nov 27 19:34:33 2019 New Revision: 355136 URL: https://svnweb.freebsd.org/changeset/base/355136 Log: MFC r350579,r350741,r352584 Enable superpage promotion within the kernel pmap. Ordinarily, during a superpage promotion or demotion within a pmap, the pmap's lock ensures that other operations on the pmap don't observe the old mapping being broken before the new mapping is established. However, pmap_kextract() doesn't acquire the kernel pmap's lock, so it may observe the broken mapping. And, if it does, it returns an incorrect result. This revision implements a lock-free solution to this problem in pmap_update_entry() and pmap_kextract() because pmap_kextract() can't acquire the kernel pmap's lock. In case a translation fault on the kernel address space occurs from within a critical section, we must perform a lock-free check on the faulting address. Modified: stable/12/sys/arm64/arm64/pmap.c stable/12/sys/arm64/include/pte.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c == --- stable/12/sys/arm64/arm64/pmap.cWed Nov 27 19:32:29 2019 (r355135) +++ stable/12/sys/arm64/arm64/pmap.cWed Nov 27 19:34:33 2019 (r355136) @@ -1128,40 +1128,35 @@ vm_paddr_t pmap_kextract(vm_offset_t va) { pt_entry_t *pte, tpte; - vm_paddr_t pa; - int lvl; - if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) { - pa = DMAP_TO_PHYS(va); - } else { - pa = 0; - pte = pmap_pte(kernel_pmap, va, &lvl); - if (pte != NULL) { - tpte = pmap_load(pte); - pa = tpte & ~ATTR_MASK; - switch(lvl) { - case 1: - KASSERT((tpte & ATTR_DESCR_MASK) == L1_BLOCK, - ("pmap_kextract: Invalid L1 pte found: %lx", - tpte & ATTR_DESCR_MASK)); - pa |= (va & L1_OFFSET); - break; - case 2: - KASSERT((tpte & ATTR_DESCR_MASK) == L2_BLOCK, - ("pmap_kextract: Invalid L2 pte found: %lx", - tpte & ATTR_DESCR_MASK)); - pa |= (va & L2_OFFSET); - break; - case 3: - KASSERT((tpte & ATTR_DESCR_MASK) == L3_PAGE, - ("pmap_kextract: Invalid L3 pte found: %lx", - tpte & ATTR_DESCR_MASK)); - pa |= (va & L3_OFFSET); - break; - } - } - } - return (pa); + if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) + return (DMAP_TO_PHYS(va)); + pte = pmap_l1(kernel_pmap, va); + if (pte == NULL) + return (0); + + /* +* A concurrent pmap_update_entry() will clear the entry's valid bit +* but leave the rest of the entry unchanged. Therefore, we treat a +* non-zero entry as being valid, and we ignore the valid bit when +* determining whether the entry maps a block, page, or table. +*/ + tpte = pmap_load(pte); + if (tpte == 0) + return (0); + if ((tpte & ATTR_DESCR_TYPE_MASK) == ATTR_DESCR_TYPE_BLOCK) + return ((tpte & ~ATTR_MASK) | (va & L1_OFFSET)); + pte = pmap_l1_to_l2(&tpte, va); + tpte = pmap_load(pte); + if (tpte == 0) + return (0); + if ((tpte & ATTR_DESCR_TYPE_MASK) == ATTR_DESCR_TYPE_BLOCK) + return ((tpte & ~ATTR_MASK) | (va & L2_OFFSET)); + pte = pmap_l2_to_l3(&tpte, va); + tpte = pmap_load(pte); + if (tpte == 0) + return (0); + return ((tpte & ~ATTR_MASK) | (va & L3_OFFSET)); } /*** @@ -3020,8 +3015,12 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent */ intr = intr_disable(); - /* Clear the old mapping */ - pmap_clear(pte); + /* +* Clear the old mapping's valid bit, but leave the rest of the entry +* unchanged, so that a lockless, concurrent pmap_kextract() can still +* lookup the physical address. +*/ + pmap_clear_bits(pte, ATTR_DESCR_VALID); pmap_invalidate_range_nopin(pmap, va, va + size); /* Create the new mapping */ @@ -3423,8 +3422,7 @@ validate: } #if VM_NRESERVLEVEL > 0 - if (pmap != pmap_kernel() && - (mpte == NULL || mpte->wire_count == NL3PG) && + if ((mpte == NULL || mpte->wire_count == NL3PG) &&
svn commit: r355135 - head/sys/netinet
Author: tuexen Date: Wed Nov 27 19:32:29 2019 New Revision: 355135 URL: https://svnweb.freebsd.org/changeset/base/355135 Log: Plug two mbuf leaks during INIT-ACK handling. One leak happens when there is not enough memory to allocate the the resources for streams. The other leak happens if the are unknown parameters in the received INIT-ACK chunk which require reporting and the INIT-ACK requires sending an ABORT due to illegal parameter combinations. Hopefully this fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19083 MFC after:1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Wed Nov 27 19:12:32 2019 (r355134) +++ head/sys/netinet/sctp_input.c Wed Nov 27 19:32:29 2019 (r355135) @@ -495,6 +495,9 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int /* process the peer's parameters in the INIT-ACK */ retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb); if (retval < 0) { + if (op_err != NULL) { + sctp_m_freem(op_err); + } return (retval); } initack_limit = offset + ntohs(cp->ch.chunk_length); @@ -502,6 +505,9 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int if ((retval = sctp_load_addresses_from_init(stcb, m, (offset + sizeof(struct sctp_init_chunk)), initack_limit, src, dst, NULL, stcb->asoc.port))) { + if (op_err != NULL) { + sctp_m_freem(op_err); + } op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Problem with address parameters"); SCTPDBG(SCTP_DEBUG_INPUT1, ___ 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: r355134 - head/sys/x86/x86
Author: scottl Date: Wed Nov 27 19:12:32 2019 New Revision: 355134 URL: https://svnweb.freebsd.org/changeset/base/355134 Log: Clean up and clarify meta commentary on TAA. Add a state to denote that TSX doesn't exist on the CPU. MFC after:3 days Sponsored by: Intel Modified: head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/cpu_machdep.c == --- head/sys/x86/x86/cpu_machdep.c Wed Nov 27 18:52:01 2019 (r355133) +++ head/sys/x86/x86/cpu_machdep.c Wed Nov 27 19:12:32 2019 (r355134) @@ -1180,11 +1180,15 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | int x86_taa_enable; int x86_taa_state; enum { - TAA_NONE= 0, - TAA_TSX_DISABLE = 1, - TAA_VERW= 2, - TAA_AUTO= 3, - TAA_TAA_NO = 4 + TAA_NONE= 0,/* No mitigation enabled */ + TAA_TSX_DISABLE = 1,/* Disable TSX via MSR */ + TAA_VERW= 2,/* Use VERW mitigation */ + TAA_AUTO= 3,/* Automatically select the mitigation */ + + /* The states below are not selectable by the operator */ + + TAA_TAA_UC = 4,/* Mitigation present in microcode */ + TAA_NOT_PRESENT = 5 /* TSX is not present */ }; static void @@ -1208,7 +1212,7 @@ x86_taa_recalculate(void) if ((cpu_stdext_feature & CPUID_STDEXT_HLE) == 0 || (cpu_stdext_feature & CPUID_STDEXT_RTM) == 0) { /* TSX is not present */ - x86_taa_state = 0; + x86_taa_state = TAA_NOT_PRESENT; return; } @@ -1216,7 +1220,7 @@ x86_taa_recalculate(void) if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TAA_NO) { /* CPU is not suseptible to TAA */ taa_need = TAA_NONE; - taa_state = TAA_TAA_NO; + taa_state = TAA_TAA_UC; } else if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TSX_CTRL) { /* * CPU can turn off TSX. This is the next best option @@ -1323,9 +1327,11 @@ sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) case TAA_VERW: state = "VERW"; break; - case TAA_TAA_NO: - state = "Not vulnerable"; + case TAA_TAA_UC: + state = "Mitigated in microcode"; break; + case TAA_NOT_PRESENT: + state = "TSX not present"; default: state = "unknown"; } ___ 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: r355133 - stable/12/sys/net
Author: vmaffione Date: Wed Nov 27 18:52:01 2019 New Revision: 355133 URL: https://svnweb.freebsd.org/changeset/base/355133 Log: MFC r354867: netmap: check if we already ran mmap before we attempt it Submitted by: n...@neelc.org Reviewed by:vmaffione Differential Revision: https://reviews.freebsd.org/D22390 Modified: stable/12/sys/net/netmap_user.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/netmap_user.h == --- stable/12/sys/net/netmap_user.h Wed Nov 27 16:52:46 2019 (r355132) +++ stable/12/sys/net/netmap_user.h Wed Nov 27 18:52:01 2019 (r355133) @@ -981,7 +981,8 @@ nm_close(struct nm_desc *d) static int nm_mmap(struct nm_desc *d, const struct nm_desc *parent) { - //XXX TODO: check if mmap is already done + if (d->done_mmap) + return 0; if (IS_NETMAP_DESC(parent) && parent->mem && parent->req.nr_arg2 == d->req.nr_arg2) { ___ 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: r355132 - head/stand/efi/loader
Author: andrew Date: Wed Nov 27 16:52:46 2019 New Revision: 355132 URL: https://svnweb.freebsd.org/changeset/base/355132 Log: Support kernels larger than EFI_STAGING_SIZE in loader.efi With a very large kernel or module the staging area may be too small to hold it. When this is the case try to allocate more space before failing in the efi copyin/copyout/readin functions. Reviewed by: imp, tsoome Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D22569 Modified: head/stand/efi/loader/copy.c Modified: head/stand/efi/loader/copy.c == --- head/stand/efi/loader/copy.cWed Nov 27 13:46:28 2019 (r355131) +++ head/stand/efi/loader/copy.cWed Nov 27 16:52:46 2019 (r355132) @@ -185,7 +185,7 @@ out: #endif #endif -EFI_PHYSICAL_ADDRESS staging, staging_end; +EFI_PHYSICAL_ADDRESS staging, staging_end, staging_base; intstage_offset_set = 0; ssize_tstage_offset; @@ -224,6 +224,7 @@ efi_copy_init(void) EFI_ERROR_CODE(status)); return (status); } + staging_base = staging; staging_end = staging + nr_pages * EFI_PAGE_SIZE; #if defined(__aarch64__) || defined(__arm__) @@ -240,6 +241,66 @@ efi_copy_init(void) return (0); } +static bool +efi_check_space(vm_offset_t end) +{ + EFI_PHYSICAL_ADDRESS addr; + EFI_STATUS status; + unsigned long nr_pages; + + /* There is already enough space */ + if (end <= staging_end) + return (true); + + end = roundup2(end, EFI_PAGE_SIZE); + nr_pages = EFI_SIZE_TO_PAGES(end - staging_end); + +#if defined(__i386__) || defined(__amd64__) + /* X86 needs all memory to be allocated under the 1G boundary */ + if (end > 1024*1024*1024) + goto before_staging; +#endif + + /* Try to allocate more space after the previous allocation */ + addr = staging_end; + status = BS->AllocatePages(AllocateAddress, EfiLoaderData, nr_pages, + &addr); + if (!EFI_ERROR(status)) { + staging_end = staging_end + nr_pages * EFI_PAGE_SIZE; + return (true); + } + +before_staging: + /* Try allocating space before the previous allocation */ + if (staging < nr_pages * EFI_PAGE_SIZE) { + printf("Not enough space before allocation\n"); + return (false); + } + addr = staging - nr_pages * EFI_PAGE_SIZE; +#if defined(__aarch64__) || defined(__arm__) + /* See efi_copy_init for why this is needed */ + addr = rounddown2(addr, 2 * 1024 * 1024); +#endif + nr_pages = EFI_SIZE_TO_PAGES(staging_base - addr); + status = BS->AllocatePages(AllocateAddress, EfiLoaderData, nr_pages, + &addr); + if (!EFI_ERROR(status)) { + /* +* Move the old allocation and update the state so +* translation still works. +*/ + staging_base = addr; + memmove((void *)staging_base, (void *)staging, + staging_end - staging); + stage_offset -= (staging - staging_base); + staging = staging_base; + return (true); + } + + printf("efi_check_space: Unable to expand staging area\n"); + return (false); +} + void * efi_translate(vm_offset_t ptr) { @@ -257,7 +318,7 @@ efi_copyin(const void *src, vm_offset_t dest, const si } /* XXX: Callers do not check for failure. */ - if (dest + stage_offset + len > staging_end) { + if (!efi_check_space(dest + stage_offset + len)) { errno = ENOMEM; return (-1); } @@ -283,7 +344,7 @@ ssize_t efi_readin(const int fd, vm_offset_t dest, const size_t len) { - if (dest + stage_offset + len > staging_end) { + if (!efi_check_space(dest + stage_offset + len)) { errno = ENOMEM; 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: r355131 - in stable/11: . sbin/ipf targets/pseudo/userland
Author: cy Date: Wed Nov 27 13:46:28 2019 New Revision: 355131 URL: https://svnweb.freebsd.org/changeset/base/355131 Log: MFC r315223, r325182: Disconnect ipftest and ipresend from the build until it can be verified that they still work. These utilities have become out of sync with the code in the kernel and need work to bring them back into shape. Most people test on real systems or VMs on real networks. Suggested by: glebius Modified: stable/11/ObsoleteFiles.inc stable/11/sbin/ipf/Makefile stable/11/targets/pseudo/userland/Makefile.depend Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc == --- stable/11/ObsoleteFiles.inc Wed Nov 27 10:26:37 2019(r355130) +++ stable/11/ObsoleteFiles.inc Wed Nov 27 13:46:28 2019(r355131) @@ -1136,6 +1136,9 @@ OLD_FILES+=usr/tests/usr.sbin/pw/pw_useradd OLD_FILES+=usr/tests/usr.sbin/pw/pw_userdel OLD_FILES+=usr/tests/usr.sbin/pw/pw_usermod OLD_FILES+=usr/tests/usr.sbin/pw/pw_usernext +# 20170313: sbin/ipftest and ipresend temporarily disconnected. +OLD_FILES+=sbin/ipftest +OLD_FILES+=sbin/ipresend # 20170308: rename some tests OLD_FILES+=usr/tests/bin/pwait/pwait OLD_FILES+=usr/tests/usr.bin/timeout/timeout Modified: stable/11/sbin/ipf/Makefile == --- stable/11/sbin/ipf/Makefile Wed Nov 27 10:26:37 2019(r355130) +++ stable/11/sbin/ipf/Makefile Wed Nov 27 13:46:28 2019(r355131) @@ -1,7 +1,9 @@ # $FreeBSD$ SUBDIR=libipf .WAIT -SUBDIR+= ipf ipfs ipfstat ipftest ipmon ipnat ippool ipresend +SUBDIR+= ipf ipfs ipfstat ipmon ipnat ippool +# XXX Temporarily disconnected. +# SUBDIR+= ipftest ipresend SUBDIR_PARALLEL= .include Modified: stable/11/targets/pseudo/userland/Makefile.depend == --- stable/11/targets/pseudo/userland/Makefile.depend Wed Nov 27 10:26:37 2019(r355130) +++ stable/11/targets/pseudo/userland/Makefile.depend Wed Nov 27 13:46:28 2019(r355131) @@ -104,11 +104,9 @@ DIRDEPS+= \ sbin/ipf/ipf \ sbin/ipf/ipfs \ sbin/ipf/ipfstat \ - sbin/ipf/ipftest \ sbin/ipf/ipmon \ sbin/ipf/ipnat \ sbin/ipf/ippool \ - sbin/ipf/ipresend \ sbin/ipf/libipf \ sbin/ipfw \ sbin/iscontrol \ ___ 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: r355130 - head/usr.sbin/sesutil
Author: trasz Date: Wed Nov 27 10:26:37 2019 New Revision: 355130 URL: https://svnweb.freebsd.org/changeset/base/355130 Log: Fix typos. MFC after:2 weeks Sponsored by: Klara, Inc Modified: head/usr.sbin/sesutil/eltsub.c Modified: head/usr.sbin/sesutil/eltsub.c == --- head/usr.sbin/sesutil/eltsub.c Wed Nov 27 10:24:46 2019 (r355129) +++ head/usr.sbin/sesutil/eltsub.c Wed Nov 27 10:26:37 2019 (r355130) @@ -65,11 +65,11 @@ geteltnm(int type) case ELMTYP_FAN: return ("Cooling"); case ELMTYP_THERM: - return ("Temperature Sensors"); + return ("Temperature Sensor"); case ELMTYP_DOORLOCK: return ("Door Lock"); case ELMTYP_ALARM: - return ("Audible alarm"); + return ("Audible Alarm"); case ELMTYP_ESCC: return ("Enclosure Services Controller Electronics"); case ELMTYP_SCC: ___ 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: r355129 - head/sys/netipsec
Author: ae Date: Wed Nov 27 10:24:46 2019 New Revision: 355129 URL: https://svnweb.freebsd.org/changeset/base/355129 Log: Add support for dummy ESP packets with next header field equal to IPPROTO_NONE. According to RFC4303 2.6 they should be silently dropped. Submitted by: aurelien.cazuc.external_stormshield.eu MFC after:10 days Sponsored by: Stormshield Differential Revision:https://reviews.freebsd.org/D22557 Modified: head/sys/netipsec/xform_esp.c Modified: head/sys/netipsec/xform_esp.c == --- head/sys/netipsec/xform_esp.c Wed Nov 27 07:51:29 2019 (r355128) +++ head/sys/netipsec/xform_esp.c Wed Nov 27 10:24:46 2019 (r355129) @@ -614,6 +614,13 @@ esp_input_cb(struct cryptop *crp) } } + /* +* RFC4303 2.6: +* Silently drop packet if next header field is IPPROTO_NONE. +*/ + if (lastthree[2] == IPPROTO_NONE) + goto bad; + /* Trim the mbuf chain to remove trailing authenticator and padding */ m_adj(m, -(lastthree[1] + 2)); ___ 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"