Commit graph

293733 commits

Author SHA1 Message Date
Maurice Walker
9940b62c33 build U-Boot booti compatible kernel 2026-07-13 01:50:38 +02:00
Tomaz Zaman
7b901a3752 kern: add colored timestamps to console output
Prefix every console line with a Linux-style [seconds.microseconds]
timestamp. Brackets in default white, number in green via ANSI escapes.
Uses microuptime() for the time source and emits directly to console
hardware to avoid cnputc recursion. Both EARLY_PRINTF and normal
console paths are covered.
2026-07-13 01:50:38 +02:00
Tomaz Zaman
245855e7c5 zfs: switch root filesystem from UFS to ZFS, silence fmcd ioctl spam
Change GATEWAY kernel config from UFS root to ZFS root (pool0/ROOT/default).
ZFS is compiled into the kernel since booti direct boot has no FreeBSD loader
to load modules. Disable kern.geom.label.disk_ident.enable so GPT labels
work cleanly with ZFS.

Remove printf from fman chardev ioctl default cases. ZFS GEOM probes all
character devices with DIOCGMEDIASIZE (0x40086481) at boot, generating ~32
spurious "unknown ioctl" messages. ENOTTY is the correct response and the
printf serves no diagnostic purpose.
2026-07-13 01:50:37 +02:00
Tomaz Zaman
107d135ff0 sff: move SFP module management into sfp_fdt state machine
Move ~900 lines of SFP management code (GPIO polling, EEPROM reading,
RollBall I2C-MDIO PHY probing, auto-negotiation, link monitoring) from
the dtsec MAC driver into the sfp_fdt framework driver.

sfp_fdt now implements a full state machine (EMPTY → PROBE → PRESENT →
PHY_PROBE/WAIT_LOS → PHY_AN/DDM_POLL → LINK_UP) that handles module
detection, identification, and link management for any MAC driver with
SFP+ cages. MAC drivers register a callback table (sfp_upstream_ops)
via SFF_REGISTER_UPSTREAM() and receive module_insert, module_remove,
link_up, and link_down events.

dtsec is reduced to ~50 lines of callback implementations that update
interface link state and store module info for sysctl reporting.

Tested on hardware with both fiber (FLEXOPTIX DAC) and copper (FS.com
10GBASE-T with AQR113C PHY via RollBall) modules at 10 Gbps.
2026-07-13 01:50:37 +02:00
Tomaz Zaman
cce1f2579d dpaa: add 10GBASE-T copper SFP+ PHY driver via I2C-MDIO bridge
Add support for copper (RJ45) SFP+ modules with embedded PHYs.
These modules use Clause 45 MDIO registers accessed via an I2C-to-MDIO
bridge for PHY management, auto-negotiation, and link status polling.

Two bridge protocols are supported with automatic detection:
- RollBall (I2C addr 0x51, page 3, command-based)
- Standard I2C-MDIO (I2C addr 0x56, SFF-8472)

PHY probe runs on module insertion for RJ45 connectors, configures
auto-negotiation (10G/5G/2.5G/1G advertisement with Extended Next Page),
and polls PMA/PMD link status at 1Hz via taskqueue. Speed detection
uses AN 10GBT_STAT for multi-gig and PMA/PMD CTRL1 as fallback.

For copper modules without accessible PHY (autonomous operation),
falls back to DDM RX_LOS polling for link state detection.

Also fixes three GPIO issues that prevented copper modules from working:
- TX_DISABLE pin direction must be set to OUTPUT explicitly
- TX_DISABLE polarity inverted due to board hardware inverter
- Module PHY stays inactive until TX_DISABLE is properly deasserted

