OPNSense/src d9d7a8ausr.sbin/daemon daemon.c

Revert "daemon: replace memchr with memrchr"

This reverts commit 5745a5841413da5c2e002ba65c60d7b9d594bc52.
DeltaFile
+4-8usr.sbin/daemon/daemon.c
+4-81 files

OPNSense/src 5ae8c89sys/netipsec ipsec.c

ipsec: Fix a lock leak in ipsec_chkreplay()

Reported by:    Chris Jarrett-Davies of the OpenAI Codex Security Team
Reviewed by:    pouria, kp
Fixes:          0361f165f219 ("ipsec: replace SECASVAR  mtx by rmlock")
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58521

(cherry picked from commit b6823a973737f06ea6cf0ea5a3083383af2ba5a4)
DeltaFile
+3-1sys/netipsec/ipsec.c
+3-11 files

OPNSense/src 72cec63usr.sbin/bsdinstall/scripts netconfig

bsdinstall/netconfig: use a better heuristic for wlan dev desc

For devices like the rtw88, they will show up in `ifconfig -l` as
rtw880, rtw881, etc. We want to query the rtw88.0 and rtw88.1 sysctl
respectively, not rtw.880.

Chances are that there aren't more than 9 wlan devices using the same
driver. Use a better heuristic to get the device description.

Reviewed by:    bz
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit c4b0b13cadac46b7c2cdfeeedeffa596c62568fa)
DeltaFile
+1-1usr.sbin/bsdinstall/scripts/netconfig
+1-11 files

OPNSense/src dae4735sys/netinet6 nd6_rtr.c

netinet6/nd6: Sprinkle missing prefix refcounting

When we drop the prefix lock to call nd6_prefix_offlink() or
nd6_prefix_onlink(), make sure to keep the correpsonding prefix
structure alive.  It is possible for a concurrent nd6_timer() to expire
the prefix while the lock is dropped.

Reported by:    Maik Muench of Secfault Security
Reviewed by:    pouria, zlei
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58423

(cherry picked from commit 76ca489e0f147e9bd90408ea562087e84ed6f479)
DeltaFile
+4-0sys/netinet6/nd6_rtr.c
+4-01 files

OPNSense/src 0c4c75csys/netinet/libalias alias_db.c

libalias: Serialize updates to the global instance list

libalias maintains a global list of all libalias handles.  The list was
updated without any locking, but nothing prevents updates from running
concurrently.

MFC after:      1 week

(cherry picked from commit 2ff705f32a2033201a8f83f1ade5ddbc0460387d)
DeltaFile
+17-0sys/netinet/libalias/alias_db.c
+17-01 files

OPNSense/src ae2617bsbin/ipf/ippool ippool.5, sys/netinet/libalias libalias.3

man: Fix RFC 1918 network prefix lengths

According to RFC 1918, the following IP prefixes are reserved for
private internets:

    10.0.0.0/8
    172.16.0.0/12
    192.168.0.0/16

This PR fixes the prefix lengths in references to private networks
("RFC 1918 networks", "the standard private IP address ranges").
The changes are limited to man pages.

Signed-off-by:  Yusuke Ichiki <public at yusuke.pub>
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2328

(cherry picked from commit 1403ca10189c47ad1de3915eeb030deddc114685)
DeltaFile
+2-2sys/netinet/libalias/libalias.3
+1-1sbin/ipf/ippool/ippool.5
+3-32 files

OPNSense/src 9f4ef3dsys/net pfvar.h

pf: switch to getmicro(up)time()

It is reported that micro(up)time() performs poorly in certain
virtualisation scenarios. Absolute accuracy isn't required here, so
switch to the slightly less accurate (as per the man page) get-variants.

PR:             295043
MFC after:      3 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e4130ac13d2fe9c17b8f8e86d39a7b5223fe7b79)
DeltaFile
+2-2sys/net/pfvar.h
+2-21 files

OPNSense/src 0652cf1sys/net if_ovpn.c

if_ovpn: Fix memory leak in VNET during unload

