Commit Graph
314755 Commits
Author SHA1 Message Date
Michael Tuexen ff066579fd TCP RACK: fix RSM computation for TCP fast open
When spitting an RSM containing the SYN and data, honor the
sequence number used by the SYN flag when computing the offset
in the socket buffer.

PR:			297006
Reviewed by:		rrs, Peter Lei
MFC after:		3 days
MFC to:			stable/15
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D61149
2026-11-07 14:33:45 +01:00
Brooks Davis 4ca9291004 kenv(2): add kern_kenv
Effort:		CHERI upstreaming
Sponsored by:	Innovate UK
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2284
2026-11-07 12:10:46 +00:00
Brooks Davis 230d581d4e fstat(2): add user_fstat
Effort:		CHERI upstreaming
Sponsored by:	Innovate UK
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2284
2026-11-07 12:10:46 +00:00
Brooks Davis 3369af6f98 cpuset(2): add kern_cpuset
Effort:		CHERI upstreaming
Sponsored by:	 Innovate UK
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2284
2026-11-07 12:10:46 +00:00
Brooks Davis d7c0ab90cd acct(2): add kern_acct
Effort:		CHERI upstreaming
Sponsored by:	Innovate UK
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2284
2026-11-07 12:10:45 +00:00
Brooks Davis 7b18863d59 mac syscalls: add kern_ implementations
Where the kern_ interfaces map trivially to the syscall interface, follow
the syscall name even if awkward (e.g., sys___mac* -> kern___mac*).
Otherwise use shorter names.

Effort:		CHERI upstreaming
Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2284
2026-11-07 12:10:45 +00:00
Abdelkader Boudih 6d5c80aee3 xhci: only set the slot context parent hub fields on xHCI 1.2
The Enhanced SuperSpeed meaning of the slot context parent hub slot ID
and port number fields was introduced in xHCI 1.2. Controllers built to
an earlier revision define them only for a Low- or Full-speed device
behind a High-speed hub.

A SuperSpeed device behind a USB 3.2 hub on an Intel Alpine Ridge
controller, an xHCI 1.1 part, stops responding to Address Device and
loops in uhub_reattach_port until the port is disabled.

Fixes:		20b1998254 ("usb: support SSP and SSPx2 xHCI")

Reviewed by:	aokblast, ngie, adrian
Differential Revision:	https://reviews.freebsd.org/D61278
2026-11-07 09:56:13 +00:00
Abdelkader Boudih 4ce90d56a8 asmc: notify the SMC of shutdown and restart
Nothing tells the SMC that a power off or restart was user requested, so
the T2 keeps rebooting the machine thinking the system is wedged.

Approved-by: ngie (co-mentor)

Reviewed by:	ngie, adrian
Differential Revision:	https://reviews.freebsd.org/D61260
2026-11-07 09:14:28 +00:00
Justin Hibbits 0f908dae9d powerpc: Define the sub-word atomic load and store directly
All currently supported powerpc CPUs handle single-copy atomicity for
any size up to the native word size, so load and store operations are
guaranteed for sub-word size that are naturally aligned.
2026-11-06 23:05:56 -05:00
Justin Hibbits 934ffa4c7d powerpc64: Don't ignore lookup errors in kernel linker
If a lookup fails for a R_PPC_JMP_SLOT (PLT relocation) ignoring errors
results in an address of 0 gets written into the jump slot, leading to a
NULL pointer jump when attempting to call the function it points to.
Fix this with proper error checking so that a module will fail to load
instead of crashing later on.
2026-11-06 22:41:15 -05:00
Kenneth D. Merry 68ba58a064 camcontrol: Fix -Wcast-align errors in the NVMe reservation report
Casting the byte buffer that holds the Reservation Report payload to
the status structures trips -Wcast-align on strict-alignment
architectures, which broke the CI builds there.  Put the buffer in a
union with the two status structures instead, so it is properly
aligned and no casts are needed.

Reported by:	FreeBSD CI
Fixes:	ba75cf0572 ("camcontrol: Support NVMe reservations via the persist subcommand")
Co-authored-by:	Claude Fable 5 <[email protected]>
MFC after:	1 week
Sponsored by:	Spectra Logic
2026-11-06 22:33:25 -05:00
Hayzam Sherif c17aa0984d camdd: Fix the worker startup race
The reader can hand off its first buffer before the writer sets
CAMDD_DEV_FLAG_ACTIVE.  camdd_queue_peer_buf() then mistakes the writer
for an exited peer and releases the buffer instead of queueing it.  This
can make a copy fail with bytes read but nothing written, without an
error message.