Verified at 10 Gbps (9.4 Gbps iperf3) with FS.com SFP-10G-T (AQR113C)
and Intel X550 link partner over Cat6e cable.
2026-07-13 01:50:36 +02:00
Tomaz Zaman
36f96ed5b6 dpaa: fix SFP link state semantics and copper module handling
Use LINK_STATE_UNKNOWN for no-module state (instead of DOWN) so the
sfpled driver can distinguish "no module" from "module present, no
link".  For copper PHY modules (RJ45 connector type 0x22), ignore
LOS GPIO — these modules deassert LOS when powered up regardless
of copper link negotiation status.  Always report LINK_STATE_DOWN
for RJ45 modules until a PHY driver can negotiate.
2026-07-13 01:50:36 +02:00
Tomaz Zaman
43eb531be0 dpaa: add SFP module detection and link management for 10GbE ports
Wire SFP infrastructure into dtsec so 10GbE ports detect module
insertion/removal via mod-def0 GPIO polling, read the SFP EEPROM
for identification, control TX enable/disable, and report accurate
link status via LOS GPIO instead of hardcoding link as always up.

Module presence is polled at 1Hz in the existing tick callout.
EEPROM reads are deferred to taskqueue_thread since I2C can sleep.
Insert task re-checks module presence under DTSEC_LOCK to handle
races with hot-removal during EEPROM read.

Adds dev.dtsec.N.sfp_info sysctl for module vendor and part number.

No DTS changes needed — sfp phandle, GPIOs, and i2c-bus are already
defined in mono-gateway-dk.dts.
2026-07-13 01:50:35 +02:00
Tomaz Zaman
5065099c0d dpaa: move fmlib ioctl headers into kernel tree
Move the 5 fmlib ioctl ABI headers (fm_pcd_ioctls.h, fm_ioctls.h,
net_ioctls.h, ioctls.h, integration_ioctls.h) from the external
opnsense-deps repo into sys/contrib/ncsw/inc/ioctls/.  This makes the
kernel buildable without depending on a sibling repository.

Merge FMCD_COMPILE_CMD into DPAA_COMPILE_CMD since it only added a
single -I path; fman_chardev.c now compiles with the same flags as all
other DPAA source files.
2026-07-13 01:50:34 +02:00
Tomaz Zaman
ef0aedc40b dpaa: use opnsense-deps for fmcd headers instead of ASK
Point FMCD_COMPILE_CMD include paths from $S/../../ASK/freebsd/fmlib/
to $S/../../opnsense-deps/fastpath/fmlib/. The headers are identical;
this removes the build dependency on the standalone ASK repository.
2026-07-13 01:50:34 +02:00
Tomaz Zaman
38faadb5fa ng_pppoe: add NGM_PPPOE_GET_SESSION_INFO for PPPoE offload
Add netgraph control message (cookie 20) that returns PPPoE session
parameters: session_id, peer MAC, state, and hook name.  Supports
both single-session query (by hook name) and list-all-sessions mode.

Used by CMM to detect active PPPoE sessions and extract the parameters
needed to program hardware flow offload (session ID for PPPoE header
insertion, peer MAC for L2 header construction).
2026-07-13 01:50:33 +02:00
Tomaz Zaman
f1e91c63fa dpaa: start MII tick for LAGG member ports, reprogram MAC on enable
LAGG member ports are enabled via SIOCSIFFLAGS -> dtsec_if_enable_locked(),
not dtsec_if_init_locked(). The MII tick callout was only started in the
init path, so LAGG member ports never got periodic PHY polling. Without
the tick, link state changes (cable unplug/replug) were never detected
and RTM_IFINFO was never generated.

Start callout_reset in dtsec_if_enable_locked() so member ports get the
same periodic PHY polling as standalone ports. Also reprogram the hardware
MAC address via FM_MAC_ModifyMacAddr() since LAGG changes the stack MAC
via if_setlladdr() then cycles SIOCSIFFLAGS.
2026-07-13 01:50:33 +02:00
Tomaz Zaman
24369ce0b4 dpaa: per-VAP FQ registry, dist fallback, OH enqueue EBUSY, refill API
dpaa_oh: Add per-VAP distribution FQ registry so CDX can route WiFi
download frames to hash-distributed FQIDs. Add dist fallback callback
for frames with unrecognized BPIDs on OH dist FQs. Return EBUSY from
dpaa_oh_enqueue when EQCR ring is full so callers can retry. Free
dtsec buffers in error callback to prevent BMan pool drain.

