Commit graph

301693 commits

Author SHA1 Message Date
Christos Margiolis
1480c0b3f2 Add 'contrib/libsamplerate/' from commit '69a539a327ef8d78260056c5394363569b5751ef'
Initial import. Needed by upcoming patches which port virtual_oss to
base.

Sponsored by:	The FreeBSD Foundation

git-subtree-dir: contrib/libsamplerate
git-subtree-mainline: e9dd9f95f8
git-subtree-split: 69a539a327
2025-08-01 16:01:24 +03:00
Bojan Novković
e9dd9f95f8 riscv: Add the sdhci_fdt driver to the build
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D48534
2025-08-01 14:35:54 +02:00
Bojan Novković
092b70dadb riscv: Add cvitek SoC files to the build
Reviewed by:	br, jrtc27
Differential Revision:	https://reviews.freebsd.org/D48533
2025-08-01 14:35:54 +02:00
Bojan Novković
e07254d148 riscv: Add driver for the cvitek reboot controller
This patch adds support for the cvitek reboot controller.
This controller is present on the Milk-V riscv SoCs.

Reviewed by:	br, mhorne, jrtc27
Differential review:	https://reviews.freebsd.org/D48532
2025-08-01 14:35:54 +02:00
Bojan Novković
25b9b0b6be riscv: Add driver for cvitek reset controller
This patch adds support for the cvitek reset controller.
This controller is present on the Milk-V riscv SoCs. The controller is
currently only used by the if_dwc driver.

Differential Revision:	https://reviews.freebsd.org/D48531
Reviewed by:	jrtc27, br
2025-08-01 14:35:54 +02:00
Bojan Novković
7a9a15eaf9 if_dwc: Add support for cvitek ethernet controller
This patch adds support for the cvitek flavor of the DWC ethernet
controller. This controller is present on the Milk-V riscv SoCs.

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D48530
2025-08-01 14:35:54 +02:00
Bojan Novković
19643b415b if_dwc: Ignore clk_set_assigned errors if "assigned_clocks" is not specified
dwc_attach will currently fail if clk_set_assigned fails, even if the
"assigned_clock" property was not specified. Since there are platforms
whose DTS files do not have this property (e.g. if_dwc_aw,
if_dwc_socfpga), do not return an error if clk_set_assigned
returns ENOENT.

Reviewed by:	manu
Differential review:	https://reviews.freebsd.org/D48529
2025-08-01 14:35:54 +02:00
Bojan Novković
89e650eacc sdhci: Add driver for the cvitek sdhci controller
This patch add support for cvitek SDHCI controller (only SD card mode).
This controller is present on Milk-V's riscv SoCs.

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D48528
2025-08-01 14:35:54 +02:00
Christos Margiolis
69a539a327 libsamplerate: Vendor import 0.2.2
Sponsored by:	The FreeBSD Foundation
2025-08-01 14:28:41 +03:00
Andrew Turner
3a4927ad91 arm64: Add CNTPOFF_EL2 op/CR values
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D51376
2025-07-30 13:46:39 +01:00
Andrew Turner
863e8b457b arm64: Rename ID_AA64MMFR0_ECV_CNTHCTL
Rename ID_AA64MMFR0_ECV_CNTHCTL to ID_AA64MMFR0_ECV_POFF as this is the
field value when FEAT_ECV_POFF is implemented.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D51370
2025-07-30 13:46:35 +01:00
Andrew Turner
118bfc9f53 arm64: Fix the sign in ID registers
Some ID registers use 0b0000 to indicate a feature is enabled, and
0b1111 to indicate it's not. In these cases we need to tell the kernel
to treat the value as a signed field.

Set the signed flag in fields we decode that should be signed.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D51369
2025-07-30 13:46:22 +01:00
Kajetan Staszkiewicz
d2761422eb pf: Use different address family for source and redirection address
The function pf_map_addr() and source tracking operate on a single
address family. This made sense before introducing address family
translation. When combining af-to with route-to or with sticky-address,
the next-hop or the NAT address are of different address family than
the source address. For example in NAT64 scenaro an IPv6 source address
is translated to an IPv4 address and routed over IPv4 gateway.

Make source nodes dual-AF, that is have a separate source AF and
redirection AF. Store route AF in struct pf_kstate, export it to pfctl.
When loading rules with redirection pools with pfctl store address
family of each address. When printing states don't deduce next-hop's
address family from af-to, use the one stored in state.