Mark both devices active before creating either worker, leaving the
workers to clear the flag on exit.  The work queues and EVFILT_USER
events are already initialized, so queued buffers and their notification
can wait for the writer to start without a startup barrier.

Treat pthread_create() failure as fatal.  Returning through the normal
cleanup path can free devices that an already-started worker is still
using, and an unstarted peer cannot consume any queued buffers.

Reviewed by:	imp, markj, ken
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D61277
2026-11-06 20:19:07 -05:00
Kenneth D. Merry 6eae951cd5 camcontrol: Add a feature subcommand for NVMe Get/Set Features
Add a feature subcommand for the NVMe Get Features and Set Features
commands:

  camcontrol feature ndaX -a <get|set> -f feature [-d data]
      [-s num] [-U]

There is no transport-specific prefix in the name: SCSI has no
feature command (the closest equivalents are mode pages), and the
ATA SET FEATURES subcommands are already exposed through dedicated
camcontrol subcommands (apm, aam, epc and the power commands), so
the name is unclaimed.  The subcommand returns an error for
non-NVMe devices.

Currently, only the hostid feature is fully implemented.  The
hostid value for set is specified with -d as a UUID or an integer
in decimal, hex, or octal, and -U outputs the hostid as a UUID on
get.

The -s argument exposes the feature select / save fields from the
NVMe specification.  If bit 4 of the Optional NVM Command Support
(ONCS) field of the Identify Controller data is set, each feature
has a default, saved and current value, plus a capabilities mask:

  - For get, -s selects which to display: 0 (current),
    1 (default), 2 (saved) or 3 (capabilities).
  - For set, -s is the save flag; a value of 1 sets the saved
    value as well as the current value, so the feature
    persists across an NVMe reset.  Setting the save flag only
    works if the feature's capability mask includes saveable.

sbin/camcontrol/nvfeature.c:
  New file, the camcontrol(8) feature subcommand for getting
  and setting NVMe features.

sbin/camcontrol/camcontrol.c:
  Add the feature subcommand, dispatched only to NVMe devices.

sbin/camcontrol/camcontrol.h:
  Add the nvmefeature() prototype.

sbin/camcontrol/Makefile:
  Add nvfeature.c to the build.

sbin/camcontrol/camcontrol.8:
  Document the feature subcommand.

Co-authored-by:	Reid Linnemann <[email protected]>
Co-authored-by:	Dave Baukus <[email protected]>
Co-authored-by:	Claude Fable 5 <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D59536
2026-11-06 20:05:56 -05:00
Kenneth D. Merry 80f090111a camcontrol: Support NVMe namespace formatting via the format subcommand
Support formatting NVMe namespaces through the existing format
subcommand.  The format subcommand now dispatches on the device
protocol, in the same way the identify and persist subcommands do,
and issues the NVMe FORMAT NVM command for NVMe devices.

The SCSI syntax and behavior are unchanged.  The NVMe-specific
options are -e (secure erase setting), -G (format all namespaces),
-f (LBA format), -l (protection information location), -m (metadata
setting) and -p (protection information type).  The -q and -y options
work for both protocols; NVMe formats gain the same confirmation
question that SCSI formats have always had.  The -r and -w options
are SCSI only; -r returns an error for NVMe devices and -w has no
effect, since the NVMe format command does not complete until the
format is finished.

The default timeout for NVMe is 30 seconds for a cryptographic erase
and 30 minutes otherwise; the generic -t option overrides it.

sbin/camcontrol/nvformat.c:
  New file, the NVMe format backend for the format subcommand.

sbin/camcontrol/camcontrol.c:
  Dispatch the format subcommand to scsiformat() or
  nvmeformat() based on the device protocol.

sbin/camcontrol/camcontrol.h:
  Add the nvmeformat() prototype.

sbin/camcontrol/Makefile:
  Add nvformat.c to the build.

sbin/camcontrol/camcontrol.8:
  Document NVMe support in the format subcommand section, and
  note the differences from SCSI where they occur.

Co-authored-by:	Claude Fable 5 <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D59535
2026-11-06 20:05:56 -05:00
Kenneth D. Merry ba75cf0572 camcontrol: Support NVMe reservations via the persist subcommand
The NVMe reservation model is closely patterned after SCSI Persistent
Reservations, so support NVMe devices through the existing persist
subcommand rather than adding a transport-specific subcommand.  The
persist subcommand now dispatches on the device protocol, in the same
way the identify subcommand does.