if_dtsec: Export dtsec_rm_pool_rx_refill_bpid for external callers
(dpaa_wifi, dpaa_oh, CDX) that consume dtsec BMan pool buffers.
2026-07-13 01:50:32 +02:00
Tomaz Zaman
5391092ae5 dpaa: PLCR/KG miss fixup, portal quiesce, OH dist callbacks
fm_ehash: Rewrite ModifyMissNextEngine to match Linux SDK two-phase
pattern (DROP→update→real action). Support KG (with CC_EN), PLCR
(shared profile), and DONE engines. Remove verify-retry loop and CC
tree copy propagation — single WRITE_UINT32 per word suffices with
the two-phase approach.

qman_portals: Add qman_portal_quiesce() to drain all per-CPU portal
poll taskqueues. Called after FQR retire to ensure no in-flight
QM_PORTAL_Poll references a stale callback from an unloading module.

if_dtsec_rm: Add dtsec_rm_pool_rx_refill_bpid() for external callers
(CDX dist FQ callback) to trigger BMan pool refill by BPID.

dpaa_oh: Add distribution FQ callback registry (register/unregister/
lookup by BPID) for OH port consumers (WiFi, IPsec) to receive
frames from CDX distribution FQs. Add MODULE_VERSION.
2026-07-13 01:50:31 +02:00
Tomaz Zaman
7e747b3417 dpaa: cross-module buffer free for WiFi offload
Add dtsec_rm_buf_free_external() for dpaa_wifi.ko to release BMan
buffers from dtsec RX pools back to the correct UMA zone. Route
M_PROTO1-tagged mbufs to if_transmit in QMan portal drain path.
2026-07-13 01:50:31 +02:00
Tomaz Zaman
1dd81a66be gpio: add FDT gpio-hog processing for boot-time pin configuration
Process gpio-hog child nodes during gpiobus attach to configure pins
at boot. Used on Mono Gateway for WiFi module enable (2R-enable),
3R-disable, and UART mux routing.
2026-07-13 01:50:30 +02:00
Tomaz Zaman
0d8077ab97 pci: DesignWare PCIe big-endian CCSR and lane configuration for LS1046A
- qoriq_dw_pci: byte-swap CCSR register access for big-endian controller
- pci_dw: lane configuration support for proper link training
- DTS: enable PCIe3 for WiFi module (88W9098)
2026-07-13 01:50:30 +02:00
Tomaz Zaman
0e8c370df5 pf: add state creation/destruction notification hooks
Add callback interface for PF state lifecycle events (create, destroy,
update). Used by CMM connection offload module to synchronize hardware
flow tables with PF firewall state.
2026-07-13 01:50:29 +02:00
Tomaz Zaman
69d91d6eeb net: add bridge L2 offload notification hooks
Add callback hooks for bridge member add/remove and L2 address learning
events. Used by CDX flow offload module to maintain hardware L2
forwarding tables.
2026-07-13 01:50:28 +02:00
Tomaz Zaman
9ed1ec5e22 dpaa: add CEETM egress QoS traffic management
Class-based Enqueue/Dequeue Traffic Management for DPAA1 QMan.
Provides hardware traffic shaping and scheduling via QMan CEETM
channels.
2026-07-13 01:50:28 +02:00
Tomaz Zaman
05dd604514 iicbus: add INA2xx power monitor driver
TI INA219/INA226/INA234 I2C power monitor with sysctl interface for
voltage, current, and power readings. Used on Mono Gateway for rail
monitoring.
2026-07-13 01:50:27 +02:00
Tomaz Zaman
0bf8388a58 arm64: peripheral driver fixes for LS1046A
- qoriq_gpio: QorIQ GPIO controller support
- gpiopower: GPIO-based power control fix
- iicmux/pca954x: I2C mux devclass fix (use "iicbus" not "ofw_iicbus")
- ofw_iicbus: FDT child enumeration fix
- random_harvestq: allow CAAM hardware RNG as entropy source
2026-07-13 01:50:27 +02:00
Tomaz Zaman
6d697eab12 mii: add MaxLinear GPY115/GPY2xx PHY driver
Firmware-based SGMII PHY used on the Mono Gateway (3x 1GbE ports).
Key differences from standard PHY drivers:
- No BMCR reset (kills firmware, darkens LEDs)
- SGMII auto-negotiation via MMD VEND1 register
- Status read from MIISTAT instead of BMSR
2026-07-13 01:50:26 +02:00
Tomaz Zaman
20527baa85 dpaa: add offline/header manipulation (OH) port driver
OH ports provide hardware packet processing pipelines for IPsec and
WiFi offload via CDX. Port assignment matches Linux SDK: cell-index 3
(IPsec), cell-index 4 (WiFi). Cell-index 2 reserved for Host Command.
2026-07-13 01:50:26 +02:00
Tomaz Zaman
61805ff428 dpaa: dTSEC/mEMAC Ethernet driver with checksum offload and RSS
Add the main DPAA1 Ethernet driver using the NCSW FM_MAC API for
mEMAC (LS1046A FManv3). Implements TX/RX via QMan frame queues and
BMan buffer pools with scatter-gather support.

