Commit Graph

303613 Commits

Author SHA1 Message Date
Adrian Chadd 262172de95 iwx: add some lock assertions in the TX start path
The locking paths into these routines LOOK correct, but I figured
it'd be good to at least enforce we're not doing concurrent entry
into iwx_start() / iwx_tx() without the lock held.

Differential Revision:	https://reviews.freebsd.org/D52655
Reviewed by:	thj
2025-10-03 19:55:14 -07:00
Adrian Chadd f531375560 iwx: add some missed beacon debugging
I'm seeing random disconnects in iwx without any useful information
as to why.  I'll start by adding missed beacon debugging here; hopefully
they're generally useful.

Differential Revision:	 https://reviews.freebsd.org/D52524
Reviewed by:	bz
2025-10-03 19:54:30 -07:00
Mateusz Guzik 6cc493c79d mtx: remove stale commentary about inlined spinlock ops
While both locking and unlocking a spinlock used to be inline, this
changed when spinlock_enter/spinlock_exit got introduced, defeating the
point of inlining them.

This either needs to have inlined spinlock enter/exit in place or have
mtx lock/unlock as function calls with the irq flags inlined in there.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-10-04 02:20:37 +00:00
Kyle Evans b11a5709ec flua: kick out the remaining builtin modules
Bootstrap flua has some magic now to handle modules by building them in
and discovering them via linker sets.  This is slightly cleaner than
always building them in and baking them into loadedlibs for both
bootstrap and system flua.

Adjust the stand build now that these three libs have their own new
homes.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D51891
2025-10-03 21:16:51 -05:00
Kyle Evans 151bd3516b flua: support our flua modules in the bootstrap flua
This version builds every module into the flua binary itself, since all
of the bootstrap tools are built -DNO_SHARED.  As a result, we also
cannot dlsym(), so we can't really discover the names of our newly
builtin modules.  Instead, just build out a linker set with all of our
luaopen_*() functions to register everything up-front.

Building in all of the modules isn't strictly necessary, but it means
that we have an example of how to add a bootstrap module everywhere you
go and one doesn't need to consider whether bootstrap flua can use a
module when writing scripts.  On my build machine, the consequence on
our binary size is an increase from around 1.6M -> 1.9M, which isn't
really that bad.

.lua modules can install into their usual path below $WORLDTMP/legacy
and we'll pick them up automagically by way of the ctor that sets up
LUA_PATH early on.

This re-lands bootstrap module support with a more sensible subset, and
after having verified that it cross-builds fine on macOS and Linux -- we
cannot do libfreebsd on !FreeBSD because it's more system header
dependant.  We also need to bootstrap libmd to bring in libhash, and
libucl + libyaml.

Reviewed by:	bapt, emaste (both previous version)
Differential Revision:	https://reviews.freebsd.org/D51890
2025-10-03 21:16:51 -05:00
Kyle Evans bbef1c72b4 Revert "flua: support our flua modules in the bootstrap flua"
This reverts commit 1953a12ee2, because it
cannot work at all on macOS without more work, at a minimum.  We use
linker sets for module discovery, but we don't have a version of this
that works for mach-o at the moment.
2025-10-03 19:53:28 -05:00
Kyle Evans d4c973fa14 Revert "flua: kick out the remaining builtin modules"
This reverts commit 80ada95900, because
bootstrap flua is about to get backed out.
2025-10-03 19:53:28 -05:00
Kyle Evans 981cf36d64 Revert "flua: don't build libjail into the bootstrap flua"
This reverts commit 3132040247, because
bootstrap flua is about to get backed out.
2025-10-03 19:53:27 -05:00
Colin Percival d0ff67db29 release: Publish pkgbase-repo.tar
This is a tarball containing the pkgbase repository for the release.

Note: This is an uncompressed tarball, because all of its constituent
.pkg files are already compressed; there's no point adding another
layer of compression.

Reviewed by:	ivy
MFC after:	1 minute
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52899
2025-10-03 17:26:32 -07:00
Colin Percival e64eb9ea0f release: Respect NODISTSETS
In addition to not putting distribution sets onto ISO images, if
NODISTSETS is set then we should not build the distribution sets
or put them onto the "FTP" site (aka download.freebsd.org).

MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
2025-10-03 16:56:53 -07:00
Colin Percival 4b8b4c7dbf release: Check for empty NODISTSETS
Treat an empty NODISTSETS the same as if it is not defined; this avoids
problems if a script calls 'make release NODISTSETS=${NODISTSETS}'.

MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
2025-10-03 16:55:44 -07:00
Ryan Libby daf4da4d09 acpidump: quiet GCC -Wmaybe-uninitialized
Reviewed by:	kib
2025-10-03 15:48:28 -07:00
Lexi Winter 8d0a90512e bsdinstall: Improve pkgbase handling for jails
Add a new --jail option to the pkgbase script which installs
jail-specific set variants if they exist:

* "minimal" is replaced with "minimal-jail"

* A kernel is not installed.

* For sets shown in the component selection dialogue, only show the
  appropriate variant (jail or non-jail) for the target.

Modify the jail script to pass --jail to the pkgbase script.

Remove the redundant --no-kernel option, which was added in 15.0 and
was only used to install jails.

MFC after:	3000ms
Reviewed by:	ifreund_freebsdfoundation.org
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52829
2025-10-03 22:51:48 +01:00
Jason W. Bacon aa9e4fe3c9 getconf: Report value of _SC_PHYS_PAGES
PR:		289717
Reviewed by:	jhb
2025-10-03 16:43:47 -04:00
Kyle Evans 3132040247 flua: don't build libjail into the bootstrap flua
Other systems don't have jail support, and we won't be using it anyways.
2025-10-03 15:16:30 -05:00
Mateusz Guzik 641a582395 nullfs: avoid the interlock in null_lock with smr
This largely eliminates contention on the vnode interlock.

Note this still does not scale, to be fixed(tm).

Reviewed by:		kib
Tested by:		pho (previous version)
Differential Revision:	https://reviews.freebsd.org/D38761
2025-10-03 19:16:21 +00:00
Mateusz Guzik 249ec85352 nullfs: smr-protected hash lookup
Vast majority of real-world contention on the hash comes from lookups,
notably seen during highly parallel poudriere runs.

Lockless lookup largely alleviates the problem.

Reviewed by:		kib
Tested by:		pho (previous version)
Differential Revision:	https://reviews.freebsd.org/D38761
2025-10-03 19:16:04 +00:00
Mateusz Guzik 72347d7346 nullfs: assert the vnode is not doomed in null_hashget_locked
While here some style touch ups and fixing a stale name in an assert.

Reviewed by:		kib
Tested by:		pho (previous version)
Differential Revision:	https://reviews.freebsd.org/D38761
2025-10-03 19:15:34 +00:00
Mateusz Guzik 94aae05138 nullfs: remove the vhold/vdrop cycle around unlock
Both lower vnode and null data are safe while the lock is held,
at the same time neither is touched after unlock.

While here remove stale comment about interlock handling. It is no
longer legal to pass to unlock.

Reviewed by:		kib
Tested by:		pho (previous version)
Differential Revision:	https://reviews.freebsd.org/D38761
2025-10-03 19:14:30 +00:00
Kyle Evans 80ada95900 flua: kick out the remaining builtin modules
Bootstrap flua has some magic now to handle modules by building them in
and discovering them via linker sets.  This is slightly cleaner than
always building them in and baking them into loadedlibs for both
bootstrap and system flua.

Adjust the stand build now that these three libs have their own new
homes.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D51891
2025-10-03 13:09:25 -05:00
Kyle Evans 1953a12ee2 flua: support our flua modules in the bootstrap flua
This version builds every module into the flua binary itself, since all
of the bootstrap tools are built -DNO_SHARED.  As a result, we also
cannot dlsym(), so we can't really discover the names of our newly
builtin modules.  Instead, just build out a linker set with all of our
luaopen_*() functions to register everything up-front.

Building in all of the modules isn't strictly necessary, but it means
that we have an example of how to add a bootstrap module everywhere you
go and one doesn't need to consider whether bootstrap flua can use a
module when writing scripts.  On my build machine, the consequence on
our binary size is an increase from around 1.6M -> 1.9M, which isn't
really that bad.