The SCSI syntax is unchanged.  For NVMe devices, the -i modes all map
to the Reservation Report command (read_full_status requests the
extended data structure, which contains 128-bit Host Identifiers), and
the -o service actions map to the corresponding NVMe reservation
operations: register, register_ignore, reserve, preempt,
preempt_abort, release and clear, plus two NVMe-only actions,
unregister and replace.  The reservation type names for -T are shared
between SCSI and NVMe.  A new -c option gives explicit control over
the NVMe Persist Through Power Loss State; -p is equivalent to
-c enable.  SCSI-only options return an error for NVMe devices.

Tested against a PASCARI X200 series SSD (reservation capabilities:
WR_EX, PTPL, IEKEY13): register, reserve, release, replace,
unregister, -c enable/disable (Persist Through Power Loss State change
verified in the report output), reservation report, and the error
paths.  register_ignore is rejected by drives that implement NVMe 1.3
IEKEY semantics, as expected.  SCSI persist against a da(4) device is
unchanged.

sbin/camcontrol/nvres.c:
  New file, the NVMe reservation backend for the persist
  subcommand.

sbin/camcontrol/camcontrol.c:
  Dispatch the persist subcommand to scsipersist() or
  nvmepersist() based on the device protocol.

sbin/camcontrol/camcontrol.h:
  Add the nvmepersist() prototype.

sbin/camcontrol/Makefile:
  Add nvres.c to the build.

sbin/camcontrol/camcontrol.8:
  Document NVMe support in the persist subcommand section, and
  note the differences from SCSI where they occur.

Co-authored-by:	Reid Linnemann <[email protected]>
Co-authored-by:	Claude Fable 5 <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D59534
2026-11-06 20:05:55 -05:00
Kenneth D. Merry 961fa195b3 camcontrol: Add support for NVMe namespace Identify
Add a -N argument to camcontrol identify.  This will fetch and
display namespace Identify data for NVMe drives, using
nvme_print_namespace() from nvmecontrol(8).

This gets the namespace Identify data via XPT_DEV_ADVINFO (i.e.
data cached in the kernel) like the standard NVMe identify command
does, and so works even on NVMe devices that do not support NVMe
Namespace Management.

sbin/camcontrol/camcontrol.c:
	Add a -N argument to camcontrol identify.

	Rename nvme_get_cdata() to nvme_get_data(), and give it the
	ability to fetch controller or namespace Identify data.
	While here, improve its error reporting with
	cam_error_print(), and only look at the CAM status bits of
	the returned CCB.

	Change identify(), ataidentify(), and nvmeidentify() to
	handle the extra arguments.

	Give nvmeidentify() the ability to fetch and print NVMe
	namespace data, using nvme_print_namespace() from
	nvmecontrol(8).

sbin/camcontrol/camcontrol.h:
	Add the nvme_get_data() prototype, for use by future NVMe
	subcommands living outside camcontrol.c.

sbin/camcontrol/camcontrol.8:
	Document camcontrol identify -N.  Make it clear that the
	NVMe data is from data cached in the kernel.  Add a cross
	reference to nvmecontrol(8).

Co-authored-by:	Claude Fable 5 <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D59533
2026-11-06 20:05:55 -05:00
Kenneth D. Merry 9814633f63 cam: Add NVMe reservation, format and features CCB building functions
Add NVMe CCB (union ccb / struct ccb_nvmeio) building functions for
the four NVMe reservation opcodes, Format NVM, and Get Features /
Set Features.  These use the nvme_command building blocks added to
sys/dev/nvme/nvme.h, and are used by the new camcontrol(8) nvres,
nvformat and nvfeature subcommands that will be added separately.

sys/cam/nvme/nvme_all.c:
	Add NVMe CCB building functions for the four NVMe reservation
	opcodes: nvme_resv_report(), nvme_resv_register(),
	nvme_resv_acquire() and nvme_resv_release().  Data direction
	is set internally (CAM_DIR_IN or CAM_DIR_OUT as appropriate),
	so no flags parameter is needed.

	Add a new nvme_format() CCB building function.

	Add nvme_get_feature() and nvme_set_feature() CCB building
	functions, along with nvme_get_feature_hostid() and
	nvme_set_feature_hostid() convenience wrappers for the hostid
	feature.  nvme_set_feature_hostid() takes an sv argument so
	the caller can request that the hostid persist across reset.

sys/cam/nvme/nvme_all.h:
	Add prototypes for the above.  Wrap the declarations in
	__BEGIN_DECLS / __END_DECLS so C++ compilers don't mangle the
	names of the C symbols.