Features: TX checksum offload (RPD+DTC), RX checksum validation with
PCD parser, 128-FQID RSS via FMan KeyGen, deferred RX delivery via
mbufq to prevent SMP hard lockups from nested NCSW_PLOCK, per-port
BMan buffer pool with consumption model and in-flight cap.

Includes mEMAC external MDIO controller for PHY management.
2026-07-13 01:50:25 +02:00
Tomaz Zaman
89ce353b40 dpaa: BMan/QMan/FMan portal integration and bus drivers
Add the FreeBSD bus driver wrappers that bridge NCSW to the kernel
device tree. BMan and QMan portal drivers handle multi-CPU
initialization with explicit CPU binding (sched_bind unavailable
during attach). FMan driver configures the frame manager hardware,
reserved-memory regions (PFDR/FQD/FBPR via no-map DT nodes), and
MURAM allocation.

Portal common infrastructure provides shared init and cache-inhibited
mapping for both BMan and QMan portals.
2026-07-13 01:50:24 +02:00
Tomaz Zaman
ba1e85edb1 ncsw: port DPAA1 NCSW layer to ARM64
Port the NetCommSW (NCSW) library from PowerPC to ARM64 for the
NXP LS1046A. Adds ARM64 environment layer (xx_arm64.c, core_arm64.c,
dflags_arm64.h), fixes big-endian portal access, cache operations,
and integration headers for DPAA_VERSION 11 (FManv3/mEMAC).

Includes enhanced hash table support (fm_ehash.c) for CDX PCD,
MURAM batch-write fixes for ARM64 store behavior, QMan FQR RSS
expansion, and BMan/QMan portal initialization changes.

Enable device dpaa in GATEWAY config with NCSW file list.
2026-07-13 01:50:23 +02:00
Tomaz Zaman
4b3943cf68 arm64: GATEWAY kernel config, device tree, and platform support
Add the MONO-GATEWAY kernel configuration for the NXP LS1046A-based
Mono Gateway Development Kit. Based on GENERIC with OPNsense standard
features, DPAA1 build infrastructure (empty file list for now), and
early printf via QorIQ ns16550.

Add the mono-gateway-dk.dts device tree covering the full SoC and board
peripherals (DPAA1 FMan/QMan/BMan, I2C mux tree, GPIO, UART, eMMC, QSPI,
SFP+ cages, and reserved memory regions).

Add ARM64 I/O stubs (pio.h) for NCSW compatibility, EARLY_PRINTF qoriq
type registration, CAAM RNG entropy source enum, and qoriq_therm build
fix (remove spurious pci dependency).
2026-07-13 01:50:22 +02:00
Mark Johnston
9b6eef552f Add UPDATING entries and bump version
Approved by:	so
2026-06-30 23:17:03 +02:00
Mark Johnston
e78927d11c iconv: Fix a stack buffer overflow in _ISO2022_sputwchar()
In the ISO2022-CN encoding, characters may require at least seven bytes,
and MB_LEN_MAX==6 is insufficient.  From code inspection,
_ISO2022_sputwchar() can emit 10 bytes in the worst case, so use that to
size buffers.

