Commit graph

304478 commits

Author SHA1 Message Date
Rick Parrish
992f994bb7
librt/mq_getfd_np.3: Initial manual page
The mq_getfd_np function appeared in FreeBSD 11 with no documentation.
This function dereferences the mqd_t as a pointer to an int.

Relnotes:		yes
MFC after:		3 days
Reviewed by:		kib (previous), markj, ziaee
Differential Revision:	https://reviews.freebsd.org/D43947

(cherry picked from commit ca2413d216197fd55f9363d6f65c641ff1aa3ec5)
2026-01-01 13:05:04 -05:00
Rob Nichols
f9bb95414c
jail.conf.5: Fix mandoc typos
MFC after:	3 days
Reviewed by:	ziaee
Signed-off-by:	Rob Nichols <robert.nichols@dialwave.com>
Closes:		https://github.com/freebsd/freebsd-src/pull/1928

(cherry picked from commit d1d88b6e8c31b1e472d66471ff1e666e5310709e)
2026-01-01 13:05:04 -05:00
Alexander Ziaee
49358373aa
examples/mdoc: Remove document description quotes
Quotes in roff do not work the way quotes in shell do,
remove them from the examples to hopefully lead less people astray.

MFC after:	3 days

(cherry picked from commit 067b62bd5834484c927038aff28d36da6c5d6cca)
2026-01-01 13:05:04 -05:00
Alexander Ziaee
2ecb299081
bnxt.4: Adjust for recent HARDWARE
+ Adjust document description matching another terabit driver
+ Add BCM576XX family to DESCRIPTION, switch to XX notation
+ Add some model names, additional models, and improvements to HARDWARE

MFC after:		3 days
Reviewed by:		sumit.saxena_broadcom.com (previous)
Differential Revision:	https://reviews.freebsd.org/D54028

(cherry picked from commit 473bc5778c3e5136831c08d525d673059ef0aaa2)
2026-01-01 13:05:04 -05:00
Seth Hoffert
da13642913
man typos: Fix pf.conf.5 and jail.2 typos
MFC after:	3 days
Signed-off-by:	Seth Hoffert <seth.hoffert@gmail.com>
Closes:		https://github.com/freebsd/freebsd-src/pull/1919

(cherry picked from commit 0140dc4a68ac25c70300ed2a418e7ca441638bdb)
2026-01-01 13:05:03 -05:00
Pau Amma
1e34e2f9fd
vidcontrol.1: Video buffer dump is syscons only
Fixes:		1f4442f71f (be explicit that -p and -P are sc(4) only)
MFC after:	3 days
Reviewed by:	ziaee
Differential Revision:	https://reviews.freebsd.org/D53878

(cherry picked from commit 9ec8196f68bac015965164f7f1a65c619bab4e85)
2026-01-01 13:05:03 -05:00
Alexander Ziaee
fd72ad29c5
freebsd-base.7: Rewrite table into a tagged list
The table is not playing nicely with
https://man.freebsd.org/freebsd-base

MFC after:		3 days
Reviewed by:		pauamma@gundo.com
Differential Revision:	https://reviews.freebsd.org/D54036

(cherry picked from commit 39b2ca9ec99eded0b248082dcec6c843f40330a8)
2026-01-01 13:05:03 -05:00
Rick Macklem
785d429c2b 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.

(cherry picked from commit 4f184fd35d81bbd85284d47d2a65aeece67e87d4)
2025-12-30 17:23:27 -08:00
Mitchell Horne
4a15a3528d aw_rtc: bump settime() delays
There are delay loops, checking the BUSY status bit, before writing to
the date or time registers. Each iteration contains a 1usec delay, for a
maximum of 70 iterations.

This is frequently not enough on the D1 platform, where the message is
emitted:

  rtc0: could not set date, RTC busy

Bump the loop delay to 10usecs each, and the maximum number of
iterations to 150, for a maximum delay of 1.5msecs between each write of
the register.

In my testing this seems to be adequate.

The loop variable is renamed for clarity/simplicity.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D54180

