Commit Graph

309054 Commits

Author SHA1 Message Date
Mark Johnston 3d8928114c eventhandler: Fix the NODEBUG build
Reported by:	Michael Butler <imb@protected-networks.net>
Fixes:		735b16d490 ("eventhandler: Fix a race when pruning eventhandlers")
2026-05-06 14:39:52 +00:00
Baptiste Daroussin 748402ebf2 devmatch: read linker.hints from all module paths
Previously, devmatch would stop at the first linker.hints file
found in kern.module_path. This meant modules installed in
/boot/modules/ were invisible to devmatch if /boot/kernel/
contained a linker.hints file (which it always does).

Merge hints from all directories in kern.module_path.
This allows third-party or out-of-tree kernel modules in
/boot/modules/ to be auto-loaded by devmatch just like
built-in modules.

Reviewed by:		imp
Differential Revivion:	https://reviews.freebsd.org/D56847
2026-05-06 16:16:54 +02:00
Mark Johnston 486c2dfaa7 if_vlan: Use the exclusive lock everywhere
Running sys/net tests in parallel reveals some panics which look like
the one below:

```
shared lock of (sx) vlan_sx @ /home/markj/sb/main/src/sys/net/if_vlan.c:2395
while exclusively locked from /home/markj/sb/main/src/sys/net/if_vlan.c:1850
panic: excl->share
cpuid = 9
time = 1776467219
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00d84e0780
vpanic() at vpanic+0x136/frame 0xfffffe00d84e08b0
panic() at panic+0x43/frame 0xfffffe00d84e0910
witness_checkorder() at witness_checkorder+0xdb1/frame 0xfffffe00d84e0ad0
_sx_slock_int() at _sx_slock_int+0x64/frame 0xfffffe00d84e0b10
vlan_ioctl() at vlan_ioctl+0x25c/frame 0xfffffe00d84e0b70
if_setflag() at if_setflag+0xdc/frame 0xfffffe00d84e0be0
ifpromisc() at ifpromisc+0x27/frame 0xfffffe00d84e0c00
vlan_setflags() at vlan_setflags+0x64/frame 0xfffffe00d84e0c30
vlan_unconfig_locked() at vlan_unconfig_locked+0xb7/frame 0xfffffe00d84e0c70
vlan_clone_destroy() at vlan_clone_destroy+0x5d/frame 0xfffffe00d84e0cb0
if_clone_destroyif_flags() at if_clone_destroyif_flags+0x8c/frame 0xfffffe00d84e0cf0
if_clone_detach() at if_clone_detach+0x106/frame 0xfffffe00d84e0d20
vnet_destroy() at vnet_destroy+0x154/frame 0xfffffe00d84e0d50
prison_deref() at prison_deref+0xaf5/frame 0xfffffe00d84e0dc0
sys_jail_remove() at sys_jail_remove+0x1a7/frame 0xfffffe00d84e0e00
amd64_syscall() at amd64_syscall+0x169/frame 0xfffffe00d84e0f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00d84e0f30
--- syscall (508, FreeBSD ELF64, jail_remove), rip = 0x25bd44705ca, rsp = 0x25bcfe72ab8, rbp = 0x25bcfe72b40 ---
```

All vlan interfaces are locked by a single recursive global lock.  There
are cases, like in the panic above where vlans are stacked on top of
each other, where the driver tries to acquire an exclusive lock while
holding a shared lock, and vice versa.

With longer-term goals of making the networking regression test suites
stable when run in parallel, and simplifying network control plane
locking, which I find is quite complex and buggy, let's change if_vlan
to use the exclusive lock everywhere.

Reviewed by:	pouria, zlei, kp, glebius
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D56778
2026-05-06 11:48:24 +00:00
Mark Johnston 735b16d490 eventhandler: Fix a race when pruning eventhandlers
By default, eventhandler_deregister() blocks until it reaches some point
where no threads are invoking the event.  At this point, it knows that
1) no threads are currently executing the handler,
2) some thread has freed the eventhandler structure by virtue of having
   called eventhandler_prune_list(),
so it is safe to return.

Suppose a thread is trying to deregister an event handler.  A different
thread prunes it, and wakes up the first thread.  Before the first
thread runs, a third thread grabs the event handler lock, and starts
executing handlers.  The first thread observes el_runcount > 0, and goes
back to sleep.  The third thread sees no event handlers to prune, and
doesn't wake up the first thread, which sleeps forever.

