aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* sound: Make SNDST_UNVLBUF_MAX a power of twoChristos Margiolis3 days1-1/+1
| | | | | | | | | Fixes: 074d337ad618 ("sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*") Reported by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45277
* sound: Correctly check nvlist_unpack() errorChristos Margiolis3 days1-1/+1
| | | | | | | | | | | The current check is never false and if nvlist_unpack() fails, we might panic later down the road. PR: 266144 Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: dev_submerge.ch, emaste Differential Revision: https://reviews.freebsd.org/D45237
* sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*Christos Margiolis3 days2-0/+10
| | | | | | | | | | | | | | SNDSTIOC_ADD_USER_DEVS* expects a user-supplied sndstioc_nv_arg->nbytes, however we currently do not check whether this size is actually valid, which results in a panic when SNDSTIOC_ADD_USER_DEVS* is called with an invalid size. sndstat_add_user_devs() calls sndstat_unpack_user_nvlbuf(), which then calls malloc() with that size. PR: 266142 Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D45236
* sound: Prevent uninitialized variable destruction in chn_init()Christos Margiolis3 days1-2/+2
| | | | | | | | | | | | | | If dsp_unit2name() fails, we'll get to out2 with b, bs and devinfo uninitialized, which will result in a panic. Reported by: Pierre Pronchery <pierre@freebsdfoundation.org> Reported by: Coverity Scan CID: 1545029, 1545025 Pull-request: https://github.com/freebsd/freebsd-src/pull/1240 Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45272
* sound: Get rid of redundant assignments in chn_init()Christos Margiolis3 days1-2/+0
| | | | | | | | | | c is allocated with M_ZERO. Reported by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45273
* if_vxlan(4): Add checking for loops and nesting of tunnelsZhenlei Huang3 days1-0/+23
| | | | | | | | | | | | User misconfiguration, either tunnel loops, or a large number of different nested tunnels, can overflow the kernel stack. Prevent that by using if_tunnel_check_nesting(). PR: 278394 Diagnosed by: markj Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45197
* linux(4): Add const qualifier to the value parameter of function handle_string()Zhenlei Huang3 days1-1/+1
| | | | | | | The content that `value` point to is not going to be altered by function handle_string(). MFC after: 1 week
* compat_freebsd4: Add const qualifier to the local variable s inside function ↵Zhenlei Huang3 days1-1/+2
| | | | | | | | | | freebsd4_uname() This local variable s is for iterating characters of global variable `version`. The content of `version` is not going to be altered by function freebsd4_uname(). MFC after: 1 week
* arm64 pmap: eliminate a redundant variableAlan Cox4 days1-4/+3
| | | | | | | | Moreover, if we attempt an L2 promotion on the kernel pmap from pmap_enter_quick_locked(), this change eliminates the recomputation of the L2 entry's address. MFC after: 1 week
* geli: fix indentationMariusz Zaborski4 days1-126/+126
| | | | no functional changes
* geli: allocate a UMA pool earlierMariusz Zaborski4 days1-1/+3
| | | | | | | | | | | | | | | | | | | The functions g_eli_init_uma and g_eli_fini_uma are used to trace the number of devices in GELI. There is an issue where the g_eli_create function may fail before g_eli_init_uma is called, however g_eli_fini_uma is still executed in the fail path. This can incorrectly decrease the device count to zero, potentially leading to the UMA pool being freed. Accessing the device after the pool has been freed causes a system panic. This commit resolves the issue by ensuring devices count is increassed eariler. PR: 278828 Reported by: Andre Albsmeier <mail@fbsd2.e4m.org> Reviewed by: asomers MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45225
* nfs client comment typo fixKonstantin Belousov5 days1-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* Remove TCP_SAD optional code now that the sack filter performs this function.Randall Stewart5 days5-768/+16
| | | | | | | | With the commit of D44903 we no longer need the SAD option. Instead all stacks that use the sack filter inherit its protection against sack-attack. Reviewed by: tuexen@ Differential Revision:https://reviews.freebsd.org/D45216
* devctl: Disable the boottime optimization of suppressing NOMATCHWarner Losh5 days1-1/+1
| | | | | | | | | | | | | The usb bus code (uhub) doens't present the same information to devctl as it does to the NOMATCH events it generats. As such, devmatch fails to find USB devices on boot when NOMATCH events are optimized out. Since the savings of boot time is relatively trivial for all but the most demanding boot environments, disable it by default until this issue is fixed. Fixes: 6437872c1d66 MFC After: 1 minute Sponsored by: Netflix
* cxgbe(4): Consolidate all mk_set_tcb_field_ulp in one place.Navdeep Parhar6 days5-161/+68
| | | | | MFC after: 1 week Sponsored by: Chelsio Communications
* cxgbe(4): sc->port is indexed by port_id and not tx_chan.Navdeep Parhar6 days1-1/+1
| | | | | MFC after: 1 week Sponsored by: Chelsio Communications
* fib_dxr: code hygiene, prune old code, no functional changesMarko Zec6 days1-42/+1
| | | | | | | | | | | | | The !DXR2 code corresponds to the original DXR encoding proposal from 2012 with a single direct-lookup stage, which is inferior to the more recent (DXR2) variant with two-stage trie both in terms of memory footprint of the lookup structures, and in terms of overall lookup througput. I'm axing the old code chunks to (hopefully) somewhat improve readability, as well as to simplify future maintenance and updates. MFC after: 1 week
* fib_dxr: do not leak memory if FIB constellation hits structural limitMarko Zec6 days1-1/+3
| | | | | | | | | | DXR lookup table encoding has an inherent structural limit on the amount of binary search ranges it can accomodate. With the current IPv4 BGP views (circa 1 M prefixes) and default DXR encoding we are only at around 5% of that limit, so far, far away from hitting it. Just in case it ever gets hit, make sure we free the allocated structures, instead of leaking it. MFC after: 1 week
* fib_dxr: check if cached fib_data matches the new request in dxr_init()Marko Zec6 days1-2/+3
| | | | | | | | | | | | | | | | | | | | | | When calling dxr_init(), the FIB_ALGO infrastructure may provide a pointer to a previous dxr instance, which permits reuse of auxiliary dxr structures, i.e. incremental lookup structure updates. For dxr this is a crucial feature provided by FIB_ALGO, since dxr incremental updates are typically several orders of magnitude faster than full lookup table rebuilds. However, the auxiliary dxr structure caches a pointer to struct fib_data and relies upon it for performing incremental updates. Apparently, incremental rebuild requests from FIB_ALGO, i.e. a calls to dxr_init() with a pointer old_data set, may (under not yet fully understood circumstances) be invoked within a different fib_data context than the one cached in the previous version of dxr auxiliary structures. In such (rare) events, we ignore the offered old dxr context, and proceed with a full lookup structure rebuild instead of attempting an incremental one using a fib_data context which may or may not no longer be valid, and thus lead to a system crash. PR: 278422 MFC after: 1 week
* arm64: Support break and watch points in VHEAndrew Turner6 days1-0/+6
| | | | | | | | | | | When booting the kernel with VHE it will be running at EL2. The current config register values only enable the reaces at EL1 when tracing the kernel. Set the HMC flag to also trap from EL2. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45121
* arm: Use the correct irq when in the hypervisorAndrew Turner6 days1-7/+18
| | | | | | | | | | When booting in the hypervisor state we need to use the hypervisor interrupt in the generic timer. In this case the registers we access in the kernel are remapped to the EL2 versions, however this causes an unexpected interrupt to trigger. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43975
* arm: Add a missing interrupt to the generic timerAndrew Turner6 days1-0/+2
| | | | | | | | | | The ACPI generic timer attachment added 3 interrupts, but missed the hypervisor physical interrupt. As the field is present in all versions of the GTDT ACPI table and isn't an optional interrupts we can add it to the interrupts provided to the driver. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43974
* uart: DBG2 support to find the debug uartAndrew Turner6 days1-0/+83
| | | | | | | | | | | The Debug Port Table 2 (DBG2) contains information on which devices can be used for debugging purposes. Add support to the uart driver to use the DBG2 table when enabled from loader. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D44359
* zfs: Avoid a gcc -Wint-to-pointer-cast warningBrooks Davis6 days1-1/+1
| | | | | | | | | | | | On 32-bit platforms long long is generally 64-bits. Sufficiently modern versions of gcc (13 in my testing) complains when casting a pointer to an integer of a different width so cast to uintptr_t first to avoid the warning. Fix i386 gcc builds while we wait for this to be merged to OpenZFS. Sponsored by: DARPA, AFRL Pull Request: https://github.com/openzfs/zfs/pull/16203
* arm64: add CONTEXTIDR_EL1 regZachary Leaf6 days1-0/+9
| | | | | | | | | CONTEXTIDR_EL1 is used in debug and trace features to identify the current process or context. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45173
* arm64: add PMBSR_MSS_{BSC,FSC} status code fieldZachary Leaf6 days1-0/+2
| | | | | | | | | | | Bits [5:0] of PMBSR_MSS encodes either Buffer Status Code (BSC) or Fault Status Code (FSC) depending on PMBSR_EC value. Add PMBSR_MSS_{BSC,FSC} to cover this field. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45172
* arm64: make SPE regs use ALT_NAME macroZachary Leaf6 days1-60/+72
| | | | | | | | | | | | | | | When the register is not defined in Armv8.0 i.e. added in a later extension, like SPE added in v8.2, the alternative name format of: S<op0>_<op1>_C<crn>_C<crm>_<op2> should be used; otherwise, calls to {READ,WRITE}_SPECIALREG() will fail. Use the MRS_REG_ALT_NAME() macro for SPE changing hex to decimal as required by the macro. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45171
* dev/psci: Fix a function nameAndrew Turner6 days1-1/+1
| | | | | | dd a missing underscore to arm_smccc_1_2_* to fix the GCC build. Sponsored by: Arm Ltd
* arm64/vmm: Fix the build with GCCAndrew Turner6 days2-2/+2
| | | | | | | - Fix the spelling of handle_el2_el1_irq64 - Add .section before .rodata as the GCC build needs it Sponsored by: Arm Ltd
* tpm: Add new tpm_bus.c to module MakefileJustin Hibbits6 days1-0/+1
| | | | | Reported by: eduardo@ Fixes: c2e9c5bbf0 ("tpm: Refactor TIS and add a SPI attachment")
* arm64: Use the _REG macros to read ID registersAndrew Turner6 days1-33/+13
| | | | | | | | | | | | | To build with old toolchains use the *_REG macros to access the ID registers. These become a name in the form S?_?_C?_C?_? where the '?' values encode the op and CR values needed to access the register. For consistency use these macros for all ID registers, even if most toolchains understand them. Reviewed by: Zachary Leaf <zachary.leaf@arm.com> Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45177
* arm64: Add MRS_REG_ALT_NAME ID register macrosAndrew Turner6 days1-0/+15
| | | | | | | | | These can be used even when the compiler is too old for the register to be included. Reviewed by: Zachary Leaf <zachary.leaf@arm.com> Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45176
* linuxkpi: rwlock: Fix rwlock_initEmmanuel Vadot6 days1-1/+1
| | | | | | | Some linux code re-init some spinlock so add MTX_NEW to mtx_init. Reported by: rlibby Fixes: 5c0a1923486e ("linuxkpi: rwlock: Simplify code")
* linuxkpi: Fix spin_lock_initEmmanuel Vadot6 days1-1/+1
| | | | | | | Some linux code re-init some spinlock so add MTX_NEW to mtx_init. Reported by: David Wolfskill <david@catwhisker.org> Fixes: ae38a1a1bfdf ("linuxkpi: spinlock: Simplify code")
* SysV IPC: provide in-kernel helpers to obtain ipcs(8)-like informationKonstantin Belousov7 days6-0/+111
| | | | | | | | | PR: 278949 Reviewed by: markj Tested by: Ricardo Branco <rbranco@suse.de> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45175
* SysV SHM: move SHMSEG constants to sys/shm.hKonstantin Belousov7 days2-4/+4
| | | | | | | | | There are planned consumers in linprocfs. Tested by: Ricardo Branco <rbranco@suse.de> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45175
* linuxkpi: Provide a non-NULL value for THIS_MODULEAustin Shafer7 days3-0/+41
| | | | | | | | | | | | | | | | | | | THIS_MODULE is used to differentiate modules on Linux. We currently completely stub out any Linux struct module usage, but THIS_MODULE is still used to populate the "owner" fields of various drivers. Even though we don't actually dereference these "owner" fields they are still used by drivers to check if devices/dmabufs/etc come from different modules. For example, during DRM GEM import some drivers check if the dmabuf's owner matches the dev's owner. If they match because they are both NULL drivers may incorrectly think two resources come from the same module. This adds a general purpose __this_linker_file which will point to the linker file of the module that uses it. We can then use that pointer to have a valid value for THIS_MODULE. Reviewed by: bz, jhb Differential Revision: https://reviews.freebsd.org/D44306
* sys/modules/dpdk_lpm4: do not build without INETLexi Winter7 days1-1/+1
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1236
* linuxkpi: refcount: Use atomic_t directlyEmmanuel Vadot7 days2-17/+9
| | | | | | | | | | Simply use a typedef for refcount_t on atomic_t, this allow us to use a nativ type and also changing struct kref to directly use a refcount_t like Linux. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45207
* linuxkpi: rwlock: Simplify codeEmmanuel Vadot7 days1-15/+6
| | | | | | | | | Just use a typedef for rwlock_t, no need to create a useless structure. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45206
* linuxkpi: spinlock: Simplify codeEmmanuel Vadot7 days5-34/+20
| | | | | | | | | Just use a typedef for spinlock_t, no need to create a useless structure. Reviewed by: bz, emaste Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45205
* vfs_domount_update(): postpone setting MNT_UNION until VFS_MOUNT() is doneKonstantin Belousov7 days1-1/+8
| | | | | | | | | | | | | | | | The file system that handles updating the mount point might do lookups during the update, in which case it could find the flag MNT_UNION set on the mp while mount point is still not updated. In particular, the rootvp->v_mount->mnt_vnodecovered is not yet set. Delay setting MNT_UNION until the mount is performed. PR: 265311 Reported by: Robert Morris <rtm@lcs.mit.edu> Reviewed by: mckusick, olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45208
* vfs_domount_update(): style, use space instead of tabKonstantin Belousov7 days1-1/+1
| | | | | | Noted by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 3 days
* riscv: fix L0 PTE setup (Sv48)Mitchell Horne8 days1-1/+1
| | | | | | | | | | | | | | Per the Privilege Spec, the Accessed (A) or Dirty (D) bits must only be set for a leaf PTE. It seems newer versions of QEMU have started to enforce this requirement, and without this change, pmap_bootstrap() hangs when switching to Sv48 mode. Reviewed by: jrtc27, markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45210
* uart: Honour clock-frequency in FDT for UART_FDT_CLASS if presentJessica Clarke8 days1-1/+2
| | | | | | | | | | | | | | | | | | | | | | The StarFive VisionFive 2 has a Synopsys DesignWare ABP UART, whose driver uses UART_FDT_CLASS rather than UART_FDT_CLASS_AND_DEVICE as it has its own separate newbus driver. This UART is driven by a 24MHz clock as specified in the FDT, but we don't currently look at the property here, instead passing down 0 and letting the default value be used in the 8250 driver (~1.8MHz). As a result the divisor is misconfigured for the current baud rate for the entire kernel boot process. Once the newbus driver attaches the correct frequency is saved in the softc, but that does not take effect until the next time ns8250_param is called and the divisor is recalculated, namely when userspace runs and /dev/console is opened (note that ns8250_init does not get called when the newbus device corresponding to the current console attaches). Fix this issue by attemmpting to get the current clock frequency as for the UART_FDT_CLASS_AND_DEVICE_CASE, but falling back to 0 rather than failing on error. Reviewed by: imp, mhorne Differential Revision: https://reviews.freebsd.org/D45159
* AMD CPUs: update bits and data from CPUID 0x8000_0008Konstantin Belousov8 days3-0/+30
| | | | | | | | | | from AMD APM vol3 doc no 24594 Rev. 3.36 March 2024 Reviewed and tested by: emaste Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45188
* net80211: add initial key management suites from 802.11-2016, APIs to ↵Adrian Chadd9 days5-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | register them The WPA1/WPA2 driver capabilities aren't really enough in today's world. There are a /lot/ more key management suites to support! So, add initial support for net80211 and drivers to announce what key management suites are supported. These are the list from 802.11-2016 section 9.4.2.25.3 (AKM suites.) The flags are for software supported key management. Drivers may support more key management suites and are welcome to announce more; net80211 will only announce ones that we know net80211 knows "enough" about to support correctly. There /are/ other suites that may be interesting to some people in the future that are not part of this set - eg if anyone ever wants to support the Chinese WAPI standard - so this bitmap is not specifically just the AKM suites in the RSN OUI. This should eventually be communicated up to the wpa_supplicant and hostapd via a replacement driver/vap capabilities call so they know what to enable rather than just IEEE80211_C_WPA1 / IEEE80211_C_WPA2. Differential Revision: https://reviews.freebsd.org/D44919 Reviewed by: bz
* net80211: allow a single wlan crypto module to register for >1 cipherAdrian Chadd9 days1-2/+5
| | | | | | | | | | | | | This allows a single wlan crypto module to register for more than one cipher. Without it, duplicate linkerset structs are initialised for the actual module loading machinery itself. I've tested this in my private tree with wlan_ccmp providing both 128 and 256 bit cipher support. Differential Revision: https://reviews.freebsd.org/D44901 Reviewed by: bz, cc, cy Approved by: bz, cc, cy
* net80211: add placeholder module names for the new ciphersAdrian Chadd9 days1-0/+7
| | | | | | | | | | | | This is effectively a no-op as we currently don't advertise these ciphers as available anywhere. Note though the intent to support 128 and 256 bit ciphers in the same crypto module. Differential Revision: https://reviews.freebsd.org/D44900 Reviewed by: cc, cy Approved by: cc, cy
* net80211: add the 802.11-2016 cipher list to the crypto array set.Adrian Chadd9 days1-2/+20
| | | | | | | | | | | These are the bitmap / cipher module number fields used for net80211 ciphers. This requires a kernel recompile, but nothing (currently) in userland is using these. Differential Revision: https://reviews.freebsd.org/D44899 Reviewed by: bz, cc