(cherry picked from commit cae9ae66ad1b01e84597d03c436bc0579bd07fd4)
2025-12-30 12:07:29 -04:00
Xin LI
4e48e50ea5 MFV 762f11d98d5cd57ebbe85c36e9e86a557a91fe4e: xz 5.8.2.
(cherry picked from commit ae12432049e7873ab3912643ae5d08297b8cbc49)
2025-12-29 18:19:14 -08:00
Ka Ho Ng
9cfd75a6f8 bio: Fix KASAN invalid access report in biodone
Do not touch the bio fields after calling the bio_done callback. The bio
might have been freed after the callback returns.

Fixes:	725f4b108d
Reported by:	kp, markj
2025-12-29 18:47:56 +00:00
Michael Osipov
ad6381a6eb linprocfs.4: Improve docs around pid/self entries
Mark <pid> as a placeholder and document that self is a symlink to a directory.

PR:		283080
Reviewed by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54358

(cherry picked from commit 0d31189cbce4de142a43b65037beb7bf8c09cf26)
2025-12-29 19:35:32 +01:00
Michael Osipov
980c44df42 bhyve: Document that MAC address has to be unicast
bhyve accepts any MAC address even foreign as long it is a unicast one.

Reviewed by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D54372

(cherry picked from commit e1bfd541c7cdee1e184cacb2ea3bbebb3a500dfb)
2025-12-29 19:35:08 +01:00
Michael Osipov
919cb70724 bhyve_config.5: 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/D54370

(cherry picked from commit 66604463e737f4754ae6268171031ceefc226837)
2025-12-29 19:34:53 +01:00
Dmitry Salychev
22f8973d1e
dpaa2: Setup interface caps on attach
39d4094173 ("epair: add support for checksum offloading") revealed
that HW checksum offloading is not enabled when the dpaa2_ni driver
is attached despite being declared and enabled on the dpni interface.

I modified dpaa2_ni_setup_if_caps to take into account both IPv4 and
IPv6 checksum offloading capabilities and added a call to re-configure
interface capabilities on attach to fix it.

Reviewed by:	bz
Fixes:		39d4094173 ("epair: add support for checksum offloading")
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D53436

(cherry picked from commit a731cb93a66271713d6ea197946e4a307e5b0837)
2025-12-29 19:12:29 +01:00
Mark Johnston
108e4f3142 armv8rng: Fix an inverted test in random_rndr_read_one()
If we get a random number, the NZCV is set to 0b0000.  Then
"cset %w1, ne" will test whether Z == 0 and set %w1 to 1 if so.
More specifically, "cset %w1, ne" maps to "csinc %w1, wzr, wzr, eq",
which stores 0 in %w1 when NZCV == 0b0100 and 1 otherwise.

Thus, on a successful read we expect ret != 0, so the loop condition
needs to be fixed.  In practice this means that we would end up trying
to fetch entropy up to ten times in a row.  If all attempts are
successful, the last will be returned, otherwise no entropy will be
returned.

Reported by:	Kevin Day <kevin@your.org>
Reviewed by:	andrew
Fixes:		9eecef0521 ("Add an Armv8 rndr random number provider")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54259

(cherry picked from commit 93811883500b99f9f1fb4ffd6e764226d37dcfd0)
2025-12-29 14:50:34 +00:00
Mark Johnston
859fcbb919 vmem: Fix the gcc build
gcc complains when building libuvmem because the last two operands of ?:
in ORDER2SIZE and SIZE2ORDER have different signs.  Add explicit casts
to address this.

Reported by:	Jenkins
Reviewed by:	alc, kib
MFC after:	1 week
Fixes:		1ecf01065b45 ("libuvmem: usermode port of vmem(9)")
Differential Revision:	https://reviews.freebsd.org/D54268

(cherry picked from commit 377e6050c1cb9edce90d2a3caa2833fcc09b8c68)
2025-12-29 14:50:12 +00:00
Mark Johnston
eb92fbcade 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:		80203a27e964 ("Add sys/_align.h replacing machine/_align.h")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54290

(cherry picked from commit 3a4275a5f1f5dccd6918c4eff3b84488e322ad5d)
2025-12-29 14:31:40 +00:00
Mark Johnston
75293aaeea 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

