Commit graph

300177 commits

Author SHA1 Message Date
Pau Amma
e945411697 diff: minor fixes to manual page
* Add missing dash before long option name in synopsis.
* Remove spurious paragraph break and bullet item.
* While there, fix mandoc -T lint complaints.

Reviewed by:	ziaee, des
Differential Revision:	https://reviews.freebsd.org/D48388
2025-06-06 14:05:05 +02:00
Kristof Provost
311ad5bc81 UPDATING: document recent pf changes
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50664
2025-06-06 13:16:01 +02:00
Kristof Provost
3baef738a8 pf tests: update after IPv6 hop-by-hop change
Hop-by-hop headers on IPv6 are now blocked by default. Specify 'allow-opts' to
allow them.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50663
2025-06-06 13:16:00 +02:00
Kristof Provost
ee97d89183 pf: align option handling for IPv4 and IPv6
Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header.  Such packets can be passed by adding
"allow-opts" to the rule.  So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, c50c83ac27
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50662
2025-06-06 13:16:00 +02:00
Kristof Provost
7659d0fa2b pf tests: skip TestHeader6::test_too_many if ipfilter is loaded
IPFilter interferes with the header.py:TestHeader6::test_too_many test, so skip
it if the module is loaded.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50661
2025-06-06 13:16:00 +02:00
Kristof Provost
32546d57f3 pf tests: verify header processing limit
Verify that we drop packets with 20 or more AH headers (IPv4) or 20 or more
extension headers (IPv6).

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50660
2025-06-06 13:16:00 +02:00
Kristof Provost
dda88af8fa pf: limit how many headers we look at
Limit the nested header chain for IPv6 extensions headers and for
authentication headers in the IPv4 case.  This prevents spending
excessive cpu time on crafted packets.
OK henning@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 2e5bc81177
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50659
2025-06-06 13:16:00 +02:00
Kristof Provost
3be4d54ecd pf: use 'struct ah' for the AH extension header rather than 'struct ip6_ext'
This fixes the build for NOINET6 kernels, but also more accurately reflects what
we're doing. The first two fields are the same, so the only functional change is
that we require slightly more data in the first fragment now.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50658
2025-06-06 13:15:59 +02:00
Kristof Provost
09d62e0658 pf: align IPv4 and IPv6 AH header handling
Pf was handling IPv4 and IPv6 differently regarding AH extension
headers.  pf_walk_header6() steps over it and detects the real
protocol.  So to implement a minimal header walking function
pf_walk_header() for IPv4.  It does the header checks and jumps
over AH.  Then pf does not understand AH as a protocol, it is just
an extension that authenticates the packet.  Move some header and
option checks to pf_walk_header() for consistency with IPv6.  This
also improves the header check for IPv4 packets in ICMP payload.
OK henning@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 22ef11432c
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50657
2025-06-06 13:15:59 +02:00
Baptiste Daroussin
9a62e1d98d nuageinit: log nuageinit execution
Sponsored by:	OVHCloud
2025-06-06 13:07:32 +02:00
Zhenlei Huang
898a886b45 git-blame-ignore-revs: iflib style(9) tweaks 2025-06-06 18:07:06 +08:00
Zhenlei Huang
721e783a2a iflib: Some style(9) tweaks
Prefer tab over eight whitespaces for indentation, and four spaces as
second level idents.

MFC after:	3 days
2025-06-06 18:04:42 +08:00
Ed Maste
6d46fd2cbe capsicum.4: Add capsicum_helpers and libcasper references
These were present in the SEE ALSO section but were not explicitly
mentioned.  Add a brief description of both.

Reviewed by:	ziaee
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50707
2025-06-05 22:38:27 -04:00
John Baldwin
7b3ee39e73 libcam: Include nvme opcode and status code routines from nvme_util.c
libcam in userspace also includes nvme_all.c which now depends on
nvme_util.c, so add nvme_util.c to libcam's sources.  This requires
exporting the opcode and status code routines in nvme_util.c to
userspace as well as the kernel.  In turn, this means nvmecontrol now
depends on libsbuf (which is already present in /lib).