Unloading if_ovpn while it's in use by other vnets causes
memory leaks and panics.
Fix this by reverting VNET_SYSUNINIT and adjusting the SI_SUB
initialization order.

Reviewed by:    markj
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D54175

(cherry picked from commit bf142ea4760bd4391092d9cc0038a0870cf7e0b2)
DeltaFile
+12-8sys/net/if_ovpn.c
+12-81 files

OPNSense/src fc44dd1sys/dev/netmap netmap_bdg.c

netmap: Don't assume that user-provided strings are nul-terminated

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit e1ab35148dd425340a88a2acaf10b972cb119f8f)
DeltaFile
+4-0sys/dev/netmap/netmap_bdg.c
+4-01 files

OPNSense/src 4a1cb71lib/libpfctl libpfctl.c

pf: Add missing PF_TS_CNT Netlink attribute

There is no parser entry for PF_TS_CNT, therefore PF_TS_REFCNT
is written starting at pfrts_cnt, causing the refcount
to be wrongly shown in the "Addresses:" section of print_tstats().

Issue: https://github.com/opnsense/src/issues/300
DeltaFile
+2-1lib/libpfctl/libpfctl.c
+2-11 files

OPNSense/src f23370bsys/dev/igc if_igc.c

igc: additionally disable PCIe ASPM for I226

Always disable PCIe ASPM for i226 type cards to improve stability
and wire sysctl calls to iflib_request_reset instead of igc_if_init
as this will stall the drivers RX path.
DeltaFile
+33-3sys/dev/igc/if_igc.c
+33-31 files

OPNSense/src 4742e7esys/dev/igc igc_base.h igc_base.c

igc: Disable PCIe L1.2 on I225

I225 devices can incorrectly enter L1 substates while CLKREQ# is
asserted, both while idle and in D3.  Disable ASPM and PCI-PM L1.2 on
I225 to prevent the resulting packet loss.

Keep the I226 workaround ASPM-only because it addresses a separate
traffic exit latency observation.

PR:             265714

(cherry picked from commit 4a28d390f5fbae2483e88805559881b04ccf9a80)
DeltaFile
+22-20sys/dev/igc/if_igc.c
+29-0sys/dev/igc/igc_base.c
+1-0sys/dev/igc/igc_base.h
+52-203 files

OPNSense/src 1ca55acsys/dev/igc igc_base.c

igc: Apply ASPM L1.2 workaround to all I226 devices

Classify I226_LMVP and I226_BLANK_NVM as I226 silicon so they
receive the I226-specific ASPM L1.2 workaround.

PR:             279245
Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2318

(cherry picked from commit cecb0f45cb83349c60514da38fddce83ad042468)
DeltaFile
+5-0sys/dev/igc/igc_base.c
+5-01 files

OPNSense/src ece5e3esys/dev/igc igc_base.h igc_base.c

igc: Disable ASPM L1.2 on I226 to prevent RX stalls

I226 parts advertise support for the PCIe L1.2 link substate, but a
hardware erratum makes the exit latency from that low-power state
longer than the packet buffer can absorb under load. This stalls the
inbound packet stream. Disabling ASPM system-wide (BIOS or OS ASPM
policy) does not fix it. The L1.2 enable bit must be cleared directly
in the device's own PCIe L1 PM extended capability.

Add igc_is_device_id_i226() to identify affected parts and
igc_disable_broken_aspm_l1_2() to clear the ASPM L1.2 enable bit
on attach and after resume, since PCIe config space can be
reset across a suspend/resume cycle.

Adapted from the Linux igc driver:

  0325143b59c6 igc: disable L1.2 PCI-E link substate to avoid
               performance issue
  1468c1f97cf3 igc: fix disabling L1.2 PCI-E link substate on I226

    [9 lines not shown]
DeltaFile
+44-0sys/dev/igc/if_igc.c
+21-0sys/dev/igc/igc_base.c
+1-0sys/dev/igc/igc_base.h
+66-03 files

OPNSense/src 6b79b4fcontrib/kyua/cli cmd_debug.cpp, contrib/kyua/doc kyua-debug.1.in

