Commit Graph

308225 Commits

Author SHA1 Message Date
Enji Cooper 60baee1fa4 release.sh: add chroot cleanup routine
The chroot_cleanup routine handles any cleanup needed post-chroot_setup,
etc. This consists of purely tearing down `${CHROOTDIR}/dev` today, but
might involve additional steps, as needed for custom functions. This
allows end-users to override the various chroot functions without having
to modify code in main() or replicate the unmount procedure in an
equivalent routine setup via the trap builtin.

This change modifies the /dev unmount process to use `umount -f` instead
of `umount`. The latter can result in failures if resources are still
mounted or are running post-build, whereas the former will clean up any
resources still in use by processes running in the chroot at time of
build. Moreover, the `chroot_cleanup` routine is now called when the
script is killed with `SIGINT` and `SIGTERM`, as well as at `EXIT`,
better ensuring that the script's resources are cleaned up in relatively common
scenarios that can be detected/handled.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55450 (as part of a larger change)
2026-03-21 20:02:09 -07:00
Enji Cooper b24fc79095 release.sh: document user-overriddable functions
This helps others attempting to customize the behavior of `release.sh`.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55450 (as part of a larger change)
2026-03-21 20:01:29 -07:00
ShengYi Hung c25976f0a9 libc: Fix cxa_thread_atexit{,nothr} test.
After patch 9d26b82, we don't provide recursive call protection anymore.
Therefore, to pass the test, we adjust the testcase by protecting on
caller and the testcase is to make sure the dtors is properly handled.

Reported by:    siva
Reviewed by:    kib
Approved by:    markj (mentor)
Fixes:  9d26b82826 ("libc: Fix dtor order in __cxa_thread_atexit")
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55893
2026-03-22 10:48:24 +08:00
ShengYi Hung 191f47bcd6 hwpstate_amd: Refactor the cpufreq code by using delegation pattenr
We separate the code of CPPC and legacy pstate driver to make it easier
to read.

Reviewed by:    olce
Approved by:    markj (mentor)
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55604
2026-03-22 10:35:36 +08:00
Enji Cooper 3797fe720a libcrypto: compile all PIC objects with -DOPENSSL_PIC -fPIC
This change modifies the libcrypto PIC objects to always compile with
`-DOPENSSL_PIC -fPIC` to restore parity with the upstream build process.
This ensures that the legacy provider is built with parity to the
upstream legacy provider.

MFC after:              12 days
Tested with:		`make check` (legacy provider), `make universe`
Fixes:			14b9955e
Differential Revision:  https://reviews.freebsd.org/D44896
2026-03-21 18:38:49 -07:00
Konstantin Belousov 1ba29614c4 amd64: revert back struct trapframe to the pre-FRED definition
Trying to use the grown struct trapframe for IDT case broke in cases
where code supposed that hardware consumed sizeof(struct trapframe) of
the stack space when delivering interrupt or exception.  In particular,
this was broken for #NM/#DB/#MC.  Naive attempt of using IDT-trapframe
size for stack consumption caused later problems with larger C type.

Instead of pretending that IDT event delivery pushed two never-accessed
doubleword to the stack, keep it honest and provide separate type for
the FRED interrupt frame, i.e. struct trapframe_fred.

Convert between trapframe_fred and trapframe can be done by trivial pointer
arithmetic.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-03-22 00:37:27 +02:00
Bjoern A. Zeeb 1d18872c25 LinuxKPI: add supporting #includes
Compiling drm-kmod on !X86 does not include asm/smp.h which includes
preempt.h on FreeBSD.  In order to compile drm-kmod on other
architectures add the secondary #includes for preempt.h to
spinlock.h and hardirq.h (which now also gets included from highmem.h)
to connect the #include chain.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
PR:		279864
Reviewed by:	jhibbits, emaste
Differential Revision: https://reviews.freebsd.org/D55974
2026-03-21 21:16:43 +00:00
Bjoern A. Zeeb 2ce06d2543 sbuf: make assertion message a lot more useable
Saying that we are called with an (un)finished or corrupted sbuf
is like saying "error" (though [un]finished is an extra hint).

Add the pointer to the sbuf so one could easily check it,
add the flags we are checking so one could see quickly about
a possible state mismatch.

Given we already dereference the pointer in the KASSERT there is no
extra harm adding it to the message.