Reviewed by:	kp
Approved by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D51659
2025-08-01 12:11:30 +02:00
Kajetan Staszkiewicz
539da08f55 pfctl: Use sa_family_t for af instead of int
Reviewed by:	kp
Approved by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D51658
2025-08-01 12:11:25 +02:00
Peter Holm
5b977a8e2b stress2: A workaround for an infrequent "filesystem full" issue 2025-08-01 11:55:50 +02:00
Peter Holm
c1c58c0019 stress2: Added two syzkaller reproducers and updated the exclude list 2025-08-01 11:54:05 +02:00
Bojan Novković
aa05d1b2ef db/hash.c: Fix flag check in hash_seq
Fixes:	3a686b851f
2025-08-01 11:33:00 +02:00
Andrew Turner
1c52229528 lib: Move libopencsd to /usr/lib and make private
libopencsd is used to decode Arm CoreSight traces. It isn't needed
during the boot so can be moved to /usr/lib, and may change it's API
so can be marked as private as onlt the future hwt tool will use it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D51380
2025-07-30 11:11:38 +01:00
Timo Völker
bcb298fa9e sctp, tcp, udp: improve deferred computation of checksums
When the SCTP, TCP, or UDP implementation send a packet, it does not
compute the corresponding checksum but defers that. The network layer
will determine whether the network interface selected for the packet
has the requested capability and computes the checksum in software,
if the selected network interface doesn't have the requested
capability.
Do this not only for packets being sent by the local SCTP, TCP,
and UDP stack, but also when forwarding packets. Furthermore, when
such packets are delivered to a local SCTP, TCP, or UDP stack, do not
compute or validate the checksum, since such packets never have been on
the wire.
This allows to support checksum offloading also in the case of local
virtual machines or jails.
Support for epair, vtnet, and tap interfaces will be added in
separate commits.

Reviewed by:		kp, rgrimes, tuexen, manpages
MFC after:		4 weeks
Differential Revision:	https://reviews.freebsd.org/D51475
2025-08-01 12:09:47 +02:00
Kyle Evans
f61c48f440 kern: rename crsetgroups_fallback, document it in ucred(9)
As of FreeBSD 15.0, crsetgroups() *only* sets supplementary groups,
while crsetgroups_and_egid() will do both using an array of the same
style that previous versions used for crsetgroups() -- i.e., the first
element is the egid, and the remainder are supplementary groups.

Unlike the previous iteration of crsetgroups(), crsetgroups_and_egid()
is less prone to misuse as the caller must provide a default egid to use
in case the array is empty.  This is particularly useful for groups
being set from data provided by userland.

Reviewed by:	olce
Suggested by:	olce
Differential Revision:	https://reviews.freebsd.org/D51647
2025-07-31 19:50:48 -05:00
Kyle Evans
09f2abaa59 kern: add a new ucred flag for groups having been set
Now that we can legitimately have ngroups == 0 as a result of calling
crsetgroups(), set a flag when we've set groups for the sake of sanity
checking usage of crextend().  While it's true this flag will only
really be used under INVARIANTS, it's only the second flag bit that
we're adding in 16 years.

Reviewed by:	olce
Differential Revision:	https://reviews.freebsd.org/D51646
2025-07-31 19:50:47 -05:00
Toomas Soome
733da235aa libsa: errors with pointer conversion
loader ip implementation is using pointer to structure ip to receive
the packet and is using this pointer to cast on other data types
(namely structure arphdr). Problem does arise when those data structures
are declared with different alignment rules and when/if the compiler
does check those rules. To work around and silence warnings, use
void * generic pointer instead.

Error seen with gcc 14 (-Werror=address-of-packed-member).

Reviewed by:    imp
Differential Revision: https://reviews.freebsd.org/D51662
2025-08-01 01:04:32 +03:00
Colin Percival
0a3792d5c5 release: No newaliases when cross-building VMs
We've been running newaliases(8) when cross-building VMs for a long
time, and it's not entirely clear why -- especially since we don't
do it when we're building a native VM image.

If someone knows why running newaliases is important we can add it
back later, but only after newaliases gets unbroken: As of last week
(a3d4ae7cf3) newaliases fails with EPERM on /etc/dma/dma.conf.

This should unbreak VM (and cloudware) cross-builds.