kyua-debug: Add -P option

Add -P as shorthand for --pause-before-cleanup.

MFC after:      1 week
Reviewed by:    ngie
Differential Revision:  https://reviews.freebsd.org/D56613

(cherry picked from commit 7c51da13ae55dc98e9cc1b794e1fe6fc001d7f42)
DeltaFile
+2-2contrib/kyua/doc/kyua-debug.1.in
+1-0contrib/kyua/cli/cmd_debug.cpp
+3-22 files

OPNSense/src 33a943elib/libifconfig libifconfig_internal.c libifconfig.c, sys/net rtsock.c

sys/socket.h: Fix AF_MAX

AF_MAX was always intended to be one more than the greatest allocated
value.  Jeff broke this in 2013.  Unfortunately, a bunch of people then
decided to adapt to the mistake instead of correcting it.

Fixes:          863c7e45628d (" - Reserve a special AF for SDP.  The one we were incorrectly using before    was taken by another AF.")
MFC after:      3 days
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    kevans, glebius
Differential Revision:  https://reviews.freebsd.org/D58597

(cherry picked from commit ddd850aa7720f77b6605599655df898b16ed74cc)
DeltaFile
+3-3sys/netlink/route/rt.c
+2-2sys/net/rtsock.c
+2-2sys/net/route/route_helpers.c
+2-2lib/libifconfig/libifconfig.c
+3-1sys/sys/socket.h
+1-1lib/libifconfig/libifconfig_internal.c
+13-113 files not shown
+16-149 files

OPNSense/src 2b7b052sys/dev/ena ena.h

ena: Update driver version to v2.8.4

Bug Fixes:
* Fix false 'missing TX completions' warnings due to timestamp race
* Put taskqueues into correct NUMA domain if !RSS

Minor Changes:
* Batch RX statistics updates
* Swap RX/TX completions cleanup order

Submitted by: Arthur Kiyanovski <akiyano at amazon.com>
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D58242

(cherry picked from commit 605e699cd6ca4feae6c73c5c5ea8337054897116)
DeltaFile
+1-1sys/dev/ena/ena.h
+1-11 files

OPNSense/src 28ca5dfsys/dev/ena ena.h ena_datapath.c

ena: Fix false 'missing TX completions' warnings due to timestamp race

Sporadic 'Found a Tx that wasn't completed on time' warnings appear
under sustained TX load, always reporting '1 msecs since last cleanup'
despite the 5-second timeout threshold.

The per-packet TX timestamp uses struct bintime (128 bits: two 64-bit
fields sec and frac) which is read and written non-atomically. A race
exists between the missing TX completion check
(check_missing_comp_in_tx_queue reading the timestamp) and the TX
submit path or cleanup path writing it on another CPU. Since the two
fields are not updated atomically, the check can observe a partially
written timestamp - one field from the old value and one from the new.
This can produce a timestamp with {sec=0, frac=valid}, causing the
check to compute a time offset equal to system uptime and falsely
exceeding the 5-second timeout.

Confirmed by instrumentation showing all occurrences had sec=0 with
valid frac/mbuf, cleanup_running=0, and ticks==last_cleanup_ticks.

    [24 lines not shown]
DeltaFile
+7-6sys/dev/ena/ena.c
+2-2sys/dev/ena/ena_datapath.c
+1-1sys/dev/ena/ena.h
+10-93 files

OPNSense/src 98e492dsys/dev/ena ena_datapath.c

ena: Batch RX statistics updates

Move per-packet counter_enter/counter_exit pairs out of the RX
processing loop and batch them into a single update after the
loop completes.

Previously, each received packet triggered two separate
counter_enter/counter_exit blocks -- one for bytes and one for
packet count. This commit accumulates totals in local variables
and updates all four counters (ring and hw stats for both packets
and bytes) in a single counter_enter/counter_exit block after the
loop.

Also move the stats update to after the refill and LRO flush
so that the error path (goto update_stats) and the normal path
converge at the same label, avoiding code duplication.

