Skip to content

Conversation

@bsdjhb
Copy link
Collaborator

@bsdjhb bsdjhb commented Oct 28, 2025

PR for CI

kostikbel and others added 30 commits November 3, 2024 01:45
Reviewed by:	emaste
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47255
This driver is functionally equivalent to the in-tree Intel DMAR code.
It handles busdma and interrupt remapping from the host OS.  There is no
integration with bhyve, and the stub iommu drivers in bhyve code cannot
coexist with this driver (planned).

The biggest architectural problem with the code is that the AMD IOMMU
units are enumerated as PCIe-attached security devices, which is much
later after HPET and IOAPIC drivers attached and actived interrupts.
Because of this, HPET FSB interrupts and IOAPIC interrupts are always
identity-mapped.

The code is of late alpha quality.  By default the driver is disabled.
To enable for testing, set in loader.conf:
hw.amdiommu.enable=1
hw.iommu.dma=1 <- to enable iommu busdma
hw.iommu.ir=1 <- to enable interrupt remapping

Discussed with:	emaste
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47256
Identify interfaces consistenly by the pair of the ifn pointer
and the index.
This avoids a use after free when the ifn and or index was reused.

Reported by:	bz, pho, and others
MFC after:	3 days
MFC after:	3 days
We cannot unconditionally access nfsd's VNET variables in
'sys/kern/vfs_export.c' nor 'sys/fs/nfsserver/nfs_nfsdsubs.c', as they
may not have been compiled in depending on build options.

So, forget about the extra mile of using the configured default group
and use the hardcoded GID_NOGROUP (which differs only on systems running
nfsuserd(8) and with a non-default GID for their "nogroup" group).

Reported by:    rpokala, bapt (MINIMAL compile breakup)
Reported by:    cy, David Wolfskill (panics caused by mountd(8))
Approved by:    markj (mentor)
Fixes:          cfbe7a6 ("nfs, rpc: Ensure kernel credentials have at least one group")
pf_find_state_all() expects the caller to initialize "*more" if it is
non-NULL, but pf_handle_natlook() didn't obey this protocol.  Follow the
pattern from OpenBSD and initialize it in the caller.

Also make pf_find_state_all() unconditionally initialize "*more" for
good measure.

Fixes:		71d3c70 ("pf: convert DIOCNATLOOK to netlink")
Reported by:	KMSAN
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D47405
With this patch, it is possible to call fchmod() on a unix socket prior
to binding it to the filesystem namespace, so that the mode is set
atomically.  Without this, one has to call chmod() after bind(), leaving
a window where threads can connect to the socket with the default mode.
After bind(), fchmod() reverts to failing with EINVAL.

This interface is copied from Linux.

The behaviour of fstat() is unmodified, i.e., it continues to return the
mode as set by soo_stat().

PR:		282393
Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D47361
Take advantage of the ability to atomically set unix socket modes to
ensure that /var/run/logpriv always has mode 0600.

MFC after:	1 month
The tftpd tests all follow the same pattern:
1. open a UDP socket,
2. fork a child to exec tftpd, which subsequently handles requests on
   the socket,
3. use a client socket to send some message to the tftpd daemon.

However, tftpd's first action is to mark its socket as non-blocking and
then read a request from it.  If no data is present in the socket, tftpd
exits immediately with an error.  So, there is a race; we often see
tftpd test timeouts when running tests in parallel.  These timeouts also
arise periodically in CI runs.

One solution is to restructure each test to create the server socket,
then write the request to the client socket, then fork tftpd.  This
closes the race.  However, this involves a lot of churn.

This patch fixes the problem a different way, by adding a new -b flag to
tftpd which makes it block to read the initial request.  Each test is
modified to use -b, closing the race.

Reviewed by:	imp, asomers
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47404
- Invalid/non-existent/unable to use message catalog file should result in
  ENOENT, and not in EFTYPE.
- Added detection of several cases of wrong file format due to length [*].
- Update man page.

* Based on the original patch from PR.

PR:	172805
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47413
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47414
The alternative, more concise, translations for signal names, are left
intact under XXX in comments.

Noted by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
AU_OFLAG_NORESOLVE is documented as "Leave user and group IDs in their
numeric form" but it was not actually tested.

OpenBSM pull request at openbsm/openbsm#85

PR:		282271
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47263
pcm_veto_load is used to prevent pcm_register() from running if the root
feeder has not been registered yet. However, feeder_register_root() is a
SYSINIT.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D47280
Create the sysctl and /dev/dsp* nodes in pcm_setstatus(), which is
responsible for finalizing the device initialization, instead of doing
this in the middle of the initialization.

For the sysctl creation specifically, move them into pcm_sysinit(),
since this is where we create the rest of the sysctl nodes anyway.

A side effect of this change is, that we avoid the possibility of racing
in between pcm_register() and pcm_setstatus() by accessing /dev/dspX or
the sysctls within that window.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47322
The d->status string is populated in pcm_setstatus() anyway, so call
sndstat_register() after we populate it, and are closer to finalizing
the device creation.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47323
These flags are properly set in pcm_setstatus(), once the primary
channels have been created. The existing comment already states that
this is wrong.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47324
The way a sound driver currently registers to sound(4) is using the
following sequence of function calls:

1. pcm_register() to initialize snddev_info.
2. pcm_addchan() calls to create the device's primary channels.
3. pcm_setstatus() to do the final setup.

While using 3 different functions in a specific order might not be very
elegant, this pattern cannot be easily avoided. However, pcm_register()
and pcm_setstatus() are especially confusing, since one would
intuitively expect:

1. pcm_register() to actually do the registration, as opposed to a basic
   initialization.
2. pcm_setstatus() to, as the name suggests, set some kind of status, as
   opposed to finalizing the registration.

This patch renames pcm_register() to pcm_init(), and pcm_setstatus() to
pcm_register(). Drivers are modified accordingly.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D47325
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D47360
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
iommu_free_ctx_locked() alone is enough

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Follow the existing pattern of fflush() in verbose mode.

PR:		71665
Sponsored by:	The FreeBSD Foundation
It was not removed for FreeBSD 14.

Sponsored by:	The FreeBSD Foundation
Now that crextend() asserts that groups are not set (rightfully so,
since it may change the backing storage without copying the content of
the old one), have crsetgroups() throw away the old groups before
calling it, as it installs an entirely new set anyway.

This allows to reuse unshared credentials by resetting their groups set,
as NFS exports actually do.

Reported by:    cy
Tested by:      cy
Fixes:          ea26c0e ("cred: crextend(): Harden, simplify")
Pointy hat to:  olce

While here, as I forgot these credits in commit 77d652b4b472 ("nfs:
Fallback to GID_NOGROUP on no groups"):
Tested by:    cy, David Wolfskill (panics caused by mountd(8))
Tested by:    kib (MINIMAL/custom kernel compile breakup)
The -n flag specifies that user and group IDs should remain numeric, not
be mapped to names.  The golden output for praudit -n, however,
contained user and group names.

Reported by: markj
Reviewed by: markj
Fixes: ba10bfe ("libbsm: honour AU_OFLAG_NORESOLVE")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47434
- IN_LOOPBACK() cannot be used without INET, because it references a
  VNET symbol vnet_entry_in_loopback_mask.

- ip_fillid() is not available without INET.  since this codepath is
  only entered in the AF_INET case, guard it with #ifnet INET.

Fixes:		27f54be ("pf: merge pf_test() and pf_test6()")
Fixes:		4f9e688 ("pf: merge pf_scrub_ip() and pf_scrub_ip6()")
Reviewed by:	kp
To avoid a conflict with the new amdiommu driver imported recently.

Fixes:		0f5116d ("AMD IOMMU driver")
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D47415
Reviewed by:	zlei
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D47315
wulf7 and others added 28 commits October 28, 2025 14:26
with operational mode firmware.

Sponsored by:	Future Crew LLC
MFC after:	1 month
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D46734
Required firmware files are already included in to comms/iwmbt-firmware port

Sponsored by:	Future Crew LLC
MFC after:	1 month
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D46735
If Intel firmware is already in operational mode at boot that takes
place at warm boot, BT adaptor can generate extra HCI events which
interferes with firmware mode detection logic. Ignore them.

Sponsored by:	Future Crew LLC
MFC after:	1 month
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D46736
If Intel firmware is already in operational mode at boot that takes
place at warm boot, BT adaptor can generate extra HCI events which
interferes with firmware mode detection logic. Ignore them.

Sponsored by:	Future Crew LLC
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46737
Attempt to initialize FreeBSD bluetooth stack while such a device is in
bootloader mode locks the adapter hardly so it requires power on/off
cycle to restore.

This change blocks ng_ubt attachment unless operational firmware is
loaded thus preventing the lock up.

Sponsored by:	Future Crew LLC
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46738
Firmware files are available in the comms/rtlbt-firmware port.

Sponsored by:	Future Crew LLC
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46739
Make explicit sed commands (first on commandline) behave the same
as those given with -e.

Without this patch the following two commands behave differently,
the second one being wrong:
echo ab | sed -e $'1 i\\\n--'
echo ab | sed $'1 i\\\n--'

Reviewed by:	0mp, des, kevans
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D47377
…) prototype

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
…desc

by making the LD_ENV_DESC() macro variadic.

Suggested by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
Reviewed by:	brooks (previous version)
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
Reviewed by:	Alexander Ziaee
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
Reviewed by:	Alexander Ziaee
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
* Adds support for SFPs that are not correctly coded as an SFP
  transceiver. i.e. Coherent-Finisar FCLF8522P2BTL.
* Configures multi-rate SFPs i.e. Coherent-Finisar FCLF8522P2BTL as
  SGMII so they can do 10/100/1000 auto-negotiation.
* Adds support for 100BaseLX SGMII transceivers.
* Some code cleanup and additional debugging.

