310119 Commits

Author SHA1 Message Date
Adrian Chadd 62c1865c9a net80211: delete the deprecated ieee80211_wepkey struct
This hasn't been used in a long time, and since I am shuffling around
the net80211 crypto API a bunch, let's just delete it instead of
leaving it here and trying to figure out how to support it if it's
used by userland somehow.

Reviewed by:	guest-seuros
Differential Revision:	https://reviews.freebsd.org/D57312
2026-06-08 21:27:12 -07:00
Adrian Chadd a653fd5560 net80211: create IEEE80211_KEYBUF_128_SIZE / IEEE80211_MICBUF_128_SIZE
The IEEE80211_KEYBUF_SIZE and IEEE80211_MICBUF_SIZE are sprinkled
throughout the net80211 stack, ioctl API and drivers.  This makes it
challenging to (eventually) up IEEE80211_KEYBUF_SIZE to support 256 /
384 bit encryption as, well, it'll break every single driver and the
ioctl API in doing so.

So as part of this, let's start to separate out the current key/mic
buffer size from what drivers and the ioctl layer are using.
Drivers especially shouldn't be using these definitions as their
key sizes are hardware / firmware API limits, not net80211 limits.
Ideally drivers would define their own key buffer / mic buffer
sizes and only copy in keys up to that length (and fail keys
that are too large) but the current net80211 API isn't there yet.

This doesn't yet change what defines / buffer sizes are used in the
ioctl layer.  I'm going to plan out some subsequent work to
separate out those defines and ioctl APIs so they maintain using
the 128 bit key/mic buffer sizes and will copy them in/out of any
larger net80211 key buffer size in the future.

Differential Revision:	https://reviews.freebsd.org/D54593
2026-06-08 21:26:07 -07:00
Adrian Chadd c3d8aca1d4 net80211: add DEFERRED_WORK.md
Describe the ieee80211_task API, why its used and some of
its shortcomings.

Differential Revision:	https://reviews.freebsd.org/D57261
2026-06-08 18:00:36 -07:00
Mark Johnston 2ff705f32a 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
2026-06-08 22:49:51 +00:00
Mark Johnston c491c2db2f iconv.3: Fix formatting of the error section
MFC after:	1 week
2026-06-08 22:49:51 +00:00
Mark Johnston 6cd8a1bf4f tests/ptrace: Validate PT_SC_REMOTE with some tricky syscalls
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57485
2026-06-08 22:49:51 +00:00
Mark Johnston acf0be6e51 ip6: Drop dead code in ip6_input_hbh()
After commit 069a67374e, ip6_input() quickly rejects packets with
plen == 0, before ip6_input_hbh() is called.  So, there is no need to
check this condition again in the helper function.

Reviewed by:	pouria, zlei, tuexen
Differential Revision:	https://reviews.freebsd.org/D57342
2026-06-08 22:49:51 +00:00
Dag-Erling Smørgrav 5bd78cfc80 auditd: Fix signal handling
Rewrite the main loop to use ppoll() instead of just blocking on read,
blocking the signals we care about when we aren't polling.

I didn't bother replacing alarm() with setitimer(); the alarm code
is dead anyway since there is no way for max_idletime to acquire a
non-zero value.

While here, avoid leaking the pid file and trigger descriptors to the
log child.

PR:		295840
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D57451
2026-06-09 00:45:34 +02:00
Alexander Ziaee 05f132adc5 mount_udf.8: Alphabetize and align options
While here, remove "The following UDF specific options are available:".
It is unused and does not appear to have ever been used.

MFC after:	3 days
2026-06-08 18:30:22 -04:00
Chuck Tuffli 471fdd91d9 linux: Fix sockopt copyout
The Linux getsockopt did not check the size of the provided buffer when
copying out the value, leading to buffer overflows (e.g., for TCP_INFO).

Fix is to use the smaller of the option value size and the provided
buffer.

MFC after:	1 month
Relnotes:	yes
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D55881
2026-06-08 14:20:14 -07:00
Jesús Daniel Colmenares Oviedo ea3426bc80 nuageinit: Create parent directories in write_files
Currently, 'write_files' does not create parent directories, and
'runcmd' cannot be used here, since those scripts run after the files
have been written. The only workaround is to create the files in an
existing directory, such as '/root' or '/tmp', and then move those
files using 'runcmd', but this is cumbersome when there are many files,
even if they are small.