Submitted by: David Arinzon <darinzon at amazon.com>
MFC after: 2 weeks

    [5 lines not shown]
DeltaFile
+12-11sys/dev/ena/ena_datapath.c
+12-111 files

OPNSense/src 0fadfcbsys/dev/ena ena_datapath.c

ena: Swap cleanup order

As RX processing is heavier than TX completions processing, swap the
order and process TX completions first, in order to avoid starving the
completions and causing potential missing TX completions.

Submitted by: Ofir Tabachnik <ofirt at amazon.com>
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D58239

(cherry picked from commit f08def9ed97f45700eb0611a3fd9240210c9303e)
DeltaFile
+1-1sys/dev/ena/ena_datapath.c
+1-11 files

OPNSense/src 1d9038elib/libnetmap nmreq.c

libnetmap: fix extra indirection in nmreq_remove_option

Reviewed by:    zlei, vmaffione
Obtained from:  https://github.com/luigirizzo/netmap/commit/7d9177ed9a121e66bf4eaa0acb5d574e408297da
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58151

(cherry picked from commit 141b6645204966a0e1ae10dd059c670e2a58e6e1)
DeltaFile
+1-1lib/libnetmap/nmreq.c
+1-11 files

OPNSense/src d7cf48clib/libnetmap nmport.c

libnetmap: fix error path in nmport_extmem_from_file

Reviewed by:    zlei, vmaffione
Obtained from:  https://github.com/luigirizzo/netmap/commit/b52a2bcae35e56548acfb0849b248a1e4b0c0c3b
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58150

(cherry picked from commit fcaf15e54162fe14483fdf4ac28c67c51e424441)
DeltaFile
+3-1lib/libnetmap/nmport.c
+3-11 files

OPNSense/src 74e7231. UPDATING, sys/conf newvers.sh

Add UPDATING entries and bump version

Approved by:    so
DeltaFile
+26-0UPDATING
+1-1sys/conf/newvers.sh
+27-12 files

OPNSense/src 9973d63sys/kern imgact_elf.c

coredump: Don't assume that the number of ELF segments is consistent

In an ELF coredump, each dumped vm_map_entry is represented by a
segment.  __elfN(coredump) first computes the number of segments by
looping over the vm_map entries (in each_dumpable_segment()), then
allocates a buffer to hold the ELF header and program headers, then
loops over the entries again to populate the program headers.

each_dumpable_segment() holds the vm_map read lock, but that lock is
dropped between the two calls.  If the map is shared with another
process, via rfork(), then the map can change.  cb_put_phdr() did not
account for this, and so could write out of bounds.

Add a check to prevent this; simply do not write out excess segments.

Approved by:    so
Security:       FreeBSD-SA-26:55.elf
Security:       CVE-2026-58088
Reported by:    Maik Muench of Secfault Security

    [3 lines not shown]
DeltaFile
+19-3sys/kern/imgact_elf.c
+19-31 files

OPNSense/src 16f7063sys/kern sysv_sem.c

sysvsem: Fix a TOCTOU race in semctl({GET,SET}ALL)

These commands take a snapshot of the size of a semaphore set, then drop
the lock and malloc an appropriately sized array before reacquiring the
lock.  A comment explains why this is (probably) safe.  Unfortunately,
it's wrong; it is indeed possible for a malicious userspace to create
and destroy 2^{15} sets in the window where the lock is dropped.  This
race can lead to out-of-bounds reads and writes, and that can be
exploited to elevate privileges.

Replace the assertions with runtime checks.

Approved by:    so
Security:       FreeBSD-SA-26:54.sysvsem
Security:       CVE-2026-58087
Reported by:    Maik Muench of Secfault Security
Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58421
DeltaFile
+16-20sys/kern/sysv_sem.c
+16-201 files

OPNSense/src 98f125bsys/kern kern_jail.c

jail: restore ktrace privileges for jailed root