Found while:	testing lindebugfs changes
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D55919
2026-03-21 21:16:43 +00:00
Colin Percival 118699732d EC2: Remove stale comment
MFC after:	3 days
Sponsored by:	Amazon
2026-03-21 09:10:25 -07:00
Colin Percival 4b29bf721e Revert "vmimage.subr: pkg autoremove after pkg install"
This reverts commit 6a13aeac3c.

The "bogus dependencies being installed" issue was traced down to pkg
confusion surrounding libclang_rt.asan-i386.so linking to a 32-bit
libgcc_s.so.1, and a more minimal workaround of "install clibs-lib32"
has been applied, so this hack is no longer required.

MFC after:	3 days
Sponsored by:	Amazon
2026-03-21 09:10:25 -07:00
Colin Percival cfe0b7d37e EC2: Add clibs-lib32 pkg to small/builder images
The FreeBSD-clang package on amd64 contains libclang_rt.asan-i386.so,
which links to the 32-bit version of libgcc_s.so.1.  It is not clear
if that file belongs in FreeBSD-clang or if it should be placed into
a different package.

For unknown reasons, pkg *sometimes* recognizes this and decides that
it needs to install a package to supply libgcc_s.so.1:32.

In particular, when we initially install the VM with 'pkg install
[long list of FreeBSD-* packages]', pkg does not recognize that it
wants this; but the *next* time 'pkg install' runs, it decides that
it needs libgcc_s.so.1:32 -- even though that particular library is
not needed by the particular package we're trying to install -- and
goes looking for it... and ends up picking gcc12-devel as a provider.

Later in the EC2 image building process, we run 'pkg autoremove' (which
was added during 15.0 to get rid of the "bogus dependencies" which were
added while installing other packages) and pkg is once again confused:
It decides that gcc12-devel is an automatic port which is not required
by anything else, but upon determining that it should be removed it
then determines that FreeBSD-clang depends upon a port which is being
removed and deletes FreeBSD-clang as well.

It's not clear what is breaking in pkg, but as a temporary workaround
add the FreeBSD-clibs-lib32 package to the "small" and "builder" EC2
image flavours in order to satisfy the libgcc_s.so.1 demand.

This commit should be reverted if libclang_rt.asan-i386.so moves out
of FreeBSD-clang, (i.e. if it becomes possible to install a 32-bit-free
amd64 system) or when the pkg issue is resolved (i.e. pkg consistently
recognizes the shared library dependency and installs clibs-lib32
automatically as a FreeBSD-clang dependency).

MFC after:	3 days
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D55978
2026-03-21 09:09:03 -07:00
Dag-Erling Smørgrav b1f72dd2a9 tunefs: Don't combine GEOM journaling with SU
GEOM journaling shouldn't be used at the same time as soft updates, so
don't enable one if the other is already in use.

MFC after:	1 week
PR:		293896
Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D56002
2026-03-21 08:21:45 +01:00
Dag-Erling Smørgrav e30fcdaae2 newfs: Don't combine GEOM journaling with SU
GEOM journaling shouldn't be used at the same time as soft updates, so
don't enable soft updates if GEOM journaling has been requested, and
error out if both are explicitly requested.

MFC after:	1 week
PR:		293896
Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D55999
2026-03-21 08:21:45 +01:00
Dag-Erling Smørgrav 092687a031 kernel: Be clearer about what ZSTDIO is for
ZSTDIO is not just for core dumps, and it is now required by ZFS, so
move it (and GZIO, which is still just for dumps) to a new “Compression
support” section in GENERIC, and add them both to MINIMAL.

MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D55940
2026-03-21 08:21:45 +01:00
Aymeric Wibo a87bde8523 acpi_spmc: Simplify constraint freeing
We don't need to check for NULL before calling free().

Sponsored by:	The FreeBSD Foundation
2026-03-21 13:20:46 +08:00
Aymeric Wibo 2547f97202 acpi.4: Update sysctl descriptions for new stypes
The previous S1-S5 options are still accepted for compatibility, but
they are now deprecated in favour of the new generic sleep types.