With this change, nuageinit now creates the parent directories for each
file using the path field, which mimics the same behavior as in
cloud-init.

Permissions and ownership can also be configured using 'runcmd'.

Reviewed by:            bapt@
Approved by:            bapt@
Differential Revision:  https://reviews.freebsd.org/D57395
2026-06-08 17:05:09 -04:00
Ed Maste b16c731b01 ipfw nat: Add assertion that mbuf is not a chain
Discarding m_free's return value will result in an mbuf leak if the mbuf
was in a chain.

In general we should use m_freem if the mbuf may be in a chain, or
assert that the return was NULL.  There will not be a chain here due to
m_megapullup, so add an assert.

Reviewed by:	ae
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57479
2026-06-08 16:47:24 -04:00
Konstantin Belousov a2cfe53577 exit1(9): do not deadlock if exit is called due to PT_SC_REMOTERQ
The remote syscall is executed in the context where debugger owns a
p_lock hold on the target.  Due to this, exit1() waiting for p_lock
going to zero, never happen.

Postpone the exit1() call to ast then, saving the provided rval and
signo in the struct proc.  Mark the async-exiting proc with the new
p_flag P_ASYNC_EXIT.

While p_xexit can be reused, p_xsig can be only set by actual exit1(),
otherwise it breaks the ptrace mechanism. Allocate a dedicated p_asig
for it.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57482
2026-06-08 23:14:20 +03:00
Konstantin Belousov 9f378397ee procstat binary: do not skip pid if either path or osrel sysctls failed
PR:	295893
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57493
2026-06-08 23:14:20 +03:00
Ed Maste 888d9236e2 netlink: Use unsigned type in nl_process_nbuf
nlmsghdr::nlmsg_len and nl_buf::offset are u_int.  Make msglen match.

Reviewed by:	pouria, glebius
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57474
2026-06-08 15:51:35 -04:00
Konstantin Belousov 0b269737f9 imgact_elf: handle unaligned phdrs
Althought non-compliant, there are binaries which have the phdrs placed
unaligned in the image.  Since we have the code to allocate memory for
off-page phdrs, the same code path can be used to handle unaligned
phdrs.

Relax the requirement for both the activated image and interpreter.

PR:	295629
Reviewed by:	emaste, markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57498
2026-06-08 20:02:13 +03:00
Gleb Smirnoff 256fa87c9f netgraph: remove remnants of IPPROTO_DIVERT
Fixes:	8624f4347e
2026-06-08 09:35:07 -07:00
Abdelkader Boudih a9519f7821 firewire: Fix watchdog_clock aliasing and fw_tl2xfer UAF race
Two bugs in the firewire bus layer that affect all consumers (
if_fwip, sbp):

watchdog_clock was a static local in firewire_watchdog(), shared across
all firewire_comm instances.  With two controllers (e.g. built-in +
Thunderbolt Display), both advance the same counter, so the second
controller's 15-second boot-time timeout guard expires prematurely.

fw_tl2xfer() released tlabel_lock before returning the xfer pointer.

Reviewed by:	zlei, adrian
Differential Revision:	https://reviews.freebsd.org/D57496
2026-06-08 07:30:29 -07:00
Cy Schubert fce16f60de krb5: Fix reachable assert when importing krb5 names
If a name token contains trailing garbage, error out from
krb5_gss_import_name() instead of crashing the process with an
assertion failure.

Commit message details obtained from upstream commit.
Obtained from:	upstream commit 07818f1fd
Reported by:	Aisle Research (Ze Sheng, Dmitrijs Trizna,
		Luigino Camastra, Guido Vranken) to krb5-bugs
MFC after:	3 days
2026-06-08 06:52:04 -07:00
Cy Schubert efb5c07f91 krb5: Fix null dereference in SPNEGO token processing
krb5 1.22.1 erroneously removed a check from get_negTokenResp() for
successful decoding of the mechListMIC field.  Restore the check to
prevent a null pointer dereference.