Commit 4be491e1b9b3 ("jail: Optionally allow audit session state to
be configured in a jail") removed the #if 0 around the audit cases
in prison_priv_check() and added the PR_ALLOW_SETAUDIT check under
them.  This unintentionally captured the preceding case PRIV_KTRACE,
which used to fall through the disabled block into the unconditional
return (0) of the credential cases: since then, jailed root only has
ktrace privileges (tracing processes with changed credentials, see
ktrcanset()) when the unrelated allow.setaudit knob is enabled, and
conversely gains them when that audit knob is turned on.

Give PRIV_KTRACE back its own unconditional return (0), matching its
comment and the pre-4be491e1b9b3 behaviour.

Approved by:    so
Security:       FreeBSD-SA-26:53.ktrace
Security:       CVE-2026-58086
Fixes:          4be491e1b9b3 ("jail: Optionally allow audit session state to be configured in a jail")

    [2 lines not shown]
DeltaFile
+1-0sys/kern/kern_jail.c
+1-01 files

OPNSense/src 7d5416cetc/mtree BSD.tests.dist, tests/sys/net Makefile

wg(4): Add a test that the driver handles a decryption failure

The test uses a fail point to inject a decryption error in OCF while
sending a ping across the tunnel.  The driver should then fail to
respond to the ping and increment the input error counter on the
interface.

Approved by:    so
Security:       FreeBSD-SA-26:52.if_wg
Security:       CVE-2026-58085
Reviewed by:    markj
Sponsored by:   Chelsio Communications
DeltaFile
+111-0tests/sys/net/wg/if_wg_nojail.sh
+10-0tests/sys/net/wg/Makefile
+2-0etc/mtree/BSD.tests.dist
+1-0tests/sys/net/Makefile
+124-04 files

OPNSense/src e5bf7cfsys/kern kern_time.c

ktimer: Check for errors from realtimer_gettime()

clock_gettime(CLOCK_TAI) can fail, leaving *ovalue uninitialized.

Approved by:    so
Security:       FreeBSD-SA-26:51.ktimer
Security:       CVE-2026-58084
Reported by:    Hazley Samsudin of GovTech CSG
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58225

(cherry picked from commit 2f1ec7d159cbe56d40e7b6d7fc4188c9079e1783)
(cherry picked from commit a4b5ff57ef85031ba52feb70c754ba77f7c92cb0)
DeltaFile
+5-2sys/kern/kern_time.c
+5-21 files

OPNSense/src 69b9c6dsys/kern kern_event.c, sys/sys event.h

kqueue: Avoid enqueuing an already-enqueued knote

knotes with a non-trivial f_copy implementation may be activated before
kqueue_fork_copy_knote() is finished.  In particular, it may be enqueued
at the time that kqueue_fork_copy_knote() calls knote_enqueue().  Guard
against this.

Add a test case which triggers the race.

Fix several other problems with the replication of knote state:
- Make sure only the KN_ACTIVE and KN_DISABLED status flags are
  inherited, the rest should not be copied.
- Ignore marker knotes.
- Ignore knotes for kqueues.  They cannot be safely copied into the
  child without more work, as kqueues are inherently local to a process;
  on fork, we need to ensure that such knotes are patched to reference
  the new kqueue, not the original.
- Try to keep knote state stable by holding the kqueue and knlist locks
  while copying.

    [8 lines not shown]
DeltaFile
+35-8sys/kern/kern_event.c
+36-0tests/sys/kqueue/kqueue_fork.c
+1-0sys/sys/event.h
+72-83 files

OPNSense/src d68e1a6sys/contrib/openzfs/module/zfs zvol.c

zvol: Fix uses of uninitialized variables in zvol_rename_minors_impl()

Reported-by: GitHub Copilot
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Signed-off-by: Mark Johnston <markj at FreeBSD.org>
Closes #18191

Approved by:    so
Security:       FreeBSD-EN-26:19.zfs

(cherry picked from commit 943a05528494b2f4585541089606796476fb229e)
(cherry picked from commit 698e0c419895da2d0d12c5f4d61d85a1d91b6b9d)
DeltaFile
+3-0sys/contrib/openzfs/module/zfs/zvol.c
+3-01 files