Add a regression test.

Approved by:	so
Security:	FreeBSD-SA-26:49.iconv
Security:	CVE-2026-58082
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D57950
2026-06-30 23:17:01 +02:00
Mark Johnston
b3e7a18433 iconv: Fix a buffer overflow in the HZ encoding
wcrtomb may store up to 2 2-byte escape sequences to the state buffer in
addition to the character itself.  In the worst case, a 3-byte heap
overflow is possible.

Approved by:	so
Security:	FreeBSD-SA-26:49.iconv
Security:	CVE-2026-58081
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D57949
2026-06-30 23:16:59 +02:00
Taylor R Campbell
b58d33c1a3 iconv(3): Draft some automatic tests.
Based on a report by Nick Wellnhofer.

Approved by:	so
Security:	FreeBSD-SA-26:49.iconv
Reviewed by:	markj, kevans
Differential Revision:	https://reviews.freebsd.org/D57948
2026-06-30 23:16:58 +02:00
Taylor R Campbell
00df46f1c9 iconv(3): Fix problems in various encodings
Fix null pointer dereference with HZ8 encoding.

Fix output buffer overrun in UTF-7, VIQR, ZW encodings.

Approved by:	so
Security:	FreeBSD-SA-26:49.iconv
Security:	CVE-2026-58081
Reviewed by:	markj, kevans
Differential Revision:	https://reviews.freebsd.org/D57947
2026-06-30 23:16:57 +02:00
Ed Maste
e0897f8606 compat32: Zero struct to avoid stack disclosure
Approved by:	so
Security:	FreeBSD-SA-26:48.compat32
Security:	CVE-2026-49425
Reported by:	Adam Crosser, Praetorian
Reviewed by:	philip
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55811

(cherry picked from commit 097cb4e9f0432c543c704cec712ce1cd3302335c)
(cherry picked from commit 4551ea3b3f)
(cherry picked from commit 6a808cd7534802d30010fb0a7f46381ff9f6ef3f)
2026-06-30 23:16:56 +02:00
Ed Maste
fd37b87e86 compat/linux: Avoid waitid() kernel stack disclosure
Approved by:	so
Security:	FreeBSD-SA-26:47.linux
Security:	CVE-2026-49424
Reported by:	Adam Crosser, Praetorian
Reviewed by:	philip
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55812

(cherry picked from commit 9a9f93bcf1aa0059d759b2f3ea6faeb2760a11bd)
(cherry picked from commit 9f8db9cc67)
(cherry picked from commit a347e6e20e75ad6224afefcf650ef738c3de094d)
2026-06-30 23:16:54 +02:00
John Baldwin
7aee9d6c6d ktls CBC decrypt: Only increment iovec index when an entry is used
If an mbuf in the chain was skipped because it only contained bytes
from the header, the iovec index ('i') was incremented even though the
entry was not populated.  Only increment 'i' when an iovec entry is
consumed.

Add a new type of KTLS receive test which writes a single TLS record
via two separate write(2) calls over a TCP_NODELAY socket to trigger
a split in the mbuf chain in the kernel.  Test various split locations
including after the "plain" TLS header (5 bytes), after the full TLS
header, in the middle of the data payload, just before the start of
the trailer, and in the middle of the trailer.  These tests are also
run against all supported ciphers, not just CBC.  The 'header' test
for CBC ciphersuites was able to trigger the bug.

Approved by:	so
Security:	FreeBSD-SA-26:46.ktls
Security:	CVE-2026-49423
Sponsored by:	Chelsio Communications
2026-06-30 23:16:53 +02:00
Kyle Evans
e0750eab8c kern: fix auditing of ptrace(2) syscall requests
`error` here is the return value of syscall_thread_enter() rather than
the syscall itself, so the committed audit records do not reflect
reality.  This is less harmful than them recording an error when the
operation actually succeeded, but it could still possibly be used to
throw off IDS techniques with things like bsmtrace.