Commit message details obtained from upstream commit.
Obtained from:	Upstream commit 4ae75cded
MFC after:	3 days
2026-06-08 06:52:04 -07:00
Cy Schubert 37e9d3641b ipfilter: Fix ip_pptp_pxy (PPTP proxy) length underflow
A PPTP client sending a specially crafted PPTP message with a length
smaller than the already processed fixed header can panic the system.
This resultes in a negative remaining length (a large unsigned 16-bit
number).

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
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D57383
2026-06-08 06:51:24 -07:00
Kristof Provost 035e87247f pfsync: remove invalid panic
When we undefer a packet (when the peer acks the state) it's possible
that we don't find a corresponding pfsync_deferral. We panic here, but
that's actually something that can happen in normal operation:
 - if we have too many deferred packets already (in pfsync_defer())
 - if the deferral timed out (in pfsync_defer_tmo())

Remove this panic and document the scenarios where it might occur.

MFC after:	2 weeks
Sponsored by:	Orange Business Services
2026-06-08 09:44:56 +02:00
Emmanuel Vadot 5f84c6db7a fwget: amdgpu: Add needed package for Granite Ridge
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2026-06-08 09:30:15 +02:00
Robert Clausecker 93221c2776 depend-cleanup.sh: rebuild strrchr.o on riscv64 if it came from strrchr.S
We have to switch back to the previous rule once the temporary
build fix has been replaced with a permanent fix.

PR:		295823
See also:	4996ebdb72
Reported by:	siva
MFC after:	1 week
2026-06-07 23:00:25 +02:00
Faraz Vahedi 5f732742ad libc: Add free_sized() and free_aligned_sized() as per C23
Add C23 sized deallocation entry points as thin wrappers around free(3).
Implementations may ignore size and alignment hints, so behaviour stays
correct for existing allocations without validating caller metadata yet.

When jemalloc is updated to 5.3.1, rewire these to je_free_sized() and
je_free_aligned_sized() so deallocation can use the allocator's sized
deallocation (free_sized for fast paths and free_aligned_sized for
correct aligned hints.)

Please note this change satisfies the standard interface only. Both
functions should be delegated to jemalloc after the upgrade so callers
get the intended allocator behaviour; until then, hints are unused and
neither sized nor aligned-sized deallocation optimizations apply.

Signed-off-by:	Faraz Vahedi <kfv@kfv.io>
Reviewed by:	fuz
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2201
MFC after:	1 month
2026-06-07 22:59:19 +02:00
Steve Kargl c3f6dcea19 msun: Fix up for recent rsqrt[fl] functions
Paul Zimmermann (of Core-Math and MPFR fame) graciously tested
the recently committed rsqrt[fl]() functions.  He identified 127
incorrectly rounded values for rsqrtf() in round-to-nearest mode.
This patch fixes the rounding in RN.  Exhaustive testing now shows
that rsqrtf() is corrected rounded for RN.  He also tested rsqrt()
and rsqrtl() in the interval [1,4).  Both appear to be correctly
rounded.  Finally, the patch includes small changes to comments.

A concise list of changes is

* lib/msun/src/s_rsqrt.c:
  . Fix comments.

* lib/msun/src/s_rsqrtf.c
  . Fix comments.
  . Exhaustive testing by Paul Zimmermann found 127 incorrectly
    rounded values in round-to-nearests.  These gave have the
    form 0x1.13e07pN with N an odd integer.  With this patch, all
    values are now correctly rounded in round-to-nearest.

* lib/msun/src/s_rsqrtl.c
   . Fix comments.
   . Move all variable declarations to top of function and sort.

PR:		295706
MFC after:	1 week
Fixes:		3085fc9d97
2026-06-07 22:59:19 +02:00
Robert Clausecker 4996ebdb72 libc/riscv64: temporarily unhook strrchr() from the build
A bug was discovered in the riscv64 assembly implementation of
this function.  Fall back to the generic implementation until a
fix can be developed.

PR:		295823
Reported by:	siva
MFC after:	1 week
2026-06-07 22:59:19 +02:00
Faraz Vahedi 26a1180cd1 qsort.3: Document mergesort() behaviour on size overflow
Signed-off-by:	Faraz Vahedi <kfv@kfv.io>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2243
Reviewed by:	fuz
MFC after:	1 week
2026-06-07 22:59:19 +02:00
Faraz Vahedi 3501eec9dd libc: Guard mergesort() allocation size arithmetic
Signed-off-by:	Faraz Vahedi <kfv@kfv.io>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2243
Reviewed by:	fuz
MFC after:	1 week
2026-06-07 22:59:18 +02:00
Martin Matuska b1b4871f37 zfs: fix sysctl_os.c
Correctly declare vfs.zfs.metaslab.condense_pct