Co-authored-by:	Reid Linnemann <[email protected]>
Co-authored-by:	Dave Baukus <[email protected]>
Co-authored-by:	Claude Fable 5 <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D59532
2026-11-06 20:05:54 -05:00
Kenneth D. Merry 7a9e437531 nvme: Add reservation, format and features command building support
Add command (struct nvme_command) building functions for the four
NVMe reservation opcodes (Report, Register, Acquire and Release),
Format NVM, and Get Features / Set Features, along with the
enumerations and data structures that go with them.  These are
shared between the kernel and userland, and are the underpinnings
for new camcontrol(8) subcommands (nvres, nvformat, nvfeature) that
will be added separately.

The reservation type names are intentionally similar to the SCSI
names for the same reservation types.

sys/dev/nvme/nvme.h:
  Add NVMe command building functions for the four NVMe
  reservation opcodes: nvme_ns_resv_report_cmd(),
  nvme_ns_resv_register_cmd(), nvme_ns_resv_acquire_cmd() and
  nvme_ns_resv_release_cmd().

  Add enumerated types for the various NVMe reservation
  subcommand actions (acquire, register, release), reservation
  types, and Change Persist Through Power Loss State values.

  Add struct nvme_resv_acq_data and struct nvme_resv_reg_data,
  the data payloads for reservation Acquire and Register.

  Add a new NVMe Format NVM command building function,
  nvme_admin_format_cmd(), and an enumeration for the Secure
  Erase Setting parameter for format.

  Add nvme_admin_get_feature_cmd() and
  nvme_admin_set_feature_cmd() functions to fill a struct
  nvme_command for Get Features / Set Features.

  Add macros for bitfields in the ctratt and mic dwords of the
  NVMe Identify Controller data structure.

  Add a prototype for nvme_hostid_sbuf().

  Stop byte swapping the hostid fields in
  nvme_resv_status_swapbytes() and
  nvme_resv_status_ext_swapbytes(), and document the fields as
  little endian.  The hostid is an opaque 8 or 16 byte value;
  keep it in the byte order the device returns it in instead of
  interpreting it at this level.

  Widen the nvme_ctrlr_cmd_get_feature() and
  nvme_ctrlr_cmd_set_feature() prototypes as described below.

  While here, fix the entry count clamp in the reservation status
  swapbytes functions to use sizeof(*s) rather than sizeof(s); using
  the pointer size made the clamp one entry too permissive.

sys/dev/nvme/nvme_util.c:
  Add nvme_hostid_sbuf(), which formats an 8 or 16 byte hostid
  (from the Get Features hostid feature, in the little-endian
  byte order the device returns it in) into an sbuf as an
  integer value in base 16, most significant byte first.

sbin/nvmecontrol/resv.c:
  Decode the now little-endian hostid fields explicitly when
  printing, and zero pad the printed 64-bit values.  Previously
  the extended hostid printed in a different byte order on big
  and little endian machines, and without zero padding between
  the two halves.

sys/dev/nvme/nvme_ctrlr_cmd.c:
  Refactor nvme_ctrlr_cmd_get_feature() and
  nvme_ctrlr_cmd_set_feature() to use the new command building
  functions from nvme.h and accept a namespace ID parameter.

  Refactor nvme_ctrlr_cmd_set_feature() to also accept the sv
  (save) parameter to persist a feature value across reset.

sys/dev/nvme/nvme_ctrlr.c:
  Update the temperature threshold, autonomous power state
  transition and host memory buffer callers for the new
  nvme_ctrlr_cmd_get_feature() and nvme_ctrlr_cmd_set_feature()
  arguments.

Co-authored-by:	Reid Linnemann <[email protected]>
Co-authored-by:	Dave Baukus <[email protected]>
Co-authored-by:	Claude Fable 5 <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D59531
2026-11-06 20:05:54 -05:00
Kenneth D. Merry 46198fba6d nvmecontrol: Factor out namespace Identify printing
Move print_namespace() from identify.c to identify_ext.c and rename
it to nvme_print_namespace(), to match nvme_print_controller().
This allows other consumers (notably camcontrol(8)) to print NVMe
namespace Identify data.

No functional changes intended.

sbin/nvmecontrol/identify.c:
	Remove print_namespace(), and call nvme_print_namespace()
	instead.

sbin/nvmecontrol/identify_ext.c:
	Add nvme_print_namespace(), moved here from identify.c.

