Commit Graph

305708 Commits

Author SHA1 Message Date
Dimitry Andric e2c93ed09f sys/font.h: avoid warnings about too-long initializer strings
Mark `font_header::fh_magic` as `__non_string`, to avoid a warning from
clang 21 similar to:

    /usr/src/usr.bin/vtfontcvt/vtfontcvt.c:763:15: error: initializer-string for character array is too long, array size is 8 but initializer has size 9 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
      763 |                 .fh_magic = FONT_HEADER_MAGIC,
          |                             ^~~~~~~~~~~~~~~~~
    /usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/font.h:109:27: note: expanded from macro 'FONT_HEADER_MAGIC'
      109 | #define FONT_HEADER_MAGIC       "VFNT0002"
          |                                 ^~~~~~~~~~

MFC after:	3 days
2025-12-26 15:32:09 +01:00
Dimitry Andric cd880010c4 pmcannotate: avoid accessing uninitialized local variables
Initialize `tbfl` and `tofl` to NULL, and check whether they are
non-NULL before calling remove(3) on them, to avoid warnings from clang
21 similar to:

    usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tbfl' is uninitialized when used here [-Werror,-Wuninitialized]
      746 |                 FATAL(exec, "%s: Impossible to locate the binary file\n",
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      747 |                     exec);
          |                     ~~~~~
    usr.sbin/pmcannotate/pmcannotate.c:57:9: note: expanded from macro 'FATAL'
       57 |         remove(tbfl);                                                   \
          |                ^~~~
    usr.sbin/pmcannotate/pmcannotate.c:695:12: note: initialize the variable 'tbfl' to silence this warning
      695 |         char *tbfl, *tofl, *tmpdir;
          |                   ^
          |                    = NULL
    usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tofl' is uninitialized when used here [-Werror,-Wuninitialized]
      746 |                 FATAL(exec, "%s: Impossible to locate the binary file\n",
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      747 |                     exec);
          |                     ~~~~~
    usr.sbin/pmcannotate/pmcannotate.c:58:9: note: expanded from macro 'FATAL'
       58 |         remove(tofl);                                                   \
          |                ^~~~
    usr.sbin/pmcannotate/pmcannotate.c:695:19: note: initialize the variable 'tofl' to silence this warning
      695 |         char *tbfl, *tofl, *tmpdir;
          |                          ^
          |                           = NULL

MFC after:	3 days
2025-12-26 14:37:53 +01:00
Dimitry Andric 3054e22e45 bsnmpd: avoid warnings about too-long initializer strings
Mark `UTC` as `__non_string`, to avoid a warning from clang 21 similar
to:

    usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c:339:29: error: initializer-string for character array is too long, array size is 3 but initializer has size 4 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
    --- all_subdir_usr.sbin ---
      339 |         static const char UTC[3] = "UTC";
          |                                    ^~~~~

MFC after:	3 days
2025-12-26 14:27:23 +01:00
Simon Wollwage eaa424e3bd snmp_pf: remove errno usage after pfctl_get_status_h change
pfctl_get_status_h() does not set errno, so don't log it.

PR:		291936
Reviewed by:	kp
2025-12-26 11:50:37 +01:00
Kristof Provost 2e7699355f pf: don't reject route-to'd too-large packets
If we're sending a packet via pf_route()/pf_route6() we check for packet
size and potentially generate ICMP(6) packet too big messages. If we do,
don't consider this a rejected packet. That is, return PF_PASS and set
the mbuf to NULL rather than returning PF_DROP.

This matters for locally generated packets, because with PF_DROP we
can end up returning EACCES to userspace, causing the connection to
terminate. Instead, with PF_PASS and a NULL mbuf this is translated to
PFIL_CONSUMED, which does not return an error to userspace.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-12-26 10:58:59 +01:00
Dimitry Andric a3394b6a23 m4: avoid warnings about too-long initializer strings
Mark `digits` as `__non_string`, to avoid warnings from clang 21 similar
to:

    usr.bin/m4/misc.c:123:27: error: initializer-string for character array is too long, array size is 36 but initializer has size 37 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
      123 |         static char digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
          |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MFC after:	3 days
