aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
...
* Correct indent.Konstantin Belousov2020-12-131-1/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=368612
* fd: fix fdrop prediction when closing a fdMateusz Guzik2020-12-132-1/+12
| | | | | | | Most of the time this is the last reference, contrary to typical fdrop use. Notes: svn path=/head/; revision=368609
* [PowerPC] Floating-point exception trap followupBrandon Bergren2020-12-133-16/+13
| | | | | | | | | | | | | | * Fix incorrect operation on 32-bit caused by incorrectly-sized storage for a temporary FPSCR. * Fix several whitespace problems. * Don't try to enable VSX during cleanup_fpscr(). Reviewed by: alfredo, jhibbits (earlier version) Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D27453 Notes: svn path=/head/; revision=368604
* Clean up more resouces of an existing SCTP association in case ofMichael Tuexen2020-12-121-1/+56
| | | | | | | | | | | | | | a restart. This fixes a use-after-free scenario, which was reported by Felix Wilhelm from Google in case a peer is able to modify the cookie. However, this can also be triggered by an assciation restart under some specific conditions. MFC after: 1 week Notes: svn path=/head/; revision=368593
* pf: Allow net.pf.request_maxcount to be set from loader.confKristof Provost2020-12-121-1/+1
| | | | | | | | | | | | Mark request_maxcount as RWTUN so we can set it both at runtime and from loader.conf. This avoids usings getting caught out by the change from tunable to run time configuration. Suggested by: Franco Fichtner MFC after: 3 days Notes: svn path=/head/; revision=368588
* amdtemp(4): Add missing Family 17h modelsConrad Meyer2020-12-121-3/+4
| | | | | | | | | | Add missing model numbers M20h (Dali, Zen1), M60H (Renoir, Zen2), and M90H (Van Gogh, Zen2). Submitted by: Greg V <greg AT unrelenting.technology> Notes: svn path=/head/; revision=368587
* amdsmn(4), amdtemp(4): add support for Family 19h (Zen 3)Conrad Meyer2020-12-122-19/+53
| | | | | | | | | | | | | Zen 3 "Vermeer" support, tested on Ryzen 9 5950X. Model numbers from https://en.wikichip.org/wiki/amd/cpuid "Extended Model" column. Submitted by: Greg V <greg AT unrelenting.technology> Differential Revision: https://reviews.freebsd.org/D27552 Notes: svn path=/head/; revision=368586
* Provide userland notification of gpio pin changes ("userland gpio interrupts").Ian Lepore2020-12-123-71/+970
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an import of the Google Summer of Code 2018 project completed by Christian Kramer (and, sadly, ignored by us for two years now). The goals stated for that project were: FreeBSD already has support for interrupts implemented in the GPIO controller drivers of several SoCs, but there are no interfaces to take advantage of them out of user space yet. The goal of this work is to implement such an interface by providing descriptors which integrate with the common I/O system calls and multiplexing mechanisms. The initial imported code supports the following functionality: - A kernel driver that provides an interface to the user space; the existing gpioc(4) driver was enhanced with this functionality. - Implement support for the most common I/O system calls / multiplexing mechanisms: - read() Places the pin number on which the interrupt occurred in the buffer. Blocking and non-blocking behaviour supported. - poll()/select() - kqueue() - signal driven I/O. Posting SIGIO when the O_ASYNC was set. - Many-to-many relationship between pins and file descriptors. - A file descriptor can monitor several GPIO pins. - A GPIO pin can be monitored by multiple file descriptors. - Integration with gpioctl and libgpio. I added some fixes (mostly to locking) and feature enhancements on top of the original gsoc code. The feature ehancements allow the user to choose between detailed and summary event reporting. Detailed reporting provides a record describing each pin change event. Summary reporting provides the time of the first and last change of each pin, and a count of how many times it changed state since the last read(2) call. Another enhancement allows the recording of multiple state change events on multiple pins between each call to read(2) (the original code would track only a single event at a time). The phabricator review for these changes timed out without approval, but I cite it below anyway, because the review contains a series of diffs that show how I evolved the code from its original state in Christian's github repo for the gsoc project to what is being commited here. (In effect, the phab review extends the VC history back to the original code.) Submitted by: Christian Kramer Obtained from: https://github.com/ckraemer/freebsd/tree/gsoc2018 Differential Revision: https://reviews.freebsd.org/D27398 Notes: svn path=/head/; revision=368585
* Fix NOINET6 build broken by r368571.Alexander V. Chernikov2020-12-121-1/+1
| | | | Notes: svn path=/head/; revision=368572
* ipfw kfib algo: Use rt accessors instead of accessing rib/rtentry directly.Alexander V. Chernikov2020-12-111-112/+57
| | | | | | | | | | This removes assumptions on prefix storage and rtentry layout from an external code. Differential Revision: https://reviews.freebsd.org/D27450 Notes: svn path=/head/; revision=368571
* zfs: quiet gcc -Wmissing-include-dirsRyan Libby2020-12-111-1/+0
| | | | | | | | | | | Don't tell it to look for headers in a non-existent directory. Reviewed by: imp, mmacy Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27565 Notes: svn path=/head/; revision=368567
* if_wg: appease gccRyan Libby2020-12-114-10/+0
| | | | | | | | | | | | - remove -ferror-limit option - quiet -Wredundant-decls Reviewed by: mmacy Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27559 Notes: svn path=/head/; revision=368566
* ffs: quiet -Wstrict-prototypesRyan Libby2020-12-111-0/+1
| | | | | | | | | Reviewed by: kib, markj, mckusick Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27558 Notes: svn path=/head/; revision=368565
* qat: quiet -Wredundant-declsRyan Libby2020-12-111-2/+0
| | | | | | | | | Reviewed by: markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27554 Notes: svn path=/head/; revision=368564
* ntb: quiet gcc -Wreturn-typeRyan Libby2020-12-111-0/+1
| | | | | | | | | Reviewed by: cem, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27553 Notes: svn path=/head/; revision=368563
* cache_fplookup: quiet gcc -Wreturn-typeRyan Libby2020-12-111-0/+1
| | | | | | | | | Reviewed by: markj, mjg Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27555 Notes: svn path=/head/; revision=368562
* ndis(4): expand deprecation to the whole driverBrooks Davis2020-12-113-1/+6
| | | | | | | | | | | | | | | nids(4) was a clever idea in the early 2000's when the market was flooded with 10/100 NICs with Windows-only drivers, but that hasn't been the case for ages and the driver has had no meaningful maintenance in ages. It only supports Windows-XP era drivers. Reviewed by: imp, bcr MFC after: 3 days Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27527 Notes: svn path=/head/; revision=368561
* hme(4): Remove as previous announcedBrooks Davis2020-12-1112-2656/+2
| | | | | | | | | | | | The hme (Happy Meal Ethernet) driver was the onboard NIC in most supported sparc64 platforms. A few PCI NICs do exist, but we have seen no evidence of use on non-sparc systems. Reviewed by: imp, emaste, bcr Sponsored by: DARPA Notes: svn path=/head/; revision=368559
* riscv: small counter(9) improvementsMitchell Horne2020-12-111-17/+8
| | | | | | | | | | | | | | | | Prefer atomics to critical section. This reduces the cost of the increment operation and removes the possibility of it being interrupted by counter_u64_zero(). Use CPU_FOREACH() macro to skip absent CPUs. Replace hand-rolled address calculation with zpcpu_get(). Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27536 Notes: svn path=/head/; revision=368558
* style(9): Correct whitespace in struct definitionsBrooks Davis2020-12-111-7/+7
| | | | | | | | | | | struct ifconf and struct ifreq use the odd style "struct<tab>foo". struct ifdrv seems to have tried to follow this but was committed with spaces in place of most tabs resulting in "struct<space><space>ifdrv". MFC after: 3 days Notes: svn path=/head/; revision=368543
* Revert r366943. It did not work as expected.Jung-uk Kim2020-12-111-1/+0
| | | | Notes: svn path=/head/; revision=368542
* riscv: handle debug.debugger_on_trap for fatal page faultsMitchell Horne2020-12-101-0/+12
| | | | | | | | | | | Allows recovery or diagnosis of a fatal page fault before panicking the system. Reviewed by: jhb, kp Differential Revision: https://reviews.freebsd.org/D27534 Notes: svn path=/head/; revision=368527
* linux_dma: Ensure proper flags pass to allocators.Bryan Drewery2020-12-101-3/+3
| | | | | | | | | | | | | Possibly fixes the wrong flags being passed to the kernel allocators in linux_dma_alloc_coherent() and linux_dma_pool_alloc(). Reviewed by: hps MFC after: 2 weeks Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27508 Notes: svn path=/head/; revision=368524
* contig allocs: Don't retry forever on M_WAITOK.Bryan Drewery2020-12-101-4/+16
| | | | | | | | | | | | | | | | | | | | | | This restores behavior from before domain iterators were added in r327895 and r327896. The vm_domainset_iter_policy() will do a vm_wait_doms() and then restart its iterator when M_WAITOK is set. It will also force the containing loop to have M_NOWAIT. So we get an unbounded retry loop rather than the intended bounded retries that kmem_alloc_contig_pages() already handles. This also restores M_WAITOK to the vmem_alloc() call in kmem_alloc_attr_domain() and kmem_alloc_contig_domain(). Reviewed by: markj, kib MFC after: 2 weeks Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27507 Notes: svn path=/head/; revision=368523
* Add deprecation notice for bvmconsole and bvmdebugRobert Wing2020-12-102-0/+4
| | | | | | | | | | | | | | | | Now that bhyve(8) supports UART, bvmconsole and bvmdebug are no longer needed. Mark the '-b' and '-g' flag as deprecated for bhyve(8). These will be removed in 13. Reviewed by: jhb, grehan Approved by: kevans (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27519 Notes: svn path=/head/; revision=368519
* fd: make serialization in fdescfree_fds conditional on hold countMateusz Guzik2020-12-101-3/+7
| | | | | | | | | | | | | p_fd nullification in fdescfree serializes against new threads transitioning the count 1 -> 2, meaning that fdescfree_fds observing the count of 1 can safely assume there is nobody else using the table. Losing the race and observing > 1 is harmless. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27522 Notes: svn path=/head/; revision=368516
* hyperv/vmbus: avoid crash, panic if vbe fb info is missingBradley T. Hughes2020-12-101-17/+15
| | | | | | | | | | | | | | Do not assume that VBE framebuffer metadata can be used. Like with the EFI fb metadata, it may be null, so we should take care not to dereference the null vbefb pointer. This avoids a panic when booting -CURRENT on a gen1 VM in Azure. Approved by: tsoome Sponsored by: Miles AS Differential Revision: https://reviews.freebsd.org/D27533 Notes: svn path=/head/; revision=368513
* dmar: reserve memory windows of PCIe root portRyan Libby2020-12-093-5/+131
| | | | | | | | | | | | | | | | | | PCI memory address space is shared between memory-mapped devices (MMIO) and host memory (which may be remapped by an IOMMU). Device accesses to an address within a memory aperture in a PCIe root port will be treated as peer-to-peer and not forwarded to an IOMMU. To avoid this, reserve the address space of the root port's memory apertures in the address space used by the IOMMU for remapping. Reviewed by: kib, tychon Discussed with: Anton Rang <rang@acm.org> Tested by: tychon Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27503 Notes: svn path=/head/; revision=368490
* netgraph: macfilter: small fixesKyle Evans2020-12-091-19/+19
| | | | | | | | | | | | | Two issues: - The DEBUG macro defined is in direct conflict with the DEBUG kernel option, which broke the -LINT build[0] - Building with NG_MACFILTER_DEBUG did not compile on LP64 systems due to using %d for sizeof(). Reported by: Jenkins[0] Notes: svn path=/head/; revision=368487
* Plug a race between fd table teardown and several loopsMark Johnston2020-12-091-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | To export information from fd tables we have several loops which do this: FILDESC_SLOCK(fdp); for (i = 0; fdp->fd_refcount > 0 && i <= lastfile; i++) <export info for fd i>; FILDESC_SUNLOCK(fdp); Before r367777, fdescfree() acquired the fd table exclusive lock between decrementing fdp->fd_refcount and freeing table entries. This serialized with the loop above, so the file at descriptor i would remain valid until the lock is dropped. Now there is no serialization, so the loops may race with teardown of file descriptor tables. Acquire the exclusive fdtable lock after releasing the final table reference to provide a barrier synchronizing with these loops. Reported by: pho Reviewed by: kib (previous version), mjg Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27513 Notes: svn path=/head/; revision=368486
* Use refcount_load(9) to load fd table reference countsMark Johnston2020-12-091-9/+14
| | | | | | | | | | | No functional change intended. Reviewed by: kib, mjg Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27512 Notes: svn path=/head/; revision=368485
* dev/mfi: Make a seemingly bogus conditional unconditionalJustin Hibbits2020-12-091-9/+5
| | | | | | | | | | | | | | | | Summary: r358689 attempted to fix a clang warning/error by inferring the intent of the condition "(cdb[0] != 0x28 || cdb[0] != 0x2A)". Unfortunately, it looks like this broke things. Instead, fix this by making this path unconditional, effectively reverting to the previous state. PR: kern/251483 Reviewed By: ambrisko MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D27515 Notes: svn path=/head/; revision=368473
* Merge OpenSSL 1.1.1i.Jung-uk Kim2020-12-097-39/+56
| | | | Notes: svn path=/head/; revision=368472
* Fixup r368446 with KERN_TLS.Gleb Smirnoff2020-12-081-2/+2
| | | | Notes: svn path=/head/; revision=368468
* cpuset_set{affinity,domain}: do not allow empty masksKyle Evans2020-12-081-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | cpuset_modify() would not currently catch this, because it only checks that the new mask is a subset of the root set and circumvents the EDEADLK check in cpuset_testupdate(). This change both directly validates the mask coming in since we can trivially detect an empty mask, and it updates cpuset_testupdate to catch stuff like this going forward by always ensuring we don't end up with an empty mask. The check_mask argument has been renamed because the 'check' verbiage does not imply to me that it's actually doing a different operation. We're either augmenting the existing mask, or we are replacing it entirely. Reported by: syzbot+4e3b1009de98d2fabcda@syzkaller.appspotmail.com Discussed with: andrew Reviewed by: andrew, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27511 Notes: svn path=/head/; revision=368462
* kern: cpuset: resolve race between cpuset_lookup/cpuset_relKyle Evans2020-12-081-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | The race plays out like so between threads A and B: 1. A ref's cpuset 10 2. B does a lookup of cpuset 10, grabs the cpuset lock and searches cpuset_ids 3. A rel's cpuset 10 and observes the last ref, waits on the cpuset lock while B is still searching and not yet ref'd 4. B ref's cpuset 10 and drops the cpuset lock 5. A proceeds to free the cpuset out from underneath B Resolve the race by only releasing the last reference under the cpuset lock. Thread A now picks up the spinlock and observes that the cpuset has been revived, returning immediately for B to deal with later. Reported by: syzbot+92dff413e201164c796b@syzkaller.appspotmail.com Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27498 Notes: svn path=/head/; revision=368461
* kern: cpuset: plug a unr leakKyle Evans2020-12-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | cpuset_rel_defer() is supposed to be functionally equivalent to cpuset_rel() but with anything that might sleep deferred until cpuset_rel_complete -- this setup is used specifically for cpuset_setproc. Add in the missing unr free to match cpuset_rel. This fixes a leak that was observed when I wrote a small userland application to try and debug another issue, which effectively did: cpuset(&newid); cpuset(&scratch); newid gets leaked when scratch is created; it's off the list, so there's no mechanism for anything else to relinquish it. A more realistic reproducer would likely be a process that inherits some cpuset that it's the only ref for, but it creates a new one to modify. Alternatively, administratively reassigning a process' cpuset that it's the last ref for will have the same effect. Discovered through D27498. MFC after: 1 week Notes: svn path=/head/; revision=368460
* arm64: fix struct l_sigaction_t layoutMitchell Horne2020-12-081-1/+1
| | | | | | | | | | | | | | | The definition was copied from amd64, but the layout of the struct differs slightly between these platforms. This fixes spurious `unsupported sigaction flag 0xXXXXXXXX` messages when executing some Linux binaries on arm64. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27460 Notes: svn path=/head/; revision=368458
* Check that the frame pointer is within the current stack.John Baldwin2020-12-087-34/+29
| | | | | | | | | | | | | | This same check is used on other architectures. Previously this would permit a stack frame to unwind into any arbitrary kernel address (including unmapped addresses). Reviewed by: andrew, markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27362 Notes: svn path=/head/; revision=368455
* Stack unwinding robustness fixes for RISC-V.John Baldwin2020-12-086-17/+30
| | | | | | | | | | | | | | | | - Push the kstack_contains check down into unwind_frame() so that it is honored by DDB and DTrace. - Check that the trapframe for an exception frame is contained in the traced thread's kernel stack for DDB traces. Reviewed by: markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27357 Notes: svn path=/head/; revision=368454
* [ath] also remove the magic size value here for the transmit antenna statistics.Adrian Chadd2020-12-081-1/+2
| | | | Notes: svn path=/head/; revision=368451
* [ath] Don't use hard-coded values in the sanity check.Adrian Chadd2020-12-081-3/+6
| | | | | | | | Don't use hard-coded values in the phy error and receive antenna checks. Notes: svn path=/head/; revision=368450
* [ath] replace the hard-coded magic values in if_athioctl.h with constant definesAdrian Chadd2020-12-081-4/+11
| | | | | | | | | | Replace some hard-coded magic values in the ioctl stats struct with #defines. I'm going to follow up with some more sanity checking in the receive path that also use these values so we don't do bad things if the hardware is (more) confused. Notes: svn path=/head/; revision=368449
* The list of ports in configuration path shall be protected by locks,Gleb Smirnoff2020-12-081-6/+4
| | | | | | | | | | epoch shall be used only for fast path. Thus use LAGG_XLOCK() in lagg_[un]register_vlan. This fixes sleeping in epoch panic. PR: 240609 Notes: svn path=/head/; revision=368448
* Convert LAGG_RLOCK() to NET_EPOCH_ENTER(). No functional changes.Gleb Smirnoff2020-12-081-43/+50
| | | | Notes: svn path=/head/; revision=368446
* Use a macro to find the offset of kern_ttbr0Andrew Turner2020-12-082-1/+2
| | | | | | | | | | Rather than hard coding the offset of kern_ttbr0 within arm64_bootparams use a macro like the other fields. Sponsored by: Innovate UK Notes: svn path=/head/; revision=368445
* Free the arm64 bootparams memory after initarmAndrew Turner2020-12-081-0/+2
| | | | | | | | | | This is only needed in initarm, we can return this memory to the stack used by mi_startup. Sponsored by: Innivate UK Notes: svn path=/head/; revision=368444
* New Netgraph module ng_macfilter:Nick Hibma2020-12-085-0/+1021
| | | | | | | | | | | | | | | Macfilter to route packets through different hooks based on sender MAC address. Based on ng_macfilter written by Pekka Nikander Sponsered by Retina b.v. Reviewed by: afedorov MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27268 Notes: svn path=/head/; revision=368443
* In ext2fs, BA_CLRBUF is used in ext2_balloc() not UFS_BALLOC().Kirk McKusick2020-12-081-1/+1
| | | | | | | | | Noted by: kib MFC after: 3 days Sponsored by: Netflix Notes: svn path=/head/; revision=368425
* Bump __FreeBSD_version for removal of crypto fd's in r368005.John Baldwin2020-12-071-1/+1
| | | | | | | | Requested by: swills Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=368417