Reviewed by:	emaste, markj, Franco Fichtner <[email protected]>
Tested by:	Natalino Picone <[email protected]>
MFC after:	2 weeks
Sponsored by:	Nozomi Networks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D47337
REMOVE doesn't work properly in the face of hard links.  Use UNLINKAT
instead, which is implemented by qemu and bhyve and lets the client
specify the name being removed.

PR:		282432
Reviewed by:	dfr
Differential Revision:	https://reviews.freebsd.org/D47438
Noted by:	Christos Longros @github
MFC after:	3 days
Key code swapping between [<>] and [^°] key is enabled for all Apple ISO
type keyboards.  Before, swapping was enabled when the Eject key was
detected in HID usage.  This did not correlate well with the swapped
keys presence.

usbdevs file is extended by several Apple keyboard models to support ISO
model identification.

Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	freebsd/freebsd-src#1506
vmmops_modinit() needs to create a device file, and this must happen
after SI_SUB_DEVFS.  On non-EARLY_AP_STARTUP platforms (i.e., !x86) this
happens already by accident, but we shouldn't rely on it.

On riscv, remove the current SI_SUB_SMP ordering since that was copied
from arm64 and isn't needed.  In particular, riscv's vmmops_modinit()
does not call smp_rendezvous().

Reported by:	Oleksandr Kryvulia <[email protected]>
Fixes:	a97f683 ("vmm: Add a device file interface for creating and destroying VMs")
But comment out FDT stuff for amd64 built inside kboot. This also
restricts a bit the powerpc platforms we build on to powerpc64.

Sponsored by:		Netflix
ADATA USB Drive lies about the RC16, so add a quirk to ignore it.

MFC After: 3 days
PR: 188999
Sponsored by:		Netflix
This adds three OCI archive format files to the release containing
FreeBSD base images suitable for static linked, dynamic linked and shell
workloads. The shell image also contains pkg-bootstrap and can be easily
extended by installing packages (including pkgbase packages).

Reviewed by: dch, cpersiva, jlduran, zlei
Differential Revision: https://reviews.freebsd.org/D46759
MFC after: 2 days
in_pcblookup_hash_wild_* looks up unconnected inpcbs, so there is no
point in passing the foreign address and port, and indeed those
parameters are not used.  So, remove them.

No functional change intended.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D47385
Don't schedule work during reset / abort.  For USB NICs, work
must not be scheduled during a call to rtwn_usb_abort_xfers(),
as then it'll cause the call to usbd_transfer_drain() to hang.

This fixes a hang I've been seeing where the NIC hits a TX timeout
and then the reset/re-init path is called.  If data is scheduled
to be transmitted in that window, the call to usbd_transfer_drain()
would hang and require a hard reboot to recover.

Differential Revision: https://reviews.freebsd.org/D47479
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/19.x llvmorg-19.1.3-0-gab51eccf88f5,
a.k.a. 19.1.3 release.

PR:		280562
MFC after:	1 month
When having to find a firmware image with a lower version number
we must only break the inner but not also the outer loop so we
keep looking at any possibly remaining firmware details.

While here also try to find a version from max..1 and not from 1..max.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Introduce -q to quieten other output (unless -v is also given).

pkg-install(8) currently has no option to allow skipping unavail
packages but it will just fail.
We would realy want to try to install as much firmware found as
possible from the installer.
Work around this by doing one firmware package at a time.
For that it is highly helpful to be able to query (or possibly re-query)
all outstanding fimrware packages.
-q together with -n only shows each package to be installed one by line.

Once freebsd/pkg#2195 will be implemented
we could undo this part of the change and future changes to the installer
and use the new option for pkg-install(8) there.

While here switch to getopts so -qn works and not just -q -n.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D47445
We have been incorrectly choosing the "hlt" idle method on modern AMD
EPYC servers for C1 idle. This is because AMD also uses the Functional
Fixed Hardware interface. Due to not parsing the table properly for
AMD, and due to a weird quirk where the mwait latency for C1 is
mis-interpreted as the latency for hlt, we wind up choosing hlt for
c1, which has a far higher wake up latency (similar to IO) of roughly
400us on my test system (AMD 7502P).

This patch fixes this by:

- Looking for AMD in addition to Intel in the FFH
 (Note the vendor id of "2" for AMD is not publically documented, but
 AMD has confirmed they are using "2" and has promised to document it.)

- Using mwait on AMD when specified in the table, and when CPUid says
 its supported

- Fixing a weird issue where we copy the contents of cx_ptr for C1 and
 when moving to C2, we do not reinitialize cx_ptr. This leads to
 mwait being selected, and ignoring the specified i/o halt method
 unless we clear mwait before looking at the table for C2.

Differential Revision: https://reviews.freebsd.org/D47444
Reviewed by: dab, kib, vangyzen
Sponsored by: Netflix
This will fail when mac_veriexec is enforced.

Move the check from procfs_doprocmem to proc_rwmem to ensure all
cases are covered.

Reviewed by:	olce, markj
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D47484
@bsdjhb bsdjhb merged commit 80ece47 into CTSRD-CHERI:dev Oct 29, 2025
29 checks passed
@bsdjhb bsdjhb deleted the merge-freebsd-20241108 branch October 29, 2025 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.