Reported by:	markj
Reviewed by:	markj
Approved by:	markj
Fixes:		97d152698f ("acpi: Use sleep types defined in sys/power.h")
Event:		AsiaBSDCon 2026
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D56008
2026-03-21 13:16:06 +08:00
Aymeric Wibo 66447abae8 acpi: Print sysctl name in deprecated sleep type warning
Reported by:	markj
Fixes:		97d152698f ("acpi: Use sleep types defined in sys/power.h")
Event:		AsiaBSDCon 2026
Sponsored by:	The FreeBSD Foundation
2026-03-21 11:21:45 +08:00
Konstantin Belousov 8cc1c0f35e amd64 trap.c: provide tag for the struct sfhandlers definition
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-03-21 00:49:03 +02:00
Konstantin Belousov 23dc4850fb amd64: add prototype for ia32_syscall()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-03-21 00:48:42 +02:00
Konstantin Belousov acce5fa3db amd64: remove assertion about sizeof(struct pcb)
We no longer put pcb on stack, it is part of the struct thread.
Similarly, we do not put user fpu save area on stack.  There is no
constraints on the pcb size due to the XSAVE area required alignment.

Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D55931
2026-03-21 00:48:42 +02:00
Konstantin Belousov 6275cd73ac sys/param.h: bump __FreeBSD_version for amd64 struct trapframe size change
Requested by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-03-21 00:48:30 +02:00
Konstantin Belousov e909506273 x86 FRED: add hardware definitions for the trap frames fields
as provided by the Intel document 346446-009 AKA FRED 8.0 and SDM v90,
February 2026.

Note that the layout of the struct trapframe does not change with
FRED. The differences are in addition of two fields at the end of the
structure. Other members are carved from existing tf_cs and tf_ss by
limiting hw-written segments to 16 bits officially, and reusing rest
from the doubleword for the new data.

Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D55831
2026-03-20 23:05:15 +02:00
Konstantin Belousov 8892176c86 amd64: check that %cs and %ss values from ucontext fit into registers
This change only checks that the values from the user-supplied context
are not truncated by C implicit type convertions.  The validity of the
segment selectors is still checked by hardware.

Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D55861
2026-03-20 23:05:15 +02:00
Konstantin Belousov e18449fbe2 amd64: move code to check for traps with interrupts disabled into helpers
Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D55809
2026-03-20 23:05:15 +02:00
Enji Cooper 67b918e034 Revert "libcrypto: compile all PIC objects with -DOPENSSL_PIC"
This commit broke the build with some build options.

Some validation needs to be done to confirm that moving the preprocessor
argument to `secure/lib/libcrypto/Makefile.inc` works without breaking
the build, but revert for now until a `tinderbox` run can be done with
the change.

PR:		293934
Reported by:	Jenkins, Trond Endrestøl