sbin/nvmecontrol/nvmecontrol.h:
	Remove the print_namespace() prototype.

sbin/nvmecontrol/nvmecontrol_ext.h:
	Add the nvme_print_namespace() prototype.

sbin/nvmecontrol/ns.c:
	Include nvmecontrol_ext.h, and rename print_namespace() calls
	to nvme_print_namespace().

Co-authored-by:	Claude Fable 5 <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D59530
2026-11-06 20:05:53 -05:00
Konstantin Belousov 9dae9b31d2 libthr: require both _Unwind_ForcedUnwind and _Unwind_GetCFA for !PIC
Static linking must bring in both symbols for the unwind to work.

The landing pads added by 2734bbbcba reference _Unwind_Resume and
__gcc_personality_v0. In a static link, these pull UnwindLevel1.o
from libgcc_eh.a, which also defines _Unwind_ForcedUnwind, but
not UnwindLevel1-gcc-ext.o, which defines _Unwind_GetCFA. Unless
something else pulls that object in, as libcxxrt does for C++ programs,
thread_unwind_stop() calls a NULL _Unwind_GetCFA on every thread exit.

Reported and tested by:	dch
Fixes:	2734bbbcba ("libthr: Create landing pad in thr_once in C++ exception")
Sponsored by:	The FreeBSD Foundation
2026-11-07 01:21:08 +02:00
Richard Scheffenegger c3a05933b3 Revert "iSCSI: Fast and per-session timeouts"
This reverts commit 6129bc4b65.
2026-11-06 23:38:25 +01:00
Alexander Ziaee b556d9c9ce ports.7: Add the DEVELOPER make variable
make.conf(5) says make variables that are for the ports tree should
be documented in ports(7). Add this from the porters handbook.

MFC after:		3 days
Reviewed by:		alven
Event:			FreeBSD 2026 Vendor Summit
Differential Revision:	https://reviews.freebsd.org/D61272
2026-11-06 16:54:10 -05:00
Richard Scheffenegger 6129bc4b65 iSCSI: Fast and per-session timeouts
Support per-session configurable ping (SCSI NOP) and login timeouts
similar to what is supported in the Linux iSCSI initiator configuration file.

Reduce iscsi timer granularity to 0.1 sec.
For backwards compatibility, when all timers are selected on integer numbers,
all status messages are unchanged. If the higher granularity is used, the
log messages include sub-second granularity.

The sysctl(3) interface has changed from pure int to string, in order to
support fractional seconds in a human-readable, dotted notation.

Reviewed By: #netapp, #manpages, jhb, pauamma_chezdork.com, siderop1_netapp.com
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D32540
2026-11-06 22:21:12 +01:00
Richard Scheffenegger e0c6b88706 irdma: improve TCP header validation
iWARP handling code deals with TCP header processing outside of the normal TCP stack.
Add validation checks to verify the internal integrity of the TCP headers.

Reviewed By: tuexen, O11 Intel Networking group, #transport, bartosz.sobczak_intel.com
Sponsored by: NetApp, Inc.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D58323
2026-11-06 21:42:45 +01:00
Mark Johnston 40371e5141 ctfconvert: Make the absence of debug info non-fatal
When compiled with gcc14, subr_ticks.o legitimately doesn't contain any
DWARF sections.  Just emit a warning in this case.  In general we still
want to run ctfconvert on asm files.

Reviewed by:	emaste, des
Fixes:		e959f2a7d8 ("ctf*: exit with error upon terminate()")
Differential Revision:	https://reviews.freebsd.org/D61231
2026-11-06 11:59:43 -05:00
Artem Bunichev d0666b1f24 uname.1: Document which flags are non-POSIX
MFC after:		3 days
Reviewed by:		ziaee
Differential Revision:	https://reviews.freebsd.org/D58476
2026-11-06 14:54:25 -05:00
Gordon Tetlow f3b6bb1404 openssl: restore removed libcrypto symbols as compat symbols
c01c0a27cb (D60397) stopped exporting 52 names from libcrypto.so.35 that
upstream does not export.  Binaries and libraries linked against the
earlier libcrypto.so.35 can still import them; the libssl.so.35 from
15.0 and 15.1 imports 15 of them, so it fails to load with the new
libcrypto.

Provide all 52 again as non-default (compat) versions, in the version
nodes they had before: OPENSSL_cpuid_setup@OPENSSL_3_0_9, the others
@OPENSSL_3_5_0.  Existing consumers resolve them; new links cannot bind
to them.  The default exports do not change and still match upstream.

