aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* edk2: Import Loadfile2.h and TcgService.h from edk2-stable202502Warner Losh7 hours2-0/+273
| | | | | | Verbatim import of these files, with unix line endings. Sponsored by: Netflix
* jail: set default root directory for a jail to its parent's root.Jamie Gritton14 hours1-1/+1
| | | | | | | | | | | All default jail parameter values are an empty or otherwise standard value, or are copied the jail's parent. A notable exception is the root directory, which is instead copied from the creating process's jail. Fix that to be in line with everything else. This change affects only the default when no path is specified; if a path of "/" is explicitly given, that will still be the creating process's root directory.
* fusefs: fix a deadlock caused by daemons that never initializeAlan Somers15 hours4-38/+32
| | | | | | | | | | | | | | | | | | | If a daemon never responds to FUSE_INIT, but some process attempts to access the mountpoint, and a different process (possibly the daemon itself) attempts to unmount, a deadlock would result. Fix this bug by blocking any thread that enters fuse_vfsop_root until the daemon responds to FUSE_INIT or it times out. That will block any thread attempting to lookup a path in the fuse mountpoint, before it even gets to fuse VOPs. Remove less thorough initialization checks in fuse_ticket_fetch and fuse_vnop_access that are no longer necessary. And add a test case. PR: 287431 MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: js Differential Revision: https://reviews.freebsd.org/D59737
* sys: Remove orphaned build glue for le(4)John Baldwin18 hours3-10/+0
| | | | Fixes: 7a323f873662 ("sys: Retire le(4)")
* x86/NOTES: Drop stale comments about si(4)John Baldwin18 hours1-7/+0
| | | | | | This driver was removed several years ago. Fixes: c1c9764296e5 ("Remove the si(4) driver and sicontrol(8) for Specialix serial cards.")
* dtrace: Remove bogus Makefile.incJohn Baldwin18 hours2-25/+0
| | | | | | | | | | | | | | | This was added in the initial import of dtrace and overrides the normal load/unload targets with a custom target that loads a hardcoded set of modules. Over time, the set of modules has not been updated and is now incomplete. It's also not really useful compared to the default implementation of these targets used for loading or unloading an individual module being actively developed. This functionality is also available via dtraceall.ko which is how users commonly load the full suite of dtrace modules. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D59821
* hwpmc: hwpmc: record page size to fix analysis in some caseAndrew Gallatin19 hours2-2/+12
| | | | | | | | | | | | | | | | This fixes a bug where a binary linked using max-page-size=0x200000 can result in a bogus relocation offset when running on a system with a smaller page size. This causes samples to fall outside the image mapping or be translated to the wrong address (resulting in symbol resolution, or incorrect symbol resolution). We noticed this at Netflix because we run a patchset enabling 16k pages on amd64 and have been compiling userspace with a 2MB page size. Since we started doing this profiling userspace binaries has been wonky. Reviewed by: ali_mashtizadeh.com Differential Revision: https://reviews.freebsd.org/D59771 Sponsored by: Netflix
* linuxkpi: Fix double-cleanup in linux_pci_attach_device() error pathSlava Shwartsman19 hours1-12/+7
| | | | | | | | | | | | | put_device() already triggers lkpi_pci_dev_release(), which removes pdev from pci_devices, frees pdev->bus, destroys pcie_cap_lock, and uninits the DMA private data. Reported by: gallatin Fixes: 66b25ddf9125 ("LinuxKPI: pci detach: implement a proper detach (release) path") Reviewed by: kib, gallatin, bz Sponsored by: NVidia networking MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59913
* nvme: bound the AER error log byte-swap by the fetched lengthAbdelkader Boudih19 hours1-1/+1
| | | | | | | | | | The Get Log Page request for the error log is clamped to NVME_MAX_AER_LOG_SIZE, but the byte-swap loop iterated ELPE + 1 entries. A controller reporting more than 63 entries makes the loop overrun the 4 KiB log page buffer. Reviewed by: ngie, imp, adrian Differential Revision: https://reviews.freebsd.org/D59626
* nvme: do not touch INTMS/INTMC when configured for MSI-XAbdelkader Boudih19 hours3-2/+7
| | | | | | | | | | | The single-vector MSI-X fallback installs the shared interrupt handler, which masks interrupts through INTMS/INTMC around the completion poll. INTx and MSI are unaffected. Only MSI-X track the interrupt mode and skip un/masking Reviewed by: ngie, imp, adrian Differential Revision: https://reviews.freebsd.org/D59637
* posixshm: Fix a double unlock in shm_partial_page_invalidate()Mark Johnston21 hours1-7/+2
| | | | | | | | | | | | | | | | For some reason, shm_partial_page_invalidate() unlocks the object upon an error, but its callers don't expect this. Don't do any special error handling. Keep the subroutine anyway since the name is a bit clearer than vm_page_grab_zero_partial(). While here, normalize the object pointer used for locking in shm_deallocate(). Reviewed by: kib Fixes: 454bc887f250 ("uipc_shm: Implements fspacectl(2) support") MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59877
* ktls: Fix an off-by-one bug in tls13_find_record_type()Mark Johnston21 hours1-2/+2
| | | | | | | | | | | | | | If the entire plaintext is zero-filled, the backwards walk in tls13_find_record_type() would return the offset of the last byte of the TLS header. This causes an underflow when decrypting, resulting in a null pointer dereference. Fix the bug and add a regression test. Reviewed by: gallatin, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59767
* sys/powerpc/powerpc/elf64_machdep.c: enable ASLR on ELFv2Piotr Kubaj24 hours1-1/+1
| | | | | | | | Turns out that ever since introducing ELFv2 support, it was missing ASLR, it was only used for ELFv1 processes. Reviewed by: jhibbits (via IRC #powerpc64) MFC after: 1 week
* vfs_register: prevent kernel crashAlexander Leidinger25 hours1-0/+2
| | | | | | | | | | | | | | vfs_register hashes the filesystem name and uses it for sysctl oids. A filesystem name which hashes to 0 crashes in sysctl_register_oid(). Map 0 to 1 to prevent the kernel crash. This can be tested with "udf2" as the filesystem name. MFC after: 1 month MFC to: stable/15 stable/14 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D59839
* misc: Avoid use of Unicode closing single quoteDag-Erling Smørgrav25 hours12-21/+21
| | | | | | | | | | | | | The Unicode closing single quotation mark is classified as a homoglyph and can trip automated code quality checks in downstream CI pipelines or cause code review UIs to refuse to display a file. If used as an apostrophe, use the ASCII single quote instead. If used as a closing single quote, replace with double quotes or no quotes at all. Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: ziaee, obiwac, olce Differential Revision: https://reviews.freebsd.org/D59911
* powerpc/radix: fix double page offset in mmu_radix_sync_icache()Piotr Kubaj27 hours1-3/+1
| | | | | | | | | | | | | | | | mmu_radix_sync_icache() adds the offset of va within its page to the physical address it gets from mmu_radix_extract_locked(). That address already includes the offset - the extract routines return the physical address of the byte, not of the frame - so the offset is counted twice and __syncicache() is handed frame + 2 * offset. The hash MMU counterpart, moea64_sync_icache(), has to add the offset because PVO_PADDR() yields only the frame. Here the addition is wrong. Fixes: 6f0b2a235a13 ("powerpc/pmap: Add pmap_sync_icache() for radix pmap") Reviewed by: jhibbits MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59870
* clk: Fix a few typos in the spacemit CCU driverBojan Novković41 hours2-5/+5
| | | | | Fixes: dcb10e3add17 Reported by: Bruno Banelli <bruno.banelli@sartura.hr> (p_idx typo)
* route/fib_algo: Respect immediate_sync in fd_ref_nhopPouria Mousavizadeh Tehrani42 hours1-2/+4
| | | | | | | | | Now fd_ref_nhop() returns zero for cross family routes, Do not schedule nhop references and try to rebuild it immediately for connected and static routes. PR: 298733 Fixes: 633438224304 ("route/fib_algo: Fix nexthop index ...")
* route/fib_algo: Remove redundant zeroing of fd_afPouria Mousavizadeh Tehrani42 hours1-2/+0
| | | | | | | fd is allocated with M_ZERO and fd_num_af never decreases. Therefore, no need for zeroing nhaf_count and nhaf_base here. Fixes: 633438224304 ("route/fib_algo: Fix nexthop index ...")
* Ignore LINUX_POLLREMOVEMaxim Sobolev43 hours1-2/+4
| | | | | | | | | | | This matches upstream behaviour since Linux's demangle_poll() silently discards POLLREMOVE from the requested events. Reviewed by: emaste Sponsored by: Sippy Software, Inc. Differential Revision: https://reviews.freebsd.org/D59914 MFC after: 1 week PR: 297467
* sound: Retire the version constantsChristos Margiolis44 hours39-44/+38
| | | | | | | | | | | They exist only to fill in MODULE_DEPEND() and MODULE_VERSION(), and every consumer passed the same value for all three, so the version range never did anything. Use 1, like the rest of the tree does. MFC after: 1 week Sponsored by: The FreeBSD Foundation Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D59873
* sound: Use uint8_t instead of legacy u_charChristos Margiolis45 hours7-90/+90
| | | | | | | No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* amd64: use WRMSRNS immediate form to update splitlock control, when availableKonstantin Belousov46 hours1-4/+34
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* amd64: cache MSR_MEMORY_CTL in pcpuKonstantin Belousov46 hours5-5/+19
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* amd64: add userspace control for disabling splitlocksKonstantin Belousov46 hours2-1/+28
| | | | | | | | | | Thread can control it with sysarch(I386_SET_SPLITLOCK). The global default is set with hw.splitlock_force. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* amd64: support for tracking per-thread 'disable splitlocks' stateKonstantin Belousov46 hours9-0/+72
| | | | | | | | | | | | | | If hw supports it, on atomic operation that requires exclusive ownership of more than one cache line, #AC is generated. The state is maintained as the arch-private TDF_MD_SPLITLOCK_AC flag. The state is inherited on thread creation from the thread spawning the new one. It is cleared on exec. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* amd64: calculate if hardware supports disabling splitlocksKonstantin Belousov46 hours3-0/+32
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* amd64: handle #AC in kernel modeKonstantin Belousov46 hours1-0/+8
| | | | | | | | | Recover from it if PCB_ONFAULT handler is provided. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* amd64: add md thread flags wordKonstantin Belousov46 hours1-0/+1
| | | | | | | | | Use a hole in struct mdthread. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* amd64 cpufunc.h: add WRMSRNS helpersKonstantin Belousov46 hours1-0/+13
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* x86: add cpu_stdext_feature5Konstantin Belousov46 hours3-0/+16
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* x86: add definitions for the CORE_CAP and MEMORY_CTL MSRsKonstantin Belousov46 hours1-0/+8
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
* arm64/smmu: Fix the SMMU-600 errata checkAndrew Turner6 days1-4/+6
| | | | | Fixes: 6dca6e2aa89d ("arm64/smmu: Start handling errata") Sponsored by: Arm Ltd
* hwpmc: fix leak of IBS per-CPU array on unloadPaulo Fragoso48 hours2-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | pmc_ibs_initialize() allocates the ibs_pcpu[] pointer array, and pmc_ibs_finalize() exists to free it, but pmc_ibs_finalize() is never called. Every hwpmc unload on a CPU with IBS therefore leaks one pmc_cpu_max()-sized pointer array. Call pmc_ibs_finalize() from pmc_amd_finalize(), alongside the RAPL, TSC and perf classes. IBS is only initialized on CPUs that support it, so make pmc_ibs_finalize() return early when ibs_pcpu is NULL, making it safe to call when the class was skipped at initialize time, as pmc_rapl_finalize() already is. Tested on an AMD Ryzen 5 5600X (Zen 3, 12 threads) with INVARIANTS. Before the change, each kldload/kldunload cycle leaked one 96-byte M_PMC allocation, and DTrace showed the ibs_pcpu[] allocation from pmc_ibs_initialize() as the only one never freed. After the change, 50 load/unload cycles leave M_PMC InUse and MemUse unchanged, and every allocation made at load is freed at unload. Reviewed by: mhorne Fixes: e51ef8ae490f ("hwpmc: Initial support for AMD IBS") Sponsored by: NLINK (https://nlink.com.br), Recife, Brazil Differential Revision: https://reviews.freebsd.org/D59881
* jh7110_temp: CPU temperature sensor for JH7110Brian Scott48 hours3-0/+286
| | | | | | | | | | | | | | | | | | This patch adds a driver for the CPU temperature sensor on the jh7110 SoC. The calibration numbers come from the OpenBSD driver but are reworked to produce a result in K rather than C. The temperature is exposed as a sysctl, dev.jh7110_temp.0.temperature but I have also exposed it as dev.cpu.0.temperature because that's where you find it on a RaspberryPi and amdtemp(4), so it's a lot more obvious. (mhorne: Added 'starfive,jh7100-temp' compatible.) Reviewed by: mhorne, bnovkov MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59478
* arm64/vmm: Fix translation regime in s2_tlbi_rangeKajetan Puchalski6 days1-4/+4
| | | | | | | | | | | | | | s2_tlbi_range under VHE is supposed to clear HCR_EL2.TGE, but it erroneously clears an unrelated bit 27 in TCR_EL2 (HWU61). Since HCR_TGE determines which translation regime will be used by a tlbi, the instruction targets the wrong regime when it is not cleared. Fix the register accessed by the function to actually clear HCR_EL2.TGE. Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com> Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://github.com/freebsd/freebsd-src/pull/2435
* hwpmc/amd: replace static pmcdesc[] and pc_amdpmcs[] with dynamic allocationOsvaldo Janeri Filho3 days2-3/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AMD_NPMCS_MAX = 342 (16 core + 6 L3 + 64 DF + 256 UMC). On a Zen 4 EPYC 9654 with 6 core, 6 L3, 16 DF, and 4 UMC counters, only 32 descriptors are needed; the static arrays over-allocate by ~10x. Replace both amd_pmcdesc[AMD_NPMCS_MAX] and per-CPU pc_amdpmcs[AMD_NPMCS_MAX] with mallocarray() sized to the actual registered PMC count: - amd_pmcdesc: allocated in pmc_amd_initialize() - pc_amdpmcs: allocated per-CPU in amd_pcpu_init(), freed in fini() Normalize amd_l3_npmcs and amd_df_npmcs against the AMDID2_PTSCEL2I and AMDID2_PNXC feature bits before computing npmcs_total, so that allocation, registration, and amd_get_msr() row offsets are all derived from the same values. Previously the ternary in npmcs_total excluded L3/DF from the allocation while the globals retained their defaults, causing amd_get_msr() to miscompute DF row offsets when L3 is absent. amd_umc_npmcs comes from CPUID Fn8000_0022h EBX[23:16] (NumUMCCounters) and is zero when the leaf is absent, so no additional feature flag is needed. See AMD64 APM Vol.3 Appendix E. Fix three error-path memory leaks: amd_hwcheck() failure, goto error, and finalize. Reset amd_npmcs = 0 on the error path. Tested on AMD EPYC 9654 (Zen 4, Family 19h Model 11h, 192 threads). Full PMC test suite (IBS/UMCDF/PMC/L3/DF/TSC): 0 failures. Signed-off-by: Osvaldo Janeri Filho <ojanerif@amd.com> Reviewed by: mhorne MFC after: 1 week Sponsored by: AMD Pull Request: https://github.com/freebsd/freebsd-src/pull/2415
* riscv: enable gpiopower driverMitchell Horne3 days1-0/+1
| | | | | | | | It is functional, and there are some RISC-V platforms which can benefit from it. Requested by: Brian Scott <bscott@bunyatech.com.au> Sponsored by: The FreeBSD Foundation
* eqos: Reduce RX error noisinessBrian Scott3 days1-1/+9
| | | | | | | | | | | | | | | | Reduce very common console messages: Receive error rdes3=30208000 As observed on the VisionFive v2 hardware after some large transfers. Differentiate between overflow errors and others. Report the errors when the length is non-zero (overflow errors). Also, count errors for netstat purposes. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59479
* amd64/*sigtramp.S: re-enable some cfi annotations for special registersKonstantin Belousov3 days2-23/+40
| | | | | | | | | | Also explicitly specify .cfi_sections to emit the cfi bytecode into the loadable .eh_frame section. Reviewed by: mchoo Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59838
* vmm: Re-arm the PIT callout for square wave modeHayzam Sherif3 days1-1/+1
| | | | | | | | | | | | | | | | | The 8254's square wave mode (mode 3) is periodic, with the same interrupt rate as the rate generator mode (mode 2), but vatpit_callout_handler() only re-arms the channel 0 callout for TIMER_RATEGEN. A guest that programs mode 3 therefore receives a single IRQ0 and no further timer interrupts. Re-arm the callout for TIMER_SQWAVE as well, matching illumos change 13301. Reviewed by: markj Obtained from: illumos 93d78aba5b32996fc2ae893a6237a0d3972f86b2 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59816
* vmm: Fix a page wiring leak in MOVS emulationHayzam Sherif3 days1-3/+9
| | | | | | | | | | | | | | | | | | | When emulating a MOVS from MMIO to guest RAM, the kernel's vm_copy_setup() wires the destination pages. If the subsequent MMIO read fails, emulate_movs() skips vm_copy_teardown(), leaking the page wire references acquired during setup. Run vm_copy_teardown() regardless of the MMIO read result, and only copy the value to guest memory if the read succeeds. Preserve the existing error return. This matches illumos change 13309. Reviewed by: markj Obtained from: illumos 83cd75bb2949d26e6eb38ddefc60fdeed1909643 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59823
* vmm: Synchronize long-mode state when emulating CR0 writesHayzam Sherif3 days1-17/+15
| | | | | | | | | | | | | | | | vmx_emulate_cr0_access() sets EFER.LMA and the IA-32e guest VM-entry control when enabling paging with EFER.LME set, but does not clear them when disabling paging. This can leave an inconsistent guest state that fails VM entry. Update both fields in either direction based on EFER.LME and the CR0 value written to the VMCS. Use the mask-adjusted CR0 value so the resulting state remains consistent with the VMX fixed-bit requirements. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59756
* vmm: Normalize a zero PIT count before starting channel 0Hayzam Sherif3 days1-2/+2
| | | | | | | | | | | | | | | pit_timer_start_cntr0() does not schedule a callout when the initial count is zero. The counter write handler normalizes a programmed zero count only after calling it, leaving an initially unarmed channel 0 without a scheduled timer event. Move the existing normalization before the timer-start call. Retain the historical 0xffff representation of a zero count. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59749
* pfsync: when importing a state clear take the interface name into accountKristof Provost3 days1-6/+10
| | | | | | | | | | | | When one pfsync host clears states it informs its peers about this. While processing such messages, in pfsync_in_clr() we failed to take the interface name into account. This meant that if one host cleared states on one interface the peers would clear all states, not just those on the affected interface. Actually check for the interface in pfsync_in_clr() Sponsored by: Rubicon Communications, LLC ("Netgate")
* arm64/smmu: Only MSI poll when cache-coherentAndrew Turner6 days3-4/+14
| | | | | | | | | | | | Only use the MSI polling method when we support MSIs and the SMMU is cache-coherent. The SMMU writes to a memory location. If it is not cache-coherent then the CPU may read the existing value in its cache and miss the signal the sync operation has completed. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59489
* arm64/smmu: Support polling for sync completionAndrew Turner6 days1-4/+35
| | | | | | | | | When the hardware doesn't support MSIs we need to poll to wait for sync operations to complete. Add support for this to support booting on this hardware. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59488
* arm64/smmu: Split out waiting for sync completionAndrew Turner6 days1-22/+27
| | | | | | | | | | | In preparation for adding a non-MSI method split out waiting for sync completions from smmu_sync. While here fix the loop to wait for sync timeout to the worst case Linux uses. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59487
* arm64/smmu: Start handling errataAndrew Turner6 days2-0/+44
| | | | | | | | | | | Handle the Arm MMU-600 erratum 1076982 where when we poll for a sync command completion we can't use the wait-for-event instruction. This is in preparation for later adding support for polling for sync command completion and is not an issue on stable branches. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59486
* arm64/smmu: Move smmu laterAndrew Turner6 days2-2/+2
| | | | | | | | | | | | We need to wait for the interrupt drivers to attach before the smmu driver. As both of these happened at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE there was no guarantee this would happen in the correct order. Fix by moving the smmu driver to BUS_PASS_ORDER_LATE. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59485