Approved by:	so
Security:	FreeBSD-SA-26:45.audit
Security:	CVE-2026-49426
Reviewed by:	des, kib, markj, csjp
Differential Revision:	https://reviews.freebsd.org/D57847
2026-06-30 23:16:51 +02:00
Mark Johnston
92cf7227a1 posixshm: Fix handling of sendfile() with largepage objects
sendfile(2) can transmit POSIX shared memory objects.  Typically it will
look up and wire each page before sending it to a socket; once
transmission is complete, the page is unwired and typically released
back into the page queues.  sendfile() has an advisory flag, SF_NOCACHE,
which means, "try to free the page once transmission is complete."  This
is implemented in vm_page_release(), which expects to operate on managed
pages.

Pages belonging a largepage object are de-facto wired not explicitly so.
Thus, vm_page_release() will unwire and, having found no additional
references, free the page.  Because mappings of largepage objects are
unmanaged, userspace can still access the now freed page.

Fix the problem by explicitly wiring largepage pages.  Make the VM
object destructor responsible for unwiring and freeing them.

Add a regression test.

Approved by:	so
Security:	FreeBSD-SA-26:44.posixshm
Security:	CVE-2026-49427
Reported by:	Chris Jarrett-Davies <chrisjd@openai.com>
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57832
2026-06-30 23:16:49 +02:00
Mark Johnston
9009c47d17 posixshm: Disallow truncation of largepage objects
We correctly handled ftruncate(), but not open(O_TRUNC).

Add a regression test.

Approved by:	so
Security:	FreeBSD-SA-26:44.posixshm
Security:	CVE-2026-49428
Reported by:	Chris Jarrett-Davies <chrisjd@openai.com>
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57831
2026-06-30 23:16:46 +02:00
Mark Johnston
8038f63730 posixshm: Disallow fspacectl() on largepage objects
As with truncation, the operation isn't supported, but nothing prevented
it.

Add a regression test.

Approved by:	so
Security:	FreeBSD-SA-26:44.posixshm
Security:	CVE-2026-49428
Reported by:	Chris Jarrett-Davies <chrisjd@openai.com>
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57830
2026-06-30 23:16:45 +02:00
Mark Johnston
1a0ae4cd6c rack: Reload the TCP stack PCB after reacquiring the inpcb lock
Malicious userspace might switch TCP stacks twice while the inpcb lock
is dropped.  If it does so, the validation of tp->t_fb might succeed,
but the saved pointer to the stack PCB might be invalid.  Reload it to
avoid this problem, as BBR already does.

Approved by:	so
Security:	FreeBSD-SA-26:43.tcp
Security:	CVE-2026-49422
Reported by:	Maik Münch
Reviewed by:	tuexen
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57791
2026-06-30 23:16:44 +02:00
Mark Johnston
2bafd2de76 unlinkat: Pass flags down to the work functions
The unlinkat(2) and funlinkat(2) system calls were ignoring
AT_RESOLVE_BENEATH.

Also pass pathseg through instead of assuming it's UIO_USERSPACE.

Add some tests which make sure that AT_RESOLVE_BENEATH is handled
properly by various system calls.

Approved by:	so
Security:	FreeBSD-SA-26:42.unlinkat
Security:	CVE-2026-49421
Reported by:	Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57790
2026-06-30 23:16:42 +02:00
Mark Johnston
d058577e9b tests/libalias: Add a regression test for an alias_smedia bug
Approved by:	so
Security:	FreeBSD-SA-26:41.libalias
Security:	CVE-2026-49420
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57747
2026-06-30 23:16:41 +02:00
Dag-Erling Smørgrav
649b7862fc libalias: Fix buffer overflow in RTSP aliasing
In alias_rtsp_out(), we construct a new packet in a fixed-length buffer
before copying it back into the original buffer.  We never checked if
the data we were writing to this temporary buffer fit in it, nor if the
result fit in the original buffer.

* Use a dynamically sized allocated buffer instead of a fixed-length
  stack buffer.

* Check for overflow before appending to our temporary buffer.

* Check for overflow before copying the data back to the packet buffer.

* While here, use size_t for sizes and bool for booleans.

