This is a display of mostly-automatically-classified git commits from 2026-10-05 to 2026-10-11.
Table of contents and commits per category:
| (0) | Highlighted commits (these are copies, not in stats) | |
| 1 | 0.5% | Userland programs |
| 5 | 2.4% | Documentation |
| 70 | 33.3% | Hardware support |
| 20 | 9.5% | Networking |
| 24 | 11.4% | System administration |
| 11 | 5.2% | Libraries |
| 5 | 2.4% | Filesystems |
| 31 | 14.8% | Kernel |
| 12 | 5.7% | Build system |
| 4 | 1.9% | Internal organizational stuff |
| 3 | 1.4% | Testing |
| 3 | 1.4% | Style, typos, and comments |
| 14 | 6.7% | Contrib code |
| 7 | 3.3% | Reverted commits |
| 0 | 0.0% | Unclassified commits |
| 210 | 100% | total |
| Technical notes about this page |
For extra visibility, these are copies of commits found in
other sections. Most (if not all) come from the commit message
containing "Relnotes:", or commits modifying
UPDATING.
-- no commits in this category this week --
Commits about commands found in man section 1 (other than networking).
Use nitems() to calculate the number of elements in sourcepaths. Reviewed by: fernape@, ngie@ Approved by: ngie@ Fixes: https://cgit.freebsd.org/src/commit/?id=3963483523a4 Sponsored by: Intel Corporation Assisted-by: Github Copilot (GPT-5.6 Terra) Differential Revision: https://reviews.freebsd.org/D60368
Man pages, release notes, etc.
MFC after: 1 week Sponsored by: The FreeBSD Foundation
Reported by: glebius@
Reviewed by: olce MFC after: 1 week Sponsored by: fme AG Differential Revision: https://reviews.freebsd.org/D60443
Reword the UL_GETFSIZE and UL_SETFSIZE descriptions to say 512-byte blocks and make the setter's argument clearer. While here, improve mdoc markup and pull in other small improvements. Reviewed by: des MFC after: 3 days Obtained from: https://github.com/apple-oss-distributions/libc Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D60467
This change adds missing documentation for various NFSv4 constants supported by acl(9). Bump `.Dd` for the change. MFC after: 1 week Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D58736
Hardware drivers and architecture-specific code.
trap() and set_mcontext() change the FP/VMX/VSX ownership state in several steps with preemption enabled. A context switch in between leaves the thread computing with another thread's register contents: - enable_fpu()/enable_vec() set PCB_FPU/PCB_VEC before loading the registers, so a switch mid-load saves a half-loaded unit over the PCB. - set_mcontext() clears the frame's MSR bits and then the PCB flags; a switch in between re-enables the unit, and the thread returns to user space with it enabled but not owned, so it is neither saved nor restored until the next signal. Both paths run after every sigreturn(2), setcontext(2) and swapcontext(3). A POWER9 test that keeps f14-f31 live across a signal, with other threads using the FPU on the same CPU, saw 283 corrupted round trips out of 882000; none after this change. Hold a critical section around both, as amd64 and arm64 do. Reviewed by: jhibbits MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60054
dev.igc.N.fc read and wrote a function-static variable shared by every igc device, so a read returned the last value written to any of them (3 until the first write), not the state of the device. The softc value started as 0, which is also the value of "no flow control", while the hardware was set up for full flow control. As a result: - Writing 0 was taken for no change and did nothing, unless another value had been written to that device before. - igc_reset() took a softc value of 0 for "not set", so a device set to 0 went back to full flow control on the next init. - With more than one receive queue the driver enabled per-queue drop (SRRCTL.DROP_EN), which is meant for a MAC that does not send pause frames, although the MAC was told to send them. - Values out of range were accepted and ignored. A write only forced the MAC's flow control bits. The pause bits advertised to the link partner, the pause thresholds and DROP_EN stayed as the last init had set them, and the next link event resolved flow control from the stale advertisement again: a port set to 0 came back honoring pause frames, for example. Start the softc value as full, report it, use it as it is in igc_reset(), reject invalid values, and apply a change by reinitializing the interface, as the dmac and eee_control sysctls do. Two things behave differently now. Changing the mode of a running interface takes the link down to renegotiate. And with the default mode and more than one receive queue DROP_EN is no longer set: a full receive ring makes the MAC send pause frames, and holds up the other queues, where it used to drop that queue's packets. Setting fc to 0 or 1 selects per-queue drop. Tested on I226-V ports with four receive queues: for each mode, the flow control bits in CTRL, the pause thresholds and DROP_EN were read back, and the mode the link partner resolved, also after a down/up. Reviewed by: gallatin Fixes: https://cgit.freebsd.org/src/commit/?id=517904de5cca ("igc(4): Introduce new driver for the Intel I225 Ethernet controller.") MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60363
The GICv5 ACPI code uses CpuInterfaceNumber to as the CPU ID. This a GICv5 CPU ID and may not be the same as the appropriate FreeBSD value. It is also possible the target CPU is disabled, e.g. when the hw.ncpu tunable is uses to limit CPUs. If this is the case we don't want to enable the CPU in the cpu set as it is offline so cannot handle interrupts. Switch to use ArmMpidr to find which pcpu to use when finding which CPUs the IRS is attached to. Fixes: https://cgit.freebsd.org/src/commit/?id=9556306213e1 ("arm64: Add ACPI support to GICv5 driver") Differential Revision: https://reviews.freebsd.org/D59993 Sponsored by: Arm Ltd
Avoid allocating per-transfer maps for coherent tags that cannot bounce. Retain maps for cache synchronization, CCA realms, and KMSAN. These un-used maps carry with them memory and cache miss overheads. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D60098 Sponsored by: Netflix
MFC after: 3 days Sponsored by: The FreeBSD Foundation
MFC after: 3 days Sponsored by: The FreeBSD Foundation
dev.em.N.fc and dev.igb.N.fc read and wrote a function-static variable
shared by every em(4) and igb(4) device, so a read returned the last
value written to any of them (3 until the first write), not the state of
the device. The softc value started as 0, which is also the value of
"no flow control", while the hardware was set up for full flow control.
As a result:
- Writing 0 was taken for no change and did nothing, unless another
value had been written to that device before.
- em_reset() took a softc value of 0 for "not set", so a device set to 0
went back to full flow control on the next init.
- On igb(4) with more than one receive queue the driver enabled
per-queue drop (SRRCTL.DROP_EN), which is meant for a MAC that does
not send pause frames, although the MAC was told to send them.
- Values out of range were accepted and ignored.
A write only forced the MAC's flow control bits. The pause bits
advertised to the link partner, the pause thresholds and DROP_EN stayed
as the last init had set them, and the next link event resolved flow
control from the stale advertisement again. On 82577 and 82578 (pchlan)
a write could also turn on transmit flow control, which em_reset() keeps
off there as a workaround.
Start the softc value as full, report it, use it as it is in em_reset(),
reject invalid values, and apply a change by reinitializing the
interface, as the dmac and eee_control sysctls do. This is the same fix
as 68386f6b551e ("igc: Fix the flow control sysctl"); igc(4) inherited
the handler from this driver. On pchlan, remove transmit pause from the
requested mode instead of replacing the mode with receive pause, so that
the workaround stays and 0 still turns flow control off.
Reviewed by: kbowling
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60376
On Zen 6, an extra IBS NMI can arrive after later samples. Keep the credit until the empty NMI arrives, and handle fetch and op samples when both are ready. Reviewed by: mhorne Fixes: https://cgit.freebsd.org/src/commit/?id=34b00ed041a4 ("hwpmc: fix IBS fetch and op NMI handling") Fixes: https://cgit.freebsd.org/src/commit/?id=e51ef8ae490f ("hwpmc: Initial support for AMD IBS") Sponsored by: AMD Differential Revision: https://reviews.freebsd.org/D60367
Support the new "riscv,isa-extensions" property on RISC-V hart nodes
in FDT.
The "riscv,isa" property is deprecated, but cannot be removed because
doing so would break compatibility with existing DTBs. The new properties
replace it: "riscv,isa-base" describes the base ISA and
"riscv,isa-extensions" is a string array containing the supported ISA
extensions.
The "riscv,isa-extensions" property can be relatively large; on the
Spacemit K3 SoC it is approximately 300 bytes.
The FreeBSD OFW interface does not provide access to the underlying FDT
property data without copying it, and memory allocation is not possible
this early. So allocate a static buffer for the property instead.
Reuse the existing parse_riscv_isa() implementation to parse both the new
extension property and the legacy "riscv,isa" property.
Reviewed by: bnovkov, mhorne
Sponsored by: EPSRC ("UKRI3001: CHERI Research Centre")
Differential Revision: https://reviews.freebsd.org/D60209
These diagnostics do not exist anymore. MFC after: 1 week
When device initialization fails during attach (for instance, if device resource configuration or firmware negotiation fails), the driver aborts and unrolls partial state via its detach routine. However, the teardown path assumes transmit and receive queues have already been created. If attach aborts before queue allocation, tearing down the uninitialized queues triggers a NULL pointer dereference and panics the kernel during boot. Guard queue teardown against uninitialized queue state so that early attach failures unwind safely, allowing the driver to report the failure gracefully without crashing the operating system. Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com> Reviewed by: adrian, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60385
When gve_alloc_rings fails (such as when failing to acquire MSI-X vectors or during partial ring allocation), ring cleanup can be executed multiple times across nested error paths (e.g. within gve_alloc_rings abort and gve_attach abort). Because gve_free_counters invoked counter_u64_free without nullifying the pointer in the stats array, repeated invocation caused a double-free panic when freeing the same counter references. Check for non-NULL before freeing and nullify each counter pointer upon release in gve_free_counters. Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com> Reviewed by: adrian, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60386
When a PTE logically supports write access, as indicated by its DBM field, but write access is nonetheless blocked by the PTE's protection field, pmap_fault() can enable write access with only a local TLB invalidation. Reviewed by: andrew, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60417
Add a knob to debug ioctl(IPMICTL_SEND_COMMAND). Log the IPMI NetFn and Cmd fields, followed by a hexdump of the request data. Upon completion, log the hexdump of the response data. Reviewed by: adrian, imp, ngie Sponsored by: Vdura Differential Revision: https://reviews.freebsd.org/D59514
This updates iwx to the given OpenBSD versions upstream. This is a squashed commit of the given differential revisions and openbsd upstream commits. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D59757 Differential Revision: https://reviews.freebsd.org/D59758 Differential Revision: https://reviews.freebsd.org/D59759 Differential Revision: https://reviews.freebsd.org/D59760 Differential Revision: https://reviews.freebsd.org/D59761 Differential Revision: https://reviews.freebsd.org/D59762 Differential Revision: https://reviews.freebsd.org/D59763 Differential Revision: https://reviews.freebsd.org/D59764 Differential Revision: https://reviews.freebsd.org/D59765 Differential Revision: https://reviews.freebsd.org/D59766 Obtained from: OpenBSD, dd37084bb9bbc1cb63137a98072e149306cc2e2a Obtained from: OpenBSD, 521eb4f37a87f4d1ba6b3aa685721d015525efb4 Obtained from: OpenBSD, 177f96ae5464c4393971d72a9703f84ba84ad60c Obtained from: OpenBSD, be47d0a5f00c62ce8dd784cf7f90f635203434ae Obtained from: OpenBSD, 1fe292d1a480241213e618a905fef43d03ac65ca Obtained from: OpenBSD, 41713280ddbe6fa1b12833163070617fa75d6e43 Obtained from: OpenBSD, 844e213d50c754e415ff22924cb86e86d4d63002 Obtained from: OpenBSD, 9fb1f10bfcbfc611a885a088a1658b52427addcb Obtained from: OpenBSD, 3b9d585e0ce86bc6eed0b4493f3c73d741778f91 Obtained from: OpenBSD, 22f856c70e6211679c512ca0726f3c6f6a152dde
The virtio-gpu resource formats are defined by byte order in memory, while vt(4) and the X server (through vt_fb and the fb mmap) write native 32-bit 0x00RRGGBB pixels into the shadow framebuffer. On a big-endian guest such as powerpc64 those pixels land in memory as 00 RR GG BB, which the host interprets under B8G8R8X8 with red and blue swapped and the padding byte taken as blue: white renders yellow and blue renders black. Request X8R8G8B8 on big-endian guests instead, which is also what the Linux driver does (DRM_FORMAT_HOST_XRGB8888). Reproduced with a colour test pattern on a powerpc64 QEMU pseries guest using the identically coded out-of-tree fork of this driver (graphics/virtio-gpu-qemu-kmod); little-endian guests are unchanged. Differential Revision: https://reviews.freebsd.org/D60085 Approved by: jhibbits MFC after: 1 week
MFC after: 1 week Sponsored by: The FreeBSD Foundation
The check compares cpu_family with decimal 19 instead of 0x19, so Families 17h and 19h get the Family 1Ah DF encoding. Signed-off-by: Osvaldo Janeri Filho <ojanerif@amd.com> Reviewed by: mhorne Fixes: https://cgit.freebsd.org/src/commit/?id=00c0a1f0bf6c ("hwpmc: Fix PMC flags for AMD Zen cores") MFC after: 3 days Sponsored by: AMD Pull Request: https://github.com/freebsd/freebsd-src/pull/2461
pcd_get_msr() returns a positive errno, but only a negative value was treated as a failure, so errors were reported as success. Signed-off-by: Osvaldo Janeri Filho <ojanerif@amd.com> Reviewed by: mhorne MFC after: 3 days Sponsored by: AMD Pull Request: https://github.com/freebsd/freebsd-src/pull/2461
Set si_iosize_max for namespace character devices matching the fix from commit 125ec0e30785bb0cbca7aa6c0b1a34b75e53078d. Sponsored by: Chelsio Communications
The device has multiple PIDs as it supports different USB profiles. Approved by: adrian MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D60482
On many arm64 processors, the kernel plays a part in maintaining instruction cache (icache) coherence as the contents of the underlying physical pages change. Previously, the only mechanism for maintaining icache coherence implemented by the machine-dependent layer was a full icache flush. However, on machines with physically indexed and physically tagged (PIPT) icaches, where aliasing cannot occur, we can instead selectively invalidate just the affected cache lines. Reviewed by: andrew Tested by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60271
if_bnxt: consolidate readl_fbsd/writel_fbsd and fix BAR mapping There are multiple duplicates of readl_fbsd and writel_fbsd spread accross bnxt_en and bnxt_re drivers. Move a single definition into bnxt.h as static inline, shared by bnxt_en and bnxt_re, using the correctly sized bus_space_read_4()/bus_space_write_4() accessors, and drop the other two copies along with their declarations. Also, Fix the BAR selection while at it: bar_idx 0 addresses BAR0 (the HWRM bar) and bar_idx 2 addresses BAR2 (the doorbell bar), matching every call site (e.g. BNXT_FW_HEALTH_REG_TYPE_BAR0/BAR1 in if_bnxt.c) and bnxt_pci_mapping()'s own bnxt_map_bar() calls, but both old copies and bnxt.h's own inline had the two bars swapped. Add BNXT_HWRM_BAR_IDX/BNXT_DOORBELL_BAR_IDX macros for the two valid bar_idx values and use them at every readl_fbsd()/writel_fbsd() call site plus bnxt_pci_mapping(), instead of bare 0/2 literals. Any other bar_idx is a programming error, so readl_fbsd()/writel_fbsd() panic on it rather than silently guessing a BAR. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58995
if_bnxt: add RX timestamping support Add PHC register mapping, RTC initialization, refclk read with FW-reset serialization, and sbinuptime-based calibration to convert the raw hardware timestamp carried in RX completions into an mbuf timestamp. Advertise IFCAP_HWRXTSTMP, configure the RX timestamp filter in bnxt_init(), and drain the calibration callout on stop. Check HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED in bnxt_hwrm_func_qcaps() so the capability bit PTP is gated on actually gets set, without which PTP never armed on real hardware. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58596
if_bnxt: add CAGR interrupt coalescing tick-resolution support Add the P7 CAGR (Completion AGgregation Ring) NQ-aggregation timer tick-resolution knob, programmed via a direct GRC-window register write, with a new dev.bnxt.<unit>.cagr_tick_res read-only tunable. This is independent of the existing per-ring AGGINT_PARAMS coalescing. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58598
if_bnxt: add HW-based TX completion coalescing When firmware advertises BNXT_FLAG_TX_COAL_CMPL, request coalesced completions via cmpl_coal_cnt on TX ring alloc and decode the resulting tx_cmpl_coal_t records using a free-running SQ consumer index per ring, instead of one completion per BD. Add the tx_hw_coal_cnt sysctl to tune the firmware coalescing count code. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58599
if_bnxt: add host-based TX completion coalescing Suppress per-BD completions (TX_BD_LONG_FLAGS_NO_CMPL/_COAL_NOW) and accumulate a running_bds count per ring, forcing a real completion when iflib requests one or when the count nears overflowing the opaque bd-count field. Replaces the previous raw (bd_count << 24 | idx) TX completion opaque encoding, which only had 8 bits for the count and would overflow well within these coalescing thresholds, with a tx_bd_opaque bitfield (16-bit idx + 15-bit bds + 1-bit ktls_replay for later use). Add tx_host_coal_bds/tx_host_coal_enable sysctls to tune and toggle it. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58600
The driver currently only supports BS v1 for Thor even though the firmware supports v2, capping max_mr at ~192K when firmware can support up to ~256K. Enable Backing Store v2 support for the Thor controller. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58601
An interrupt storm was observed on Thor2 because the Rx CQ consumer index was always one less than it should be. Correct the Rx CQ consumer index to fix the storm. Reported by: gallatin Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58602
if_bnxt: add MPC (Mid-Path Channel) ring infrastructure Add MPC ring support: a pair of extra, driver-private TX/completion/notification rings the firmware uses as a side-channel for offload commands. The only current consumer is kTLS TX crypto command submission; RCE/CFA channel types are not yet implemented by any consumer. Adds MPC ring allocation/teardown, HWRM ring alloc/free, a private interrupt path for the MPC NQ ring, and the TX submit/completion path. The RoCE-only IRQ table builder is split into a generic, exported bnxt_populate_irq(softc, irq_count) that both MPC and RoCE use, plus an incremental bnxt_populate_irq_roce() that grows the table on top of whatever is already there, so IRQ rids stay consistent regardless of attach order. This patch does not link standalone: bnxt_mpc_cmp() calls into kTLS's completion handler, added by a later patch. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58603
if_bnxt: add bnxt_compat.h version-compat shim Add bnxt_compat.h, a small __FreeBSD_version-gated compatibility shim: if_getmtu()/if_name()/if_getsoftc()/if_getflags() fallbacks for pre-1500000, and a config-task vs. config-gtask abstraction over the iflib API split at 1403000. On this branch's FreeBSD version it also unconditionally enables KTLS_IFLIB_SUPPORT/KTLS_REC_SEQ_NUMBER, which the upcoming kTLS patch depends on. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58604
if_bnxt: add bitmap search/test-and-set helpers Add bitmap search/test-and-set helpers the kTLS key-context ID allocator needs; bitstring.h has no equivalent primitives. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58605
Add kTLS TX crypto offload, layered on MPC (crypto add/delete commands submitted over its TCE channel) and TX completion coalescing (shared tx_bd_opaque encoding). Adds kTLS session lifecycle management, a key-context ID allocator, HWRM key-context alloc/free with partition-mode support, and the TX submit path: in-order packets go out on the normal iflib path with CSUM_SND_TAG set, while out-of-order or retransmitted TLS records get a presync command plus a replayed copy of the record built from the driver's own replay ring. Also adds kTLS/MPC completion-time counter sysctls and the max_ktls_entries tunable. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58606
if_bnxt: Fix HWRM mailbox/DMA teardown race on detach iflib's generic device-deregister path never drains the admin task before calling IFDI_DETACH, so bnxt_update_admin_status() (scheduled once/sec) could still run concurrently with bnxt_detach(), racing on softc->hwrm_lock and the shared HWRM request/response DMA buffer that bnxt_detach() destroys. That race could leave the firmware-side HWRM mailbox inconsistent, surfacing as "Timeout sending HWRM_VER_GET" on the next module load. Add a softc->detached guard: set it as the first statement in bnxt_detach(), and bail out of bnxt_update_admin_status() immediately when it's set. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58607
if_bnxt: honor firmware min wait before VER_GET on reset The firmware advertises a minimum wait time it needs before it is ready. The driver was not honoring it and sent VER_GET too early during firmware error-recovery, which could return an incomplete VER_GET buffer. Enforce that minimum wait, measured from when the RESET_NOTIFY async event arrived, before sending VER_GET. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58608
if_bnxt: Pass HWRM cmd response to apps even if FW fails it The driver was not passing the HWRM command response to management apps when the firmware failed the command, which is not what apps expect. Copy the response out whenever firmware populated one (resp_len != 0), regardless of the command's overall return code, and stop bailing out of the mgmt ioctl path early on a failed passthrough so DMA'd indirect data and the response still get copied to userspace. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58609
if_bnxt: Collect hw stats every 250 milliseconds bnxt_if_timer() only scheduled bnxt_update_admin_status(), which polls HW stats, once per second. Drop the interval to 250ms so stats collection is timely. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58610
bnxt_unregister_dev() called synchronize_rcu() while holding bp->en_ops_lock, which witness flags as a sleeping-while-locked violation on driver unload. Drop the lock around the RCU grace period and reacquire it afterward. Also gate the RoCE extended-stats hex dump in bnxt_qplib_qext_stat() behind bootverbose instead of printing it unconditionally. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58611
if_bnxt: ktls: Reject new kTLS sessions once driver is detaching bnxt_tls_snd_tag_alloc() only gated on BNXT_STATE_OPEN, which is set once by bnxt_open()/bnxt_attach_pre() but never cleared again, so it could not reject new sessions once bnxt_detach() started tearing things down. The snd_tag_alloc_ref-based wait in bnxt_detach(), which waits for in-flight allocators to exit, was already in place, but without this gate new sessions could keep being created for the entire duration of that wait, extending it indefinitely instead of just draining existing ones. Reject new sessions once softc->detached is set, and reset it back to false in bnxt_attach_pre() so it doesn't wrongly persist across a detach/reattach cycle. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58612
if_bnxt: Restore Rx CQ doorbell skip-when-idle optimization on P5 The unconditional-doorbell fix for Whp/older NICs (always ring the Rx CQ doorbell after processing Rx interrupts) had also been applied to P5+ chips, discarding process_nq()'s work-done signal entirely and losing the doorbell-skip optimization on P5+ when process_nq() finds no CQ notification to act on. Make process_nq() return whether it saw a CQ notification, and only skip the Rx CQ doorbell on P5+ when it didn't; non-P5+ chips continue to always ring it, since process_nq() isn't used on that path. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58613
if_bnxt: add support for HW generic stats HW generic stats provide information about PCIe transactions and out-of-order doorbell writes, useful for debug. Allocate a DMA buffer for them (disabling BNXT_FW_CAP_GENERIC_STATS if the allocation fails), fetch them via HWRM_STAT_GENERIC_QSTATS once per admin-status tick on P5+ chips, and expose them to userspace under dev.bnxt.<unit>.hwstats.generic_stats.* via sysctl. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58614
if_bnxt: avoid FTQM/STQM pg_info alias on reset Copying the STQM backing-store context to seed FTQM's also copied STQM's pg_info pointer verbatim. On cold load STQM's pg_info is still NULL so this is harmless, but on a firmware reset STQM's pg_info is already non-NULL, making FTQM alias STQM's backing-store pages. The allocator then skips FTQM since it looks already allocated, and FTQM is later indexed as its own array, reading out of bounds into STQM's buffer and dereferencing a bogus DMA address. Clear ctxm->pg_info after the memcpy so FTQM always gets its own backing store. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58615
if_bnxt: Never ARM Tx CQ as they are not interrupt-driven Tx completion rings are not interrupt-driven, so there is no need to ring the doorbell with CQ_ARMALL and toggle bits set for them. Stop arming the Tx CQ doorbell on P5+, which makes tx_cp_rings[]->toggle dead, so drop the now-unnecessary toggle bookkeeping for it in process_nq() too. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58616
if_bnxt: fix HWRM failures/timeouts after repeated FW resets Consecutive firmware-initiated reset cycles produced HWRM failures/timeouts and traffic didn't come back. Fix the FW-reset recovery path: - bnxt_fw_reset_close() called bnxt_stop() and bnxt_hwrm_func_drv_unrgtr(), sending HWRM ring/VNIC/filter free commands to a firmware that's already mid-reset and unresponsive, producing the observed timeouts. Both are unnecessary since firmware comes back with fresh state anyway; drop them along with the now-redundant iflib_request_reset(). - bnxt_func_reset() now skips bnxt_hwrm_resource_free() entirely while BNXT_STATE_IN_FW_RESET is set, for the same reason. - bnxt_open() (used to reopen after a firmware reset) now issues bnxt_hwrm_func_reset() up front and drives reinit through iflib's own reset machinery (iflib_request_reset() plus a new bnxt_iflib_reset_sync() that waits for IFF_DRV_RUNNING/OACTIVE to flip 1->0->1) instead of calling bnxt_init()/bnxt_intr_enable() directly. - Route repeated PORT_QSTATS/PORT_QSTATS_EXT HWRM timeouts through bnxt_log_live() instead of device_printf(), so a stats poll timing out during a reset doesn't spam dmesg on every tick. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58617
if_bnxt: support more Tx rings than Rx rings on P5+ Add an unsupported-config guard rejecting nrxqsets > ntxqsets, and teach the P5+ NQ datapath to handle the opposite asymmetric case: extra Tx rings beyond the Rx ring count. softc->nq_rings[i].type now tags each NQ as SHARED_NQ (paired with an Rx CQ) or BNXT_TX_ONLY_NQ (dedicated to an extra Tx CQ with no backing Rx ring); bnxt_init() and bnxt_hwrm_resource_free() gate all Rx ring group/ring/stat-ctx alloc and free on IS_SHARED_NQ() so the extra Tx-only NQs don't touch nonexistent Rx ring state. Gate the new type-tagging and IS_SHARED_NQ checks on BNXT_CHIP_P5_PLUS(), since non-P5+ chips never allocate softc->nq_rings and would otherwise access a nonexistent array. BNXT_TX_ONLY_NQ is a distinct value from the existing MPC-private TX_CP_NQ; the two are unrelated and kept apart to avoid confusion. Suggested by: gallatin Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58618
if_bnxt: drop redundant PCI disable in bnxt_fw_reset_close() bnxt_fw_reset_close() unconditionally called pci_disable_device() after freeing the Rx IRQs, on every firmware reset, not just the BNXT_STATE_FW_FATAL_COND path which already disables the device via bnxt_fw_fatal_close(). BNXT_FW_RESET_STATE_ENABLE_DEV in bnxt_fw_reset_task() already re-enables the device unconditionally, so this wasn't leaving the device disabled, just adding an unnecessary PCI disable/re-enable cycle around every non-fatal reset. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58619
if_bnxt: drop epoch_arr[] to detect EPOCH bit toggle The EPOCH array size is 4096 but the driver does not enforce any limit on ring size, so setting ring size >4096 corrupts adjacent memory and leads to undefined behavior. Toggle epoch_bit directly at every ring-producer wrap point (TX/RX encap and refill, MPC crypto commands, kTLS presync/replay) instead of looking it up per-index in the doorbell path, dropping the now-unused epoch_arr[] snapshot array. Reported by: gallatin Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58620 Change-Id: I4673d64670ee0e8ea256b8a8932724bbd73f710d
if_bnxt: rework interrupt coalescing onto the AGGINT_QCAPS scheme Query firmware-advertised coalescing capabilities and program per-direction rx/tx coalescing settings against them, replacing the old hardcoded scheme. Add sysctls for the coalescing mode, budget, and stats-timer knobs the new scheme exposes. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58621
if_bnxt: log: fix missing lock coverage in bnxt_log_live() bnxt_log_live() walked the loggers TAILQ without holding log_lock, unlike every other bnxt_log.c function, racing against concurrent bnxt_register_logger()/bnxt_unregister_logger() calls. Take log_lock around the traversal, and bail out early (with the lock dropped) if live_msgs_len has already reached max_live_buff_size, which would otherwise underflow the length passed to bnxt_log_info(). bnxt_start_logging_driver_coredump() now drops log_lock before invoking logger->log_live_op() (which calls back into bnxt_log_live()) and re-acquires it afterward, resetting live_msgs to NULL so a later bnxt_log_live() call (e.g. from a VF async event handler) can't write into a coredump buffer the caller has already freed. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D59086
if_bnxt: sysctl: remove unused linux/delay.h include and dead mutex <linux/delay.h> and the DEFINE_MUTEX(tmp_mutex) it enabled are both unused in bnxt_sysctl.c: no msleep/udelay/mdelay call remains, and tmp_mutex itself was never referenced anywhere. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D59087
if_bnxt: sriov: replace Linux kPIs with FreeBSD native APIs Convert bnxt_sriov.c and related SRIOV files from Linux to FreeBSD native equivalents: - Replace cpu_to_le16/32/64/le16_to_cpu with htole16/32/64/le16toh. - Replace Linux is_valid_ether_addr, ether_addr_equal, ether_addr_copy with local bnxt_eth_addr_valid/bnxt_eth_addr_equal/bnxt_eth_addr_copy helpers built on ETHER_IS_MULTICAST/ETHER_IS_ZERO. - Replace kcalloc/kzalloc/kfree with malloc/free (M_DEVBUF, M_WAITOK|M_ZERO). - Replace dma_alloc_coherent/dma_free_coherent with iflib_dma_alloc/ iflib_dma_free; add struct iflib_dma_info hwrm_cmd_req_mem[4] to bnxt_pf_info to hold the DMA handles. - Replace the Linux unsigned long *vf_event_bmap with FreeBSD bitstr_t *, allocated via bit_alloc(); bit_ffs_at()/bit_clear()/ bit_set() replace find_next_bit()/clear_bit()/set_bit() on it (if_bnxt.c's vf-event producer side included). - Replace DIV_ROUND_UP with howmany; rcu_assign_pointer with a plain store. - Harden bnxt_alloc_vf_resources() error paths to free partially-allocated DMA pages and the VF array before returning ENOMEM. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D59088
if_bnxt: port workqueue, task-queue, and synchronization kPIs to FreeBSD natives - Replace Linux workqueue (struct workqueue_struct, bnxt_pf_wq) with a FreeBSD taskqueue (bnxt_taskq) shared by every attached PF. bnxt_taskq is created once at module load and destroyed once at module unload (SYSINIT/SYSUNINIT on SI_SUB_KLD), matching the module-owned-taskqueue idiom used elsewhere in the tree (e.g. sys/dev/cxgbe/t4_main.c's reset_tq). This replaces an earlier lazy, per-attach/detach create-or-reuse scheme guarded by a mutex and a "ready" flag, which had a real race: bnxt_queue_sp_work()/bnxt_queue_fw_reset_work() and bnxt_attach_pre() re-read the bnxt_taskq/bnxt_taskq_ready globals outside the mutex right after the lazy-init call returned, so a concurrent bnxt_detach() on another PF freeing the shared queue once bnxt_num_pfs hit 0 could race a still-attached PF into enqueuing onto a freed taskqueue. Tying the taskqueue's lifetime to the module instead of to any one PF's attach/detach removes that race outright, since the module can't unload while a PF is still attached. - Replace struct work_struct sp_task with struct task sp_task; replace struct delayed_work fw_reset_task with struct timeout_task fw_reset_tmo. - Replace INIT_WORK/INIT_DELAYED_WORK with TASK_INIT/TIMEOUT_TASK_INIT; queue_work/schedule_work with taskqueue_enqueue; queue_delayed_work/schedule_delayed_work with taskqueue_enqueue_timeout; cancel_work_sync/cancel_delayed_work_sync with taskqueue_drain/taskqueue_drain_timeout. - Rename bnxt_fw_reset_task(struct work_struct *) to bnxt_fw_reset_timeout_task(void *ctx, int pending) to match FreeBSD timeout_task callback signature. - Add inline helpers in bnxt.h to wrap all Linux test_bit/set_bit/ clear_bit/test_and_clear_bit calls on softc->state and softc->sp_event: bnxt_drv_state_test/set/clear/test_and_clear, bnxt_sp_event_set/test_and_clear (implemented via bit_test() from <sys/bitstring.h> and atomic_testandset_long()/ atomic_testandclear_long(), all bit-index based like the Linux bitops they replace). - Replace struct mutex lock in bnxt_fw_health with struct mtx; mutex_init to mtx_init. - Replace kzalloc/kfree with malloc/free (M_DEVBUF). - Replace DIV_ROUND_UP with howmany; hweight32 with bitcount32. - Replace jiffies/HZ with ticks/hz; msleep with pause_sbt(). Since `ticks` (unlike LinuxKPI's `unsigned long jiffies`) is a 32-bit `volatile int` that wraps every ~24 days at hz=1000, BNXT_TIME_AFTER and bnxt_sleep_until_min_elapsed() compute the ticks delta as `int` (matching the in-tree wraparound-safe idiom used elsewhere, e.g. sys/dev/axgbe/xgbe-mdio.c) rather than widening it to `long`/ `unsigned long`, so the comparison stays correct across a wrap. - Replace IS_ERR_OR_NULL/ERR_PTR with plain NULL checks. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D59089
if_bnxt: port endian, memory-barrier, and bitops kAPIs to FreeBSD natives There are few more Linux kernel APIs left in the code. So, replaced them with corresponding FreeBSD native APIs. - Replace cpu_to_le16/32/64/le16_to_cpu/le32_to_cpu/le64_to_cpu with htole16/32/64/le16toh/le32toh/le64toh throughout bnxt_hwrm.c and the vf-event producer path in if_bnxt.c. - Replace rmb()/wmb() interprocessor-ordering uses in bnxt_ulp.c (publishing/consuming ulp->async_events_bmap and max_async_event_id across CPUs) with atomic_thread_fence_acq()/atomic_thread_fence_rel(); keep wmb() for the HWRM doorbell/DMA ordering barrier in _hwrm_send_message() (bnxt_hwrm.c), since atomic_thread_fence_rel() compiles to a bare compiler barrier on amd64/i386 and does not order the request-buffer store against the doorbell MMIO write. - Replace hweight32 with bitcount32, ARRAY_SIZE with nitems, and DECLARE_BITMAP with a plain unsigned long array (sized via howmany()) in bnxt_hwrm_func_drv_rgtr(); replace the __set_bit/ test_bit calls there with bit_set()/bit_test() from <sys/bitstring.h>, which correctly index the multi-word bitmap (event IDs up to 0x45 span more than one 64-bit word). - Replace the remaining DIV_ROUND_UP/HZ with howmany/hz in bnxt_handle_async_event()'s error-recovery timer setup. - Replace bnxt_sriov.h's <linux/pci.h> include with the native <dev/pci/pcireg.h> + generated "pci_if.h", now that nothing in that header needs Linux's struct pci_dev. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D59090
if_bnxt: don't reserve RoCE MSI-x on chips that don't support RoCE RoCE is only supported on Thor and onwards chips. bnxt_init_sctx_variants() unconditionally set isc_admin_intrcnt to BNXT_ROCE_IRQ_COUNT for every PF device, stealing 9 MSI-x vectors from older, non-RoCE-capable chips that will never use them. Gate the reservation on the device ID: RoCE-capable chips keep BNXT_ROCE_IRQ_COUNT, other chips fall back to 1, the baseline isc_admin_intrcnt value used before RoCE support (commit 050d28e13cde) repurposed it for RoCE MSI-x on every device. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D59091
if_bnxt: add support for SIOCGI2CPB page/bank i2c requests Advertise IFLIB_I2C_PAGE_BANK and forward the requested page/bank to firmware, so CMIS optics can be read correctly instead of falling back to bogus legacy SFF-8472 decoding. Also fix bnxt_i2c_req() to return positive errno values. Signed-off-by: gallatin Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D59573
if_bnxt: dcb: serialize HWRM sends and avoid freeing DMA bufs on timeout Every _hwrm_send_message() call in bnxt_dcb.c ran without BNXT_HWRM_LOCK, unlike the rest of the driver, letting concurrent HWRM commands race on the shared MMIO doorbell and response buffer. Route single-shot sends through the already-locked hwrm_send_message() wrapper, and wrap the remaining send+response-read sequences in explicit BNXT_HWRM_LOCK/UNLOCK. Also stop freeing the transient DMA buffers used for structured-data get/set on ETIMEDOUT: a host-side timeout doesn't guarantee firmware actually gave up, so a late completion could still DMA into memory that's since been freed and reused. Leak the buffer instead in that case. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D60179
arm64: Add a header for system instructions Like armreg.h for system registers add a header to hold macros for system instructions. Reviewed by: jhb Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59147
arm64: Use sysinsn.h to generate tlbi instructions Some toolchains may not understand the .arch_extension. Reviewed by: jhb Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59148
arm64: Fix the MPIDR_EL1 field names Use the field names from the Arm Documentation for the MPIDR_EL1 register. These will later be generated from a BSD Licensed JSON file so to reduce the diff for that rename now. Reviewed by: kajetan.puchalski_arm.com Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D59176
bhyve: Use the new spelling of MPIDR_Aff* Fixes: https://cgit.freebsd.org/src/commit/?id=6bf6fe1d70e7 ("arm64: Fix the MPIDR_EL1 field names") Sponsored by: Arm Ltd
ICH_LR_EL2 bit 41 (EOI) determines whether a maintenance interrupt will be asserted if the interrupt identified by the LR's vINTID is deactivated. For level-triggered interrupts, that maintenance interrupt is necessary for the host to resample the current level once the interrupt is deactivated. Set the EOI bit when flushing level-triggered interrupts into LRs. Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com> Reviewed by: andrew Sponsored by: Arm Ltd Pull Request: https://github.com/freebsd/freebsd-src/pull/2437
vgic_cpu->private_irqs is allocated but never freed, as a result leaking memory whenever the vmm module is unloaded. Add the missing free. Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com> Reviewed by: andrew Sponsored by: Arm Ltd Pull Request: https://github.com/freebsd/freebsd-src/pull/2439
x86: Add external retpoline thunk This allows use of -mindirect-branch=thunk-extern, and is only a few bytes of dead code if not used. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60524
x86: Fix retpoline capitalization Fixes: https://cgit.freebsd.org/src/commit/?id=74d971fe1561 ("x86: Add external retpoline thunk")
Suspend routine for USB4 v1.0 NHIs. This will work on v2.0 NHIs too for now, but there's ideally a different method we should be using for those in fine. Reviewed by: imp, ngie, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49453
bnxt_dcb_init() currently pushes all-zero ETS and PFC settings to the firmware at every attach. This reserves bandwidth allocation for RoCE traffic, which prevents L2 traffic from reaching line rate. These settings should only be updated with valid values when the RoCE driver is loaded. Therefore, we should stop programming them during bnxt_dcb_init(). Signed-off-by: Andy Gospodarek <gospo@broadcom.com> Reviewed by: chandrakanth.patil_broadcom.com, gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D60516
The TX interrupt handler checked MGB_INTR_STS_RX(qidx) instead of MGB_INTR_STS_TX(qidx) -- presumably a copy-paste issue. Because the driver does not use TX interrupts so there was no actual issue in practice. Reviewed by: adrian Sponsored by: The FreeBSD Foundation Fixes: https://cgit.freebsd.org/src/commit/?id=8890ab7758b8 ("Introduce if_mgb driver for Microchip LAN743x PCIe NIC") Differential Revision: https://reviews.freebsd.org/D60550
Mask all interrupts when suspending and warn when there are unserviced interrupts which might block entry to S0i3. In the future we won't want to mask wake interrupts. Once we can actually make use of GPIO interrupts on x86, we'll also want to unmask relevant pins when resuming. Reviewed by: aokblast, avg Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51589
A single page invalidation sets addr2 == 0. In the original code, it falsely flush the whole address in non global pmap. However, the kernel pmap are all PG_G, which means a single page flush will always be staled and thus become invalid. As a result, we set parameter based on their op in a new helper function instead of relying on args. This affects only on AMD platform as Intel has their PTI implementation. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291577 Tested by: franco@opnsense.org MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60380
The pm_active bitmask is indexed by hart IDs which can differ from CPU IDs. `pmap_invalidate_range_svinval` assumes that the map is indexed by CPU IDs, which is wrong and causes remote TLB invalidations on unrelated CPUs. Fix this by adding a routine that converts a hart-indexed bitmask to a CPU ID-indexed bitmask. While we're here, fix a similar issue in `pmap_active_cpus`. Fixes: https://cgit.freebsd.org/src/commit/?id=99360212c739 ("riscv/pmap.c: Add an Svinval-aware variant of pmap_invalidate_range") Reported by: markj Reviewed by: markj, mhorne Differential Revision: https://reviews.freebsd.org/D60072
Network-related commands, library, and kernel.
We cannot simply treat a pointer to struct oin6_aliasreq as a pointer to struct in6_aliasreq: the latter is larger. In particular, the store to ifra->ifra_vhid is out of bounds. Since OSIOCAIFADDR_IN6 does not need to copy data back out, it can simply use a struct in6_ifaliasreq on the stack. Reported by: Andrew <xxx.sys@protonmail.com> Reviewed by: pouria MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60184
The TCP-over-UDP ICMP callback receives ip6c_m as a borrowed chain owned by icmp6_notify_error. It used m_pulldown() to obtain a contiguous UDP header even though that API frees the complete chain when the requested range is unavailable. The callback could then return without propagating the lost ownership, leaving raw ICMP delivery to read and free a stale head. Validate that the complete UDP header was quoted, copy it through the chain with m_copydata(), and temporarily advance the parser offset instead of consuming bytes from the caller-owned packet. A remote sender can reach the old path when TCP UDP tunneling is enabled by quoting the configured local UDP source port in an ICMPv6 error and including only four through seven UDP-header bytes. Signed-off-by: Andrew Griffiths <andrew@calif.io> Reviewed by: pouria, tuexen, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60143
For a lightly used ring iflib_txd_db_check() may defer zero descriptors,
so its "pending >= limit" test is true even when nothing has been queued
since the last doorbell. iflib_txq_drain() calls it before, inside and
after its loop, so a sender that drains its own packet wrote the tail
register three times per packet, twice with the value the hardware
already had.
The log of 81be655266fa ("iflib: ensure that tx interrupts enabled and
cleanups") calls skipping the doorbell when db_pending is zero "an
obvious missing optimization"; the comparison against a limit of zero
defeated it. vmx(4) and mgb(4) have dropped such repeated requests in
the driver since 2019. Return early when nothing is pending.
Reviewed by: gallatin
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60290
Invert the test so the doorbell write is no longer nested inside the
conditional, and wrap its comments to 80 columns. Fix a typo in one of
them.
No functional change intended.
Reviewed by: kbowling
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60371
Requested by: glebius Reviewed by: pouria, glebius MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60247
add_route_flags() drops the RIB lock and passes the existing entry, rt_orig, to add_route_flags_mpath(). If a concurrent delete removes the prefix in that window, the retry re-inserts rt_orig, which is then freed while still linked, crashing later in rn_match(). Pass the new rt instead, return ENOENT when the prefix is gone and RTM_F_CREATE is not set, and fix the rnd_orig NULL check. Approved by: pouria Fixes: https://cgit.freebsd.org/src/commit/?id=c24a8f19c5d5 ("routing: fix rib_add_route_px()") Differential Revision: https://reviews.freebsd.org/D60353
I can't see a reason for vnet_epair_init() and vnet_epair_uninit() to be inconsistent in the sys(un)init run order. Move vnet_epair_uninit() to SI_SUB_PSEUDO, which is more appropriate for software ifnet drivers. Reviewed by: glebius MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60388
NVMe namespace IDs are 1-based, but CTL LUN IDs are 0-based. The in-kernel NVMe ctl(4) target accounts for this by adding one to the LUN ID to compute a namespace ID. ctld was attempting to handle this by translating namespace IDs from config files to internal LUN IDs, but it did this incorrectly resulting in the namespace configured for as namespace N actually showing up as namespace N + 1. Fixes: https://cgit.freebsd.org/src/commit/?id=66b5296f1b29 ("ctld: Add support for NVMe over Fabrics") Sponsored by: Chelsio Communications
key_unregister_ifnet() was erroneously decrementing the size of the global security policy database, V_sptree, but it doesn't modify that database. V_sptree_ifnet is for policies attached to if_ipsec interfaces. Note also that key_register_ifnet() was not incrementing the counter. Move the definition of V_spd_size up to the rest of the SPD definitions. Its inclusion among the SPD cache definitions was confusing to me. Reviewed by: ae Reported by: Stephan de Wit and Cedrik Pischem from OPNsense Sponsored by: OPNsense Sponsored by: Klara, Inc. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60418
Without a suitable link-local address, in6_ifadd() obtains the interface identifier from in6_get_ifid(). It wrote the result into a freshly allocated struct in6_ifaddr, M_NOWAIT since the function runs in the network epoch, so SLAAC could fail under memory pressure over a 16 byte scratch buffer. Write the identifier into the on-stack address the rest of the function uses instead. Zero it first, in6_get_ifid() only fills in the low 64 bits, as the M_ZERO allocation did. Track which path provided the identifier with a flag instead of a pointer into the ifaddr, so each path releases its own reference. Reviewed by: glebius Fixes: https://cgit.freebsd.org/src/commit/?id=9e792f7ef729 ("sys/netinet6: Fix SLAAC for interfaces with no /64 LL address") Fixes: https://cgit.freebsd.org/src/commit/?id=f9fc93690aef ("sys/netinet6: fix memory corruption in in6_ifadd") MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60488
Inbound lookups find the (alias address, alias port, link type) group with a splay tree and then walk grp->full, a list of every fully specified link in that group, comparing the remote address and port. With redirect_addr in front of a busy server, every client connection to public:443 lands in the same group, so each inbound packet that is not near the head of the list walks all of it. TCP links live up to 24 hours unless libalias sees a clean close, so the list can grow to hundreds of thousands of entries and saturate a core at a few hundred packets per second. Keep the fully specified links of a group in an RB tree ordered by (dst_addr, dst_port). Links that share an endpoint are ordered newest first by a per-instance insertion counter, which keeps the "most recent link wins" behaviour of the list (tested by 3_natin:2_portoverlap). Lookups with an unknown remote address and a known port still scan the group. Each link grows by 16 bytes. With ~170,000 links in one group, LibAliasIn() took 1-2 ms per packet and one core saturated at ~720 packets/s. With this change it takes 2-4 us per packet and the offered 1,000 packets/s are handled with the thread nearly idle. Sponsored by: NLINK Differential Revision: https://reviews.freebsd.org/D60083
if_me(4) registers its net.link.me node with the static OID number
IFT_TUNNEL, the same number if_gre(4) has used for net.link.gre since
2003, so the two tunnel drivers collide under net.link. Until
d35c4cfad580 that only printed a warning and left two nodes with the
same number; since then sysctl_register_oid() panics, so loading if_me
after if_gre (or the other way round) takes the box down:
kldload if_gre
kldload if_me
panic: sysctl: OID number(131) is already in use for 'me'
Use OID_AUTO like the other tunnel drivers. Nothing addresses the node
by number.
Reviewed by: ae
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60536
RSS hash calculations no longer depend on RSS macro. Therefore, remove unused macros and its XOR fallback. Reviewed by: adrian Fixes: https://cgit.freebsd.org/src/commit/?id=9c55b2e8cd6b ("rss: Enable portions of RSS globally to ...") Differential Revision: https://reviews.freebsd.org/D60556
Following 8b21c469dbd6 add more entries for various MT BT USB VPI combinations given we currently do not support any of them. Suggested by: thierry (while testing MT7920 wireless) MFC after: 3 days Reviewed by: emaste, imp Differential Revision: https://reviews.freebsd.org/D60279
The work queued by ng_send_fn() is intentionally processed outside of the epoch in ngthread(). It is ng_ksocket's responsibility to enter epoch if it decides to send data from such work. Reviewed by: glebius Fixes: https://cgit.freebsd.org/src/commit/?id=104827151e2a ("ng_iface: don't recursively enter epoch ...") Differential Revision: https://reviews.freebsd.org/D60589
if_gre(4) registers net.link.gre with the static OID number IFT_TUNNEL.
That number is an interface type that several tunnel drivers share, not
one that belongs to gre(4). if_me(4) used it too, which made loading
both modules panic until 21f2245de219. Nothing addresses the node by
number, so use OID_AUTO as if_me(4) now does.
Suggested by: markj
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
This was done in all code paths except one. Fix this to avoid race conditions. Reported by: syzbot+2e2dc35c0e24a74663a7@syzkaller.appspotmail.com Reviewed by: tuexen MFC after: 1 week MFC to: stable/14 MFC to: stable/15
This is a brief introduction into the top-level newbus driver methods and net80211 driver registration. Differential Revision: https://reviews.freebsd.org/D60503 Reviewed by: ziaee, zi
* add the driver registration doc to README.md * fix the links to resolve correctly with current doxygen (1.18.0) with the current file path -> sanity conversion -> html path rules. Differential Revision: https://reviews.freebsd.org/D60504 Reviewed by: ziaee
When a message outgrows the writer's buffer, _nlmsg_refill_buffer() allocates a larger one and moves the unfinished message there. The new buffer was sized for the data about to be added alone, so with enough of the message already written the caller wrote past its end and left it with datalen > buflen. A 20-byte message plus an attribute of 8176 bytes got a buffer of 8192 bytes for 8200 bytes of data, and reading it panicked an INVARIANTS kernel in nl_soreceive(). Size the new buffer for both, and add a ktest for it. Reviewed by: glebius Fixes: https://cgit.freebsd.org/src/commit/?id=7e5bf68495cc ("netlink: add netlink support") MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60541
Stuff in man section 8 (other than networking).
Fixes: https://cgit.freebsd.org/src/commit/?id=d45d7aea6197 ("i386 rtld: implement support for TLSDESC relocation") Sponsored by: The FreeBSD Foundation MFC after: 1 week
Currently, userdisk_init() iterates through disks and checks whether DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls are available for the device. If either ioctl fails, userdisk_init() returns ENXIO with ud_info only partially initialized. devinit() records the failure, but loader_main() ignores devinit()'s return value, so later code may access an uninitialized entry. In certain cases this code can still boot from a disk even if userdisk_init() returns ENXIO, for example, when the first of two disks is valid and the second errors out. To address this issue while not breaking the current behavior, do the following: - Zero-initialize the userdisk_info array and use a zero media size to mark disks that do not support the ioctls mentioned above or report an empty medium. - Update userdisk_print() not to print unusable disks. - Update userdisk_open() to return EIO for unusable disks. - Update extract_currdev() to pick the first usable disk instead of the first disk. Introduce userboot_disk_firstunit() for that. Additionally, reset counters on ud_info allocation failure to prevent accessing unallocated data. Reviewed by: jhb (previous version), markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59262
The obj->path is assigned directly from the path argument, and load_object() frees the path on do_load_object() failure. Do not free it in obj_free() on the error path. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60402
The majority of lines of code currently in fwdownload.c come from ken@'s
rework in commit 0e358df062dd ("Revamp camcontrol(8) fwdownload support
and add the opcodes subcommand."). Add the appropriate copyright.
Approved by: ken
dhclient: recognize the Captive Portal DHCP options Rename option 114 from "url" to "captive-portal" (RFC 8910) and retain "url" as a deprecated alias. Rename option 160 from the generic "option-160" to "captive-portal-legacy" (RFC 7710). Reviewed by: emaste, dch Apprived by: emaste, dch Differential Revision: https://reviews.freebsd.org/D60256
dhclient: request the Captive Portal options Add DHCP options 114 (captive-portal) and 160 (captive-portal-legacy) to the default Parameter Request List so that servers advertise the Captive Portal API URI. Approved by: emaste Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D60257
dhclient: export the Captive Portal URI to the script Differential Revision= https://reviews.freebsd.org/D60259
Write the URI received in DHCP option 114 to /var/run/captive-portal.IFACE atomically, with the legacy option 160 as a fallback, and remove the file on EXPIRE and FAIL. Reviewed by: bcr (manpage) Differential Revision: https://reviews.freebsd.org/D60259
Reviewed by: dteske, olce Approved by: christos (mentor) MFC after: 1 week Sponsored by: fme AG Differential Revision: https://reviews.freebsd.org/D60408
mountd exits if it cannot read any exports files. Requiring /etc/exports, however, unconditionally stops mountd from starting on a server that exports ZFS datasets only (/etc/zfs/exports). Let sbin/mountd handle requirements itself, instead of hardcoding /etc/exports, which is also wrong, because different files can be specified in mountd_flags. This patch also works with nfsv4_server_enable="YES", by preserving the behavior of failing to start if there is no "V4:" line in the exports file, which is missing by default on ZFS-only exports. MFC after: 1 week Sponsored by: The FreeBSD Foundation Reviewed by: rmacklem, markj, emaste Differential Revision: https://reviews.freebsd.org/D60044
c4640126f1160 ("loader.efi: Apply command-line DHCP overrides earlier")
was really good, but moving it just one statement earlier is even
better. polarian on Libera describes a GELI setup on a system that
doesn't advertise a serial console via ConOut. They don't have serial
input at the point that they would get prompted for the GELI passphrase,
but if we parse args just before devinit() then he can override the
console with `efibootmgr -e`. This gives UEFI one advantage over BIOS
loader, as /boot.config isn't available to provide that kind of override
if your impediment is GELI.
We also considered reading loader.env earlier, but we have a chicken/egg
problem in that we must have probed for the ESP to be able to open() it.
We would instead need a devinit_early() and devinit_late() scheme that
allows GELI probing to be deferred until the later pass, after reading
loader.env to pick up the console override. That's an idea I'd still
like to discuss because it's more robust than hoping that firmware won't
wipe out our efibootmgr(8) entries.
Tested by: polarian on Libera
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D60449
This is a kernel-only header for /dev/io. The user-facing header defining the ioctl commands is <dev/io/iodev.h>. Reviewed by: bnovkov, imp Differential Revision: https://reviews.freebsd.org/D60399
Exact match still wins. An ambiguous prefix is rejected with the list of matches. Move keyword selection and the rc pass-through into sysconf-targets.c. Bump sysconf(8) to 2.1. Reviewed by: kfv Differential Revision: https://reviews.freebsd.org/D59924
poudriere.conf is handed to sysrc(8), including the jail, tree, and set overlays poudriere(8) consults. make, src, and src-env are sub-targets over the matching make(1) files under poudriere.d. -l and -L list one path per line; -L includes overlays that do not exist yet. A bare -- ends the sub-target so the next word is a variable. Bump sysconf(8) to 2.2. Reviewed by: fuz, kfv, bcr Differential Revision: https://reviews.freebsd.org/D59943
The root directory of a dataset is populated from an fsnode that is the "." entry of the staging directory, and its children are the siblings of that node, so the loop that computes the link count and the size of the directory (which expects "." among the children, as the nodes of the other directories have) never counts it. The link count of the root of every dataset is one less than it should be (1 for an empty dataset instead of 2, 19 instead of 20 for a root with 18 subdirectories), and so is its size. fts(3) trusts the link count of the directories of ZFS when called with FTS_NOSTAT and FTS_PHYSICAL: it stops looking for subdirectories once it has seen as many as the link count says, and does not descend into the ones it did not look at. As a result find(1), and rm(1) when it does not need to stat the entries, silently skip directories of a pool made by makefs. On a root filesystem made by makefs, find / does not list /etc at all. Start the loop at the "." node itself for the roots of datasets, so that it is counted the same way as in every other directory. Add a test that checks the link counts and the sizes of the dataset roots and of the other directories, with nested datasets and a dataset whose mountpoint is not in the staging tree, and that find(1) sees the whole tree. Fixes: https://cgit.freebsd.org/src/commit/?id=240afd8c1fc ("makefs: Add ZFS support") MFC after: 1 week Approved by: markj Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60439
Sponsored by: The FreeBSD Foundation MFC after: 3 days
We unlock the bind lock around .init calls anyway. Also, the main object cannot be unloaded. Reported and reviewed by: dim PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298943 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60588
safe_var_set can be used to safely handle var=val args from command line.
eg.
while :
do
case "$1" in
*=*) # eval "$1" can be very dangerous
# safe_var_set will only eval if
# both var and value are sane.
if ! safe_var_set "$1"; then
case "$?" in
1) echo invalid variable name;;
2) echo invalide value;;
3) echo variabel not allowed;;
esac
fi
shift
;;
*) break
;;
esac
done
Get the log message right! Fix default allowed chars (untabify clobbered TAB) Add a couple more : messages to help debugging.
The description was out of sync wrt return values. 1. invalid var 2. invalid val 3. var not in allowed list
The function went when DIOCRINADEFINE was converted to netlink; pfctl calls pfctl_ina_define() from libpfctl instead. Name that one in the error message that pfctl_load_tables() prints when it fails. Fixes: https://cgit.freebsd.org/src/commit/?id=219ce3063840 ("pf: convert DIOCRINADEFINE to netlink") Sponsored by: Rubicon Communications, LLC ("Netgate")
Use options to set ssv_{allow,only,extra}
Improve the documentation.
Add a test harness for safe_set_var.
Also use $ssv_extra$ssv_only as the default for $ssv_only has '-' which must be last in the character class.
Commit 1a296762b3d0 made libcasper pass PD_NOWAITPID to pdfork(2). Kernels predating the flag (15.1 and earlier, since the flag first ships in 15.2) reject it with EINVAL, which makes cap_init() and every service fork fail when a newer world runs on an older kernel, for example in a poudriere jail. Add casper_pdfork(), which retries without the flag on EINVAL, and use it at both pdfork(2) call sites. The retry is safe because the kernel validates pdfork flags before creating a child. On such kernels the zombie must still be reaped with waitpid(2), as before the flag was introduced. The fallback is compiled out once __FreeBSD_version reaches 1700000, so it disappears from main when stable/16 branches while remaining in the stable/15 and stable/16 branches that need it. Reviewed by: kib MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D60401
eXpat 2.9.0 deprecates XML_GetCurrentLineNumber() in favour of XML_GetCurrentLineNumber64(). The new function behaves the same as the old one but is not prone to 32 bit integer wrap-around.
MFC after: 2 weeks
counter + 1 > 0 is a undefined behavior and nobody guarantee that it will be honestly perform by the compiler that counter + 1 will always be INT_MIN. We switch to INT_MAX check instead to provide a deterministic result. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60426
This causes count == -1 spin for INT_MAX times in userspace. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60425
On a 64 byte cache line CPU (amd64), m_owner is contended by all of the shared processes. However, after finding one winner, mtx is enqueued, which trigger a cache refresh from other processors. Reorder mtx so that m_lock and m_qu will not be in the same cache line. Notice that this doesn't affet arch that expose 128 bytes cache line line aarch64 or powerpc. Reviewed by: kib, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60434
1. When contester > 2, a release causes kernel set CONTENTION bit but with no owner. In this case, the userspace should be able to try the lock instead of fall immediately. We copy this from trylock2. 2. A PI mutex should consult to kernel instead of decided by userspace itself. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60427
While testing the bare values happens to work, the intent is to test for their definition. Reviewed by: emaste Fixes: https://cgit.freebsd.org/src/commit/?id=9a16bd169e8c ("libsysdecode: support errno and syscalls for arm64 Linux") Fixes: https://cgit.freebsd.org/src/commit/?id=b69ae1a34c6f ("libsysdecode: Add preliminary support for decoding Linux syscalls") Differential Revision: https://reviews.freebsd.org/D60415
Make the libcrypto Version.map export the same symbol names as upstream 3.5.8 (and 3.5.9, no new symbols were added). Remove 52 names that upstream does not export: - the internal threading and record layer functions (ossl_crypto_*, ssl3_cbc_*, tls1_cbc_*), which only libssl used; - the internal WPACKET_quic_* functions; - OPENSSL_cpuid_setup; - ASN.1 item functions that are not in util/libcrypto.num. Add 7 public names that were missing (ASYNC_get_mem_functions, ASYNC_set_mem_functions, CMS_EnvelopedData_it, EVP_CipherPipeline*) to OPENSSL_3_5_0, where the other symbols from upstream 3.1 to 3.5 are. EC_GFp_nistp224_method, EC_GFp_nistp256_method and EC_GFp_nistp521_method stay unexported (see 6f6446b33064). Compatibility: libssl.so.35 from earlier builds imports the removed internal symbols, so it does not load with this libcrypto.so.35. libcrypto and libssl must be updated together. This change needs the previous libssl change, which gives libssl its own copies. Nothing in the base system imports a removed symbol. Reviewed by: ngie, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60397
Like yieldloops, we shoulde be able to set _thr_spinloops to zero. Originally, it makes us to enformce default spin time even if we try to disable it. Make MUTEX_ADAPTIVE_SPINS a one time initialization now. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60486
The counts of a table definition were stored only if the caller's variables already held a non-zero value, and read uninitialised ones otherwise. pfctl_ina_define() passes the address of two uninitialised locals and sums them up. Reviewed by: kp Fixes: https://cgit.freebsd.org/src/commit/?id=219ce3063840 ("pf: convert DIOCRINADEFINE to netlink") Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60614
This fixes long-standing issue where ufssuspend file descriptor could leak over fork or be passed over unix domain socket, and then closing it in the opener would not unsuspend the file system. It should not affect the well-behaving growfs(8) utility, but makes the userspace API safer on principle. Reviewed by: markj Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60285
We have identified some cases where silent slot loss can occur when operations on NFS mounts are aborted. We experience this when using NFSv4.2, but it likely also occurs with NFSv4.1. A slot is acquired for compound operations by nfsv4_setsequence() and freed by newnfs_request(). Any call path that abandons the compound before reaching newnfs_request() loses the slot permanently. We identified four call sites where this happens, one of which where it actually does happen for us in a semi-reproducible way, which allowed us to develop a candidate patch, attached. The patch adds one function, nfsv4_freeunsentslot(), to nfs_clcomsubs.c. It is called from each of the four call sites: nfsrpc_writerpc(), nfsrpc_writeds(), and two in nfsrpc_setextattr(). nfsv4_freeunsentslot() calls nfsv4_freeslot() with resetseq set to true because the aborted RPC will never be sent and therefore the slot sequence ID should not advance. With this patch and other diagnostics, we have confirmed that slot loss does not occur under the conditions that otherwise cause it in our environment. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298416 Reviewed by: rmacklem MFC after: 1 week
In principle, inotify can be used to leak timing information about I/O device accesses by privileged process, which might be sensitive, e.g., in the case of /dev/input. See https://inoti.fyi/#1-linux-inter-keystroke-timing In practice this does not work since I/O to devfs nodes does not go through vnodes, so the INOTIFY() calls in various VOP hooks do not fire. But, let's explicitly define a no-op VOP_INOTIFY to help ensure that no one tries to "fix" this bug. Alternately we could simply ignore VCHR/VBLK vnodes in vn_inotify(). However, maybe someday it'll be desirable to enable inotify for specific device files, in which case the filtering should live in devfs. Add a regression test. Reported by: Sudheendra Raghav Neela <sneela@tugraz.at> Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60364
Add an "autotrim" option taking "on" or "off". The value is stored in
the pool properties object alongside "bootfs", so the imported pool
starts trimming freed space automatically without a separate
"zpool set" step. When the option is omitted nothing is written and
the pool keeps the default ("off"), exactly as before.
A string option is used rather than makefs's boolean option type since
the latter ignores its value, which would make "autotrim=off" enable
the feature.
Define the spa_autotrim_t enumeration in the boot zfsimpl.h, copied
from OpenZFS's sys/spa.h, so that makefs can refer to SPA_AUTOTRIM_OFF
and SPA_AUTOTRIM_ON by name. The loader does not use it.
Document the option in makefs(8) and add a regression test.
Reviewed by: markj
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60420
When ERELOOKLUP is returned by a file operation (always vop_lookup?) the operation is retried without doing nfsrv_statsend(). This patch fixes this problem, The only effect of the bug was bogus "nfsstat -d" output. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298534 Reviewed by: rmacklem MFC after: 1 week
Kernel stuff (other than networking, filesystems, and drivers).
Reviewed by: wulf Differential Revision: https://reviews.freebsd.org/D60275
cdevsw: add D_NONPASSABLE flag to make the opened device files non-passable. Reviewed by: markj Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60285
devfs_open: do not access dsw after dev_relthread() Noted and reviewed by: markj Fixes: https://cgit.freebsd.org/src/commit/?id=850d4562928e ("cdevsw: add D_NONPASSABLE flag") Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60393
Submitted by: Yuri Tkachenko <yura.tkachenko at gmail.com> MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D60392
sendfile: Fix build for kernels without INET or INET6 Don't cap the new low watermark to a TCP-specific setting in kernels without TCP. Fixes: https://cgit.freebsd.org/src/commit/?id=6948f4d5e2b2 ("sendfile: keep the lowat hack more conservative")
sendfile: Include opt_inet*.h Pointy hat to: jhb Reported by: markj Fixes: https://cgit.freebsd.org/src/commit/?id=1d8c5f8e0255 ("sendfile: Fix build for kernels without INET or INET6")
For writes, if we fail in the middle of reading from the source, the destination may have already been dirtied. For example, the source may cross a page boundary, and the second page is inaccessible. Conservatively mark the destination as dirty, even on errors. Reported by: Claude (Opus 5.5) Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60280
sched: New scheduler interface definition scheme Define the scheduler interface once and for all (in 'sys/sys/sched.h') and remove all code duplication related to it (function signatures, slot names, dispatch, scheduler instance declaration), making it easier to modify the interface or to add new schedulers. This is implemented by defining the interface as X macros, which are passed a macro (and additional arguments for it) that is "called" with a variable number of arguments describing a single function of the interface. The convention used for a function's parameters is that each parameter is represented with two macro arguments, the first one being the type and the second one being the name. Helper macros allow to process arguments described in this convention in order to generate a list of arguments for function definitions (currently, up to 4 function parameters). The chosen convention eliminates the need for any specific declaration of functions depending on their number of arguments. DECLARE_SCHEDULER() has been changed to automatically declare and fill a 'struct sched_instance' structure. Its number of parameters has been reduced to the minimum, and the symbol part used to produce distinct structure names can now start with a digit (useful for 4BSD). The new implementation has the following additional benefits: 1. The name of implementations for the interface functions is imposed (same name as the interface function but with the scheduler symbol that was passed to DECLARE_SCHEDULER() added just after the 'sched_' prefix, e.g., for ULE, 'sched_ule_*()') and checked at compile-time. 2. Missing functions in an implementation are detected at compile-time (and not at runtime with a NULL dereference). 3. Failures to fill correctly the 'struct sched_instance' object associated to an implementation are eliminated. Preserve comments/categories of interface functions by moving comments that were in the old explicit interface declarations to the SCHED_ITF*() macros, and while here, marginally improve some (and move the common documentation for sched_initticks() from the implementations to the interface). Several of them are not exact, but this will be fixed in a separate commit. Make the active scheduler instance object internal, as it is not used outside of the shim implementation and one of the purposes of the interface is also to hide the actual implementation. If the need arises, it would be easy to add scheduler-specific routines as new fields in 'struct sched_instance' and to extend the machinery to automatically assign routines returning EOPNOTSUPP to these fields, and then to provide a macro to register non-trivial implementation, instead of making the current instance object visible again. Additionally, in order to avoid collision with C and C++ keywords: 1. Fields in 'struct sched_instance' are now suffixed with '_impl', so that, e.g., 'switch()' does not require special treatment anymore and the corresponding implementations can be renamed back to `sched_*_switch()`. This suffix avoids any collision with existing C++ keywords as new functions are added to the interface. (See SCHED_ITF_FIELD_NAME().) 2. Actual interface functions' C declarations do not list parameter names anymore (sched_class() was causing a problem in C++ with its 'class' parameter). allowing to remove the bracketing with '#ifndef __cplusplus'. Reviewed by: mchoo, kib Fixes: https://cgit.freebsd.org/src/commit/?id=ce38acee8d0b ("Add kern/sched_shim.c") (+ some followups) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59988
sched.h: Fix a typo and remove an extra line Fixes: https://cgit.freebsd.org/src/commit/?id=42490d5cd29d ("sched: New scheduler interface definition scheme") Sponsored by: The FreeBSD Foundation
The function updates scheduler statistics but does not complete the bio. Rename it to avoid implying ownership of bio completion. Sponsored by: Netflix Reviewed by: ali_mashtizadeh.com Differential Revision: https://reviews.freebsd.org/D60349
Separate the updating the stats for the completion from the biodone for each one. Sponsored by: Netflix Reviewed by: ali_mashtizadeh.com Differential Revision: https://reviews.freebsd.org/D60155
Separate the updating the stats for the completion from the biodone for each one. Sponsored by: Netflix Reviewed by: ali_mashtizadeh.com Differential Revision: https://reviews.freebsd.org/D60156
Separate the updating the stats for the completion from the biodone for each one. Sponsored by: Netflix Reviewed by: ali_mashtizadeh.com Differential Revision: https://reviews.freebsd.org/D60157
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D60350
Even if SCHED_STATS is not defined, this header is necessary to provide a definition of 'curthread' used in sched_pin() and sched_unpin(). MFC after: 1 week Sponsored by: The FreeBSD Foundation
Make sure that linux_ifnet_departure() can't run after linux_ifnet_vnet_uninit() has destroyed the per-VNET unit number allocator. Otherwise, when ifc_detach_cloner() destroys instances of an interface type, it might be running too late. Most cloner-based drivers tear themselves down during SI_SUB_PSEUDO or SI_SUB_PROTO_IF. Reviewed by: pouria, glebius MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60389
The flag only use is for special handling of core dump vnodes. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60283
PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299095 Reported by: Rick Richard <rick@sloservers.com> Reviewed by: markj Tested by: Rick Richard <rick@sloservers.com> (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60283
rdma-core's mlx5dv_devx_umem_reg_ex() passes the page sizes the caller
can use in MLX5_IB_ATTR_DEVX_UMEM_REG_PGSZ_BITMAP. Add the attribute and
choose the UMEM page size, page offset and MTT count the way Linux commit
7610ab57de56 ("RDMA/mlx5: Allow larger pages in DevX umem") does.
Linux looks at the DMA list only. The UMEM is mapped at an IOVA equal to
the DMA address of its first byte, ib_umem_find_best_pgsz() picks the
largest page size of the bitmap that this mapping allows, and
devx_umem_find_best_pgsize() halves it while the first DMA address is not
aligned to it or the length is not a multiple of it, stopping at
PAGE_SIZE, even if that is below every size in the bitmap.
The FreeBSD OFED layer has none of the ib_umem helpers this relies on,
so local copies of the current Linux ones are added.
ib_umem_find_best_pgoff() and ib_umem_dma_offset() come from Linux
commit b045db62f6f6 ("RDMA/mlx5: Use ib_umem_find_best_pgoff() for
SRQ"), ib_umem_num_dma_blocks() from Linux commit a665aca89a41
("RDMA/umem: Split ib_umem_num_pages() into ib_umem_num_dma_blocks()").
The ib_umem_find_best_pgsz() logic includes Linux commit 486055f5e09d
("RDMA/core: Fix best page size finding when it can cross SG entries"),
without which no page size above 4K would ever be found, as FreeBSD's
ib_umem_get() maps every page as an SG entry of its own, and Linux
commit 09ea6837a043 ("RDMA/umem: Be careful about boundary conditions in
ib_umem_find_best_pgsz()").
Without the attribute the bitmap defaults to GENMASK_ULL(63, 12), as in
Linux. The attribute is read with uverbs_copy_from(), FreeBSD's
uverbs_get_const_default() works on an s64 and rejects any value with bit
63 set, the default included. The page size is kept in a u64, Linux
returns it as an unsigned int and so fails registrations that would use
pages of 4G or more.
Reviewed by: kib
Sponsored by: Nvidia networking
MFC after: 1 month
Prior to this change, in the event that a firmware module could not be loaded, the linux_firmware driver would return a partially initialized structure with uninitialized/zeroed out values for certain fields. Linux does not do this, however, so some drivers that use `request_firmware_nowait` expecting Linux behavior, like `if_bcrmfmac`, would crash trying to dereference a NULL pointer. This doesn't address the load/unload situation completely as the driver remains loaded after the "firmware crashes", but it makes a completely unusable situation (a kernel panic) into a slightly more usable situation (driver does not unload). As a sidenote: the raw free(9) call was replaced with a call to `linuxkpi_release_firmware` because the latter call [better] ensures that all resources allocated earlier on in the function are cleaned up. MFC after: 1 weeks Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D58451
When userland_sysctl() experiences EAGAIN, don't loop internally but leave retrying to the caller. Looping was a problem in case of using tcpsso(8) to switch a TCP stack where the acceptance check of the new TCP stack results in EAGAIN. Reviewed by: kib, glebius MFC after: 1 week MFC to: stable/15 Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D60444
It only contains sched_pin_lite() and sched_unpin_lite(), which have
been unused in-tree for the past 8 years, and were only briefly used
between 6573d7580b85 ("epoch(9): allow preemptible epochs to compose")
and a760c50c9ea7 ("With epoch not inlined, there is no point in using
_lite KPI. (...)").
Additionally, these functions are redundant with the existing
sched_pin() and sched_unpin() in <sys/sched.h>, which are already
themselves inline functions. The only difference is that the
sched_*_lite() ones do not require the full definition of 'struct
thread', which may have been useful to circumvent namespace pollution.
That problem, if it materializes again, could be quickly circumvented
without this trickery by the use of non-inline functions, or using
inline functions referencing a variable filled at kernel startup with
the desired offset. The trickery of using offsets computed at
compile-time appears necessary only in the case of extremely performance
sensitive functions. Cleaning up namespace pollution should stay the
preferred way forward whenever possible.
Reviewed by: glebius, imp
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60404
See the manpage addition for rationale Reviewed by: ziaee, kib Approved by: ziaee, kib Differential Revision: https://reviews.freebsd.org/D59930
Implement debugfs_create_devm_seqfile() keyed by device and a read function. This was implemented months ago in order to support debugfs with mt76 but hasn't been exercised since. The code does not really seem to belong in lindebugfs, but also does not really fit into debugfs.h (rather fs.h?); leave it here with a comment for now as neither dumbbell nor I could come up with a better place. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D57524
In [1] it was pointed out that devm_kmemdup_* have moved apparently in Linux 7.0 into their own device/devres.h header file from device.h. Move them and other parts (some being dependencies) along. device/devres.h gets included from device.h so all that changes is prototype, macro, and inline function ordering. This should prepare us in case drivers start directly including the sub-header. It also helps to keep device.h more reasable. Suggested by: dumbbell (in D56396) [1] MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D60213
LinuxKPI: re-implement pm_runtime.h The original implementation was based on OpenBSD under public domain but just defined the functions to void. FreeBSD later extended the file with more inline functions or dealing with differences in Linux versions. This rework tries to group some functions, adds properly typed arguments and return values in some cases. It further adjusts return values based on the !CONFIG_PM expectations. Lastly pr_debug() calls are added so we could see if/how much these functions are used in new/other works rather than code just compiling but the functions entirely being ignored without the knowledge of the person porting code. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D58169
LinuxKPI: introduce LINUXKPI_DEBUG to enable LinuxKPI debugging This allows us to build kernels which will (if the sysctl is enabled too) show pr_debug() and pr_devel() output. Enable it by default for debug kernels. This option can later also be used for other LinuxKPI parts, like skbuffs, netdevice, rcu, ... to conditionally compile in debugging support to further justify its existence beyond an in-code #define. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D54060
LinuxKPI: use LINUXKPI_DEBUG to determine on witness lock tracing LinuxKPI by default tells witness to ignore the locks, which is unhelpful in case of panics like 'panic: sleeping thread holds lnxspin'. While I have edited the lock initialitzation manually in the past, make this dependent on both LINUXKPI_DEBUG and WITNESS. Define an internal _LKPI_MTX_NOWITNESS (and equivalent for other lock types used) and set them accordingly in kconfig.h, a file automatically included to all LinuxKPI compiled code (like global.h). (*) In addition, in the debug case, also define WITNESS_ALL to get file, line, and lock name as a lock name rather than just, e.g., lnxspin. (*) We will need another follow-up as -include ordering is currently wrong for LinuxKPI modules. See D60207. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D59231
LinuxKPI: pci: cleanup lkpinew_pci_dev_release() Factor out some cleanup routines from the device detach path so we can re-use them here too. Also clarifying that lkpinew_pci_dev_release() should only run from the (*release) callback function means that we adjust our other calls to what we had already envisioned in comments, to go through the official pci_dev_put() path. Compared to the device detach path, we have little chance to know if we held the last reference and if the device is really gone or not but in this case a later release would be fine (if it happens). In contrast to the device detach path we cannot do the hack of setting the .release callback to NULL and check upon return from pci_dev_put() as in this case the pdev is freed. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell (before rebase for ac9c07a3e908 instead of D57430) Differential Revision: https://reviews.freebsd.org/D57431
LinuxKPI: pci: make internal variables file local
The only reason the internal lists and lock are shared seems to be
because the SYSINIT code was in linux_compat.c.
Migrate the three variables (pci_drivers, pci_devices, and pci_lock)
to linux_pci.c and make them file local.
While doing so adjust a few things:
(a) mark the various sections of the linux_pci.c file as we add new
SYSINIT code to the middle of the file. The file currently really
contains three parts.
(b) rename the variables by adding a lkpi_ prefix indicating that they
are part of our internal code and not part of the public KPI, and
to clearly distinguish them from any native PCI code upon which
we call as well.
(c) factor the locking code out into macros as we have often done in
various parts of the kernel to make the lock itself more opaque.
No functional changes intended.
Sponsored by: The FreBSD Foundation
MFC after: 3 days
Reviewed by: emaste, dumbbell (before rebase)
Differential Revision: https://reviews.freebsd.org/D57432
LinuxKPI: pci: first round of file cleanup
While the multiple sections of the file are mostly clearly separated
some bits were spread around.
Get the device methods array to the end of the file saving us a lot
of forward function delcarations and making it easier to rename them
to a common lkpi_ prefix instead of linux_ showing that they are file
local internal functions not part of any official LinuxKPI KPI.
Sort the various lkpi_pci_* bus attachment functions together,
followed by the lkpi_pci_iov_ ones. Then add the
pci_[un]register_driver* driver bits. This keeps the group
logically together.
For the PCI functions then group the pdev allocations and free/release
functions--for the two paths--together, giving them more homogeneous
names and add comments to some of them so it is more clear which
ones are shared ("common") and which ones belong to which code path.
Move some helper function around to where they are needed now.
There is still more to do for the resource section which sits somewhere
in the middle but that will better be a separate pass.
For the DMA and backlight parts, rename various private bits to
a lkpi_ prefix as well (structures, variables, functions) away
from the public linux_ prefix which should belong to the linuxolator
in first place.
No functional changes intended.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell (before rebase)
Differential Revision: https://reviews.freebsd.org/D57433
bsd.lib.mk: only ctfmerge if objfiles have a CTF section PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299013 Reported by: Trond.Endrestol@ximalas.info Reviewed by: emaste Fixes: https://cgit.freebsd.org/src/commit/?id=222210c6a822 ("libgcc_s: add libgcc_s_asneeded.so wrapper for gcc 16") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60252
sys.mk: CTFMERGE: don't assume objfiles always have CTF sections
There are many instances, e.g. in the kernel, where
object files don't have CTF sections, but still need
to be merged into one that does have a CTF section.
This fixes cases like the following:
--------------------------------------------------------------
>>> stage 3.1: building everything
--------------------------------------------------------------
linking kernel.full
ctfmerge -t -L VERSION -g -o kernel.full ...
ERROR: ctfmerge: Input file force-dynamic-hack.pico was partially built from C sources, but no CTF data was present
Removing kernel.full
kernel.full ---
[kernel.full] Error code 1
This partially reverts commit fdd3f6f78888b02a1bfa69a0572317413dc14a45.
PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299013
Reported by: markj
Reviewed by: markj, emaste
Fixes: https://cgit.freebsd.org/src/commit/?id=fdd3f6f78888 ("bsd.lib.mk: only ctfmerge if objfiles have a CTF section")
Differential Revision: https://reviews.freebsd.org/D60378
Don't complain about unaligned atomic operations on i386. This same approach is already used for libspl.
This driver has been in sys/conf/NOTES (and thus enabled in LINT builds on all architectures) since the file was renamed from the i386 LINT and there is no i386-specific code in the driver. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D60177
The utility targets described by this comment are in fact related to building (buildworld), not installing (which is included in `make world`). Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56715
Build targets should generally be run as an unprivileged user. Even though building as root is discouraged many users do so, so just start with a warning. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D50352
For rm -f it's not an error if the files do not exist. If there's any other error it's presumably a real issue, so avoid ignoring all errors. Reviewed by: brooks, adrian Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56714
Some of these messages looked at first glance like they were incorrectly concatenated, e.g. "installing DIRS testsFILESDIR". Add a colon to clarify. Reviewed by: brooks, imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60525
man: Link mgb.4 to if_mgb.4 For consistency, create a symbolic link from mgb.4 to also if_mgb.4 Reviewed by: #manpages, ziaee, emaste Differential Revision: https://reviews.freebsd.org/D60551 MFC after: 3 days
man4: Only link mgb.4 to if_mgb.4 where mgb.4 is installed mgb.4 is only installed on amd64 and i386, move the MLINKS entry into the amd64/i386 block next to _mgb.4. Fixes: https://cgit.freebsd.org/src/commit/?id=05c49e2aa643 ("man: Link mgb.4 to if_mgb.4") MFC after: 3 days Sponsored by: The FreeBSD Foundation
man.4: Create if_mgb.4 symlink on supported architectures only. Fixes: https://cgit.freebsd.org/src/commit/?id=05c49e2aa643 ("man: Link mgb.4 to if_mgb.4") Fixes: https://cgit.freebsd.org/src/commit/?id=e0a5aa37c1ef Differential revision: https://reviews.freebsd.org/D60551
Replace the exclusion list with an allowlist of the architectures whose libc exports brk/sbrk: amd64, i386, arm and powerpc. On aarch64, riscv and loongarch libc does not export those symbols and the test cannot run, so do not build it there. New architectures now default to not building the test unless brk support is added. MFC after: 1 week Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007@gmail.com> Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D60357
Reviewed by: ae Approved by: ae (mentor)
Sponsored by: The FreeBSD Foundation MFC after: 3 days
Reviewed by: jrm (mentor) Approved by: jrm (mentor) Differential Revision: https://reviews.freebsd.org/D60591
The test pinged an unanswered address and then deleted the resulting INCOMPLETE neighbor entry. The kernel frees that entry after about 3s, so on a loaded VM, ndp -d could run too late and fail with ENOENT. Configure 2001:db8::2 on epair0b so the ping gets a reply and the entry becomes REACHABLE. Approved by: pouria Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D60348
PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299223 MFC after: 1 week
MFC after: 2 weeks Sponsored by: ConnectWise Pull Request: https://github.com/freebsd/freebsd-src/pull/2465 Reviewed by: imp
These could go in other categories, but it's more clear if they're here instead.
MFC after: 3 days Sponsored by: The FreeBSD Foundation
Fixes: https://cgit.freebsd.org/src/commit/?id=b9811d13572b ("https://cgit.freebsd.org/src/commit/?id=cd9660: merge level 1 and 2 filename conversion")
In advance of additional sound(4) work, remove EOL whitespace and mixed tab/space. Reviewed by: christos Differential Revision: https://reviews.freebsd.org/D60442
timedwait and clockwait_absolute_intr_remaining arm a 50ms SIGALRM and then wait until an absolute deadline only 100ms in the future. On a loaded VM the signal can be delivered more than 50ms late, so the wait times out first. Approved by: imp Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D60347
Changes: https://github.com/libexpat/libexpat/blob/R_2_9_0/expat/Changes Security: CVE-2026-102633 Security: CVE-2026-77214 MFC after: 3 days
contrib/kyua: update to 0.15.0
This new release contains multiple feature updates and bugfixes. Please
see the release notes mentioned in the merge commit for more details.
MFC after: 1 month
Merge commit '144afd05f8a2300361ec30c1c2020e4022ddd943'
Conflicts:
contrib/kyua/cli/cmd_debug.cpp
contrib/kyua/doc/kyua-debug.1.in
contrib/kyua/doc/kyuafile.5.in
contrib/kyua/engine/config.cpp
contrib/kyua/engine/execenv/execenv.cpp
contrib/kyua/engine/execenv/execenv.hpp
contrib/kyua/engine/execenv/execenv_host.hpp
contrib/kyua/engine/requirements.cpp
contrib/kyua/engine/requirements.hpp
contrib/kyua/engine/scheduler.cpp
contrib/kyua/model/metadata.cpp
contrib/kyua/os/freebsd/execenv_jail.hpp
contrib/kyua/os/freebsd/execenv_jail_stub.cpp
contrib/kyua/os/freebsd/main.cpp
contrib/kyua/os/freebsd/reqs_checker_kmods.cpp
contrib/kyua/os/freebsd/utils/jail.hpp
contrib/kyua/utils/fs/directory.cpp
contrib/kyua/utils/process/executor.cpp
contrib/kyua: commit Makefile changes for version update This was accidentally missed in the version update. MFC after: 1 month Fixes: https://cgit.freebsd.org/src/commit/?id=eb8f69902 ("contrib/kyua: update to 0.15.0")
contrib/kyua: commit generated files MFC after: 1 month Fixes: https://cgit.freebsd.org/src/commit/?id=eb8f69902 ("contrib/kyua: update to 0.15.0")
Compared the bmake source lists of libcrypto and libssl with upstream's own build of 3.5.8 (configured with the options in crypto/openssl/BSDmakefile), and fix the differences that are not intentional. libcrypto: - aarch64: build bsaes-armv8.S and md5-aarch64.S, and define BSAES_ASM and MD5_ASM, as upstream does. Both files have been generated into sys/crypto/openssl/aarch64 since the 3.5.1 import, but were never compiled. - Stop compiling der_digests_gen.c, der_dsa_key.c and der_ec_key.c. Upstream keeps them in libcommon.a, but the linker does not extract them into libcrypto (checked with --why-extract) as nothing in libcrypto references them. libssl: - Fix the "SRSC" typo that left out ssl3_cbc.c and tls_pad.c. - Build libssl's own copy of crypto/thread/arch*.c, as upstream does. Before this change, libssl got these functions from libcrypto, which exports them only for this purpose. A planned later change removes those exports. crypto/openssl: - crypto/bio/bio_sock2.c: remove the local ktls_enable() call in BIO_socket() it does nothing on FreeBSD. The file is now identical to upstream. - Remove the empty file "patch", committed by mistake in f775385affef. With this change, libssl no longer imports any libcrypto internals. Reviewed by: ngie, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60395
BSDmakefile passed --openssldir=etc. A relative openssldir is taken relative to the prefix, so the generated files described /usr/etc. FreeBSD has always used /etc/ssl (OPENSSLDIR in secure/lib/libcrypto/Makefile.common), so configure with that. Regenerate tools/c_rehash, the only committed generated file that depends on openssldir. It is not installed. No compiled code changes. Reviewed by: ngie, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60396
The initial port of the CTF tools had a FreeBSD-specific patch to print the termination message but exit with a 0 status, with a goal of getting as much to build as possible and silently ignoring any issues. We're now past the point where silently ignoring failures makes sense. Any future issues need to be found and addressed. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276826 PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276930 [exp-run] Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43743
`metaslab.c` already registers this tunable via `ZFS_MODULE_PARAM`, so the `SYSCTL_UINT` here is a second registration of the same leaf. This resulted in messages like: ``` sysctl_register_oid: can't re-use a leaf (vfs.zfs.metaslab.condense_pct) ``` Remove the duplicate sysctl registration, as upstream (OpenZFS) did. MFC after: 1 week Signed-off-by: Christos Longros <chris.longros@gmail.com> Reviewed by: imp, mm, ngie Differential Revision: https://reviews.freebsd.org/D57721
sbrk is obsolete and libc only provides it on amd64, arm, i386 and powerpc. Replace the growing exclusion lists in t_dir.c and t_mlock.c with a single positive HAVE_SBRK definition per file, so architectures without sbrk need not be enumerated as they are added. Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007@gmail.com> Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D60358
Some of the files in the vs sub-directory are checked out with CRLF line breaks via .getattributes. This causes issues when checking out the source tree with other tools that operate on Git repositories like "got". Remove the vs sub-directory from the contrib tree, since it is not required on FreeBSD.
After base ef758b59a44e6b5b2d2dc178b97c01cde1b34570 we can enable usage of .preinit_array in compiler-rt's sanitizers. The comment that stated "On FreeBSD, .preinit_array functions are called with rtld_bind_lock writer lock held. It will lead to dead lock ..." can also be removed. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298943 MFC after: 1 week
asan: refactor interceptor allocation/deallocation functions (#145087) Do some refactoring to allocation/deallocation interceptors. Expose explicit per-alloc_type functions and stop accepting explicit AllocType. This ensures we do not accidentally mix. NOTE: This change rejects attempts to call `operator new(<some_size>, static_cast<std::align_val_t>(0))`. For https://github.com/llvm/llvm-project/issues/144435 Signed-off-by: Justin King <jcking@google.com> This a prerequisite for adding sanitizer interceptors for free_sized(3) and free_aligned_sized(3). PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298943 MFC after: 1 week
[compiler-rt] Add interceptors for free_[aligned_]sized for asan+hwasan (#189109) This avoids a jemalloc assertion when running sanitized applications against glib, which uses free_sized(3). PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298943 MFC after: 1 week
linux: implement sched_getattr() This change adds the necessary glue to translate Linux scheduler policy and priority from FreeBSD so this information is available to Linux applications. This unbreaks using the Linux version of Chromium on FreeBSD. This change was originally submitted via [freebsd/freebsd-src#2370][github-pr]. MFC after: 2 weeks PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297468 Co-Authored-By: Enji Cooper <ngie@FreeBSD.org> Signed-off-by: Joao Bonifacio <joaoboni017@gmail.com> [github-pr]: https://github.com/freebsd/freebsd-src/pull/2370 Differential Revision: https://reviews.freebsd.org/D60214
Revert "linux: implement sched_getattr()" The changes need to be reviewed further; revert until the issues have been worked out. Requested by: markj This reverts commit bb5f10e51bd53771f1a438f36f554256fcbd7d08.
linux: implement fchmodat2 syscall The fchmodat2 syscall on Linux is effectively the same as the fchmodat on FreeBSD, whereas fchmodat on Linux is fchmodat on FreeBSD, minus the `flags` argument. This change provides the necessary glue in order to call kern_fchmodat properly via the Linuxulator. NB: glibc transparently passes through the `flags` argument, so this is [largely] a no-op for end-users, but it affects those who compiled binaries specifically using the fchmodat2 syscall. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60394
Revert "linux: implement fchmodat2 syscall" This got accidentally committed when I was reverting another commit. This reverts commit c070ec923e2f49b6ecb5a60b584ba8f4376a6e80.
Python in the ports tree now handles PF_DIVERT sockets properly; see ports commit 4d84480d7a68. I no longer have any specific reason to keep the shim and Gleb wants to remove it, so, let's remove it. This reverts commit cb7009867ae6b33aa39cb6cb1453b69073144b44. Requested by: glebius Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D60390
tests/libc: use an allowlist for sbrk in NetBSD-derived tests sbrk is obsolete and libc only provides it on amd64, arm, i386 and powerpc. Replace the growing exclusion lists in t_dir.c and t_mlock.c with a single positive HAS_SBRK definition per file, so architectures without sbrk need not be enumerated as they are added. Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007@gmail.com> Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D60358
Revert "tests/libc: use an allowlist for sbrk in NetBSD-derived tests" Need to update the commit message. This reverts commit 36b849b5c76406bb6d9341bfb1a7f16ae5c189c9.
Not classified automatically, and waiting for manual attention.
-- no commits in this category this week --
Dates:
cgit.freebsd.org/src. Git accurately records the
order of commits, but not their dates.Automatic grouping:
This reverts commit \\b([0-9a-fA-F]{40})\\b
and the hash was found in this week's commits.
Automatic categories:
Source code:
Generated with commits-periodical 0.21 at 2026-11-16 20:33:55+00:00.
This work is supported by Tarsnap Backup Inc.
Alternate version: 2026-10-05 (debug) (contains info about the classification)