2025-12-26 01:30:36 +01:00
Dimitry Andric ba0a115122 makefs: avoid warnings about too-long initializer strings
Mark `direntry::deName` as `__non_string`, to avoid warnings from clang
21 similar to:

  usr.sbin/makefs/msdos/msdosfs_vnops.c:512:4: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
    512 |         {       ".          ",                          /* the . entry */
        |                 ^~~~~~~~~~~~~
  usr.sbin/makefs/msdos/msdosfs_vnops.c:522:4: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
    522 |         {       "..         ",                          /* the .. entry */
        |                 ^~~~~~~~~~~~~

MFC after:	3 days
2025-12-26 01:22:18 +01:00
Igor Ostapenko ecb58f931d kyua: Fix prompt of "debug -p" command 2025-12-25 20:41:22 +00:00
Dimitry Andric 98c3d868fb fsck_msdosfs: avoid warnings about too-long initializer strings
Mark `dot_name` and `dotdot_name` as as `__non_string`, to avoid
warnings from clang 21 similar to:

    sbin/fsck_msdosfs/dir.c:466:39: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
      466 | static const u_char dot_name[11]    = ".          ";
          |                                       ^~~~~~~~~~~~~
    sbin/fsck_msdosfs/dir.c:467:39: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
      467 | static const u_char dotdot_name[11] = "..         ";
          |                                       ^~~~~~~~~~~~~

MFC after:	3 days
2025-12-25 21:34:00 +01:00
Dimitry Andric 5629b5cf79 cuse(3): annotate cuse_init() to suppress thread safety analysis
This avoids warnings from clang 21, similar to:

    /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
      111 |         TAILQ_INIT(&h_cuse);
          |                     ^
    /usr/src/lib/libcuse/cuse_lib.c:111:14: error: writing variable 'h_cuse' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
    /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]
      112 |         TAILQ_INIT(&h_cuse_entered);
          |                     ^
    /usr/src/lib/libcuse/cuse_lib.c:112:14: error: writing variable 'h_cuse_entered' requires holding mutex 'm_cuse' exclusively [-Werror,-Wthread-safety-analysis]

MFC after:	3 days
2025-12-25 19:02:40 +01:00
Rick Macklem 4f184fd35d nfsd.8: Add a short paragraph w.r.t. NFSv3 vs NFSv4 setup
The nfsd can be configured to support NFSv3, NFSv4 or both
of them.

This patch adds a short paragraph to nfsd.8 to explain this.

This is a content change.

Reviewed by:	kib, zaiee (manpages)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54279
2025-12-24 08:29:29 -08:00
Dimitry Andric 160077a4d7 OptionalObsoleteFiles.inc: fix up WITH_LLVM_LINK_STATIC_LIBRARIES cases
In commit cf1eaaf41c I added the WITH_LLVM_LINK_STATIC_LIBRARIES
src.conf(5) build knob, which also affects OptionalObsoleteFiles.inc.

However, the checks were incorrect: when WITH_LLVM_LINK_STATIC_LIBRARIES
is active, the OLD_LIBS libprivatellvm.so.19, libprivateclang.so.19 and
libprivatelldb.so.19 should always be cleaned up.

Fixes:		cf1eaaf41c
MFC after:	1 week
2025-12-24 16:52:48 +01:00
Dimitry Andric 8d5a11cd01 src.conf: Add WITH_LLVM_LINK_STATIC_LIBRARIES build knob
In commit 2e47f35be5 libllvm, libclang and liblldb were converted into
private shared libraries. This allowed clang, lld, lldb, and other llvm
tools to be linked against these shared libraries, which makes them
smaller and avoids duplication.

However, this also comes at the cost of some performance, since the
dynamic libraries are quite large, and contain lots of long symbols
(mangled C++ identifiers).

Add a WITH_LLVM_LINK_STATIC_LIBRARIES build knob that can be used to go
back to the previous behavior: libllvm, libclang and liblldb are built
as internal static libraries, i.e. only available during buildworld, and
fully linked into the various executables such as clang, lld, etc.

PR:		287447
Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D50956
2025-12-23 22:01:40 +01:00
Michael Osipov 5819f8b285 bhyve.8: Fix consistency and terms in manpage
Correct inconsistent spelling of terms and duplication.

Reviewed by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54332
2025-12-23 20:12:44 +01:00
Doug Moore 1e8c2cb328 vnode_pager: use ptoa(), atop()
In vnode_pager.c, use ptoa() or atop() instead of arithmetic with
PAGE_SIZE or PAGE_SHIFT.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D49330
2025-12-23 12:34:20 -06:00
Gleb Smirnoff 1aea5b0ba7 nvme: make the interface standard file
This makes nvme.ko and nvd.ko loadable.

Fixes:	aed44717a1
2025-12-23 09:51:25 -08:00
Poul-Henning Kamp a7e0f6a3dc Specialize the REALTEK RTL8153 quirk to just rev=0x31fd 2025-12-23 17:04:10 +00:00
Alexander Ziaee 3c83b5d340 udl.4: Tweak HARDWARE for hardware release note
Fixes:	97fa62708f (udl.4: Consolidate HARDWARE and add HISTORY)
2025-12-23 09:56:09 -05:00
Alexander Ziaee 97fa62708f udl.4: Consolidate HARDWARE and add HISTORY
Some of the information needed for the HARDWARE section was the entire
DESCRIPTION section, so merge the two. While here, add the HISTORY of
this driver, add "driver" to the document description matching other
drivers, and tag the SPDX license identifier for mechanical parsing.

MFC after:	3 days
2025-12-23 09:40:31 -05:00
Alexander Ziaee f7245a27e8 cdce.4: Add RTL8153 to HARDWARE
Fixes:	1b1fb628a1 (Quirk Realtek RTL8153 to config#1)
2025-12-23 08:55:57 -05:00
Alexander Ziaee 03752041e4 cdce.4: Minor polish
+ Tag spdx license identifier	+ Fix "e.g.,"s to quiet linter
+ Remove useless Nd quoting	+ Put example in EXAMPLES

MFC after:	3 days
2025-12-23 08:54:21 -05:00
Alexander Ziaee fbc321b9cd camcontrol.8: Descriptions before examples
This page has a lot of examples, so having them in the previous order
can be confusing. Rewrite to the normal order where the descriptions
come before the command, followed by a colon, which is still clear even
jumping to the middle of the section.

PR:			291759
MFC after:		3 days
Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D54285
2025-12-23 08:40:29 -05:00
Dag-Erling Smørgrav 745c6c0431 Resurrect standalone command
While command(1) is now classified by POSIX as an intrinsic utility and
no longer required to exist as a standalone program, it turns out that
we still have a use for it (cf. env(1)), so resurrect it.

PR:		291879
Fixes:		4100bd6caa ("usr.bin: Remove intrinsic utilities")
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D54341
2025-12-23 11:36:39 +01:00
Xin LI ae12432049 MFV 762f11d98d: xz 5.8.2.
MFC after:	7 days
2025-12-23 00:24:13 -08:00
Wei Hu d0a2bd2765 mana: support jumbo packet size
Remove the restriction of up to 4k packet size. Now the driver
supports up to MJUM16BYTES size packets as long as hardware
supporting it.

Tested on VMs in Azure.

Tested by:	whu
MFC after:	1 week
Sponsored by:	Microsoft
2025-12-23 07:00:38 +00:00
Wei Hu 44f656641c Hyper-V: hn: just call vf's ioctl when changing mtu
When changing mtu, if a vf is attached to the netvsc interface, just
calling its ioctl to change vf's mtu is good enough.

Tested by:	whu
MFC after:	3 days
Sponsored by:	Microsoft
2025-12-23 05:38:40 +00:00
Rick Macklem b94e4c7037 RELNOTES: Add an entry for 8e3fd450cc and friends 2025-12-22 18:51:41 -08:00
Rick Macklem 60eb371c2b UPDATING: Add an entry for commit 9f49f436a9 2025-12-22 15:28:59 -08:00
Rick Macklem e35191ccf3 nfs: Add some support for POSIX draft ACLs
An internet draft (expected to become an RFC someday)
https://datatracker.ietf.org/doc/draft-ietf-nfsv4-posix-acls
describes an extension to NFSv4.2 to handle POSIX draft ACLs.

This is the final patch in the series that enables
the extension of NFSv4.2 to support POSIX draft ACLs.
At this time, only UFS mounted with the "acls" option
will work, and only for FreeBSD built with these patches.
Patches for client and server for the Linux kernel are
in the works.  (I'll admit my next little project is
cleaning the Linux patches up for submission for upstream.)

To make these changes really useful, the FreeBSD port
of OpenZFS needs to be patched to add POSIX draft ACL
support.  (Support for POSIX draft ACLs is already in
the Linux port of OpenZFS.)

Interopeability with NFSv4.2 clients and servers that
do not support this extension should not be a problem.

Fixes:	a35bbd5d9f ("nfscommon: Add some support for POSIX draft ACLs")
2025-12-22 15:22:09 -08:00
Rick Macklem 9f49f436a9 nfs: Add some support for POSIX draft ACLs
An internet draft (expected to become an RFC someday)
https://datatracker.ietf.org/doc/draft-ietf-nfsv4-posix-acls
describes an extension to NFSv4.2 to handle POSIX draft ACLs.

This is the fifth of several patches that implement the
above draft.

This one mostly adds an extra argument to two functions
in nfscommon.ko.  Unfortunately, these functions are
called in many places, so the changes are numerous, but
straightforward.

Since the internal KAPI between the NFS modules is changed
by this commit, all of nfscommon.ko, nfscl.ko and nfsd.ko
must be rebuilt from sources.

There should be no semantics change for the series at
this point.

Fixes:	a35bbd5d9f ("nfscommon: Add some support for POSIX draft ACLs")
2025-12-22 13:51:15 -08:00
Poul-Henning Kamp 1b1fb628a1 Quirk Realtek RTL8153 to config#1 so if_cdce claims it. Works much better. 2025-12-22 21:24:42 +00:00
Alan Somers f51e9d0e09 fusefs: Fix further intermittency in the BadServer.ShortWrite test case
After being unmounted, the mockfs server would occasionally read from
/dev/fuse again, if the main function didn't exit fast enough, getting
an ENODEV error.  Handle that appropriately.

Reported by:	Siva Mahadevan <me@svmhdvn.name>
Fixes:		d86025c1d4
MFC after:	1 week
Reviewed by:	Siva Mahadevan <me@svmhdvn.name>
Differential Revision: https://reviews.freebsd.org/D54331
2025-12-22 10:18:16 -07:00
Kristof Provost 4f35a84b32 atf_python: support setting interface mtu
Teach the vnet support code to set interface MTU. Some tests make use of
this, so have the framework handle it.

Adapt a few pf tests to use this.

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D54333
2025-12-22 17:28:33 +01:00
Mark Johnston 3a4275a5f1 telnet: Remove usage of ALIGN
gcc doesn't like ALIGN() being applied to an array type.  Just use
__aligned instead.

Reported by:	Jenkins
Reviewed by:	brooks
Fixes:		80203a27e9 ("Add sys/_align.h replacing machine/_align.h")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54290
2025-12-22 15:18:52 +00:00
Mark Johnston da8ab13249 inotify: Avoid resetting the cookie
The IN_MOVED_FROM and _TO events only apply to names in a watched
directory, never to a watched directory itself.  So, the cookie value
there is always zero, and in particular we should not reset the
caller-provided cookie value, as it may be used later.

Add a regression test.

Reported by:	arrowd
MFC after:	1 week
2025-12-22 14:47:27 +00:00
Mark Johnston 15178d8ed2 pf: Fix state handling when ICMP packets are diverted
Commit 66f2f1c832 ("pf: handle divert packets") missed a case that I
happened to hit while testing something.

Add a regression test for the ICMP case, based on the existing test.
Fix a buglet in the existing test (missing whitespace after "[").

Reviewed by:	kp
Sponsored by:	OPNsense
Sponsored by:	Klara, Inc.
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D54321
2025-12-22 14:47:27 +00:00
Konstantin Belousov 183513d15f sys/netipsec: ensure sah stability during input callback processing
Citing ae: this fixes some rare panics, that are reported in
derived projects: `panic: esp_input_cb: Unexpected address family'.

Reported by:	ae
Tested by:	ae, Daniel Dubnikov <ddaniel@nvidia.com>
Reviewed by:	ae, Ariel Ehrenberg <aehrenberg@nvidia.com> (previous version)
Sponsored by:	NVidia networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54325
2025-12-22 14:31:25 +02:00
Dimitry Andric 3b1126208f Remove debug crutch I accidentally left in
Fixes:		cf1eaaf41c
MFC after:	1 week
2025-12-22 12:49:42 +01:00
Dimitry Andric cf1eaaf41c Reduce number of external symbols in libllvm, libclang and liblldb
In commit 2e47f35be5 libllvm, libclang and liblldb were converted into
private shared libraries. This allowed clang, lld, lldb, and other llvm
tools to be linked against these shared libraries, which makes them
smaller and avoids duplication.

However, upstream builds the shared libraries using several visibility
options, which reduces the number of external symbols, and makes the
libraries a bit smaller.

On my test machine:
* libprivatellvm.so goes from 75643 to 34706 symbols (~54% reduction)
* libprivateclang.so goes from 53250 to 33531 symbols (~37% reduction)
* libprivatelldb.so goes from 27242 to 18798 symbols (~31% reduction)

Note: to get the full benefit, a clean build is required. Incremental
builds should still work, but I didn't want to force a full rebuild on
everybody.

MFC after:	1 week
2025-12-22 10:31:40 +01:00
Guy Harris 88b04633c2 libpcap: fix resource leaks and set error messages
In finddevs_bpf() close the BPF device descriptor and free the device list
buffer before returning.

For ioctl() and malloc() errors, use pcapint_fmt_errmsg_for_errno() to
generate an error message.

Fix some comments.

(cherry picked from commit 6870404f35da32d63a0a8789edb010842dd6b208)
2025-12-21 18:23:28 -08:00
Gleb Smirnoff 129e15d499 ipfw: fix bpf tap point lookup
The trick I blindly used works for pointers to structs, but not for rule
numbers that can differ only by 1.

PR:	291854
Fixes:	3daae1ac1d
2025-12-21 18:23:14 -08:00
Gleb Smirnoff b275907fa3 if_tuntap: use ifnet_rename_event instead of ifnet_arrival_event 2025-12-21 18:23:14 -08:00
Gleb Smirnoff 0bd0c3295a ng_ether: refactor to use interface EVENTHANDLER(9)s 2025-12-21 18:23:14 -08:00
Gleb Smirnoff 349fcf079c net: add ifnet_rename_event EVENTHANDLER(9) for interface renaming
and don't trigger ifnet_arrival_event and ifnet_departure_event for a
rename, as the interface isn't being detached from any protocol.  The
consumers of the arrival/departure events are divided into a few
categories:
- which indeed need to do the same actions as if interface was fully
  detached and attached: routing socket and netlink notifications to
  userland and the Linux sysfs.  All addressed by this commit.
- which build their logic based on an interface name, but should actually
  update their database on rename: packet filters.  This commit leaves
  them with the old behavior - emulate full detach & attach, but this
  should be improved.
- which shouldn't do anything on rename, not touched by the commit.
- ng_ether and if_tuntap, that are special and will be addressed by
  separate commits.
2025-12-21 18:23:14 -08:00
Gleb Smirnoff e3d6cf8c3f pf: make eventhandler_tag's static
No functional change.
2025-12-21 18:23:14 -08:00
Gleb Smirnoff 77939d64f2 net: on interface detach purge multicast addresses after protocols
We first want to give a chance to all owners of multicast addresses to
free them and only then run through the list of remaining ones.  It might
be that no addresses remain there normally, but this needs to be analyzed
deeper.  For now restore the sequence that was before 0d469d2371 to fix
a possible use after free.

Fixes:	0d469d2371
2025-12-21 18:23:14 -08:00
Rick Macklem 0e724de9ed nfscl: Add some support for POSIX draft ACLs
An internet draft (expected to become an RFC someday)
https://datatracker.ietf.org/doc/draft-ietf-nfsv4-posix-acls
describes an extension to NFSv4.2 to handle POSIX draft ACLs.

This is the fourth of several patches that implement the
above draft.

There should be no semantics change for the series at
this point.

Fixes:	a35bbd5d9f ("nfscommon: Add some support for POSIX draft ACLs")
2025-12-21 18:05:04 -08:00
Rick Macklem 949cff4dce nfscommon: Add some support for POSIX draft ACLs
An internet draft (expected to become an RFC someday)
https://datatracker.ietf.org/doc/draft-ietf-nfsv4-posix-acls
describes an extension to NFSv4.2 to handle POSIX draft ACLs.

This is the third of several patches that implement the
above draft.

There should be no semantics change for the series at
this point.

Fixes:	a35bbd5d9f ("nfscommon: Add some support for POSIX draft ACLs")
2025-12-21 17:07:10 -08:00
Xin LI 762f11d98d Vendor import of xz 5.8.2 (trimmed) 2025-12-21 16:14:28 -08:00
Rick Macklem 8e3fd450cc nfsd: Add some support for POSIX draft ACLs
An internet draft (expected to become an RFC someday)
https://datatracker.ietf.org/doc/draft-ietf-nfsv4-posix-acls
describes an extension to NFSv4.2 to handle POSIX draft ACLs.

This is the second of several patches that implement the
above draft.

The only semantics change would be if you have exported
a UFS file system mounted with the "acl" option.
In that case, you would see the acl attribute supported.
This is bogus, but will be handled in the next commit.

Fixes:	a35bbd5d9f ("nfscommon: Add some support for POSIX draft ACLs")
2025-12-21 16:08:05 -08:00