The wrappers live in a new FreeBSD-only file, compat.c.  Remove it at
the next SHLIB_MAJOR bump.

Reviewed by:		ngie
Fixes:			c01c0a27cb ("openssl: make libcrypto export the same symbols as upstream")
MFC after:		2 weeks
MFC to:			stable/15
Event:			FreeBSD Vendor Summit 2026
Differential Revision:	https://reviews.freebsd.org/D61229
2026-11-06 10:54:13 -08:00
Gordon Tetlow 46453f0abb openssl: build legacy provider as upstream does
- Build with libcrypto's compile flags: modules/Makefile.inc now
  includes libcrypto's Makefile.inc, which brings in Makefile.common
  (NDEBUG, the asm dispatch defines, OPENSSL_PIC, the directory
  defines).  Before this change, assertions were enabled in legacy.so.
- Use upstream's per-architecture source list: the provider's own CPU
  capability code (cpuid asm and armcap.c/ppccap.c, or mem_clr.c
  without asm), and the MD5, RC4 and DES asm where upstream uses it.
  The provider no longer uses libcrypto's exported RC4, SHA1 and
  CRYPTO_*128 functions.
- Drop the objects that upstream's linker leaves out of legacy.so
  (fcrypt_b.c, md5_one.c, md5_sha1.c, provider_err.c and
  ciphercommon_{ccm,gcm}*.c / ciphercommon_hw.c).  Without them,
  params_idx.c is not needed either.
- Add a version script, a copy of upstream's providers/legacy.ld, so
  that only OSSL_provider_init is exported.  Around 209 symbols were
  exported before.

Reviewed by:		ngie
MFC after:		2 weeks
MFC to:			stable/15
Event:			FreeBSD Vendor Summit 2026
Differential Revision:	https://reviews.freebsd.org/D60398
2026-11-06 10:42:45 -08:00
Christos Margiolis 8fb539b081 amd64/vmm: Don't advertise AMD PerfMonV2 or performance counters
vmm does not handle CPUID leaf 0x80000022, so a FreeBSD guest on a
Family 19h or later host panics on "kldload hwpmc", which trusts the
PerfMonV2 bit and writes AMD_PMC_GLOBAL_CTL.

Tested by:	Osvaldo Janeri Filho <[email protected]>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj, kib
Differential Revision:	https://reviews.freebsd.org/D61141
2026-11-06 16:57:18 +01:00
Christos Margiolis 0efaebd5ab hwpmc: Decline the AMD PerfMonV2 path when GLOBAL_CTL is absent
The v2 path writes AMD_PMC_GLOBAL_CTL whenever the PerfMonV2 CPUID bit
is set. bhyve passes that bit through from the host but does not emulate
the register, so loading hwpmc in a guest on a Family 19h or later host
panics the kernel.

amd_v2_hwcheck_cpu() already probes EVSEL MSRs, so probe GLOBAL_CTL
there too, in order to reject the v2 path and fall back to the generic
CPU class.

Fixes:		9d30640105 ("hwpmc_amd: add PerfMonV2 global-control path")
Tested by:	Osvaldo Janeri Filho <[email protected]>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Reviewed by:	mhorne, [email protected]
Differential Revision:	https://reviews.freebsd.org/D61133
2026-11-06 16:57:12 +01:00
Andrew Turner e82b2913b7 arm64/acpica: Fix the IORT MSI xref type
The acpi IORT code incorrectly uses a u_int as the MSI xref type, while
INTRNG expects an intptr_t. Switch to using intptr_t to help document
this value is the xref for the MSI controller.

Reviewed by:	dsl
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D60653
2026-11-06 15:38:51 +00:00
Sarah Walker f0b589edc7 arm64/pmap: Add support for FEAT_TTL
FEAT_TTL adds a Translation Table Level field for TLB maintenance intructions,
to indicate the level holding the leaf address for the address being
invalidated. This can reduce the cost of TLB invalidation.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D60090
2026-11-06 15:38:51 +00:00
Andre Silva e5a48c8e0d hwpmc: release a PMC whose ID could not be copied out
If copyout of the newly allocated PMC ID fails, the caller cannot use or
release the PMC. Release it in the kernel.