Reported by:	viswhin, Jenkins
Fixes:		60159a98a8 ("nvme: Move opcode and status code tables from base CAM to nvme_util.c")
Sponsored by:	Chelsio Communications
2025-06-05 21:28:38 -04:00
Brooks Davis
934df0ca61 mman: Reserve two PROT_ for CHERI use
In CheriBSD we use two bits to control load and store of CHERI
capabilities (pointers).  In anticipation of merging CHERI support in
time for FreeBSD 16, reserved these two bits to avoid the (low, but
non-zero) risk of a flag day downstream.

I've used PROT_CHERI0 and PROT_CHERI1 rather than their downstream name
in hopes of avoiding the impression they do something today.

Reviewed by:	kevans, adrian
Suggested by:	kevans, adrian
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D50621
2025-06-06 00:55:35 +01:00
Brooks Davis
8e35800732 build: remove the last vestiges of lint support
Commit 1cbb58886a (shipped in 12.0.0) removed all lint infrastructure.
A bunch of NO_LINT definitions remained (perhaps as a bootstrapping
measture).  Remove them.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D50704
2025-06-06 00:55:34 +01:00
Konstantin Belousov
e989719957 pseudofs: make dup name an error instead of panic
There are enough cases where the duplicate name is caused by dubious
hardware configuration.  Stopping the whole system instead of failing a
driver, or even a diagnostic subsystem in a driver, is more
user-friendly.

Another issue right now is that the check is only present for the
INVARIANTS builds, silently accepting the request to create an entry
with the existing name on production builds.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D50669
2025-06-06 01:41:40 +03:00
Konstantin Belousov
b63f298b1f pseudofs: fix typo in comment
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D50669
2025-06-06 01:41:04 +03:00
Jasper Tran O'Leary
46fce00084 gve: Fix timestamp invalidation for DQO queue formats
We need to invalidate timestamps when a TX queue is cleared so that the
TX timeout detection callout does not mistakenly fire for cleared
packets. When using DQO queue formats, timestamps are set on the pending
packet array whose length is not the same as the length of the
descriptor ring itself. This commit fixes logic which invalidated the
wrong number of pending packets.

Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Fixes:		3d2957336c ("gve: Add callout to detect and handle TX timeouts")
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D50688
2025-06-05 21:48:57 +00:00
Alan Somers
7ce93195dd fusefs: delete dead code
These lines have been commented out ever since the first import of fuse.
The intention seems to be for the original developer to experiment with
different error handling strategies, but they're very obsolete by now.
Delete them.

MFC after:	2 weeks
Sponsored by:	ConnectWise
2025-06-05 15:17:53 -06:00
Alan Somers
35c4ea02cb fusefs: revert a workaround for a googletest bug
This bug was fixed by googletest back in 2019 and released in googletest
1.10.0, I think.  Using GTEST_SKIP from a test environment works now.

https://github.com/google/googletest/issues/2189

MFC after:	2 weeks
Sponsored by:	ConnectWise
2025-06-05 15:17:47 -06:00
John Baldwin
152372a30a Fix incorrect syntax in sys/conf/files for nvmf_transport.c
Fixes:		a15f7c96a2 ("nvmft: The in-kernel NVMe over Fabrics controller")
Sponsored by:	Chelsio Communications
2025-06-05 17:04:06 -04:00
John Baldwin
85a6ba310f nvme: Use routines from nvme_util.c to decode opcodes and status codes
This reduces the number of duplicate string tables for NVMe opcodes
and status codes.

Adjust the formatting of unknown opcodes and status codes to more
closely match nvme(4).

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D50652
2025-06-05 17:03:32 -04:00
John Baldwin
60159a98a8 nvme: Move opcode and status code tables from base CAM to nvme_util.c
This makes it possible to share these tables with the nvme(4) driver
in custom kernels that do not include any CAM support, only nvd(4).

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D50685
2025-06-05 17:03:01 -04:00
Bjoern A. Zeeb
fa02d9fcea net80211: add the beginning of the extfield information elements (IE ext)
The original list of IEs got expanded from TLV to TLextTV.
If the T matches 255 then we have a second list of IEs where the
meaning of TL stays the same. That means the 1 octet extT is part
of the length and the value starts at ie+3.