The following sysctls have moved to metaslab.c:
vfs.zfs.metaslab.df_alloc_threshold
vfs.zfs.metaslab.df_free_pct
vfs.zfs.metaslab.sm_blksz_no_log
vfs.zfs.metaslab.sm_blksz_with_log

Reported by:	dim@FreeBSD.org
2026-06-07 21:18:22 +02:00
Martin Matuska d949721745 zfs: merge openzfs/zfs@a170134fe
Notable upstream pull request merges:
 #18372 eaaea55b6 Consistently encode DRR_BEGIN packed nvlist payloads with
                  NV_ENCODE_XDR
 #18410 891e379d0 Fix failfast default and usage
 #18470 a2d053329 zdb: Add some more file layout output, triggered by -v
 #18472 d50f5b6d0 dsl_dir: avoid dd_lock during snapshots_changed updates
 #18493 d65015938 Vdev allocation bias/class change
 #18497 8fdc86675 zfs: annotate nested dd_lock in reservation sync
                  accounting
 #18494 956deba27 zdb: detect BRT and DDT leaks during block traversal
 #18499 c7cfe0805 zarcstat: detect attached L2ARC device with no data
 #18503 439b802e7 sa: fix sa_add_projid lock ordering
 #18508 968f4db03 zpool-attach.8: add EXAMPLES section
 #18513 45dddc452 zfs.4: Fix documentation of zfs_arc_dnode_reduce_percent
 #18516 8ff64005a zap: split implementation out into more files
 #18520 181e1b522 Fix double free for blocks cloned after DDT prune
 #18535 -multiple zstream: fix crashes when refcount tracking enabled
 #18536 -multiple refcount tag fixups
 #18541 a65ed7afd zpool/zfs: accept --help and -? after a subcommand
 #18544 6fb72fda0 zio_ddt_write: compute have_dvas after taking dde_io_lock
 #18546 -multiple zap: internal locking uplift
 #18550 40a87651d zap_impl: use flex array field for mzap_phys_t.mz_chunks
 #18551 -multiple zap: make the _by_dnode() op variants be the primary
                  implementation
 #18570 112b0131b zpl_xattr: stop heap-allocating prefixed xattr names
 #18578 4bc8c39b6 zed: Prefer dRAID distributed spares to regular ones
 #18596 e30ab5fa4 FreeBSD: Make it possible to build openzfs.ko with
                  sanitizers
 #18597 472ddca11 zed: Prefer spares with matching rotational and size
 #18599 c90dc2808 enforce exact decompressed length for lz4, gzip, and zstd
 #18603 -multiple zap: add zap_cursor_init_by_dnode; cursor unit tests;
                  mock dnode refcounts
 #18604 59dc88602 nvpair: Check for un-terminated strings in packed nvlist
 #18606 ef6f26145 When reading a vdev label skip libzfs_core_init()
 #18613 0aa4088dc sharenfs: Check for invalid characters
 #18615 80fb85b80 Fix the integer type in zfs_ioc_userspace_many()
 #18616 e199f6d98 Fix uninitialized variable warning in vdev_prop_get()
 #18617 7de42602c Extend dataset zfs_ioc_set_prop() secpolicy
 #18622 5fea0c838 Parallelize metaslab_sync_done() calls
 #18623 cab50d5ad Add additional verification of size fields and strings
 #18630 -multiple zap: misc function removal / uplift / tests
 #18633 a8ef128da Fix uninitialized variable warning in zil_parse()

Obtained from:	OpenZFS
OpenZFS commit:	a170134feb
2026-06-06 22:48:32 +02:00
Abdelkader Boudih 4a299ef19c firewire: clean up XXX comments
Remove stale and misleading XXX comments throughout firewire.c.
Most were from the original 2002 codebase and either described
correct behavior or noted aspirational improvements that never
happended.