With hat:	re@
2025-07-31 10:47:36 -07:00
Bjoern A. Zeeb
69ffe3a6e7 bsnmp: wlan: use correct value for rssi
net80211 keeps the rssi value in 0.5bm relative to the noise floor
(see comment in ieee80211_node.h).  Do proper maths to get a plain
rssi value back (once further fixes are in net80211).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D50930
2025-07-31 17:37:54 +00:00
Bjoern A. Zeeb
0f8a8416a4 dwmmc: cleanup cmd and locking, consistency between mmc and mmccam
In general sprinkle locking assertions and harmonized KASSERTs
throughout the upper part of the driver to document expectations.

In dwmmc_cmd_done() "cmd" should be set correctly and be used for
both MMCCAM and classic mmc rather than special-casing mmccam.
In dwmmc_next_operation() place variable declarations on the top
for both cases before the first debug and lock assertion calls;
then factor out common parts at the end and put both cases in the
same order.
By calling dwmmc_next_operation() directly from both dwmmc_request()
in the mmc case, and dwmmc_cam_request() in the mmccase (rather than)
chaining calls in the latter, we avoid unlocking the sc in the mmccam
case and have a consistent call path from both; also removing the
mmccam #ifdef from dwmmc_request() brings more clarity.
In dwmmc_next_operation() enhance the panic/error messages with
some extra information and assert that we come in with a cam pinfo
on CAM_ACTIVE_INDEX.

MFC after:      3 days
Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D51628
2025-07-31 17:37:54 +00:00
Bjoern A. Zeeb
a96486531b LinuxKPI: pci: use unsigned int for vendor/device arguments
Linux drivers may pass a typed PCI_ANY_ID (-1U) in which then leads
to a warning that the value gets truncated.  Switch argument types
to unsigned int (or uint32_t as we use in struct pci_device_id) to
avoid the problem.

Sponsored by:	The FreeBSD Foundation
Discussed in:	D50008
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D51652
2025-07-31 17:37:54 +00:00
Bjoern A. Zeeb
421bf3a968 LinuxKPI: pci: fix argument type to linuxkpi_pci_iomap[_range]
The last argument (maxlen) to linuxkpi_pci_iomap_range and
linuxkpi_pci_iomap is an unsigned long not an int.  LinuxKPI is
not using that argument in the end but fix it where needed.
While here adjust the name to 'maxlen' and remove the "mmio_" to
bar and off.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D51651
2025-07-31 17:37:54 +00:00
Bjoern A. Zeeb
69ed0f766b LinuxKPI: pci: harmonize #defines
In some blocks of #defines spacing, trailing \ and indentation of a
second line differed.  Some of them are currently fine on a single
line but future additions may not fit in that scheme.
Harmonize them into a #define X\t\t\t...\\n<4 spaces>Y scheme.

No functional changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D51650
2025-07-31 17:37:53 +00:00
Bjoern A. Zeeb
21cb44bf33 LinuxKPI: acpi: fix guid_t argument type
acpi_check_dsm() and acpi_evaluate_dsm_typed() take a guid_t argument
and not a char *.  For in-tree Linux based drivers this leads to a
compile error due to a warning.  Fix the function argument type and
cast internally.

While this made the long statements in the wrapper functions for *_dsm_*
even less readable split them up using a local variable.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D51649
2025-07-31 17:37:53 +00:00
Mark Johnston
2dde3bed34 aio: Fix a race in sys_aio_cancel()
sys_aio_cancel() loops over pending jobs for the process, cancelling
some of them.  To cancel a job with a cancel callback, it must drop the
job list mutex.  It uses flags, KAIOCB_CANCELLING and KAIOCB_CANCELLED,
to make sure that a job isn't double-cancelled.  However, when iterating
over the list it uses TAILQ_FOREACH_SAFE and thus assumes that the next
job isn't going to be removed while the lock is dropped.  Of course,
this assumption is false.

We could simply start search from the beginning after cancelling a job,
but that might be quite expensive.  Instead, introduce the notion of a
marker job, used to keep track of one's position in the queue.  Use it
in sys_aio_cancel() to resume iteration after a job is cancelled.

Reported by:	syzkaller
Reviewed by:	kib, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D51626
2025-07-31 16:51:49 +00:00
Bojan Novković
3a686b851f dbm_nextkey: Always return an error if we've reached the end of the database
POSIX.1 states that `dbm_nextkey` must return an invalid key
(i.e., `key.dptr == NULL`) after the end of the database was reached.
The current implementation of `hash_seq` will incorrectly restart
the key sequence after the end of the database is reached.