This change fixes the race and tries to make eventhandler_invoke() more
efficient: keep a count of the number of dead list entries and only
prune the list if there is at least one dead entry.  Also, in
eventhandler_deregister(), we only need to sleep if some dead entries
are present, rather than sleeping whenever some thread is running
handlers.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D56767
2026-05-06 11:48:05 +00:00
Xin LI 8223661346 Revert "zstd: disable weak-symbol tracing hooks in the kernel"
This reverts commit de2ea5423c which is
no longer needed after 1dddb580f9 .

Tested by:	mmel
2026-05-06 01:27:55 -07:00
Abdelkader Boudih 081d3ab24e ichsmb: add Ice Lake-LP (0x34a3) and Ice Lake-N (0x38a3) SMBus device IDs
Add PCI device IDs for two Ice Lake PCH SMBus controller variants:
- 0x34a3 (Ice Lake-LP), previously listed as the generic "Ice Lake" entry (ID_ICELAKE), renamed to ID_ICELAKELP for clarity.
- 0x38a3 (Ice Lake-N), a separate PCH variant not previously supported.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D56732
2026-05-05 18:31:48 -07:00
Ed Maste 0979bfb0ec smsc: Add missing newline to PHY timeout error printf 2026-05-05 19:51:43 -04:00
Dag-Erling Smørgrav 2fef18ff59 certctl: Unstickify (un)trusted certificates
Ever since certctl was rewritten in C, the rehash command has reingested
TRUSTDESTDIR / UNTRUSTDESTDIR in addition to TRUSTPATH / UNTRUSTPATH.
This seemed like a good idea at the time but was, in retrospect, a
mistake, as it means a (un)trusted certificate remains (un)trusted
forever (or at least until it expires) even if it is removed from
(UN)TRUSTPATH.  Among other issues, it causes ports QA to fail for any
port that either installs certificates or depends on a port that does.

Although this behavior was undocumented, the change may surprise users
who have added certificates manually, so update the manual page to point
it out and add prominent warnings to the trust and untrust commands.

PR:		290078
MFC after:	1 week
Reviewed by:	kevans, bcr
Differential Revision:	https://reviews.freebsd.org/D56617
2026-05-06 00:30:52 +02:00
Kristof Provost c24b1d9359 pfctl: handle errors from PFNL_CMD_GETSTATES
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-05-05 22:20:42 +02:00
Kristof Provost a0e4c65f18 pf: do not reject rules with colliding hashes
We insert rules in pf_krule_global solely for the benefit of the
'keepcounters' feature. Failing to insert (beause the rule hash
collides, or an identical rule already exists) would be worse than
restoring counts to the wrong rule (or failing to restore them at all).

PR:		282863, 294860, 294859, 294858
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D56745
2026-05-05 22:20:42 +02:00
Simon J. Gerraty 8334d46162 Fix typo in curthread 2026-05-05 13:14:36 -07:00
Abdelkader Boudih 7619d14d08 acpi_panasonic: acquire serial lock before calling hkey_sound_mute in shutdown
acpi_panasonic_shutdown() calls hkey_sound_mute() without holding
the ACPI serial lock. Every other call site holds
`ACPI_SERIAL_BEGIN(panasonic)` before calling it, as the locking
model is caller-owned.

This seems to affect the whole Panasonic Toughtbook lineup btw.

Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D56718
2026-05-05 12:51:38 -07:00
Dag-Erling Smørgrav fd386e76fa md5: Don't generate test cases just to skip them
Don't waste time generating Perl test cases for algorithms that are not
supported in Perl mode only to skip them when they are run.

MFC after:	1 week
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D56687
2026-05-05 21:44:29 +02:00
Dag-Erling Smørgrav 49e496d277 stat: Set the timezone before testing -t flag
The test assumes UTC, which is what I use on my development systems and
clearly what is used on our CI runners.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D56836
2026-05-05 19:59:36 +02:00
Ed Maste 89c883c09a mii: Fix SMSC name
The LAN8700 / LAN8710 PHYs were Standard Microsystems Corporation (SMSC)
parts.  I presume SMC was chosen as an abbreviation, but the company
always used SMSC as its short name.

SMSC was acquired by Microchip in 2012.  I kept the pre-acquisition
name, as NetBSD (from where we obtained miidevs) uses SMSC.

