summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Regen src.conf.5 after r352768, r352769Ed Maste2019-09-261-3/+14
| | | | | | | Approved by: re (gjb) Notes: svn path=/releng/12.1/; revision=352777
* MF stable/12 r352759,r352771Michael Gmelin2019-09-262-5/+41
| | | | | | | | | | | | | | | | | | | | | | Approved by: re (gjb) r352759: freebsd-update.8: Style fixes, document new features. freebsd-update: Make usage output consistent. freebsd-update: Add `updatesready' and `showconfig' commands freebsd-update: Change exit code of `freebsd-update install' to 2 in case there are no pending updates and there wasn't a fetch phase in the same invocation. r352771: Add mergeinfo missing in r352759 PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), secteam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Notes: svn path=/releng/12.1/; revision=352774
* MFS r352752: Add a WITH_BIND_NOW build knobEd Maste2019-09-265-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC r340186: Add a WITH_BIND_NOW build knob The linker's -z now flag sets the DF_BIND_NOW flag, which signals to the runtime loader that all relocation processing should be performed at process startup rather than on demand. In combination with lld's default of enabling relro this causes the GOT to be made read-only when the process starts, preventing straightforward GOT overwrite attacks. MFC r341429: disable BIND_NOW in libc, libthr, and rtld An issue remains with BIND_NOW and processes using threads. For now, restore libc's BIND_NOW disable, and also disable BIND_NOW in rtld and libthr. MFC r345625: revert r341429 "disable BIND_NOW in libc, libthr, and rtld" r345620 by kib@ fixed the rtld issue that caused a crash at startup during resolution of libc's ifuncs with BIND_NOW. MFC r345638: Revert change accidentally committed along with r345625 MFC r345640: Revert other accidentally committed part of r345625 Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Notes: svn path=/releng/12.1/; revision=352769
* MFS r352754: Add WITH_PIE knob to build Position Independent ExecutablesEd Maste2019-09-2620-45/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC r344179: Add WITH_PIE knob to build Position Independent Executables Building binaries as PIE allows the executable itself to be loaded at a random address when ASLR is enabled (not just its shared libraries). With this change PIE objects have a .pieo extension and INTERNALLIB libraries libXXX_pie.a. MK_PIE is disabled for some kerberos5 tools, Clang, and Subversion, as they explicitly reference .a libraries in their Makefiles. These can be addressed on an individual basis later. MK_PIE is also disabled for rtld-elf because it is already position-independent using bespoke Makefile rules. Currently only dynamically linked binaries will be built as PIE. MFC r344181: Fix Makefile conditional after r344179 MFC r344182: Use make's :tl instead of checking "no" and "NO" MFC r344189: Fixup bsd.prog.mk after r344182 MFC r344211: wlandebug: disable PIE to fix build failure libifconfig is built as a static-only PRIVATELIB (and there is no _pie.a version) so disable PIE in libifconfig's consumer. r345489: Fix GNU objdump build under WITH_PIE Explicitly specified bare .a libraries need ${PIE_SUFFIX}. r345490: Apply WITH_PIE changes to other binutils components Followon to r345489, explicitly specified bare .a libraries need ${PIE_SUFFIX} (although these still built). r345778: Fix gdb/kgdb build under WITH_PIE Explicitly specified bare .a libraries need ${PIE_SUFFIX}. Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Notes: svn path=/releng/12.1/; revision=352768
* MFS r352720:Mark Johnston2019-09-261-60/+70
| | | | | | | | | Use separate descriptors in bhyve's stdio uart backend. Approved by: re (gjb) Notes: svn path=/releng/12.1/; revision=352767
* MFS r352749:Mark Johnston2019-09-261-17/+17
| | | | | | | | | | Revert r316820. PR: 233952 Approved by: re (gjb) Notes: svn path=/releng/12.1/; revision=352766
* MFS r352750:Mark Johnston2019-09-261-6/+6
| | | | | | | | | ping6: Use caph_rights_limit(3) for STDIN_FILENO Approved by: re (gjb) Notes: svn path=/releng/12.1/; revision=352765
* Merge from stable/12 r352735 and r352741Warner Losh2019-09-2633-798/+867
| | | | | | | | | | | | | | Merge all the stability fixes for the mpr and mps drivers. This fixes a number of different panics. Unfortunately, mps now requires atomic_swap_64 to work properly, so it has been disabled on 32-bit powerpc and mips. The impact should be negligible, however, since this device is difficult to attach to those platforms. Approved by: re@ (glen) Relnotes: YES (for ppc32 removal) Notes: svn path=/releng/12.1/; revision=352761
* MFC r352493: Fix typo, setting hidden flag instead of reparse.Alexander Motin2019-09-251-1/+1
| | | | | | | Approved by: re (gjb) Notes: svn path=/releng/12.1/; revision=352708
* MFS r352678: msdosfs: do not deget unlinked denodesKyle Evans2019-09-251-3/+4
| | | | | | | | | | | | | | | | | | | When a file is unlinked, the denode is not reclaimed until the last reference is dropped, but the directory entry is immediately up for reuse. This is a problem later when createde goes to grab a denode for the newly created entry -- we search the hash and find a dead denode, then return that without even bumping the reference count and the data later gets truncated when the the last reference to the unlinked file is dropped. This manifested itself as a broken in-place strip(1) on msdosfs. The comment indicating that we want to skip these denodes has been updated to reflect where this is actually done. Approved by: re (gjb) Notes: svn path=/releng/12.1/; revision=352692
* MF stable/12 r352608Michael Gmelin2019-09-231-0/+9
| | | | | | | | | | | | | | | | | | | | Approved by: re (gjb) r352608: freebsd-update: Fix src component detection In case BASEDIR was set to a directory that differed from the default filesystem root, freebsd-update wrongly checked for the existence of /usr/src/COPYRIGHT to determine if the src component was installed. Existing code to address this wasn't effective due to the order in which configuration options were evaluated. PR: 224048, 238558, 239997 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D21579 Notes: svn path=/releng/12.1/; revision=352628
* MF stable/12 r352489Alan Somers2019-09-221-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Approved by: re (kib) r351192: periodic: fix anticongestion for scripts run after security Revision 316342, which introduced the anticongestion feature, failed to consider that the periodic scripts are executed by a recursive invocation of periodic. The recursive invocation wrongly cleaned up a temporary file that should've been cleaned up only by the original invocation. The result is that if the first script that requests an anticongestion sleep runs after the security scripts, the sleep won't happen. Fix this bug by delaying cleanup until the end of the original invocation. PR: 236564 Submitted by: Yasuhiro KIMURA <yasu@utahime.org> Reviewed by: imp r351203: periodic: replace "tty" with "test -t 0" Apparently using tty for this purpose has been deprecated since 4.4 Lite. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D21318 Notes: svn path=/releng/12.1/; revision=352588
* MF stable/12 r352534:Alan Somers2019-09-211-1/+1
| | | | | | | | | | | | | | | | Fix an off-by-one error from r351961 That revision addressed a Coverity CID that could lead to a buffer overflow, but it had an off-by-one error in the buffer size check. Approved by: re (kib) Reported by: Coverity Coverity CID: 1405530 MFC-With: 351961 Sponsored by: The FreeBSD Foundation Notes: svn path=/releng/12.1/; revision=352573
* MFS r352565: SIOCSIFNAME: Do nothing if we're not actually changingKyle Evans2019-09-211-0/+2
| | | | | | | | | | | | Instead of throwing EEXIST, just succeed if the name isn't actually changing. We don't need to trigger departure or any of that because there's no change from consumers' perspective. PR: 240539 Approved by: re (gjb) Notes: svn path=/releng/12.1/; revision=352571
* - Copy stable/12@r352480 to releng/12.1 as part of the 12.1 releaseGlen Barber2019-09-204-4/+11
| | | | | | | | | | | | | | cycle. - Update from PRERELEASE to BETA1. - Set the default pkg(7) repository to 'quarterly'. - Bump __FreeBSD_version. - Prune svn:mergeinfo from the new branch. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/releng/12.1/; revision=352546
* MFC r352137:Hans Petter Selasky2019-09-181-6/+4
| | | | | | | | | | Callout drain does not have to be followed by a callout stop call. Fix bogus code. Sponsored by: Mellanox Technologies Notes: svn path=/stable/12/; revision=352480
* MFC r352207:Hans Petter Selasky2019-09-181-19/+19
| | | | | | | | | | Use true and false when dealing with bool type in the LinuxKPI. No functional change. Sponsored by: Mellanox Technologies Notes: svn path=/stable/12/; revision=352478
* MFC r352206:Hans Petter Selasky2019-09-181-10/+15
| | | | | | | | | | | | Fix synchronous work drain issue in the LinuxKPI. A work callback may restart itself. Loop in the drain function to see if the work has been rescheduled and stop the subsequent reschedules, if any. Sponsored by: Mellanox Technologies Notes: svn path=/stable/12/; revision=352477
* MFC r350463Alan Cox2019-09-183-26/+50
| | | | | | | | | | | | | | | In pmap_advise(), when we encounter a superpage mapping, we first demote the mapping and then destroy one of the 4 KB page mappings so that there is a potential trigger for repromotion. Currently, we destroy the first 4 KB page mapping that falls within the (current) superpage mapping or the virtual address range [sva, eva). However, I have found empirically that destroying the last 4 KB mapping produces slightly better results, specifically, more promotions and fewer failed promotion attempts. Accordingly, this revision changes pmap_advise() to destroy the last 4 KB page mapping. It also replaces some nearby uses of boolean_t with bool. Notes: svn path=/stable/12/; revision=352475
* MFC r340602:Jayachandran C.2019-09-181-12/+7
| | | | | | | | | | | | | | | | | | | | | gitv3_its: fixes for multiple GIC ITS blocks First pass of support for multiple GIC ITS blocks with ACPI. Changes are to: * register the correct subset of interrupts with pic_register in case of ACPI. * initialize just the cpu interface for the first ITS, when domain information is not avialable. This has to be done until we split the per-CPU init to do LPI setup just once. * remove duplicate check for the GIC ITS domain, the sc_cpus are setup from domain, so the check again in per-CPU init seems unnecessary. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17841 Notes: svn path=/stable/12/; revision=352473
* MFC r352205:Hans Petter Selasky2019-09-181-2/+2
| | | | | | | | | Fix broken DECLARE_TASKLET() macro after r347852. Sponsored by: Mellanox Technologies Notes: svn path=/stable/12/; revision=352472
* MFC r340599-r340601Jayachandran C.2019-09-185-256/+277
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r340599: acpica, pci_host_generic_acpi: redo pci_host_generic_acpi.c This is a major update for pci_host_generic_acpi.c, the current implementation has some gaps that are better fixed up in one go. The changes are to: * Follow x86 method of not adding PCI resources to PCI host bridge in ACPI code. This has been moved to pci_host_generic_acpi.c, where we walk thru its resources of the host bridge and add them. * Fixup code in pci_host_generic_acpi.c to read all decoded ranges and update the 'ranges' property. This allows us to share most of the code with generic implementation (and the FDT one). * Parse and setup IO ranges and bus ranges when walking the resources above. Drop most of the changes related to this from acpica code. * Add the ECAM memory area as mem resource 0. Implement the logic to get the ECAM area from MCFG (using bus range which we now decode), or from _CBA (using _BBN/bus range). Drop aarch64 ifdefs from acpica code which did part of this. * Switch resource activation to similar code as FDT implementation, this can be moved into generic implementation in a later pass. * Drop the mechanism of using the 7th bit of bus number as the domain, this is not correct and will work only in very specific cases. Use _SEG as PCI domain and use the bus ranges of the host bridge to provide start bus number. This commit should not make any functional change to dev/acpica/acpi.c for other architectures, almost all the changes there are to revert earlier additions in this file done for aarch64. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17791 r340600: pci_host_generic, acpi_resource: drop unneeded code Now that we are handling PCI resources in pci_host_generic_acpi.c, we don't need these change (made by r336129) Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17792 r340601: pci_host_generic : move activate/release to generic code Now that the ACPI and FDT implementations for activating and deactivating resources are the same, we can move it to pci_host_generic.c. No functional changes. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17793 Notes: svn path=/stable/12/; revision=352471
* MFC r340598:Jayachandran C.2019-09-185-25/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | acpica: rework INTRNG interrupts On arm64 (where INTRNG is enabled), the interrupts have to be mapped with ACPI_BUS_MAP_INTR() before adding them as resources to devices. The earlier code did the mapping before calling acpi_set_resource(), which bypassed code that checked for PCI link interrupts. To fix this, move the call to map interrupts into acpi_set_resource() and that requires additional work to lookup interrupt properties. The changes here are to: * extend acpi_lookup_irq_handler() to lookup an irq in the ACPI resources * create a helper function acpi_map_intr() which uses the updated acpi_lookup_irq_handler() to look up an irq, and then map it with ACPI_BUS_MAP_INTR() * use acpi_map_intr() in acpi_pcib_route_interrupt() to map pci link interrupts. With these changes, we can drop the ifdefs in acpi_resource.c, and we can also drop the call for mapping interrupts in generic_timer.c Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17790 Notes: svn path=/stable/12/; revision=352470
* MFC r350347Alan Cox2019-09-181-1/+105
| | | | | | | | Implement pmap_advise(). (Without a working pmap_advise() implementation madvise(MADV_DONTNEED) and madvise(MADV_FREE) are NOPs.) Notes: svn path=/stable/12/; revision=352469
* MFC r340595-r340597Jayachandran C.2019-09-184-124/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r340595: pci_host_generic: remove unneeded ThunderX2 quirk The current quirk implementation writes a fixed address to the PCI BAR to fix a firmware bug. The PCI BARs are allocated by firmware and will change depending on PCI devices present. So using a fixed address here is not correct. This quirk worked around a firmware bug that programmed the MSI-X bar of the SATA controller incorrectly. The newer firmware does not have this issue, so it is better to drop this quirk altogether. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17655 r340596: pci_host_generic: allocate resources against devices Fix up pci_host_generic.c and pci_host_generic_fdt.c to allocate resources against devices that requested them. Currently the allocation happens against the pcib, which is incorrect. This is needed for the upcoming changes for fixing up pci_host_generic_acpi.c Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17656 r340597: pci_host_generic*: basic implementation of bus range Both ACPI and FDT support bus ranges for pci host bridges. Update pci_host_generic*.[ch] with a default implementation to support this. This will be used in the next set of changes for ACPI based host bridge. No functional changes in this commit. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17657 Notes: svn path=/stable/12/; revision=352468
* MFC r349117, r349122, r349183, r349897, r349943, r350004, r350029, r350038,Alan Cox2019-09-173-230/+396
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r350191, r350202, r350422, r350427, r350525 r349117: Three enhancements to arm64's pmap_protect(): Implement protection changes on superpage mappings. Previously, a superpage mapping was unconditionally demoted by pmap_protect(), even if the protection change applied to the entire superpage mapping. Precompute the bit mask describing the protection changes rather than recomputing it for every page table entry that is changed. Skip page table entries that already have the requested protection changes in place. r349122: Three changes to arm64's pmap_unwire(): Implement wiring changes on superpage mappings. Previously, a superpage mapping was unconditionally demoted by pmap_unwire(), even if the wiring change applied to the entire superpage mapping. Rewrite a comment to use the arm64 names for bits in a page table entry. Previously, the bits were referred to by their x86 names. Use atomic_"op"_64() instead of atomic_"op"_long() to update a page table entry in order to match the prevailing style in this file. r349183: Correct an error in r349122. pmap_unwire() should update the pmap's wired count, not its resident count. r349897: (by markj) Rename pmap_page_dirty() to pmap_pte_dirty(). This is a precursor to implementing dirty bit management. r349943: (by markj) Apply some light cleanup to uses of pmap_pte_dirty(). - Check for ATTR_SW_MANAGED before anything else. - Use pmap_pte_dirty() in pmap_remove_pages(). r350004: (by markj) Implement software access and dirty bit management for arm64. Previously the arm64 pmap did no reference or modification tracking; all mappings were treated as referenced and all read-write mappings were treated as dirty. This change implements software management of these attributes. Dirty bit management is implemented to emulate ARMv8.1's optional hardware dirty bit modifier management, following a suggestion from alc. In particular, a mapping with ATTR_SW_DBM set is logically writeable and is dirty if the ATTR_AP_RW_BIT bit is clear. Mappings with ATTR_AP_RW_BIT set are write-protected, and a write access will trigger a permission fault. pmap_fault() handles permission faults for such mappings and marks the page dirty by clearing ATTR_AP_RW_BIT, thus mapping the page read-write. r350029: (by markj) Propagate attribute changes during demotion. After r349117 and r349122, some mapping attribute changes do not trigger superpage demotion. However, pmap_demote_l2() was not updated to ensure that the replacement L3 entries carry any attribute changes that occurred since promotion. r350038: (by markj) Always use the software DBM bit for now. r350004 added most of the machinery needed to support hardware DBM management, but it did not intend to actually enable use of the hardware DBM bit. r350191: Introduce pmap_store(), and use it to replace pmap_load_store() in places where the page table entry was previously invalid. (Note that I did not replace pmap_load_store() when it was followed by a TLB invalidation, even if we are not using the return value from pmap_load_store().) Correct an error in pmap_enter(). A test for determining when to set PGA_WRITEABLE was always true, even if the mapping was read only. In pmap_enter_l2(), when replacing an empty kernel page table page by a superpage mapping, clear the old l2 entry and issue a TLB invalidation. My reading of the ARM architecture manual leads me to believe that the TLB could hold an intermediate entry referencing the empty kernel page table page even though it contains no valid mappings. Replace a couple direct uses of atomic_clear_64() by the new pmap_clear_bits(). In a couple comments, replace the term "paging-structure caches", which is an Intel-specific term for the caches that hold intermediate entries in the page table, with wording that is more consistent with the ARM architecture manual. r350202: With the introduction of software dirty bit emulation for managed mappings, we should test ATTR_SW_DBM, not ATTR_AP_RW, to determine whether to set PGA_WRITEABLE. In effect, we are currently setting PGA_WRITEABLE based on whether the dirty bit is preset, not whether the mapping is writeable. Correct this mistake. r350422: (by markj) Remove an unneeded trunc_page() in pmap_fault(). r350427: (by markj) Have arm64's pmap_fault() handle WnR faults on dirty PTEs. If we take a WnR permission fault on a managed, writeable and dirty PTE, simply return success without calling the main fault handler. This situation can occur if multiple threads simultaneously access a clean writeable mapping and trigger WnR faults; losers of the race to mark the PTE dirty would end up calling the main fault handler, which had no work to do. r350525: (by markj) Use ATTR_DBM even when hardware dirty bit management is not enabled. The ARMv8 reference manual only states that the bit is reserved in this case; following Linux's example, use it instead of a software-defined bit for the purpose of indicating that a managed mapping is writable. Notes: svn path=/stable/12/; revision=352452
* MFC r351649 Check for region dups.Aleksandr Rybalko2019-09-171-0/+2
| | | | Notes: svn path=/stable/12/; revision=352442
* MFC r343042, r343875Andrew Turner2019-09-171-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r343042: Ensure the I-Cache is correctly handled in arm64_icache_sync_range The cache_handle_range macro to handle the arm64 instruction and data cache operations would return when it was complete. This causes problems for arm64_icache_sync_range and arm64_icache_sync_range_checked as they assume they can execute the i-cache handling instruction after it has been called. Fix this by making this assumption correct. While here add missing instruction barriers and adjust the style to match the rest of the assembly. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18838 r343875: Add a missing data barrier to the start of arm64_tlb_flushID. We need to ensure the page table store has happened before the tlbi. Reported by: jchandra Tested by: jchandra Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19097 Notes: svn path=/stable/12/; revision=352441
* MFC r342552:Andrew Turner2019-09-171-3/+7
| | | | | | | | | | | | | | | | Pass VM_PROT_EXECUTE to vm_fault for instruction faults. We need to tell vm_fault the reason for the fault was because we tried to execute from the memory location. Without this it may return with success as we only request read-only memory, then we return to the same location and try to execute from the same memory address. This leads to an infinite loop raising the same fault and returning to the same invalid location. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18511 Notes: svn path=/stable/12/; revision=352440
* MFC r352048:Mitchell Horne2019-09-161-1/+1
| | | | | | | Fix cpuwhich_t column width Notes: svn path=/stable/12/; revision=352428
* MFC r351613:Mark Johnston2019-09-161-5/+0
| | | | | | | | | | | | Remove unused VM page locking macros. This completes the merge of the revision. r352043 updated only the merge info for some reason. Reported by: alc Notes: svn path=/stable/12/; revision=352419
* LinuxKPI: Limit exposure of new field in dev_pm_ops to LinuxKPI >= 50000.Johannes Lundberg2019-09-161-0/+2
| | | | | | | | | | This will fix a suspend/resume issue that occurs on drm-kmod packages build on 12.0 and run on 12.1. Approved by: imp (mentor) Notes: svn path=/stable/12/; revision=352418
* MFC r352138, r352214, r352216:Yuri Pankov2019-09-1613-142/+627
| | | | | | | | | | | | | | | | | | | | locale: handle day, abday, mon, abmon, am_pm keywords All of these are defined as mandatory by POSIX. While here, mark all non-standard ones as FreeBSD-only as other systems (at least, GNU/Linux and illumos) do not handle them, so we should not encourage their use. - make abday, day, abmon, mon, am_pm output quoting match linux - workaround localeconv() issue for mon_grouping and grouping (PR172215) - for other values not available in default locale, output -1 instead of 127 (CHAR_MAX) as returned by localeconv() PR: 237752 Notes: svn path=/stable/12/; revision=352416
* MFC r351604:Yuri Pankov2019-09-161-5/+2
| | | | | | | | | | | | | | ichsmb: defer smbus attach until interrupts are available This fixes a "timed sleep before timers are working" panic seen while attaching jedec_dimm(4) instances too early in the boot. Submitted by: ian Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D21452 Notes: svn path=/stable/12/; revision=352415
* MFC r351727:Mark Johnston2019-09-161-7/+6
| | | | | | | Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate. Notes: svn path=/stable/12/; revision=352412
* MFC r342937:Andrew Turner2019-09-161-1/+1
| | | | | | | | | | | | | | | | | | Fix the location of td->td_frame at the top of the kernel stack. In cpu_thread_alloc we would allocate space for the trap frame at the top of the kernel stack. This is just below the pcb, however due to a missing cast the pointer arithmetic would use the pcb size, not the trapframe size. As the pcb is larger than the trapframe this is safe, however later in cpu_fork we include the case leading to the two disagreeing on the location. Fix by using the same arithmetic in both locations. Found by: An early KASAN patch Sponsored by: DARPA, AFRL Notes: svn path=/stable/12/; revision=352405
* MFC r340008, r340013Andrew Turner2019-09-163-7/+27
| | | | | | | | | | | | | | | | | | r340008: Add the ARMv8.3 HCR_EL2 register fields. Sponsored by: DARPA, AFRL r340013: Add the ARMv8.3 SCTLR_EL1 fields. While here tag which architecture release fields were added and remove a field that only existed in very early releases of the ARMv8 spec. Sponsored by: DARPA, AFRL Notes: svn path=/stable/12/; revision=352403
* MFC r339988:Andrew Turner2019-09-161-2/+2
| | | | | | | | | Use the correct offsets for the trap frame in fork_trampoline. Sponsored by: DARPA, AFRL Notes: svn path=/stable/12/; revision=352402
* MFC r339594:Andrew Turner2019-09-161-4/+4
| | | | | | | | | | Stop advertising ARMv8.3 Pointer Authentication This needs firmware and kernel support before userspace can use it. Until then don't advertise it's available. Notes: svn path=/stable/12/; revision=352401
* MFC r341489:Andrew Turner2019-09-161-2/+4
| | | | | | | | | | | | | | | | | Only gnu/lib/csu when MK_BSD_CRTBEGIN is off. We were still building it from Makefile.inc1. Disable it there so we don't try to build the GNU crtbegin/crtend when the BSD version was asked for. PR: 233733 Reported by: lwhsu Reviewed by: emaste MFC with: r339738 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18428 Notes: svn path=/stable/12/; revision=352400
* MFC r339948:Andrew Turner2019-09-161-4/+9
| | | | | | | | | | | Use pmap_invalidate_all rather than invalidating 512 level 2 entries in the early pmap_mapbios/unmapbios code. It is even worse when there are multiple L2 entries to handle as we would need to iterate over all pages. Sponsored by: DARPA, AFRL Notes: svn path=/stable/12/; revision=352399
* MFC r339944:Andrew Turner2019-09-161-8/+15
| | | | | | | | Fix some style(9) issues in the arm64 pmap_mapbios/unmapbios. Split lines when they are too long. Notes: svn path=/stable/12/; revision=352398
* MFC r348323:Andrew Turner2019-09-161-1/+1
| | | | | | | | | | | | | | The alignment is passed into contigmalloc_domainset in the 7th argument. KUBSAN was complaining the pointer contigmalloc_domainset returned was misaligned. Fix this by using the correct argument to find the alignment in the function signature. Reported by: KUBSAN Sponsored by: DARPA, AFRL Notes: svn path=/stable/12/; revision=352397
* MFC r343876:Andrew Turner2019-09-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add missing data barriers after storeing a new valid pagetable entry. When moving from an invalid to a valid entry we don't need to invalidate the tlb, however we do need to ensure the store is ordered before later memory accesses. This is because this later access may be to a virtual address within the newly mapped region. Add the needed barriers to places where we don't later invalidate the tlb. When we do invalidate the tlb there will be a barrier to correctly order this. This fixes a panic on boot on ThunderX2 when INVARIANTS is turned off: panic: vm_fault_hold: fault on nofault entry, addr: 0xffff000040c11000 Reported by: jchandra Tested by: jchandra Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19097 Notes: svn path=/stable/12/; revision=352396
* MFC r346996:Andrew Turner2019-09-161-0/+10
| | | | | | | | | | | | | | | | | | | Restore x18 in efi_arch_leave. Some UEFI implementations trash this register and, as we use it as a platform register, the kernel doesn't save it before calling into the UEFI runtime services. As we have a copy in tpidr_el1 restore from there when exiting the EFI environment. PR: 237234, 237055 Reviewed by: manu Tested On: Ampere eMAG Sponsored by: DARPA, AFRL Sponsored by: Ampere Computing (hardware) Differential Revision: https://reviews.freebsd.org/D20127 Notes: svn path=/stable/12/; revision=352395
* MFC r339738, r339744, r339770, r339773, r339864-r339866, r339907-r339908, ↵Andrew Turner2019-09-1632-8/+1208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r339912-r339913, r339916, r339954, r340213, r340395, r340840, r340910-r340911, r341424, r342773, r342974, r351027, r352073: MFC the BSD crtbegin to stable/12 but keep it disabled. r339738: Implement a BSD licensed crtbegin/crtend These are needed for .ctors/.dtors and .jcr handling. The former needs all the function pointers to be called in the correct order from the .init/.fini section. The latter just needs to call a gcj specific function if it exists with a pointer to the start of the .jcr section. This is currently disabled until __dso_handle support is added. Reviewed by: emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17587 r339744: Add a missing include for src.opts.mk. Without it MK_TESTS isn't defined. MFC with: r339738 Sponsored by: DARPA, AFRL r339770: Drop the csu tests WARNS to 5 to fix the powerpc64 build. MFC with: r339738 Sponsored by: DARPA, AFRL r339773: Add __dso_handle to the BSD crtbegin. This is used to identify shared objects. MFC with: r339738 Sponsored by: DARPA, AFRL r339864: Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL when accessed from a shared object. MFC with: r339738 Sponsored by: DARPA, AFRL r339865: Include the csu test directories in BSD.tests.dist MFC with: r339738 Sponsored by: DARPA, AFRL r339866: Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be accessible from out of the files they are defined in. MFC with: r339738 Sponsored by: DARPA, AFRL r339907: The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise. MFC with: r339738 Sponsored by: DARPA, AFRL r339908: Run the csu tests on a DSO. This builds the tests into a shared library, then runs these from the base test programs. With this we can check crtbeginS.o and crtendS.o are working as expected. MFC with: r339738 Sponsored by: DARPA, AFRL r339912: Fix the location of the static keyword. MFC with: r339738 Sponsored by: DARPA, AFRL r339913: Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with the section. MFC with: r339738 Sponsored by: DARPA, AFRL r339916: Build the csu tests on all architectures. The tests haven't been run them, but this is enough to build them so I can get feedback on if the various crt.h headers are correct. MFC with: r339738 Sponsored by: DARPA, AFRL r339954: Add __used to __CTOR_LIST__ and __DTOR_LIST__ Enabling BSD_CRTBEGIN on amd64 resulted in error: unused variable '__CTOR_LIST__'. __CTOR_LIST__ is indeed unused in crtbegin.c; it marks the beginning of the .ctors array and is used in crtend.c. Annotate __DTOR_LIST__ as well for consistency. Discussed with: andrew MFC with: r339738 Sponsored by: The FreeBSD Foundation r340213: Add the (untested) mips and sparc64 .init call sequences. The BSD crtbegin/crtend code now builds on all architectures, however further work is needed to check if it works correctly. MFC with: r339738 Sponsored by: DARPA, AFRL r340395: Run __cxa_finalize in shared objects in the destructor path. When we have .dtors call them before .dtor handling, otherwise call from a destructor. PR: 233056 MFC with: r339738 Sponsored by: DARPA, AFRL r340840: Mark the function called by the MIPS .init/.fini sequence with .local. As with r328939 we need to mark local symbols as such. Without this the assembly parser treats the symbols as global and created relocations against these private symbols. MFC with: r339738 Sponsored by: DARPA, AFRL r340910: Add the missing 0 at the end of the .jcr section. Without this the dynamic library test was failing as it was calling _Jv_RegisterClasses multiple times. r340911: Re-enable the dynamiclib tests. These should be fixed by r340910. r341424: Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o files that haven't been implemented. Reported by: sbruno MFC with: r339738 Sponsored by: DARPA, AFRL r342773: Add explicit csu test dependency lib/csu/tests/dynamiclib requires libh_csu.so be built first. I'm not sure this is the most correct/best way to address this but it solves the issue in my testing. PR: 233734 Sponsored by: The FreeBSD Foundation r342974: Create crtsavres.o for powerpc builds Summary: GCC expects to link in a crtsavres.o on powerpc platforms. On powerpc64 this is an empty file, but on powerpc and powerpcspe this does contain some save/restore functions, which may not actually be necessary for newer modern GCC and clang. This appeases the in-tree gcc, though, and is needed in order to switch to the BSD CRTRBEGIN. PR: 233751 Reviewed By: andrew Differential Revision: https://reviews.freebsd.org/D18826 r351027: Enable BSD_CRTBEGIN on powerpc In r342974 jhibbits added support to build crtsavres.o. This was the blocker for BSD_CRTBEGIN to be enabled there. As such enable this option again. Reviewed by: jhibbits Sponsored by: DARPA, AFRL r352073: csu: Add the riscv .init call sequence Reviewed by: br Sponsored by: Axiado Differential Revision: https://reviews.freebsd.org/D21537 Notes: svn path=/stable/12/; revision=352394
* MFC r350499: acpi_resource.c: mention ThunderX2 firmware revision with issueEd Maste2019-09-161-1/+4
| | | | | | | | [This has been fixed in a later version] and the workaround can eventually be removed. See r330113 and r346066 details. Notes: svn path=/stable/12/; revision=352392
* MFC r350303: enable ig4_acpi on aarch64Ed Maste2019-09-161-1/+2
| | | | | | | | | | The already-listed APMC0D0F ID belongs to the Ampere eMAG aarch64 platform, but ACPI support was not even built on aarch64. Submitted by: Greg V <greg_unrelenting.technology> Notes: svn path=/stable/12/; revision=352390
* MFC r346445: Enable ioremap for aarch64 in the LinuxKPIEd Maste2019-09-162-3/+3
| | | | | | | | | | Required for Mellanox drivers (e.g. on Ampere eMAG at Packet.com). PR: 237055 Submitted by: Greg V <greg@unrelenting.technology> Notes: svn path=/stable/12/; revision=352388
* MFC r352059, r352060:Konstantin Belousov2019-09-161-7/+29
| | | | | | | Make timehands count selectable at boottime. Notes: svn path=/stable/12/; revision=352380