(cherry picked from commit da8ab13249420e85935b89794f333f0755e56385)
2025-12-29 14:31:33 +00:00
Mark Johnston
7999ce0d29 rc.subr: Use the variable we defined to invoke setaudit(8)
Reported by:	gtetlow
Fixes:		39ee24182b92 ("rc.subr: Support setting the audit user when starting services")
MFC after:	1 week

(cherry picked from commit 9dda51f13cd85791c0f18782461219f5a88e2d67)
2025-12-29 14:31:31 +00:00
Mark Johnston
0eb81bd89d pfsync: Avoid zeroing the state export union
pfsync_state_export() takes a pointer to a union that is in reality a
pointer to one of the three state formats (1301, 1400, 1500), and zeros
the union.  The three formats do not have the same size, so zeroing is
wrong when the format isn't that which has the largest size.

Refactor a bit so that the zeroing happens at the layer where we know
which format we're dealing with.

Reported by:	CHERI
Reviewed by:	kp
MFC after:	1 week
Sponsored by:	CHERI Research Centre (EPSRC grant UKRI3001)
Differential Revision:	https://reviews.freebsd.org/D54163

(cherry picked from commit 796abca7e281f0d4b7f72f48da4f941e1c8b139c)
2025-12-29 14:31:30 +00:00
Mark Johnston
26ebe093f4 socket: Fix the name of a parameter in a comment
Reported by:	des
Fixes:		0a68f644dc ("socket: Split up soreceive_generic()")
MFC after:	1 week

(cherry picked from commit a0d607957533c7fbefaac5cd81d34c037cc27344)
2025-12-29 14:31:30 +00:00
Mark Johnston
13b9f78e33 netmap: Let memory allocator parameters be settable via loader.conf
This is useful when dev.netmap.port_numa_affinity is set to 1.  When
interfaces attach, they get a memory allocator that is copied from
nm_mem.  Parameters in nm_mem can be set using sysctls, but this happens
after their values are copied.

To work around this, we can make it possible to set these memory
parameters as tunables.

Reviewed by:	vmaffione
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D54178

(cherry picked from commit c694122f3cfb7d52b882fa79086d49f45a2c7fd2)
2025-12-29 14:31:30 +00:00
Dimitry Andric
05924176b7 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

(cherry picked from commit e2c93ed09f259ed049923bdaa9b697b3586e2f1a)
2025-12-29 13:22:53 +01:00
Dimitry Andric
1b9ab283da 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

(cherry picked from commit 3054e22e4524df24908d7e9379681c1ccf829b93)
2025-12-29 13:21:15 +01:00
Dimitry Andric
0e8b2ab133 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

(cherry picked from commit ba0a11512237681fc621670023d56195cb8c82ad)
2025-12-29 13:20:50 +01:00
Dimitry Andric
7d9c6b28e1 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

(cherry picked from commit a3394b6a23fb66ccb7e588129d2465ef8ea26d30)
2025-12-29 13:19:34 +01:00
Dimitry Andric
026647c72e 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

(cherry picked from commit 98c3d868fb5a7da7356c58e8c51423975bbd078b)
2025-12-29 13:19:10 +01:00
Ayrton Munoz
248f879133 cross-build: Avoid adding <sys/cdefs.h> to SYSINCS
Summary:
The sys/cdefs.h in src is incompatible with glibc's sys/cdefs.h so
cross-building broke when the former was added to SYSINCS in 1c9ff80f06. This
commit adds a guard around that to only do that when building on FreeBSD. This
should fix github CI.

Test Plan:
Ran buildkernel using tools/build/make.py on linux in github CI and
locally on FreeBSD to double check nothing broke.

Reviewed by:    dim
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D54385

(cherry picked from commit b6672803a1cf10dd1c912fe6571a8d426b8868bd)
2025-12-29 13:15:14 +01:00
Dimitry Andric
c25ea7290e tools.build: also add sys/_visible.h to SYSINCS
This is needed since sys/cdefs.h includes sys/_visible.h.

Reported by:	kib
Fixes:		1c9ff80f0635
MFC after:	3 days

(cherry picked from commit 086bedb11a853801e82234b8a1a64f0df52d9e52)
2025-12-29 13:15:00 +01:00
Dimitry Andric
2d0600671a tools.build: add sys/cdefs.h to SYSINCS, since lots of other headers use it
This is needed to let the legacy stage compile against newer versions of
sys/font.h, which transitively includes sys/cdefs.h, and requires the
new __nonstring macro from it.