Reviewed by:	adrian
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D56819
2026-05-05 13:33:39 -04:00
Simon J. Gerraty adad686222 mac_veriexec_priv_check block proc_write_*regs*
Writing to /proc/$pid/regs can also be leveraged to mess with memory.

Only allow a trusted process to do so.

Sponsored by: Hewlett Packard Enterprise Development LP.

Reviewed by:	olce
Differential Revision:	https://reviews.freebsd.org/D56763
2026-05-05 10:29:54 -07:00
ShengYi Hung bf2c6d23ad Revert "libusb: change callback register handler to int"
This reverts commit ce9ced951a.

We should handle backward compatibility before introducing this patch as
people may rely on old ABI.
2026-05-06 00:48:46 +08:00
ShengYi Hung 0627136698 libusb: fix incorrect status type when completion on cancel the events
Reviewed by:    lwhsu, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51736
2026-05-05 23:58:49 +08:00
ShengYi Hung ce9ced951a libusb: change callback register handler to int
libusb upstream uses int for register handler. This causes some library
user (like pyusb) to assume that we have int in all implementations and
therefore provides a 4 byte storage only. This causes Segmentation
fault as we will right the pointer.

Reviewed by:    adrian
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54211
2026-05-05 23:48:22 +08:00
ShengYi Hung efc0ced5c4 ath{10,11,12}k: Add missing header in Makefile
Reviewed by:    bz
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56693
2026-05-05 23:26:48 +08:00
ShengYi Hung 261002908f libusb: Add libusb_endpoint_transfer_type enum
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
2026-05-05 23:22:47 +08:00
Baptiste Daroussin 9f2ad7c097 init: allow to specify a custom path for rc(8)
This is useful for testing alternative service managers
without modifying /etc/rc

MFC After:	1 weeks
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D56828
2026-05-05 15:39:58 +02:00
Andrew Turner dc00f11840 Revert "virtio_net: Use bus_dma for rxq/txq buffers"
This reverts commit c16c95192f.

Revert until we can fix reported issues
2026-05-05 10:18:14 +01:00
Andrew Turner c8167ebb74 Revert "virtio_net: Use bus_dma for command/ack buffers"
This reverts commit b5bad6df46.

Revert until we can fix reported issues
2026-05-05 10:18:14 +01:00
Kristof Provost bf6d00afdb pfsync: reject invalid SCTP states
SCTP states should always have a src scrub object associated with them.
Crafted pfsync packets might not have this, leading to us derferencing a
NULL pointer on cleanup.

Validate the pfsync state insertion packet to make sure this is correct.

PR:		294989
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-05-05 09:45:29 +02:00
Ryan Libby 6f84579ae4 nfs_pub: move from vfs_subr.c to vfs_export.c
nfs_pub is used only in vfs_export.c.

Reviewed by:	kib, rmacklem
Differential Revision:	https://reviews.freebsd.org/D56777
2026-05-04 22:55:11 -07:00
Colin Percival 89b97931d6 bsdinstall: Always use pkg.FreeBSD.org
The FreeBSD-base bits are accessible via pkg.FreeBSD.org, even for
releases, so there is no need to point at pkgbase.FreeBSD.org.

MFC after:	3 days
2026-05-04 21:21:27 -07:00
Lexi Winter 8e8d878562 packages: Make create-sets.sh more robust during release
Commit d1c176fedf made create-sets.sh exit when it encounters an
error, instead of creating an empty repository.  However, this turns
out to cause some issues:

1. A package not having any sets is considered an error, but during
   the release build, we stuff a 'pkg' package into the repository
   which doesn't have any sets, which causes a failure.  Avoid this
   by simply ignoring the pkg package.

2. No error was printed in this case, which made the problem hard
   to diagnose.  Add an explicit error message.

3. A similar problem occurred running on a repository which already
   contained sets, which is not usually done during the build, but
   is not necessarly an inappropriate thing to do.  Fix this one by
   ignoring set packages when looking for sets.

While here, fix another issue that might cause packages to be wrongly
skipped if the path to the repository contains a '-' character, since
we didn't strip the path before testing the package name.