This reverts commit 14b9955e57.
2026-03-20 13:12:26 -07:00
Ed Maste e296211fd5 Makefile.inc1: Don't force LLVM_BINUTILS off for cross-tools
Because of this setting we were still using ELF Tool Chain tools for
buildworld.  The sets of binary utilities are largely equivalent and
this went unnoticed after commit 1cae7121c6 ("Enable LLVM_BINUTILS
by default").

This was discovered recently because ELF Tool Chain objcopy produces
standalone debug files without phdrs and this caused an issue with a
3rd party ELF parser [1].  Remove the forced setting so that we use
LLVM's binutils to build the system.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=33876

Re-commit after fixing a bootstrapping issue with LLVM binutils (in
17494c6e6b "build: Boostrap LLVM_BINUTILS for cross-tools").

Reviewed by:	imp, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55650
2026-03-20 15:00:41 -04:00
Chuck Silvers 1fd43ee968 tpm: fix multi-threaded access with per-open state
The TPM driver currently has a single buffer per instance to hold the
result of a command, and does not allow subsequent commands to be sent
until the current result is read by the same OS thread that sent the
command, with a timeout to throw away the result after a while if the
result is not read in a timely fashion.  This has a couple problems:

 - The timeout code has a bug which causes all subsequent commands to
   hang forever if a different OS thread tries to read the result
   before the OS thread which sent the command, and the OS thread
   which sent the command never tries to read the result.

 - Even if the first problem is fixed, applications expect to be able
   to read the result from a different OS thread than the OS thread
   which sent the command. The particular case that we saw was a go
   application where the go runtime scheduled the goroutine which read
   the result to a different OS thread from one where the goroutine
   that sent the command ran, and there's no way to force these to
   always run on the same OS thread.

Fix all of this by replacing the global result buffer with a per-open
result buffer via devfs_set_cdevpriv(), so that we no longer need to
block subsequent commands until the results of a previous command are
retrieved or care about which OS thread is reading the result of a
command.

Sponsored by:	Netflix
Reviewed by:	olivier, imp
Differential Revision:	https://reviews.freebsd.org/D52328
2026-03-20 11:48:44 -07:00
Chuck Silvers 632ddb864e krb5: append to LDFLAGS instead of replacing
Sponsored by:	Netflix
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D55335
2026-03-20 10:19:35 -07:00
Gleb Smirnoff 03b7b779a8 tcp/rack: don't call call tcp_state_change() before tcp_close()
Reviewed by:		tuexen, rrs
Differential Revision:	https://reviews.freebsd.org/D55969
2026-03-20 09:55:04 -07:00
Gleb Smirnoff 0798ad8023 tcp: remove extraneous code
The tcp_close() will perform both actions.

Reviewed by:		pouria, tuexen, rrs
Differential Revision:	https://reviews.freebsd.org/D55965
2026-03-20 09:54:54 -07:00
Abdelkader Boudih 3d218b6289 cam (scsi): silence "Medium not present" SCSI sense logging for removable media
Change SS_FATAL to SS_FAIL for SCSI sense code 0x3A (Medium not present)
to suppress console spam when card readers or other removable media
devices have no media inserted.

The error is still returned to callers (ENXIO), but no longer prints to
dmesg during boot/probe.

Verified with Apple SD Card Reader - reduced boot messages from 4 to 2.

Reviewed by:	emaste, imp
Differential Revision: https://reviews.freebsd.org/D55287
2026-03-20 11:29:57 -04:00
Alexander Ziaee 8475cd93fb dwcotg.4: Initial manual page
Create visibility in apropos and the Hardware Release Notes.

MFC after:		3 days
Reviewed by:		pauamma, ray
Differential Revision:	https://reviews.freebsd.org/D53287
2026-03-20 10:45:11 -04:00
Navdeep Parhar 0661997cea loader(8): embedded MD should be the most preferred currdev
A loader built with MD_IMAGE_SIZE is almost always meant for use with
its embedded image and should try that as currdev before anything else.
Recent changes (d69fc3a9dc, 784150fd25) seem to have relaxed the ZFS
code's search for a rootfs and exposed this problem.

Reviewed by:	imp, tsoome
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D55979
2026-03-20 07:40:41 -07:00
Ed Maste 17494c6e6b build: Boostrap LLVM_BINUTILS for cross-tools
Reported by:	vexeduxr, jrtc27
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Pull request:	https://github.com/freebsd/freebsd-src/pull/2084
Differential Revision: https://reviews.freebsd.org/D55923
2026-03-20 09:38:40 -04:00
Baptiste Daroussin dc2687bf71 src.conf(5): rebuild after introduction of WITHOUT_PKGSERVE 2026-03-20 13:32:55 +01:00
Baptiste Daroussin b42e852e89 pkg-serve(8): serve pkg repositories over TCP via inetd (8)
Reviewed by:	manu, bdrewery (previous version)
Differential Revision:	https://reviews.freebsd.org/D55895
2026-03-20 13:29:48 +01:00
Poul-Henning Kamp a0170dbd4e "Pending" is more correct than "Missing"
Pointed out by: Alex "the PS/2 guy"
2026-03-20 10:32:30 +00:00
Jake Freeland 33345b8834 timerfd: Suppress kqueue readability after jump read
Do not report EVFILT_READ after reading a discontinuous clock jump.
This makes the kqueue filter consistent with Linux epoll behavior
and timerfd_poll(), which already checks tfd_jumped != TFD_READ before
reporting POLLIN.

MFC after: 2 weeks
2026-03-20 02:15:09 -05:00
Jake Freeland b11fba4126 timerfd: Wake up on discontinuous jump
If a discontinous realtime clock change occurs and sets any TFD_JUMPED
bits on the timerfd, then wake up waiting readers. This fixes failures
from the timerfd_root__clock_change_notification test case.

MFC after: 2 weeks
2026-03-20 02:15:08 -05:00
Jake Freeland 0e8f351be7 timerfd: Use saturating sbintime conversions
Some timerfd consumers set expirations with timespec tv_sec components
larger than 2^31 - 1. In such cases, converting that timespec to
sbintime results in data loss or sign flip, yielding a shorter
expiration than desired.

To avoid this problem, use saturating timespec-to-sbintime conversion
functions. These will clamp the converted sbintime to SBT_MAX under
circumstances where the normal conversion functions would overflow.

Saturating conversions still result in data loss, but the consequences
are less severe, causing problems only after SBT_MAX (~68 years) of
system uptime elapses.

Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D55792
MFC after:		2 weeks
2026-03-20 02:15:08 -05:00
Jake Freeland e3799530b3 sys/time: Add saturating sbt conversions
When converting from timespec to sbintime, the timespec's 64-bit tv_sec
component is shifted to the left 32 bits, causing any information in the
upper 32 bits to be lost.

This data loss during conversion can turn timespecs with very large
tv_sec counters into sbintimes that represent much smaller time
durations.

Add tstosbt_sat() and tvtosbt_sat(), which are saturating versions of
tstosbt and tvtosbt. With these routines, any overflow resulting from
the conversion is clamped to [-SBT_MAX - 1, SBT_MAX].

Reviewed by:		imp, markj
Differential Revision:	https://reviews.freebsd.org/D55791
MFC after:		2 weeks
2026-03-20 02:15:08 -05:00
Jake Freeland 85c0f1a87d timerfd: Fix interval callout scheduling
When a timerfd interval callout misses its scheduled activation time, a
differential is calculated based on the actual activation time and the
scheduled activation time. This differential is divided by the timerfd's
interval time and the quotient is added to the timerfd's counter.

Before this change, the next callout was scheduled to activate at:
scheduled activation time + timerfd interval.

This change fixes the scheduling of the next callout to activate at:
actual activation time + timerfd interval - remainder.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D55790
MFC after:		2 weeks
2026-03-20 02:15:08 -05:00
Jake Freeland 834c1ba793 timerfd: Add tests
Take Jan Kokemuller's timerfd tests from the epoll-shim project,
stripping out code that isn't directly related to FreeBSD.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D55789
MFC after:		2 weeks
2026-03-20 02:15:08 -05:00
Mateusz Piotrowski 2eb0a88891 dtrace.1: Reference dtrace_cam.4
Fixes:	1a7151f796 cam: Add probes for xpt actions
Event:	AsiaBSDCon 2026
2026-03-20 13:10:59 +08:00
Enji Cooper 14b9955e57 libcrypto: compile all PIC objects with -DOPENSSL_PIC
This change modifies the libcrypto PIC objects to always compile with
`-DOPENSSL_PIC` to restore parity with the upstream build process. This
ensures that `-DOPENSSL_PIC` is used whenever building the auxiliary
shared objects. In this case, just the legacy provider (we no longer
distribute the fips provider).

MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D44896
2026-03-19 17:51:51 -07:00
Bjoern A. Zeeb f979561541 ath11k: restore module Makefile
During the subtree merge and checking out the updated version of ath12k
parts of the previous ath11k merge were accidentally undone.
Retore the ath11k Makefile as well after 3c4eef5d83 restored the
driver bits.

Fixes:		a96550206e ("ath12k: update Atheros/QCA's ath12k ..")
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-20 00:17:41 +00:00
Bjoern A. Zeeb 3c4eef5d83 ath11k: reduce diff to upstream Atheros/QCA's ath11k driver
It seems that over the time of merging and only partly working
on making it compile again a few mis-merges happened.
Reduce diff to the v6.19 upstream version so that we only have
additions to the driver (usually guarded by #ifdef __FreeBSD__).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-19 23:54:21 +00:00
Bjoern A. Zeeb 03ba27c194 ath12k: update module Makefile after vendor import of v6.19
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-19 23:34:31 +00:00
Bjoern A. Zeeb a96550206e ath12k: update Atheros/QCA's ath12k driver
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
05f7e89ab9731565d8a62e3b5d1ec206485eeb0b ( tag: v6.19 ).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-03-19 23:33:59 +00:00
Bjoern A. Zeeb 09cacabd8c ath11k: update module Makefile after vendor import of v6.19[-rc6]
Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
2026-03-19 23:31:23 +00:00