Reviewed by:	mhorne
MFC after:	3 days
Sponsored by:	Advanced Micro Devices, Inc.
Differential Revision:	https://reviews.freebsd.org/D60562
2026-11-06 11:21:45 -04:00
Osvaldo Janeri Filho fdfb611461 tests: add a regression test for the orphaned IBS NMI
Toggle IBS op and fetch through /dev/cpuctl0 with hwpmc loaded and
check that every NMI hwpmc declined was claimed.  Without the fix both
cases fail on an EPYC 9654.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	AMD
Signed-off-by: Osvaldo Janeri Filho <[email protected]>
Differential Revision:	https://reviews.freebsd.org/D60766
2026-11-06 10:50:59 -04:00
Osvaldo Janeri Filho f5304e44ff cpuctl, x86: claim IBS NMIs orphaned by control MSR writes
A cpuctl(4) write that stops or reprograms IBS can clear the valid bit
of a sample whose NMI is already raised.  hwpmc then declines the NMI,
no other handler claims it, and with the default machdep.panic_on_nmi
the system panics.

Have nmi_handle_intr() claim, after all handlers declined it, one NMI
per cpuctl write to an IBS control MSR.  Claiming last, rather than
from a cpuctl NMI handler, cannot take an NMI away from hwpmc.

cpuctl.ko now needs the new kernel symbols; an MFC has to update both.

Reproduced on an EPYC 9654 by toggling IBS op through /dev/cpuctlN:
about one unclaimed NMI per 2000 toggles.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	AMD
Signed-off-by: Osvaldo Janeri Filho <[email protected]>
Differential Revision:	https://reviews.freebsd.org/D60765
2026-11-06 10:50:59 -04:00
Brooks Davis 675739153b sys/security/audit: add kern_ implementations
Effort:		CHERI upstreaming
Sponsored by:	Innovate UK
PR:		https://github.com/freebsd/freebsd-src/pull/2284
2026-11-06 13:58:14 +00:00
Konstantin Belousov 57bc1e1c2f amd64: make hw.splitlock_force adjustable at runtime
The setting is only read on exec(2), so it can be safely modified.
This is useful to adapt the system to newly discovered buggy programs
without reboot.

Note that that running processes keep their mode until they exec again.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-11-06 15:31:28 +02:00
Dag-Erling Smørgrav feab010f44 libfetch: Use monotonic clock for timeouts
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D61225
2026-11-06 12:16:42 +01:00
Abdelkader Boudih e6fc1765bd nvme: drop the S3X single-outstanding-I/O quirk
The quirk's 8KB transfer clamp exposed raw character-device I/O to
the oversized-mapping stall fixed earlier, and its single tracker
turned a stranded request into a complete I/O stall. Without it an
S3X controller runs 128 trackers at its MDTS-derived transfer size
with no retries, failures, or timeouts, at about seven times the
serialized throughput.

Reviewed by:	imp, adrian, ngie
Approved by:	ngie (co-mentor)
Differential Revision:	https://reviews.freebsd.org/D59156
2026-11-06 09:59:18 +01:00
Abdelkader Boudih 764761d316 nvme: program the arbitration burst from Identify RAB
The controller's Recommended Arbitration Burst was ignored; the
specification advises matching the Arbitration feature's burst to it
even under plain round robin. Some controllers report unusable
values: programming the Apple S3X with its reported RAB wedged
sustained I/O, so quirked controllers keep their default
configuration. The hw.nvme.arb_burst tunable overrides the
recommendation.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D59155
2026-11-06 09:58:08 +01:00
Christos Margiolis 66d078c172 netlink: Pre-register the missing devctl event systems
devctl_notify() can be called with a mutex held. If the event system is
not listed in devctl_systems[], sysevent_get_group() calls
sysevent_new_group(), which calls strdup() with M_WAITOK, and we may end
up sleeping while holding a non-sleepable mutex.

Add the missing systems.

While here, remove the nonexistent KERNEL system.

PR:		299272
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D61161
2026-11-06 09:42:37 +01:00
Simon J. Gerraty b22b999afc libsecureboot restore default trust anchors
If site.trust.mk does not set VE_SIGNATURE_LIST
initialize it based on content of VE_SIGNATURE_EXT_LIST
which is in turn initialized from TRUST_ANCHORS.

Sponsored by:	Hewlett Packard Enterprise Development LP

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D61245
2026-11-05 16:27:00 -08:00
Vinicius Ferrao cf59649539 xdr_mbuf.c: Add a check for the return value for xdrmbuf_getbytes()
The xdrmbuf_getlong() function failed to check for the return
value from xdrmbuf_getbytes().  This could have resulted in
a failure during NFS RPC message processing.

Reviewed by:	rmacklem
MFC after:	2 weeks
Sponsored by:	VersatusHPC
2026-11-05 15:58:56 -08:00
Kyle Evans 12f90bbd30 virtio_random: defer first enqueue until after DRIVER_OK
According to the virtio spec:

> The driver MUST NOT send any buffer available notifications to the
> device before setting DRIVER_OK.

DRIVER_OK isn't set until after attach completes, so defer the first
enqueue.  We haven't found any problems as a result of this to the best
of my knowledge: q35 and other devices that we *have* been used with
will apparently check when we go DRIVER_OK.

Tested with q35 virtio-random, which still works.

Reported by:	llm-postcr
Reviewed by:	kfv, markj
Fixes:	f1c5a2e3a6 ("virtio_random: Pipeline fetching the data")
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D61228
2026-11-05 15:53:30 -06:00
Dag-Erling Smørgrav 878084c774 nfsserver: Do not increment seqid on BADSEQID
When returning NFSERR_BADSEQID, the server should not have incremented
the sequence ID, yet the call to nfsrv_checkseqid() a few lines above
does precisely that.  Instead, check for a legitimate retransmission
of the original successful request, and reject otherwise, before the
ticket is used and sequence ID incremented.

MFC after:	1 week
Fixes:		ff45b9fc1a ("Bjorn reported a problem...")
Sponsored by:	Klara, Inc.
Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D61156
2026-11-05 22:11:30 +01:00
Faraz Vahedi 3ac9299ee9 libc: Export timespec_getres(3) and add tests
timespec_getres() has been declared in <time.h> and built into libc,
but never listed in a symbol map.  It is therefore local to libc.so,
and dynamically linked callers fail to link.

Reviewed by:	ziaee, fuz, des
Approved by:	fuz (mentor)
Fixes:		9b5d724cad ("libc: Add timespec_getres(3) as per C23.")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D60799
2026-11-05 23:39:01 +03:30
Olivier Cochard bfe4be85a9 tpm_crb: wait for idle and locality release after each command
transmit only requested GO_IDLE and the locality release, so a back-to-back
command could see stale state and fail with EIO.
A post-send idle timeout no longer discards a completed response.

Reviewed by:	kbowling
Approved by:	kbowling
Differential Revision:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/93
2026-11-05 20:51:20 +01:00
R. Christian McDonald 843cb77850 e6000sw: Write the value, not the register, in Clause 45 writes
e6000sw_write_xmdio() loaded the Clause 45 register address into the
SMI PHY data register a second time, where the value to write belongs,
so every Clause 45 write stored the register address.

Its only caller, e6000sw_serdes_power(), runs at attach for ports 9 and
10 of the 88E6190 and 88E6190X to power one SERDES interface up and the
other down.  It wrote 0x2000 to the SGMII control register and 0x1000
to the 10GBASE-R PCS control register instead, so neither interface was
powered down and the rest of each register was overwritten.

Fixes:		9aba06377d ("Add support for the Marvell 88E6190 11 ports switch.")
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-11-05 12:25:03 -05:00
Andrew Gallatin 4b732459f0 iflib: Use a single tx dma map
The need for a separate map for TSO and non-TSO seems to have arisen from
a misunderstanding about the DMA requirements for Intel drivers like
ice/ixl/iavf. Specifically, this Intel hardware has a quirk where no
more than N (=8) segs can be DMA'ed per packet on the wire. This limit
was enforced using a DMA map with a low segment limit for non-TSO and a
driver specific check for TSO. This led to a *lot* of complexity in
iflib (~80 extra lines of code that this change removes) when the
limit can simply be enforced via the existing EFBIG mechanisms.

This change adds a new flag, IFLIB_SPARSE_TX, that drivers for hardware
with this quirk must set.  When set, it causes non-TSO sends that
exceed isc_tx_nsegment to be treated as if bus_dmamap_load_mbuf_sg()
had returned EFBIG.

Due to the API/KABI change, I've bumped the FreeBSD version as well.

Note kgalazka suggested the flag, rather than a more awkward
mechanism that I had in my initial patch.

Reviewed by: kbowling
Sponsored by: Netflix
Differential Revision:  https://reviews.freebsd.org/D60175
2026-11-05 11:55:28 -05:00
ShengYi Hung 2734bbbcba libthr: Create landing pad in thr_once in C++ exception
In _thr_once, if init_routine fails with exception, the stack allocate
__cup will become invalid when unwinder walk back and free the stack of
thr_once. This cause cleanup linked list be dangling. In here, we give
the cleanup function a landing pad so that we td can correctly point
to previous cleanup function.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D61212
2026-11-06 03:01:55 +11:00