PR:	294966
Fixes:	d1c176fedf ("packages: Make create-sets.sh more robust")
MFC after:	2 weeks
Reported by:	Alastair Hogge <agh@riseup.net>
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D56792
2026-05-05 01:32:34 +01:00
Rick Macklem 03e9e83f35 nfs_nfsdserv.c: Clip number of callback slots
The client tells the server how many callback slots
it can handle in the callback session.  However, the
NFSv4.1/4.2 server can only handle a maximum of
NFSV4_SLOTS slots.  This patch clips the client's
value to that, to avoid using too high a slot#
for a callback.

Fortunately, I do not know of an extant client that
specifies a value greater than NFSV4_SLOTS, so this
patch is not really needed, as yet.  Also, the client
rarely uses a slot# above 0 when doing callbacks.

MFC after:	2 weeks
2026-05-04 17:04:00 -07:00
Jean-Sébastien Pédron 658bb99db9 linuxkpi: Implement module_*() APIs as static functions
This fixes an "unused variable" warning when building DRM drivers.

Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56780
2026-05-04 21:13:43 +02:00
Mateusz Piotrowski c295f02637 zone.9: Add a missing newline
MFC after:	3 days
2026-05-04 20:29:48 +02:00
Mark Johnston 41b03932e5 tests: Add a simple regression test for an execve overflow bug
MFC after:	2 weeks
2026-05-04 17:28:02 +00:00
Mark Johnston eca4dd1338 execve: Add guard pages around execve KVA buffers
This helps ensure that overflows will trigger a panic instead of
silently corrupting adjacent buffers, as happened in SA-26:13.exec.

Extend kmap_alloc_wait() to support allocation of guard pages on both
sides of a KVA allocation.  Modify the exec_map setup accordingly.  Add
the "vm.exec_map_guard_pages" tunable to provide control over the guard
page allocations.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D56711
2026-05-04 17:28:02 +00:00
Ryan Libby d5728351a5 amd/int0x80 test: fix inline asm for gcc
Gcc complained about the unused %0 asm argument.

Fixes:	2c2ec6bbc9 ("tests/sys/arch/amd64: add a program to check INT $0x80 behavior on amd64")
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D56781
2026-05-04 09:34:41 -07:00
Abdelkader Boudih 36b399f55e asmc: rename wol sysctl to auto_poweron
Older SMC firmware exposed AUPO as a Wake-on-LAN control. On updated
firmware, the key controls automatic power-on when AC power is restored
after a power loss; WoL is handled by the GBE controller instead.
Rename the sysctl to reflect the current semantics. No compatibility
alias is provided as the sysctl has not appeared in any release.

Reviewed by:	ziaee, adrian
Differential Revision:	https://reviews.freebsd.org/D56747
2026-05-04 07:26:44 -07:00
Lexi Winter 045a9ef829 llvm: Don't install /usr/bin/{gcov,objdump} twice
Commit c4f08d46c7 moved the symlinks for the LLVM binutils from LLVM
itself to the toolchain (usr.bin/clang/toolchain), but did not remove
the links for /usr/bin/gcov and /usr/bin/objdump from the llvm version,
meaning we installed them twice, once in the clang package and once in
the toolchain package.

Remove the links from the llvm version and move the MLINKs to toolchain,
which is where the other MLINKs dwell.

While here, fix toolchain to use the correct build option for llvm-cov,
MK_LLVM_COV.

Fixes: c4f08d46c7 ("llvm-*: Move all LLVM_BINUTILS symlinks to toolchain package")
Reported by:	jrm
Reviewed by:	jrm, dim, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D56788
2026-05-04 14:49:20 +01:00
Dag-Erling Smørgrav 8acc4c16c6 vis.3: Try to better describe VIS_SAFE
The current text fails to draw the reader's attention to the fact that
VIS_SAFE essentially exempts certain characters from being encoded.

While here, fix some markup nits.

MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D56716
2026-05-04 14:08:10 +02:00
Justin Hibbits 7b5a23b124 rs5c372a: Fix copyright header
Reported by:	ziaee@
Fixes:	d22051b18 ("iicbus/rtc: Add driver for the Ricoh rs5c372 RTC")
2026-05-03 21:47:54 -04:00
Justin Hibbits 7a40b8a89e dpaa: Fix copyright headers
Reported by:	ziaee@
Fixes:	fd8d34ce27 ("dpaa: Migrate from NCSW base to a home-grown driver")
2026-05-03 21:47:54 -04:00
Rick Macklem 457c621add nfsd: Disable use of callbacks for NFSv4.0
Commit 71ac1ec5c9 disabled callbacks for the NFS
client for NFSv4.0.  This patch does the same for
the NFSv4.0 server.

