Commit Graph

306357 Commits

Author SHA1 Message Date
Konstantin Belousov aa72df78d7 sys: Add cap_pdwait_rights
Suggested by:	asomers
Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:47 +02:00
Konstantin Belousov a560abedfb audit: handle AUE_PDWAIT
Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:42 +02:00
Konstantin Belousov 7fe33d58a8 kern/kern_exit.c: extract wait6_check_alive() helper
Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:36 +02:00
Konstantin Belousov 2b67cfa39d kern/kern_exit.c: extract some helpers from proc_to_reap()
Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:30 +02:00
Konstantin Belousov 109b9f48ec kern/kern_exit.c: define the exterror category for exit/wait
Convert EINVALs in kern_exit.c into EXTERRORs.

Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:22 +02:00
Konstantin Belousov f10b4b6131 lib/libsys, lib/libc: export pdrfork(2)
Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:16 +02:00
Konstantin Belousov 5c2ee618d5 sys: add pdrfork(2)
Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:09 +02:00
Konstantin Belousov d0d4b9b9df sys: add AUE_PDRFORK
Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:53:02 +02:00
Konstantin Belousov 7211cd2cce kern/kern_fork.c: define the exterror category for fork
Convert EINVALs in kern_fork.c into EXTERRORs.

Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:52:55 +02:00
Konstantin Belousov 472c32a83b kern/kern_fork/exit.c: organize includes
Remove sys/cdefs.h.
Remove sys/param.h.
Order the sys/*.h includes alphabetically.

Reviewed by:	asomers, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:52:46 +02:00
Konstantin Belousov f5acbacb28 kern/kern_exit.c: some style
Reviewed by:	asomers, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:52:39 +02:00
Konstantin Belousov 6af3cf27ed freebsd32_rusage_out(): bzero the compat32 structure
There is some padding on non-x86.  Unconditionally bzero the memory to
avoid a leak.

Noted by:	markj
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54592
2026-01-25 17:52:30 +02:00
Bjoern A. Zeeb 072af59d46 netlink: make compile without VIMAGE
Add the #include for proc.h which seems to be there in the VIMAGE
case through some other includes only.

Sponsored by:	The FreeBSD Foundation
Fixes:		04f6b99947
2026-01-25 12:35:23 +00:00
Bjoern A. Zeeb 7e4a2b381d LinuxKPI: improve hweight<n> if complie time constant
rtw89(4) uses a static_assert() with hweight<n> calls.  In order to
avoid compile time errors, deal with the case when the arguments to
hweight<n> are complie time constant.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D54806
2026-01-25 12:35:22 +00:00
Bjoern A. Zeeb 44d1153dda LinuxKPI: add umin()
Add a version of umin() simply using MIN() assuming that the Linux
upstream code properly check that the arguments are unsigned, etc.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D54807
2026-01-25 12:35:22 +00:00
Bjoern A. Zeeb 0a57589121 LinuxKPI: implement dmam_free_coherent()
dmam_free_coherent() is used by an updated mt76 driver at v6.19-rc6.
We need to surgically find the devres information and destroy it before
calling dma_free_coherent.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D54810
2026-01-25 12:35:22 +00:00
Bjoern A. Zeeb bf4aa758dd LinuxKPI: PTP add (*settime64) to struct ptp_clock_info
While iwlwifi supportes PTP, LinuxKPI does not and we only add the
definitons to avoid mangling upstream drivers.
iwlwifi(4) does not even support the (*settime64) callback but only
returns -EOPNOTSUPP.

Sponosred by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D54802
2026-01-25 12:35:21 +00:00
Jose Luis Duran 4f093770b5 nanobsd: Fix _populate_part()
- Avoid unnecessary subshell execution
- Fix removing the temporary and empty /cfg directory
- Do not remove the generated metalog file for /cfg or /data partitions

Fixes:		61ac7309c3 ("nanobsd: Add a provisional populate_part function")
MFC after:	3 days
2026-01-25 10:59:27 +00:00
Enji Cooper da59b3147b Account for the ctl test needing the ctl(4) module
This testcase does not function unless the /dev/ctl/... node exists,
which is created by the ctl(4) module. Require the ctl(4) module to be
loaded so the test can be executed.

MFC after: 1 week
Differential Revision:	https://reviews.freebsd.org/D54518
2026-01-24 16:18:45 -08:00
Colin Percival f0ecf357aa vmimage.subr: Install pkg on pkgbase images
When building VM and Cloud images with a packaged base system, install
the pkg package; this makes it possible for the base system to be
updated without installing pkg from the FreeBSD-ports repository.

Sponsored by:	Amazon
2026-01-24 12:18:35 -08:00
Colin Percival ec2b3d786b loader: Only warn for !FDT && !ACPI take two
For unclear reasons, we used to print two warnings about not having a
DTB: First,
	printf("No valid device tree blob found!\n");
and immediately later a second,
	printf("WARNING! Trying to fire up the kernel, but no "
	    "device tree blob found!\n");

A previous commit silenced the second warning in the event that the
acpi.revision environment variable was set, on the theory that systems
which have ACPI might not need a DTB; this commit silences the first
of the two warnings under the same condition.

Reviewed by:	andrew
Fixes:	3989a3d817 ("loader: Only warn when we have neither FDT nor ACPI")
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D54772
2026-01-24 12:18:35 -08:00
Jean-Sébastien Pédron 710167623d linuxkpi: Implement <linux/seq_buf.h>
It is a wrapper above a `char *` to track the overall available space in
the buffer as well as the used space. This wrapper does not manage
memory allocation.

The DRM generic code started to use this in Linux 6.10.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54488
2026-01-24 20:16:14 +01:00
Michael Osipov 28764001b5 vt.4: Document that hw.vga.textmode does not apply for UEFI(8) boot
PR:		292598
Approved by:	ziaee, imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54842
2026-01-24 19:41:29 +01:00
Alan Somers 52ddca7c2e fusefs: style
Reorder macro definitions.
2026-01-24 09:02:44 -07:00
Alan Somers ffb747d587 fusefs: Add tests for the new -o auto_unmount feature
Add tests for mount_fusefs's new -o auto_unmount feature, recently added
by arrowd.

MFC with:	10037d0978 "fusefs: Implement support for the auto_unmount"
2026-01-24 09:02:33 -07:00
Peter Holm c2b513335f stress2: Added two new test scenarios 2026-01-24 13:30:31 +01:00
Peter Holm 833f9294b4 stress2: Added two syzkaller reproducers. Updated the exclude file 2026-01-24 13:28:54 +01:00
Gleb Popov 10037d0978 fusefs: Implement support for the auto_unmount option kernel-side
libfuse clients may pass the "-o auto_unmount" flag to ensure that the mountpoint
will get unmounted even if the server terminate abnormally. Without this flag
sending KILL to a FUSE daemon leaves its mountpoint mounted.

Approved by:	asomers
Differential Revision:	https://reviews.freebsd.org/D53086
2026-01-24 13:06:16 +03:00
Pouria Mousavizadeh Tehrani 04f6b99947 netlink: use caller's credentials in rtnl_handle_newlink
Make sure rtnl_handle_newlink sets the caller's credential
during calls to ifc_create_ifp_nl and ifc_modify_ifp_nl

Reviewed by: glebius, melifaro
Approved by: glebius (mentor)
Differential Revision: https://reviews.freebsd.org/D54109
2026-01-24 13:20:50 +03:30
Jose Luis Duran cd730bef74 nanobsd: Use mtree -C to produce the metalog
Prefer an mtree -C output, which is guaranteed to be mtree-compatible.
Add "gname", "uname", and "tags" to the default keyword set, while
removing "size" and "time", the latter being set on kernel file entries
and taking precedence over makefs -T (when paired with -F).

As a side effect, this produces a cleaner file with sorted keywords.

Note that passing "-u" to sort in order to pipe to mtree is no longer
necessary, but we'll do it out of habit.

Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54854
2026-01-24 02:06:57 +00:00
Hans Rosenfeld 202e3109a9 amd64: Fix sys/pcpu.h usage in vmm_host.h and md_var.h
Include sys/pcpu in vmm_host.h as its structs and functions are used
there, and add a forward declaration of struct pcpu to md_var.h as it
is used in some function prototypes.

Reviewed by:	corvink, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D51550
2026-01-24 01:29:45 +00:00
Gleb Smirnoff f3de667137 netinet6: free in6_ifextra with epoch_call(9)
This is expected to fix the old in6_selecthlim() panics.  The nature of
the panic is that a packet sending thread will obtain the struct ifnet
pointer locklessly and then pick the if_inet6 pointer from it and
dereference it. While the struct ifnet is freed via epoch_call(9), the
struct in6_ifextra until this change was not.  For the forwarded packets,
or locally originated non-TCP packets we were probably safe due to the old
if_dead trick.  But locally originated TCP packets may dereference
in6_ifextra via direct call into in6_selecthlim() from the tcp_output(),
before ip6_output().

NB: hypothetically a similar problem also applies to IPv4's if_inet pointer,
but there are no known panics, yet.

PR:			279653
Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D54728
2026-01-23 14:18:18 -08:00
Gleb Smirnoff cba9f88105 netinet6: embed struct mld_ifsoftc into struct in6_ifextra
In mld_domifdetach() don't search the global list.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D54727
2026-01-23 14:18:12 -08:00
Gleb Smirnoff aa3bbc06e5 netinet6: embed struct scope6_id into struct in6_ifextra
Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D54726
2026-01-23 14:18:07 -08:00
Gleb Smirnoff 576ee62dd2 netinet6: store ND context directly in struct in6_ifextra
Stop using struct nd_ifinfo for that, because it is an API struct for
SIOCGIFINFO_IN6.  The functional changes are isolated to the protocol
attach and detach: in6_ifarrival(), nd6_ifattach(), in6_ifdeparture(),
nd6_ifdetach(), as well as to the nd6_ioctl(), nd6_ra_input(),
nd6_slowtimo() and in6_ifmtu().

The dad_failures member was just renamed to match the rest.  The M_IP6NDP
malloc(9) type declaration moved to files that actually use it.

The rest of the changes are mechanical substitution of double pointer
dereference via ND_IFINFO() to a single pointer dereference.  This was
achieved with a sed(1) script:

s/ND_IFINFO\(([a-z0-9>_.-]+)\)->(flags|linkmtu|basereachable|reachable|retrans|chlim)/\1->if_inet6->nd_\2/g
s/nd_chlim/nd_curhoplimit/g

Reviewed by:		tuexen, madpilot
Differential Revision:	https://reviews.freebsd.org/D54725
2026-01-23 14:17:40 -08:00
Gleb Smirnoff 25a11d9805 netinet6: use in6_ifmtu() instead of IN6_LINKMTU() macro
There should be no functional change.  If there are any performance
concerns with a function call, with the future changes, that would move
ND6 bits into in6_ifextra, this function would be easily inline-able.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D54724
2026-01-23 14:17:16 -08:00
Gleb Smirnoff 3182dc4117 netinet6: embed the counter(9) arrays in struct in6_ifextra
Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D54723
2026-01-23 14:17:10 -08:00
Gleb Smirnoff 6857b3a04e netinet6: embed struct nd_ifinfo into struct in6_ndireq
There is no functional change here, but we'd like to emphasize that the
nd_ifinfo structure is not a actually a kernel ND6 software context,
despite being actively used like this way, but an API/ABI structure for
ioctl(2).  This should prevent from a ABI breakages like in 31ec8b6407.
This also is a step towards stopping using it as a kernel software
context.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D54722
2026-01-23 14:16:42 -08:00
Li-Wen Hsu 3aa8d5395c mkimg(1): Sync mkimg(1) and usage() with the implementation
Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54419
2026-01-23 15:55:32 -05:00
Gleb Smirnoff 37d11fde8f tests/kern: add test for SSL_sendfile() 2026-01-23 11:00:49 -08:00
Warner Losh 4990cf83f5 MAINTAINERS: Remove some stale entries
Remove some stale entries, preen some others. Longer term, we need a
better format. Also, if there's mistakes, let us know: we want it to be
useful to people seeking review, not be perscriptive about who can do
what.

Reviewed by: srcmgr@
2026-01-23 11:08:16 -07:00
Dimitry Andric 3cdb6c9d92 libc++ inttypes.h: define __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS
Before transitively including the base version of inttypes.h, define
__STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS, because the base
inttypes.h directly includes sys/stdint.h, instead of going through the
'regular' stdint.h.

The libc++ version of the latter does define those macros, to ensure
things like UINT64_C() and SIZE_MAX are defined even in C++98 or C++03.

MFC after:	3 days
2026-01-23 18:33:23 +01:00
Andrew Turner 6c5fdba45a arm/gic: Detect broken configurations
Some virtualization platforms provide broken configurations. There
is a GIC interrupt controller, however accessing the CPU interface
registers leads to an external data abort. As these are needed to
handle interrupts we are unable to boot further.

Detect this misconfiguration and panic to tell the user the issue.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54832
2026-01-23 17:02:29 +00:00
Artem Bunichev e6bafbeb1e capsicum.4: Replace 'fi' ligature and smart quotation mark
While here, wrap the line to 80 characters.

Reviewed by:	jlduran
Fixes:		c54534e602 ("capsicum.4: Add some more detail from the Capsicum paper")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54761
2026-01-23 16:22:46 +00:00
Warner Losh 6b9cbeed64 CONTRIBUTING.md: Tweaks for clarity
Add a few tweaks to clarify the author and signed-off-by lines. Add
clarifying note about the style checker. Refine the AI statements
for clarity, but these will need to be revised once the AI policy
has been completed.

Sponsored by:		Netflix
2026-01-23 07:04:41 -07:00
Bjoern A. Zeeb b1bebaaba9 mt76: update Mediatek's mt76 driver
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7 ( tag: v6.19-rc6 ).

Notable change: license got switched from ISC to BSD-3-Clause-Clear.
util.h is now imported from upstream given it is no longer GPL-only.
See the upstream repository 909675fd4344f73aad5f75f123bd271ada2ab9fb
and a96fed2825d8dfb068bf640419c619b5f2df4218.

For us the new version should also help with page pools and DMA32.

Sponsored by:	The FreeBSD Foundation
2026-01-23 13:52:47 +00:00
Dag-Erling Smørgrav 498fe07257 buf_ring: Rename some variables
The elements we store in buffer rings are buffers, so refer to them as
`buf` throughout instead of a mixture of `buf`, `ret`, and `new`,
especially since the latter breaks C++ code that directly or indirectly
includes this header.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	siderop1_netapp.com, markj
Differential Revision:	https://reviews.freebsd.org/D54827
2026-01-23 12:36:21 +01:00
Brooks Davis e17d7ab869 xdr_string: don't leak strings with xdr_free
Historically (and in a small amount of older software such as OpenAFS),
developers would attempt to free XDR strings with

	xdr_free((xdrproc_t)xdr_string, &string)

This resulted in xdr_free calling xdr_string with only two intentional
arguments and whatever was left in the third argument register.  If the
register held a sufficently small number, xdr_string would return FALSE
and not free the string (no one checks the return values).

Software should instead free strings with:

	xdr_free((xdrproc_t)xdr_wrapstring, &string)

Because buggy software exists in the wild, act as though xdr_wrapstring
was used in the XDR_FREE case and plug these leaks.

Reviewed by:	kib
MFC after:	3 days
Effort:		CHERI upstreaming
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D54825
2026-01-23 10:35:55 +00:00
Brooks Davis ac5a19ec69 rpc/xdr.h: make xdrproc_t always take two arguments
The type of xdrproc_t is clearly defined in the comments as a function
with two arguments, an XDR * and a void * (sometimes spelled caddr_t).
It was initialy defined as:

	typedef bool_t (*xdrproc_t)();

At some point people started giving it a non-empty argument list.
Unfortunatly, there has been widespread disagreement about how arguments
are passed.  There seems to have been a widespread view that it should
be allowed to pass three argument function pointer to xdrproc_t.  Most
notable is xdr_string which takes a maximum length parameter. This lead
to all sorts of prototypes (all of which have been present in the
FreeBSD source tree):

FreeBSD userspace (nominally from tirpc, but seemingly local):
	typedef bool_t (*xdrproc_t)(XDR *, ...);
FreeBSD kernel, glibc:
	typedef bool_t (*xdrproc_t)(XDR *, void *, ...);
rcp/xdr.h with _KERNEL defined (not used?):
	typedef bool_t (*xdrproc_t)(XDR *, void *, u_int);
gssrpc (in krb5) and Linux kernel:
	typedef bool_t (*xdrproc_t)(XDR *, void *);

For two argument functions on current ABIs, these all equivalent as
these arguments are passed in registers regardless of decleration and
definition, but we end up with two problems:

   - xdr_free((xdrproc_t)xdr_string, ...) calls xdr_string with no third
     argument and (at least on FreeBSD) may fail to free memory if the
     string is shorter than the value lying around in the third argument
     register.  There are no instance of this in tree, but I found some
     with Debian code search, in particular in OpenAFS.

   - Under CheriABI, variadic arguments are passed in a separate,
     bounded array so theses prototypes aren't equilvalent to the
     non-variadic calling convention of the functions.

The reality is that that xdr_string should not be cast to xdrproc_t and
xdr_wrapstring should be used instead so we do not need to support this
case.  Instances of the former behavior are now extremely rare.

With this change we bring FreeBSD in line with gssrpc and the Linux
Kernel.  Warnings about casts should now be correct and should be fixed.

Bump __FreeBSD_version as some software required adaptation if it is
declaring functions to cast to xdrproc_t.  Update OpenZFS's workaround
of this historic mess accordingly.

Effort:		CHERI upstreaming
Sponsored by:	Innovate UK

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D54824
2026-01-23 10:35:32 +00:00
Michael Tuexen f31336b3e3 dpnaa2: announce transmit checksum support
Let the network stack know that the NIC supports checksum offloading
for the IPv4 header checksum and the TCP and UDP transport checksum.
This avoids the computation in software and therefore provides the
expected performance gain.

PR:			292006
Reviewed by:		dsl, Timo Völker
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D54809
2026-01-23 08:59:57 +01:00