Approved by:	so
Security:	FreeBSD-SA-26:41.libalias
Security:	CVE-2026-49420
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57753
2026-06-30 23:16:40 +02:00
Mark Johnston
5b6ade19d7 zfs: Roll up several upstream commits
This commit squashes the following upstream commits:
  #18604 63a0ff6cd nvpair: Check for un-terminated strings in packed nvlist
  #18617 38cd6adcb Extend dataset zfs_ioc_set_prop() secpolicy
  #18615 738791027 Fix the integer type in zfs_ioc_userspace_many()
  #18623 06d8cfedb Add additional verification of size fields and strings

Approved by:	so
Security:	FreeBSD-SA-26:40.zfs
Security:	CVE-2026-49429
Security:	CVE-2026-49430
Security:	CVE-2026-49431
2026-06-30 23:16:28 +02:00
Konstantin Belousov
a08b855dd2 execve_block(): a mechanism for mutual exclusion with execve() on the process
(cherry picked from commit e1a84b7708c2514769625c2af6c5034694013b6a)
(cherry picked from commit dc94d15a7136c4cfe3342c005d8a319f0583ed9a)

proc: Allow to make proc_rwmem() operate on a consistent address space

(cherry picked from commit e1b0d051bbf7e4e730470cbd6622f71a639834c3)
(cherry picked from commit e7578e37d832ecf1eee8cd3fed10df0e0cb1aa7e)

kern_proc.c: ensure stability of the vmspace we read the strings from

(cherry picked from commit a22c044cce41864a32af6b8281a3c416a2664d7f)
(cherry picked from commit 1f062247ef4e920e7fdd1ebe91b4600d69fe1e91)

kern_proc.c: ensure stability of the vmspace for sysctl kern.proc.vmmap

(cherry picked from commit 5fe6e08d2db56b530f0df2903ef24cfabab7b8ea)
(cherry picked from commit e856c10a4d6dfe30a730246b2050d9dd438085db)

kern_proc.c: ensure stability of the vmspace for sysctl kern.proc.vm_layout

(cherry picked from commit 31fa677e4af00b795bf671847b4dc72960c90f14)
(cherry picked from commit da1398dd6962b458fdcf25799fcb512f4d9c070d)

kern_proc.c: make kern.proc.osrel atomic

(cherry picked from commit 80626f34ee985671bb8c60ee986b89587b7a1511)
(cherry picked from commit b3f99ce653d456c9c829359b0dc83c4867f044b7)

kern_proc.c: disallow execve around sysctl kern.proc.kstacks

(cherry picked from commit 8b5abd9027b8b1f6290c756730ee3adebed007f4)
(cherry picked from commit 197f367cdda7919578d15b1562225d6db462c5ad)

kern_proc.c: disallow execve around sysctl kern.proc.rlimit

(cherry picked from commit 5a91fa5a7656c99e527fe7e6f6bf6bd9e85ab589)
(cherry picked from commit 35b95beb06cab0b10a7e3a697931851315fe3dc2)

kern_event: block the target process from execing for sysctl kern.proc.kqueue

(cherry picked from commit 79b384bd8fdff4869ce4799edb0342ff5c25b6fa)
(cherry picked from commit adb14791b752cf0f07dce44d840f01340aa6d6cb)

kern_resource.c: disallow execve around sysctl kern.proc.rlimitusage

(cherry picked from commit 836749817036b90b60af0584fa21f2d9dbd60ff7)
(cherry picked from commit 190d6677b11a1deed6bd0ef14fd4f990eea20f5b)

kern_procctl(PROC_WX_MAPPINGS_PERMIT): ensure stability of the target vmspace

(cherry picked from commit 6a572920f251ac8ac6a80a55d4d039736ea7dd65)
(cherry picked from commit 23ebf0c97ac5fcd6adb6cda8a8707b99257721a6)

linux_prlimit(): block execve for the target

(cherry picked from commit e41c28e67fac9cd22a85b160c5c9d0477ed03600)
(cherry picked from commit a11c4f036c1136ba90fbfda5d2025d18116562d8)

pfs_readdir(): block the target process from execing