Fix this by checking the "current bucket" index when R_NEXT is passed.

Sponsored by:   Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51635
Reviewed by:	markj
2025-07-31 17:27:24 +02:00
Rene Ladan
ada5bba476 organization.dot: update list of current portmgr members 2025-07-31 15:45:40 +02:00
Nick Banks
2266c602b3 tcp hpts: cleanup header file
Cleanup tcp_hpts.h by
* move definition used only in tcp_hpts.c to that file
* fix a typo
* remove duplicate declarion of tcp_min_hptsi_time
* rearange declarations for simpler reading

Approved by:	tuexen
MFC after:	1 week
Sponsored by:	Netflix, Inc.
2025-07-31 15:13:53 +02:00
Nick Banks
f197a24d11 tcp: improve variable and constant names
Don't use ticks in variable names or constant when they don't have
a relation to ticks. Use slots or usecs.
No functional change intended.

Reviewed by:	tuexen
MFC after:	1 week
Sponsored by:	Netflix, Inc.
2025-07-31 15:03:47 +02:00
Nick Banks
dc0c74244a tcp: improve function names
tcp_tv_to_usectick(), tcp_tv_to_mssectick(), and tcp_tv_to_lusectick()
are not related to ticks. Therefore remove the trailing 'tick'.
No functional change intended.

Reviewed by:	tuexen
MFC after:	1 week
Sponsored by:	Netflix, Inc.
2025-07-31 14:56:10 +02:00
Trond Endrestøl
868b5492d1
style.9: Fix "parantheses" typos in the new C++ section
PR:             288564
Fixes:          4b02ad9d50 ("style.9: Add a C++ section")
Sponsored by:   The FreeBSD Foundation (commit)
2025-07-31 12:11:45 +02:00
Dag-Erling Smørgrav
a8d90e3213 netlink: Fully clear parser state between messages
Failing to reset the cookie between messages can lead to an attempt
to interpret a zeroed buffer as a struct nlattr, causing a length
calculation to underflow, resulting in a memcpy() call where the
length exceeds the actual size of the buffer.

MFC after:	1 week
PR:		283797
Reviewed by:	glebius
Differential Revision:	https://reviews.freebsd.org/D51634
2025-07-31 12:06:47 +02:00
Kyle Evans
4befc6711a param.h: bump __FreeBSD_version for be1f7435ef
I meant to review the diff again to make sure that __FreeBSD_version had
not progressed in the interim, but failed to do so- belatedly bump it
for a struct ucred ABI change.

Fixes:	be1f7435ef ("kern: start tracking cr_gid outside of [...]")
2025-07-30 23:55:50 -05:00
Kyle Evans
be1f7435ef kern: start tracking cr_gid outside of cr_groups[]
This is the (mostly) kernel side of de-conflating cr_gid and the
supplemental groups.  The pre-existing behavior for getgroups() and
setgroups() is retained to keep the user <-> kernel boundary
functionally the same while we audit use of these syscalls, but we can
remove a lot of the internal special-casing just by reorganizing ucred
like this.

struct xucred has been altered because the cr_gid macro becomes
problematic if ucred has a real cr_gid member but xucred does not.  Most
notably, they both also have cr_groups[] members, so the definition
means that we could easily have situations where we end up using the
first supplemental group as the egid in some places.  We really can't
change the ABI of xucred, so instead we alias the first member to the
`cr_gid` name and maintain the status quo.

This also fixes the Linux setgroups(2)/getgroups(2) implementation to
more cleanly preserve the group set, now that we don't need to special
case cr_groups[0].

__FreeBSD_version bumped for the `struct ucred` ABI break.

For relnotes: downstreams and out-of-tree modules absolutely must fix
any references to cr_groups[0] in their code.  These are almost
exclusively incorrect in the new world, and cr_gid should be used
instead.  There is a cr_gid macro available in earlier FreeBSD versions
that can be used to avoid having version-dependant conditionals to refer
to the effective group id.  Surrounding code may need adjusted if it
peels off the first element of cr_groups and uses the others as the
supplemental groups, since the supplemental groups start at cr_groups[0]
now if &cr_groups[0] != &cr_gid.