Fixes:		e2c93ed09f25
MFC after:	3 days

(cherry picked from commit 1c9ff80f06350fa44b7e50ce09ad665ab0082abb)
2025-12-29 13:14:46 +01:00
Alex Richardson
dc28e6534b cdefs.h: Introduce __nonstring attribute
This attribute can be used to annotate char arrays that are not supposed to
be terminated with a NUL char and is needed to silence clang's new
-Wunterminated-string-initialization warning. The name matches linuxkpi.

Reviewed by:	emaste, jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D52565

(cherry picked from commit 802c6d5d61d15494a54a386dc2ffbcfefc68c8ab)
2025-12-29 12:41:14 +01:00
Kristof Provost
261642478c pf: handle TTL expired during nat64
If the TTL (or hop limit) expires during nat64 translation we may
need to send the error message in the original address family (i.e.
pre-translation).
We'd usually handle this in pf_route()/pf_route6(), but at that point we
have already translated the packet, making it difficult to include it in
the generated ICMP message.

Check for this case in pf_translate_af() and send icmp errors directly
from it.

PR:		291527
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D54166

(cherry picked from commit ac4fb06d096d6308b9522f454b68fbfc45bb8531)
2025-12-29 07:54:56 +01:00
Dimitry Andric
ea9ce38757 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

(cherry picked from commit cd880010c49a5d4ec529f4204d4e88cd27727255)
2025-12-29 03:09:43 +01:00
Dimitry Andric
1eea0671cc Remove debug crutch I accidentally left in
Fixes:		cf1eaaf41cef
MFC after:	1 week

(cherry picked from commit 3b1126208f44a90c7dc04a87207e54b22d45893c)
2025-12-29 03:09:28 +01:00
Dimitry Andric
5c5e2a0a7b 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

(cherry picked from commit cf1eaaf41cefe7e3aef45f6dab862191a3939ed8)
2025-12-29 03:09:11 +01:00
Dimitry Andric
8f7dfa4fe2 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

(cherry picked from commit 5629b5cf79934e0b94ddbbd93b7756f74fe4050a)
2025-12-29 03:06:47 +01:00
Konstantin Belousov
b86fc3284b sys/netipsec: ensure sah stability during input callback processing
(cherry picked from commit 183513d15f2290a42b542753aaffe9de2152575b)
2025-12-29 02:57:03 +02:00
Jose Luis Duran
791fb098c9
Import latest mtree from NetBSD
Merge commit 'eb2ccba0c11b405ac613c3046997765317cc8b5c'

PR:		192839
PR:		219467
MFC after:	1 week

(cherry picked from commit f8cee1f2c2dfba6223385fd711cce9faeca76451)
2025-12-27 16:28:01 +00:00
Michael Osipov
535fac0b95 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

(cherry picked from commit 5819f8b285fc55a75e5dea56ffe73b376525150c)
2025-12-26 11:47:46 +01:00
Jason A. Harmening
da6f395119 unionfs: detect common deadlock-producing mount misconfigurations
When creating a unionfs mount, it's fairly easy to shoot oneself
in the foot by specifying upper and lower file hierarchies that
resolve back to the same vnodes.  This is fairly easy to do if
the sameness is not obvious due to aliasing through nullfs or other
unionfs mounts (as in the associated PR), and will produce either
deadlock or failed locking assertions on any attempt to use the
resulting unionfs mount.

Leverage VOP_GETLOWVNODE() to detect the most common cases of
foot-shooting at mount time and fail the mount with EDEADLK.
This is not meant to be an exhaustive check for all possible
deadlock-producing scenarios, but it is an extremely cheap and
simple approach that, unlike previous proposed fixes, also works
in the presence of nullfs aliases.

PR:		172334
Reported by:	ngie, Karlo Miličević <karlo98.m@gmail.com>
Reviewed by:	kib, olce
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D53988