Start populating the list with IEEE802.11-2020 and 802.11ax-2021
values.

They will be initially used to start decoding some of the announced IEs
for ifconfig [-v] list (scan|sta).  That should help users with
AX-enabled APs to see this (rather than no or UNKNOWN_ELEMID_255 and
make debugging easier once we implement 11ax.

Sposored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D50674
2025-06-05 14:33:50 +00:00
Bjoern A. Zeeb
beb51893cc net80211: update IE list for 802.11-2020
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D50673
2025-06-05 14:33:50 +00:00
Bjoern A. Zeeb
173bbdba8f net80211: add more information elements (IEs) definitions
Annotate a few which are obsolete (gone).
Naming as usual is questionable and I contemplated using the names
from wpa with a different prefix but then we end up with another mix.

While updating the reference to the newer standard I haven't made
a full pass again and I cannot say which version I used in 2020.

The motivation for this is to get rid of unknown IEs displayed in
ifconfig and elsewhere.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Fixes:		50982d26e4 (MMIC -> MGMT_MIC)
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D50671
2025-06-05 14:33:38 +00:00
Bjoern A. Zeeb
aaee0ed3d1 LinuxKPI: 802.11: WEP noise
While we decided that we will not provide WEP support for the LinuxKPI
802.11 compat code, some of it is in there already (also because drivers
still support it).  Put proper keylen checks in place as net80211 only
knows about WEP while LinuxKPI has WEP40 and WEP104.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-06-05 11:32:27 +00:00
Bjoern A. Zeeb
29ddd58369 LinuxKPI: 802.11: add support for GCMP hw crypto offload
For iwlwifi, rtw88, and rtw89 we can treat GCMP the same way as we
treat CCMP which allows us to re-use the CCMP code for now.
Add the missing case statements and factor out some common code.

Allow IEEE80211_CRYPTO_AES_GCM_128 through our filter of supported
cipher suites to announce it to net80211.

Sponsored by;	The FreeBSD Foundation
MFC after:	3 days
2025-06-05 11:32:27 +00:00
Bjoern A. Zeeb
58dae28f66 LinuxKPI: 802.11: make synching from HT more resilient
During testing I hit a case where htcap->mcs.rx_mask[0,1] were zero.
This should not happen as that would mean we are not supporting HT.
After adding extra caution for debugging I could no longer reproduce
the case.

So just to deal with the eventuality make synching from HT more
resilient by checking that we have nss > 0 or otherwise disable
HT operations.

Move setting the bandwidth below this check to not alter it in
case of the now early return.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-06-05 11:32:27 +00:00
Kristof Provost
38c655093c route: fix rtentry double free
add_route_flags() frees the rtentry on error when called with the RTM_F_CREATE
flag. Don't free the rtentry a second time.

Reviewed by:	ae
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50665
2025-06-05 09:52:33 +02:00
Simon J. Gerraty
ac05fc3953 local.dirdeps.mk remove stray .endif 2025-06-04 20:35:59 -07:00
Simon J. Gerraty
bf407f36c5 local.dirdeps.mk move MK_RUN_TESTS .endif
The MK_RUN_TESTS check should bound all of the logic
relevant to hooking tests into the graph.
2025-06-04 20:27:39 -07:00
Cy Schubert
55f9c25f17 krb5: Apply patches to build under FreeBSD
These patches fix the MIT KRB5 on FreeBSD. Some are obtained from
ports/security/krb5-121.

Sponsored by:	The FreeBSD Foundation
2025-06-04 19:53:04 -07:00
Cy Schubert
7f2fe78b9d krb5: Import MIT 1.21.3
Import MIT KRB5 1.21.3, which will gracefully replace KTH Heimdal.

The tarball used in this import is the same tarball used in
ports/krb5-121.

The Makefiles to add MIT KRB5 to the build will be added later.

Obtained from:	http://web.mit.edu/kerberos/dist/

Sponsored by:	The FreeBSD Foundation

Add 'crypto/krb5/' from commit '8f7d3ef26dec89a92ec0665de84a5936310a5574'

git-subtree-dir: crypto/krb5
git-subtree-mainline: bf6873c578
git-subtree-split: 8f7d3ef26d
2025-06-04 19:47:53 -07:00
Cy Schubert
bf6873c578 pam-krb5: Import/add pam-krb5 from eyeire.org
From https://www.eyrie.org/~eagle/software/pam-krb5/:

pam-krb5 provides a Kerberos PAM module that supports authentication,
user ticket cache handling, simple authorization (via .k5login or
checking Kerberos principals against local usernames), and password
changing. It can be configured through either options in the PAM
configuration itself or through entries in the system krb5.conf file,
and it tries to work around PAM implementation flaws in commonly-used
PAM-enabled applications such as OpenSSH and xdm. It supports both
PKINIT and FAST to the extent that the underlying Kerberos libraries
support these features.

The reason for this import is to provide an MIT KRB5 compatible
pam_krb5 PAM module. The existing pam_krb5 in FreeBS only works
with Heimdal.

The Makefiles to hook this software into the build willl come later.

Sponsored by:	The FreeBSD Foundation

Add 'contrib/pam-krb5/' from commit '24f0b4ca2d565cdbb4fe7839ff28320706bf2386'

git-subtree-dir: contrib/pam-krb5
git-subtree-mainline: 290e8aaa38
git-subtree-split: 24f0b4ca2d
2025-06-04 19:46:46 -07:00
Cy Schubert
290e8aaa38 share/mk: Add MIT KRB5 build knob
This is the first in a series of commits to replace Heimdal with
MIT KRB5. This first commit adds the WITH_MITKRB5/MK_MITKRB5 knob
to src.opts.mk and its corresponding documentation in
tools/build/options. The default is off.

This change of and by itself is of no consequence as MIT KRB5 has
yet to be imported in to HEAD. But it does insulate the build from
inremental change until the last patch is committed when WITH_MITKRB5
will build MIT KRB5 1.21.3 instead of Heimdal.

The affords us the opportunity to review smaller commits.

This is the first of many commits.

Reviewed by:	imp, jhb, brooks, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50684
2025-06-04 19:45:46 -07:00
Rick Macklem
4be12de1d6 nfsd: Fix the build for 1749465947
MFC after:	2 weeks
Fixes:	1749465947 ("nfsd: Fix accumulating nfslockfile structures")
2025-06-04 18:57:07 -07:00
Rick Macklem
1749465947 nfsd: Fix accumulating nfslockfile structures
If a NFSv4 client does an exclusive open where the file
already exists, the server returns EEXIST.  However,
without this patch, a partially filled in nfslockfile
structure is allocated, but is not referenced by any open
and, as such, never gets freed.

This patch fixes the bug by checking for EEXIST before
calling nfsvno_open().

Reported by:	Christoper Iler <ciler@volexity.com>
Tested by:	Christoper Iler <ciler@volexity.com>
MFC after:	2 weeks
2025-06-04 16:09:01 -07:00
Rick Macklem
6b6542ec84 open.2: Document the O_NAMEDATTR flag
Commit 2ec2ba7e23 added support for the O_NAMEDATTR flag to
the open(2) and openat(2) syscalls for main.

This patch updates the man page for this flag.

Another man page that explains named attributes will
be introduced in a future commit.

This is a content change.

Reviewed by:	emaste (earlier version), kib (earlier version)
Differential Revision:	https://reviews.freebsd.org/D49691
Fixes:	2ec2ba7e23 ("vfs: Add VFS/syscall support for Solaris style extended attributes")
2025-06-04 15:50:16 -07:00
Mark Johnston
98ef590f77 dtrace/profile: Stop storing the probe name in struct profile_probe
It's unused, and the naked strcpy() was susceptible to buffer overflow
if one creates, say, a probe called "profile-2000000000ns".

Reported by:	CHERI
MFC after:	1 week
Sponsored by:	Innovate UK
2025-06-04 21:13:08 +00:00
Mark Johnston
1776ba8de5 share/mk: Define a rule for dtrace -G to generate .pieo files
Now that bsd.prog.mk uses .pieo instead of .o for object files linked
into PIEs, we need to ensure that the object file generated by dtrace -G
has the same extension.

Fixes:		245bb01106 ("Use .pieo extension for WITH_PIE bsd.prog.mk output")
Sponsored by:	Innovate UK
2025-06-04 20:58:38 +00:00
Mark Johnston
fdaba0128c dtrace tests: Fix nits in some test programs
Otherwise these tests fail spuriously, depending on which compiler is
installed as cc.

MFC after:	2 weeks
Sponsored by:	Innovate UK
2025-06-04 20:58:38 +00:00
Simon J. Gerraty
8e1e989c77 Add host.test.mk for DIRDEPS_BUILD
If we are doing DIRDEPS_BUILD and MK_RUN_TESTS is yes
we can hook tests associated with dirs to be built into the graph
such that we avoid circular dependencies but the build will fail
should any test fail.

Make MK_RUN_TESTS independent of MK_TESTS
also for non-DIRDEPS_BUILD ensure we have RELDIR and check it
against patterns in HOST_RUN_TESTS.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D50387
2025-06-04 12:56:44 -07:00
Alan Cox
51c8cd7e1a arm64 pmap: Eliminate an unnecessary NULL check
The return value from pmap_l1_to_l2() cannot be NULL.
2025-06-04 14:10:16 -05:00
Brooks Davis
a5b0b2a7d4 C runtime: add kernel version guards on exterrctl
This allows userspace to run on a (somewhat) out of date kernel.

Avoid a __FreeBSD_version bump and use the bump from a02180cf60 which
has occured since exterrctl was added.

Reviewed by:	kevans
Fixes:		b9c8a07d4d ("C runtime: enable extended error reporting from kernel")
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D50687
2025-06-04 19:09:19 +01:00
Kyle Evans
8378665ff9 tools: build: add a rewrite of makeman in lua
The primary benefit of this rewrite is that it parallelizes a number of
the make(1) jobs that it needs to do.  It does so with a very naive
forking model that could likely be improved, but is sufficient for our
purposes.  This version also doesn't assume that CWD is sane, and
instead operates relative to the directory the script resides in.

Note that this initial version is only intended to match the output of
the legacy script.  Some work is planned afterward to refactor the
script out into various components to improve maintainability after we
have switched over to it.

In my horribly performing dev environment, this version runs in 40s
rather than the original ~2 minutes.  On a Mt. Snow machine, this
version runs in ~15s rather than the original ~1m40s.

This change does not yet switch the top-level `makeman` target over to
the new version.

Reviewed by:	bapt (earlier version), emaste
Differential Revision:	https://reviews.freebsd.org/D39084
2025-06-04 12:06:29 -05:00
John Baldwin
5304a20ff1 cam nvme: Add nvme_command_string
Replace nvme_cmd_string and nvme_opcode_string with a single function.
nvme_cmd_string was already using an sbuf around a caller-supplied
string, so use the same pattern for the entire command string.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D50651
2025-06-04 11:14:13 -04:00
Warner Losh
7aac4b22f9 efi: Include sys/types.h for register_t
This file depends on sys/types.h being included before it, which isn't
the best assumption. Include it here since we have no namespace
pollution concerns.

Sponsored by:		Netflix
2025-06-04 08:53:07 -06:00
Konstantin Belousov
56a4d1a4cc ktrace: trace and decode thr_new() thr_param
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-06-04 14:24:20 +03:00