.lua modules can install into their usual path below $WORLDTMP/legacy
and we'll pick them up automagically by way of the ctor that sets up
LUA_PATH early on.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D51890
2025-10-03 13:09:14 -05:00
Robert Clausecker acd546f01e */*: remove recallocarray() compat shims following import into libc
libopenbsd retains recallocarray() during bootstrapping for now
as it is needed for mandoc.

Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D52864
2025-10-03 19:47:52 +02:00
Robert Clausecker 4266461079 lib/libc: add recallocarray()
This function from OpenBSD is a hybrid of reallocarray() and calloc().
It reallocates an array, clearing any newly allocated items.
reallocarray() ultimately originates from OpenBSD.

The source is taken from lib/libopenbsd, which now no longer has the
function unless when bootstrapping (needed for mandoc).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D52863
2025-10-03 19:46:55 +02:00
Robert Clausecker 969c119195 lib/libc: add FBSD-1.9 to Versions.def
In preparation of adding recallocarray() to libc.

See also:	D52863
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D52878
2025-10-03 19:46:22 +02:00
Robert Clausecker 7233893e94 lib{c,openbsd}: use ckd_mul() for overflow checking in re(c)allocarray
Summary:
This makes the code easier to understand and slightly faster,
but requires C23.  calloc() would  benefit, too, but I didn't
want to touch the imported jemalloc code base.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D52854
2025-10-03 19:45:54 +02:00
Ed Maste a8d774d970 man: Conditionally install ar.5 in toolchain package
Previously if WITHOUT_TOOLCHAIN was set we'd create a FreeBSD-clang
package that contained only ar.5.  As ar.5 describes the ar format
and doesn't come from Clang/LLVM move it to the FreeBSD-toolchain
package and make it conditional on MK_TOOLCHAIN.

Reviewed by:	ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52886
2025-10-03 13:19:36 -04:00
John Baldwin dfd7d1610a filedesc: Close race between fcntl(F_SETFL) and ioctl(FIONBIO/FIOASYNC)
- Use the recently-added fsetfl_lock/unlock API to synchronize direct
  FIONBIO and FIOASYNC ioctls with fcntl(F_SETFL).

- While here, skip calling the underlying ioctl if the flag's current
  state matches the requested state.

- Also while here, only update the flag state if the underlying ioctl
  succeeds.  This fixes a bug where the flags represented the new
  state even if the underlying ioctl failed.  A test is added for this
  last case that a failing FIOASYNC on /dev/null doesn't result in
  setting O_ASYNC in the file flags.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D52721
2025-10-03 12:43:30 -04:00
John Baldwin 5c331f449e fcntlflags_test: Port to atf-c(3)
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D52720
2025-10-03 12:43:18 -04:00
Jonathan T. Looney 5f1f7d8457 x86: Keep cumulative MCA statistics in the kernel
Keeping cumulative MCA statistics in the kernel provides a way for
users to get an accurate count of various kinds of errors reported
by the CPU.

After ca8929d2a3, it is possible that
the kernel will drop the record of some MCA interrupts. Moreover, this
provides a cheaper interface to obtain statistics if that is the only
reason a user is processing MCA logs.

Reviewed by:	markj
Sponsored by:	Netflix
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52709
2025-10-03 15:29:21 +00:00
Ed Maste ae5914c0e4 Cirrus-CI: Switch back to tzst packages, but use level 1
We previously used `PKG_FORMAT: tar` to avoid spending a lot of time in
zstd compression.  Instead just set PKG_LEVEL to compression level 1,
which still produces packages that are much smaller than uncompressed
tarballs with only a small penalty in build time.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52858
2025-10-03 10:49:47 -04:00
Warner Losh f19aea89ab nda.4: Add a HARDWARE section, tag SPDX
The description likely also needs some love.

MFC after:		1 hour
Co-authored-by:		ziaee (typed up imps suggestion, tagged spdx)
Differential Revision:	https://reviews.freebsd.org/D52866
2025-10-03 10:35:28 -04:00
Warner Losh bc433a0b7b sdhci.4: Improve HARDWARE for HW Relnotes + SPDX
MFC after:		1 hr
Discussed with:		ivy, olce
Co-authored-by:		ziaee (typed up imps suggestion, tagged spdx)
Differential Revision:	https://reviews.freebsd.org/D52860
2025-10-03 10:35:27 -04:00
Mark Johnston ea675a43f0 libexec/kgdb: Add new modules and install them together with debug info
This change simplifies integration of gdb python scripts with our kernel
debugging infrastructure.  Rather than putting debugging scripts in
/usr/libexec/kgdb, move them to <path-to-kernel-debug-symbols>/gdb, and
add a kernel-gdb.py which automatically loads modules from that
directory.  kernel-gdb.py will be automatically executed by kgdb when
loading kernel debug symbols (assuming a default configuration), so one
no longer needs to do anything to use these modules.

The change also adds a couple of new modules, vnet.py and pcpu.py, for
conveniently accessing VNET symbols and PCPU/DPCPU fields, respectively.
Note that these require a change to the kernel linker when accessing
symbols from a loadable kernel module.

sys/tools/gdb/README.txt describes the scheme in more detail and
provides some rudiementary documentation for the commands and functions
added by these modules.  It should be updated when adding new features.

sys/tools/gdb/selftest.py can be used to do some primitive testing of
the modules.  All it does is execute a number of gdb commands making use
of commands and functions added by these modules.  The developer is
expected to verify that the commands complete without errors and that
the output looks sane.

Discussed with:	kp, avg, jhb, glebius
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D50825
2025-10-03 14:32:09 +00:00
Mark Johnston 07747afd51 linker: Make it easier to find the VNET section layout
When trying to find the address of a VNET variable from a debugger, it
helps to have the original address of the VNET section.  In particular,
given the address of a vnet_entry_foo symbol, one wants to easily find
the linker file that the symbol belongs to.

In link_elf_obj.c, the section address for VNET and DPCPU sections is
overwritten in link_elf_link_preload() and link_elf_load_file().  Add an
"origaddr" field to store the original absolute address of the section
base.

In link_elf.c the elf_file_t already has the fields we want, but they
were not getting filled out for the kernel itself.  Fix that too, since
that simplifies things for debuggers and improves consistency.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52730
2025-10-03 14:32:09 +00:00
Nick Reilly 0952943a68 netstat: Fix -ia missing multicast addresses on some interfaces
sdl_data isn't always NULL terminated

Signed-off-by: nreilly@qnx.com

PR:		288958
Reviewed by:	markj
MFC after:	1 week
2025-10-03 14:32:09 +00:00
Ed Maste ac1408bd1d release: Consolidate pkgbase-repo dependency
Use the same approach for pkgbase-repo-dir as for the packagesystem
dependency.

Reviewed by:	Isaac Freund <ifreund@freebsdfoundation.org>
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52884
2025-10-03 10:30:52 -04:00
Siva Mahadevan 65e2ce55b6 vmimage.subr: fix typo in checking NO_ROOT var
Reviewed by: imp
Fixes: 08b497dc6c ("vmimage.subr: Support NO_ROOT pkgbase")
Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1867
Sponsored by: The FreeBSD Foundation
2025-10-03 10:23:07 -04:00
Olivier Cochard 01d5a6f30c tests/ipfw: Update regression tests to match new 32-bit size rule numbers
Commit 4a77657cbc increased the size of several opcodes to ipfw_insn_u32.

Approved by:	ae
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D52876
2025-10-03 13:06:49 +02:00
Guido Falsi 0c94dc9da7 sys/netinet6: Use atomic(9) for dad_failures counter
Replace counter(9) usage with more lightweight atomic(9) in the
code handling RFC 7217 SLAAC address generation.

Also, use `u_int` types with this. Leaving `dad_failures` local to
`in6_get_stableifid()` as a `uint64_t` to avoid changing the generated
addresses from previous code; this also gives some headroom for
future changes.

While here, moved some `#include` lines to adhere to style(9).

Reviewed by:		glebius, jhibbits, jtl, zlei
Approved by:		glebius, jtl, zlei
Differential Revision:	https://reviews.freebsd.org/D52731
2025-10-03 12:09:42 +02:00
Andrey V. Elsukov 716acd9367 carp6: revise the generation of ND6 NA
* use ND_NA_FLAG_ROUTER flag in carp_send_na() when we work as router.
* use in6addr_any as destination address for nd6_na_output(), then it
  will use ipv6-all-nodes multicast address.
* add in6_selectsrc_nbr() function that accepts additional argument
  ip6_moptions. Use this function from ND6 code to avoid cases when
  nd6_na_output/nd6_ns_output can not find source address for
  multicast destinations.
* add some comments from RFC2461 for better understanding.
* use tlladdr argument as flags and use ND6_NA_OPT_LLA when we need
  to add target link-layer address option, and ND6_NA_CARP_MASTER when
  we know that target address is CARP master. Then we can prepare
  correct CARP's mac address if target address is CARP master.
* move blocks of code where multicast options is initialized and
  use it when destination address is multicast.

Reviewed by:	kp
Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
Differential Revision: https://reviews.freebsd.org/D52825
2025-10-03 10:57:44 +03:00
Colin Percival 08b497dc6c vmimage.subr: Support NO_ROOT pkgbase
We need to tell pkg to record files in METALOG; otherwise when we
create the VM image it's almost empty.

MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva
2025-10-03 00:25:05 -07:00
ShengYi Hung f32ffd11b5 isa_common: allow multiple device instances
In some devices, there may be multiple isa bridges available from different
sources. Therefore, we allow multiple lpc devices to be generated so that
pcie bus won't show "none" anymore.
For example, in my AMD based Framework Laptop, there are two such
bridges. One is acpi hinted, another is from pcie.

Reviewed by:    imp
Approved by:    lwhsu (mentor)
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D52815
2025-10-03 14:20:04 +08:00
Ryan Libby e7e958d83d ddb show allchains: avoid traps and show pointers for lockmgr and sx
When trying to walk lock chains, we have to deduce what a thread is
blocked on.  Checking LOCK_CLASS(td->td_wchan) is not a very reliable
method by itself, as it just tests whether a particular 4 bits near
where td_wchan points have a particular value.  Misinterpreting wait
channel pointers of other sleeps as lockmgr locks would frequently cause
ddb show allchains (or show lockchain) to trap, or to produce incorrect
output.

Now, check the sleepq_type.  When calling sleepq_add, we use SLEEPQ_LK
for lockmgr locks and SLEEPQ_SX for sx locks.  This is a more reliable
indication that the td_wchan is actually a lock.

While here, also make the output of lockmgr and sx locks consistent with
the output for other locks (see print_lockchain).  Outputting a pointer
to the lock allows it to be inspected further with ddb show lock or
other methods.

Reviewed by:	markj
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D52794
2025-10-02 22:47:47 -07:00
Lexi Winter dfc9da6248 Makefile: Fix ordering for (update-)packages
The (update-)packages targets require buildworld and buildkernel to
run first.  Add some .ORDER statements to ensure this happens.

This fixes 'make -j8 buildworld buildkernel packages'.

PR:		289969
Reported by:	yasu
MFC after:	3 days
Reviewed by:	yasu, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52877
2025-10-03 06:43:15 +01:00
Lexi Winter a22f8bd457 create-sets.sh: Add missing copyright header
I wrote this file and am the only person who has modified it since
it was added.

MFC after:	3 days
2025-10-03 04:58:06 +01:00
Colin Percival 86221f965c vmimage.subr: Fix NO_ROOT build in ..._rmcache
When doing a NO_ROOT build we can't run pkg inside a chroot, for
multiple reasons including not having /dev mounted.

MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva
2025-10-02 18:06:44 -07:00
Ed Maste 5c5c0571c2 release: Fix NO_ROOT cross-building VM images
Pass PKG_ABI to virtual machine image builds.

Reviewed by:	cperciva
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52874
2025-10-02 20:30:07 -04:00
Tiago Gasiba da25573ee0 calendar.freebsd: Update calendar for tiga@
PR:		289948
Approved by:	eduardo (mentor)
2025-10-02 23:22:09 +02:00
Kristof Provost b93394a38b pf: fix 'natpass'
If an rdr (or nat) rule specifies 'pass' we don't run the filter rules, we just
pass the traffic. Or at least, we did until that got unintentionally broken.
Restore that behaviour and add a test case.

While here also fix nat:dummynet_mask, which relied on the broken behaviour.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D52838
2025-10-02 22:46:43 +02:00
Jonathan T. Looney ad38f6a0b4 tcp: close two minor races with debug messages
The syncache entry is locked by the hash bucket lock. After running
SCH_UNLOCK(), we have no guarantee that the syncache entry still
exists.

Resolve the race by moving SCH_UNLOCK() after the log() call which
reads variables from the syncache entry.

Reviewed by:	rrs, tuexen, Nick Banks
Sponsored by:	Netflix
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52868
2025-10-02 20:07:50 +00:00