(cherry picked from commit 4c0a0909f928baac982b7de4bfa5b5ca7de5291a)
(cherry picked from commit caa2e5cf7cfb07c115d143023ffb21546a60556a)

pseudofs: ensure that the target process vmspace is stable for VOP_READ/WRITE

(cherry picked from commit a4993bac41350e85bc9affb862d2974a1a09bb5e)
(cherry picked from commit ec0d7d01d6c45eff4043cf178addf65d1933d62a)

procfs, linprocfs: ensure target process vmspace stability

(cherry picked from commit 5db31f1b47b586a5091eb41fc957236f28b78dba)
(cherry picked from commit d7d5337291c983ba969e24c95df0bcab46b44621)

sys_set*id(9): wait for the execblocks to pass

(cherry picked from commit d0384f50dad25d3358d76f7556969ea1d515ba68)
(cherry picked from commit 34b95f53e7ac3a055b3d866d101a79e85d0022c4)

kern_exec.c: explicitly include sys/limits.h for UINT_MAX

(cherry picked from commit f5fce0bcc370a9700249e64901eabf2e0be4ecb0)
(cherry picked from commit bb1154f3ea20291b0c02821743084a6f1a7dd844)

Approved by:	so
Security:	FreeBSD-SA-26:39.execve
Security:	CVE-2026-49415
2026-06-30 23:16:26 +02:00
Mark Johnston
3bb4da789a device_pager: Avoid double-insertion of pages into the pager list
Unmanaged device pager objects maintain a linked list of pages that were
returned from the fault handler.  Initially, such pages are valid, but
msync(MS_INVALIDATE) can mark them invalid (and clean).  They are not
removed from page tables (since they are unmanaged), but a subsequent
mlock() call can trigger a page fault that is handled by the pager.
dev_pager_getpages() then re-inserts the page into the linked list even
though it's already present there.

This patch fixes the problem by removing the linked list.  OBJ_PG_DTOR
is set, so vm_object_terminate_pages() does nothing, and
dev_pager_dealloc() instead handles cleanup of the object.

Add a regression test case which triggers a queue.h assertion failure in
unpatched kernels.

Note, in stable branches we should avoid changing the layout of struct
vm_object.

Approved by:	so
Security:	FreeBSD-SA-26:37.vm
Security:	CVE-2026-49418
Reported by:	slidybat
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57743
2026-06-30 23:16:24 +02:00
Piotr Kubaj
06625b6800 sys/arm64: fix return values of freebsd32_{set,swap}context()
This patch aligns the return values of freebsd32_{set,swap}context()
with their counterparts on amd64 and powerpc64, fixing the setcontext()
and swapcontext() calls in armv7 applications running on aarch64.

In particular, this fixes random crashes in armv7 Ruby applications
running on aarch64 hosts.

Approved by:	so
Security:	FreeBSD-EN-26:16.arm64
Tested by:	fuz
MFC after:	1 week

(cherry picked from commit 92ae21e8a155734f73589b7ef9fa19a6bb6d042f)
(cherry picked from commit 58a15fe75cc59a73016f00069f2dad001d798edf)
2026-06-30 23:16:18 +02:00
Mark Johnston
0101c21cac pf: Avoid taking the pf rules write lock in a couple of ioctls
DIOCGETRULENV takes the write lock as well but I believe this is only
required when clearing rule counters.  Acquire the read lock if that is
not the case.

Reviewed by:	kp, allanjude
MFC after:	2 weeks
Sponsored by:	OPNsense
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D54292
2026-06-10 09:04:02 +02:00
Ed Maste
e97cdf37cc netlink: Fix lock leak in nl_find_nhop
Reviewed by: bz, pouria
Fixes: 7e5bf68495 ("netlink: add netlink support")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57156

(cherry picked from commit d66fec481bfd65cbabb6c12a410d76843e76083e)
(cherry picked from commit ab599e44dba31d7b002aed8c71242e06d992b21a)
2026-06-10 08:49:46 +02:00
Mark Johnston
04788d7c5a Add UPDATING entries and bump version
Approved by:	so
2026-06-10 08:45:22 +02:00