The only use for callbacks for NFSv4.0 is delegations
and delegations rarely work well for NFSv4.0 anyhow.

Therefore, this patch disables callbacks for the
NFSv4.0 server.  This is the same behavior as
occurs when vfs.nfsd.issue_delegations is 0.

This change allowed the functions called
nfsrv_getclientipaddr() and nfsrv_getipnumber() to be
removed from the kernel.

MFC after:	2 weeks
2026-05-03 16:25:45 -07:00
Mark Johnston 667dd9eafa tests/ping: Fix date(1) invocations
Fixes:	069681afd5 ("ping: use CLOCK_REALTIME for ICMP Originate Timestamp")
2026-05-03 21:51:50 +00:00
Mark Johnston 47ae0135d4 tests/if_lagg: Minor improvements
- Set require.kmods instead of relying on ifconfig to load if_lagg.ko,
  as this doesn't work when running within a jail.
- Simplify helper functions which create tap and lagg devices.

MFC after:	1 week
2026-05-03 21:51:50 +00:00
Mark Johnston 001cfc7b8a tests/timerfd: Serialize
At least one of these tests changes the system clock, which potentially
interferes with concurrently running tests and causes them to fail.

MFC after:	1 week
2026-05-03 21:51:49 +00:00
Mark Johnston 476805133f unix: Make sure we signal EOF on the write side when disconnecting
Add a regression test.

PR:		294014
Reported by:	diizzy
Reviewed by:	glebius
MFC after:	1 week
Fixes:		d157927807 ("unix: new implementation of unix/stream & unix/seqpacket")
Differential Revision:	https://reviews.freebsd.org/D56764
2026-05-03 21:51:49 +00:00
Rick Macklem d8d9e1cf5e krpc: Get rid of KRPC_VNET macros
When the krpc was vnet'd, the VNET macros were hidden
behind macros that had the KRPC_ prefix on them.
This was done because, at the time, it was thought
that something other than vnet might be used for this.
That has not happened and probably will not happen,
so this patch replaces these obscuring macros with
the regular vnet ones.

There should be no semantics change caused by
this commit.

Discussed with:	bz, glebius
MFC after:	1 month
2026-05-03 14:25:06 -07:00
Konstantin Belousov 9ca9a79ea6 Revert erronously pushed series of commits, which should not be.
Sorry for the mess.

Revert "sys/vnode.h: remove stale comment"
This reverts commit f193f5a749.

Revert "vfs: convert VFS_OPs from macros to static inlines"
This reverts commit 48bf024f2e.

Revert "vnode: add VIRF_KNOTE flag"
This reverts commit 7fe74a0276.

Revert "vfs: convert vfs_op_thread_* macros to static inlines"
This reverts commit a61a696e78.

Revert "struct vnode: assign v_rl.resv1 as v_vrflag"
This reverts commit d990e8f0e9.

Revert "sys/rangelock.h: explicitly enumerate padding at the end of the structure"
This reverts commit a770638ecf.

Revert "bufspace_wait(): only try to help bufdaemon if there is a chance to help"
This reverts commit 067cfac2e7.

Revert "Add O_SYMLINK emulation"
This reverts commit f9458655e7.

Revert "libc: add freadlink(3)"
This reverts commit ae6a13deb8.

Revert "Add O_SYMLINK emulation"
This reverts commit 2213820b6f.
2026-05-03 23:12:03 +03:00
Konstantin Belousov f193f5a749 sys/vnode.h: remove stale comment
The source sweep is not going to happen.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56611
2026-05-03 22:58:37 +03:00
Konstantin Belousov 48bf024f2e vfs: convert VFS_OPs from macros to static inlines
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56611
2026-05-03 22:58:37 +03:00
Konstantin Belousov 7fe74a0276 vnode: add VIRF_KNOTE flag
to indicate non-empty vnode knote list.  Use it instead of
VN_KNLIST_EMPTY() and guard note activations with it.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56611
2026-05-03 22:58:37 +03:00
Konstantin Belousov a61a696e78 vfs: convert vfs_op_thread_* macros to static inlines
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56611
2026-05-03 22:58:37 +03:00