Relnotes:	yes (see last paragraph)
Co-authored-by:	olce
Differential Revision:	https://reviews.freebsd.org/D51489
2025-07-30 23:44:11 -05:00
Kyle Evans
763a097c15 loader: add nvidia modules to the loader blacklist
It is known that nvidia modules, like the drm modules that are already
present, will panic if loaded in early boot rather than later.  Pop them
into our list to deny loading them if someone were to add, e.g.,
nvidia-modeset_load="YES", to their loader.conf.  This doesn't prevent
them from being loaded if one drops to the loader prompt, but it does
prevent the standard user from easy foot-shooting if they find old or
inaccurate information out in the wild.

Reviewed by:	imp, kbowling
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D51644
2025-07-30 23:41:28 -05:00
Kevin Bowling
147b90973b Revert "src.opts.mk: Default LLVM_ASSERTIONS off"
Enabling and disabling LLVM assertions changes the ABI. There have
been multiple reports on the freebsd-current@ mailing list of broken
'cc'.

Out of caution, you may wish to do a clean build while crossing this
commit after building the reverted commit if you do not set
LLVM_ASSERTIONS in your src.conf.

Discussed with:	kevans, jrtc27

This reverts commit 9b3055d0d4.
2025-07-30 20:33:52 -07:00
Olivier Cochard
a01ce3b87d swapon: Improve tests for non-standard kernel page size and small media
Add a test to verify swapon's behavior when attaching to media that's too small.
This also adapts existing tests to accommodate kernel page sizes larger than
the default 4KB.

Approved by:	kib, chs (previous version)
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D51641
2025-07-31 02:23:13 +02:00
Isaac Freund
6fa24b29d8 release, bsdinstall: include FreeBSD-kernel-man package
This package has been newly split off during man page reorganization and
should be considered part of the "base" component rather than being
ignored. Update pkgbase release and bsdinstall scripts for this change.

Reviewed by:	ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51519
2025-07-30 18:57:17 -04:00
Nathan Huff
3b3a289758 syslogd: Fix function return test
Looks like during the capsicum setup the return value for cap_syslogd
is checked twice rather than checking the return value of cap_net
after initializing the casper service.

Signed-off-by: Nathan Huff <nhuff@acm.org>
Fixes: 897240c7d6 ("syslogd: Enter capability mode")
Pull-request: https://github.com/freebsd/freebsd-src/pull/1796
2025-07-30 18:32:05 -04:00
Konstantin Belousov
2e3fa9395f swapongeom: destroy consumer/close vnode in case swaponsomething failed
Fixes:	aa42e49849
Reported and tested by:	olivier
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D51636
2025-07-31 00:27:12 +03:00
Konstantin Belousov
6f4de208ed ufs: change isrmdir type to bool or u_int as appropriate
Use bool for isrmdir argument to
ufs_dirremove()/softdep_setup_remove()/newdirrem(), where it is used as
bool.

Use u_int for isrmdir argument to
ufs_dirrewrite()/softdep_setup_directory_change()
where it is 0/1/ino.  Without the change to unsigned, the
	if (isrmdir > 1)
test is broken on volumes with many inodes.
Use newparent instead of isrmdir for the argument name in this case.

Reviewed by:	markj, olce
Tested by:	pho
Fixes:	610319c766
Fixes:	98eb6f0eaa
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D51617
2025-07-31 00:27:12 +03:00
Ed Maste
bf426b859b vt: Remove FONT specification from INDEX files
There is no reason to change the font in order to select a keymap or a
font.

This was done in the syscons(4) era to ensure that a font with the
appropriate character set was used for kbdmap or vidfont's localized
menu, but vt is always UTF-8 and this is no longer necessary.

PR:		235565
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51640
2025-07-30 17:22:41 -04:00
Damin Rido
7b35b4d196 sockstat: add libxo support
Sponsored by:   Google, LLC (GSoC 2025)
MFC after:      2 weeks
Reviewed by:	asomers
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1770
Relnotes:	yes
2025-07-30 14:27:14 -06:00
Ed Maste
74072e9f16 usbhid: Enable by default
Co-authored-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed by:	bapt, wulf
Relnotes:	Yes
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45659
2025-07-30 14:31:54 -04:00
Poul-Henning Kamp
0d9aa2a441 recoverdisk(1): Change time variables to time_t to compile on i386
Reported by: fluffy
PR: 288550
2025-07-30 15:28:02 +00:00