(cherry picked from commit 0247b4018de2c341ac59a585362c10044cea86ad)
2025-12-26 00:38:06 -06:00
Jason A. Harmening
177e0097b9 unionfs: Implement VOP_GETLOWVNODE
This function returns the vnode that will be used to resolve the
access type specified in the 'flags' argument, and is useful for
optimal behavior of vn_copy_file_range(). While most filesystems
can simply use the default implementation which returns the passed-
in vnode, unionfs (like nullfs) ideally should resolve the access
request to whichever base layer vnode will be used for the I/O.

For unionfs, write accesses must be resolved through the upper vnode,
while read accesses will be resolved through the upper vnode if
present or the lower vnode otherwise.  Provide a simple
unionfs_getlowvnode() implementation that reflects this policy.

Reviewed by:	kib, olce
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D53988

(cherry picked from commit 5c025978fc3649730329994eecc56ada119e6717)
2025-12-26 00:34:13 -06:00
Jason A. Harmening
04190ace74 vnode_if.src: fix function name in locking annotation
getwritevnode->getlowvnode

Reviewed by:	kib, olce
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D53988

(cherry picked from commit 38d60d453caad0f7377946d69d05d9421323f23f)
2025-12-26 00:32:47 -06:00
Martin Matuska
d673dda5af zfs: merge openzfs/zfs@743334913 (zfs-2.4-release) into stable/15
OpenZFS 2.4.0

Notable upstream pull request merges:
 #17932 c8ecd63ac zpool: fix special vdev -v -o conflict
 #17941 74bbdda1e Fix snapshot automount expiry cancellation deadlock
 #17946 f45622ff4 chksum: run 256K benchmark on demand, preserve
                  chksum_stat_data
 #17960 a41ef3685 DDT: Reduce global DDT lock scope during writes
 #17961 2aad3dee2 DDT: Make children writes inherit allocator
 #17975 2e09f166f FreeBSD: Fix uninitialized variable error
 #17980 a785ddc5f DDT: Switch to using wmsums for lookup stats
 #17983 028d66b9d Fix ddtprune causing space leak
 #18004 e1f0baa54 FreeBSD: Remove HAVE_INLINE_FLSL use
 #18015 a2f768f61 FreeBSD: Fix a potential null dereference in
                  zfs_freebsd_fsync() (already merged)

Obtained from:	OpenZFS
OpenZFS commit:	743334913e
OpenZFS tag:	zfs-2.4.0
2025-12-24 23:24:23 +01:00
Vladimir Kondratyev
198ef2a31c LinuxKPI: bump __FreeBSD_version for vmap_pfn implementation 2025-12-24 23:08:44 +03:00
Vladimir Kondratyev
304c24df44 LinuxKPI: Implement vmap_pfn
Required by i915kms to support recent discrete graphics cards.

MFC after:	1 week
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D54225

(cherry picked from commit df49fd8efa1a885089488458df0e7e88c9649c90)
2025-12-24 23:06:08 +03:00
Vladimir Kondratyev
bbc5f54837 LinuxKPI: Move vmap-related code from linux_compat.c to linux_page.c
Coming vmap_pfn() implementation requires is_vmalloc_addr() to be in
the same file with other vmap-related code. Move code out from the
overcrowded file. No functional changes intended.

MFC after:	1 week
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D54223

(cherry picked from commit 20ce906157dfc9ae6ee834f56f2bba154f37d653)
2025-12-24 23:06:00 +03:00
Maxim Konovalov
1c7c315e80 bsd-family-tree: add FreeBSD 15.0
(cherry picked from commit 7b44ab1c6abe106a44604a8504edca0e57ec1c42)

Sponsored by:	tipi.work
2025-12-24 13:18:22 -05:00
Ed Maste
d8ff327be7 bsd-family-tree: Re-center OpenBSD line
Commit 09aeca28dd75 ("BSD family tree: reduce OpenBSD-NetBSD crowding")
moved OpenBSD releases over 2 spaces.  Move the line through OpenBSD
releases over as well.

Reviewed by:	obrien
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53635

(cherry picked from commit 1821cf482ff128b08bd65807e1f7aad7eb873e0b)
2025-12-24 13:17:32 -05:00
Sergey A. Osokin
2cf7b7af8f bsd-family-tree: add macOS 26
Sponsored by:	tipi.work

(cherry picked from commit c6e02892bbca1237546e3943c0971768822e1745)
2025-12-24 11:06:49 -05:00