Two actionable items retained as TODO: config ROM CRC validation
and pending xfer cleanup on detach.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D57466
2026-06-06 13:17:18 -07:00
Abdelkader Boudih a620746da1 fix(fwe): add missing net epoch around ether_input
Wrap the if_input() call in fwe_as_input() with NET_EPOCH_ENTER/EXIT.
The network stack requires epoch protection when delivering packets
via if_input, and fwe was missing it.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D57459
2026-06-06 13:08:59 -07:00
Konstantin Belousov 390ae06d4f procctl(PROC_REAP_GETPIDS): re-validate reaper after relock of proctree_lock
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57487
2026-06-06 23:00:30 +03:00
Konstantin Belousov 261c97b47e kern_procctl: add get_reaper_or_p() helper
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57487
2026-06-06 23:00:30 +03:00
Konstantin Belousov a845480cc1 procctl(): do not allow the process to exit inside kern_procctl_single()
Requested and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57491
2026-06-06 23:00:30 +03:00
Baptiste Daroussin e5ef12ccd0 nuageinit: install certs in /usr/share/certs/trusted
Suggested by:	kevans
2026-06-06 21:31:21 +02:00
Christos Longros a170134feb metaslab: expose df_alloc_threshold and df_free_pct on Linux
Expose metaslab_df_alloc_threshold and metaslab_df_free_pct as module
parameters on Linux, matching their existing FreeBSD sysctls.

Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Christos Longros <chris.longros@gmail.com>
Closes #18632
2026-06-06 10:16:23 -07:00
Brian Behlendorf b35bf7e7c6 ZTS: relax zpool_import_parallel_pos.ksh timing
Occasionally in the CI this test will fail because the parallel import
took longer than half of the serial time (but still less than the full
serial time).  Increase the cutoff to 3/4 of the serial time to preserve
the intent yet try and avoid these false positive failures.

Reviewed-by: Chris Longros <chris.longros@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #18634
2026-06-06 10:15:11 -07:00
Mark Johnston 1ee4b5fd82 fork: Drop an uneeded PHOLD/PRELE pair
Support for swapping out kernel stacks was removed, so the PHOLD has no
purpose.  (And even before that, it's not clear why a swapout here would
have been problematic.)

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D57486
2026-06-06 12:52:15 +00:00
Ed Maste 85195c0c7f ipsec: Free entire mbuf chain on failure
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57475
2026-06-06 08:35:47 -04:00
Ed Maste 232021fd09 linuxkpi 802.11: Free entire mbuf chain on failure
Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Fixes: 0936c648ad ("LinuxKPI: 802.11: update the ni/lsta reference cycle")
Fixes: c816f64e66 ("LinuxKPI: 802.11: plug mbuf leak")
Differential Revision: https://reviews.freebsd.org/D57477
2026-06-06 08:34:50 -04:00
Ed Maste 5a7f41e94b if_stf: Free entire mbuf chain on failure
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:	markj, bz, kp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57476
2026-06-06 08:32:40 -04:00
Dag-Erling Smørgrav 8d9dff23f2 check-old-libs: Show information about packages
If pkg is installed, for each old library found to still be present,
check if any installed packages either provide or require the library,
and inform the user.

MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53977
2026-06-06 09:54:21 +02:00
Baptiste Daroussin bad3c15dff nuageinit: update documentation for phone_home and final_message 2026-06-06 08:17:04 +02:00
Baptiste Daroussin 68e60bb8b6 nuageinit: expose decode_base64 to fix tests 2026-06-06 08:05:50 +02:00
Baptiste Daroussin 58653bf4d0 nuageinit: implement phone_home support
Posts instance data (hostname, instance_id, public keys) to a URL
using fetch(1). Supports:
- url: target URL
- post: list of data items to send, or 'all'
- tries: number of retry attempts (default 1)
2026-06-05 23:28:25 +02:00
Baptiste Daroussin e01f202ecf nuageinit: implement final_message support 2026-06-05 23:03:45 +02:00
Baptiste Daroussin 71e8122b3f nuage.lua: add encode_base64 helper 2026-06-06 08:01:48 +02:00
Brian Behlendorf a8ef128da2 Fix uninitialized variable warning in zil_parse()
This resolves the following possible uninitialized variable warning
when building with --enable-code-coverage and gcc 8.5.0.

    module/zfs/zil.c: In function ‘zil_parse’:
    module/zfs/zil.c:549:47: warning: ‘end’ may be used uninitialized
    in this function [-Wmaybe-uninitialized]

Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #18633
2026-06-05 14:02:47 -07:00