Commit graph

305581 commits

Author SHA1 Message Date
Ed Maste
4551ea3b3f compat32: Zero struct to avoid stack disclosure
Reported by:	Adam Crosser, Praetorian
Reviewed by:	philip
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55811

(cherry picked from commit 097cb4e9f0432c543c704cec712ce1cd3302335c)
2026-03-20 09:36:35 -04:00
Ed Maste
6348a5fd0d shm: Zero struct kinfo_file in sysctl handler
Reported by: Calif.io in collaboration with Claude and Anthropic Research
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55806

(cherry picked from commit 25cc459286a02b646751541ccde5a33319471c73)
2026-03-20 09:36:35 -04:00
Zhenlei Huang
1b7687f053 ifnet: Fix decreasing the vnet interface count
It should be decreased only when the interface has been successfully
removed from the "active" list.

This prevents vnet_if_return() from potential OOB writes to the
allocated memory "pending".

Reviewed by:	kp, pouria
Fixes:		a779388f8b if: Protect V_ifnet in vnet_if_return()
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D55873

(cherry picked from commit 8065ff63c0e5c3bb4abb02f55b20cb47bb51d1a7)
2026-03-20 18:00:21 +08:00
Zhenlei Huang
f521487cd9 amd64: Make start_all_aps() static
It is not used elsewhere since the change [1].

[1] ac3ede5371 x86/xen: remove PVHv1 code

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55668

(cherry picked from commit 5f0ab9d9e965225c4af0c6ed481e01eee0ffab8f)
2026-03-20 18:00:21 +08:00
Sean Farley
bd5ce67416 sound: enforce MASTER volume mute during playback
MASTER mute (vol.mute) works while audio is playing. However, if a
stream is stopped and restarted (PCMTRIG_STOP -> PCMTRIG_START), the
audio will resume even though the mixer shows the MASTER volume as
muted. Other streams that are already playing remain silent. New streams
may also start playing audio regardless of the MASTER mute state.

The volume feeder now considers the MASTER mute when determining whether
a channel should be muted. This ensures MASTER mute is consistently
enforced for all streams and removes the dependency on trigger-driven
state propagation.

Tested with Creative Labs CA0132 card.

MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D55605

(cherry picked from commit ac5ff2813027c385f9037b47b2b164d4c1bebd09)
2026-03-19 13:17:35 +01:00
Colin Percival
660a79ef4f EC2: Don't use unicode in boot loader
The boot loader menu is disabled by default in EC2, but if it is ever
turned on, the default (unicode) output breaks EC2's web interface to
the serial console.

Set loader_menu_frame="ascii" instead.

MFC after:	3 days
Sponsored by:	Amazon

(cherry picked from commit 277830b4d3ae9999c80bf915b5491850e91c6516)
(cherry picked from commit 251907ca480eff7f6177f52959b71a6cfce45579)
2026-03-18 12:05:33 -07:00
Colin Percival
b1098090b7 intrng: Shuffle unhandled interrupts too
When interrupt vectors are first allocated, they get assigned to
CPU #0; at SI_SUB_SMP / SI_ORDER_SECOND (aka once we have multiple
CPUs), the intr_irq_shuffle SYSINIT clears their CPU sets with the
effect of forcing them to be assigned to new CPUs later.

In case where interrupt vectors were allocated *but not yet bound*
this code did not run, with the effect that those interrupts would
remain pinned to CPU #0 forever.  This affected the ena(4) driver,
which allocates interrupts for I/O when the device is attached but
doesn't set them up until the interface is brought up much later in
the boot process (and, crucially, long after intr_irq_shuffle runs).

Adjust intr_irq_shuffle to clear the CPU set for an interrupt source
even if it currently has no handlers, so that it will be properly
assigned to a CPU when it is used later.

Reviewed by:	andrew, mhorne
MFC after:	1 month
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D55284

(cherry picked from commit b2ba4131b9b08d6231392c0b798d0ff35809f600)
2026-03-18 12:05:16 -07:00
Siva Mahadevan
317c242462 tarfs: swap deprecated ZSTD_resetDStream() with ZSTD_DCtx_reset()
ZSTD_resetDStream() is deprecated since 1.5.4: 5d8cfa6b96

This change is needed to MFV zstd 1.5.7.

Approved by:	emaste (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D55835

(cherry picked from commit 922d73540d2d9897e5e8160c445cefa13581564e)
2026-03-18 09:49:53 -04:00
Seth Hoffert
9031b83ac1 pfctl: consistency
% pfctl -F ethernet
Ethernet rules cleared

% pfctl -s ethernet
pfctl: Unknown show modifier 'ethernet'

pfctl accepts 'ethernet' (or any prefix of it) in the -F flag but
accepts only 'ether' (or any prefix of it) in the -s flag, which seems
inconsistent.  This change brings the two to parity while remaining
backwards compatible.

Reviewed by:	kp
MFC after:	2 weeks
Signed-off-by: Seth Hoffert <seth.hoffert@gmail.com>
(cherry picked from commit 36acf1bd32ed5749af4a9f735aeea1a3434fe42f)
2026-03-18 02:41:58 +01:00
Christos Margiolis
edc9c3ee46 virtual_oss: Combine -d, -l and -L option getopt code
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55671

(cherry picked from commit a2b601343bf9261c4ada51e4d4c30c5b9320bb2b)
2026-03-17 13:03:14 +01:00
Konstantin Belousov
fc1c67912b p9fs: use atomics for updating node->flags
(cherry picked from commit c2012c7faf74c9e7b4e3de2472e10b58ed096996)
2026-03-15 08:58:57 +02:00
Konstantin Belousov
db4caf69d7 p9fs: locking improvements for p9fs_stat_vnode_dotl()
PR:	293492

(cherry picked from commit 2b256f00aaee4713b8e6f0e3c0f3493065f710c4)
2026-03-15 08:58:57 +02:00
Konstantin Belousov
1ff01f6ca2 vn_delayed_setsize(): post-commit review' changes
(cherry picked from commit 92d7808d88f0de979d76446c76c7324731c41302)
2026-03-15 08:58:57 +02:00
Konstantin Belousov
47f2998385 nfsclient: convert to use vn_delayed_setsize()
(cherry picked from commit 5c71df9850355e20cf8f89fb656b18ef79cdf178)
2026-03-15 08:58:57 +02:00
Konstantin Belousov
89559b5d27 vfs: add VOP_DELAYED_SETSIZE() and related infrastructure
(cherry picked from commit 45117ffcd533ddf995f654db60b10899ae8370ec)
2026-03-15 08:58:56 +02:00
Christos Margiolis
9c49c393a8 virtual_oss: Use virtual_oss_timestamp() to avoid duplication
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit e75c8faf277dded0a80d469cb8182583716a2211)
2026-03-14 15:03:30 +01:00
Christos Margiolis
c4e303fbdc virtual_oss: Use virtual_oss_delay_ns() to avoid duplication
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit 3a410851bf02c247e71bcd06fdeec2706c6b6070)
2026-03-14 15:03:30 +01:00
Konstantin Belousov
756689232e sigreturn.2: refresh the man page
(cherry picked from commit 9da4a804f0916b24519b8baa7ed460a7ba23d8c8)
2026-03-14 14:02:34 +02:00
Robert Clausecker
521519f72d depend-cleanup.sh: rebuild strnlen.o on riscv64 if it came from strnlen.S
We have to switch back to the previous rule once the temporary
build fix has been replaced with a permanent fix.

MFC after:	1 week
See also:	2a4e3112c811b9892e14e15cfd23538e7e47329c
PR:		293353, 293296

(cherry picked from commit b5514e1c6d9e7ec09b299a983d1ce32852e0d9dc)
2026-03-14 10:29:22 +01:00
Strahinja Stanišić
0536513eda libc/riscv64: temporarily disable strnlen() implementation until a fix is developed
strnlen() doesn't seem to cope well with a length argument such that
string pointer plus length overflows past the end of the address space.

Reviewed by:	fuz
MFC after:	1 week
PR:		293353, 293296
Differential Revision:	https://reviews.freebsd.org/D55714

(cherry picked from commit 2a4e3112c811b9892e14e15cfd23538e7e47329c)
2026-03-14 10:29:21 +01:00
Christos Margiolis
63888350d5 rc: virtual_oss: Silence potential hw.snd.default_unit error
PR:		293582
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit e85f221def717660c9daf4c0616dfb9cdfb75827)
2026-03-13 12:49:23 +01:00
Qi Wang
b4d8d9bde0 rallocx path: only set errno on the realloc case.
PR:		291677
Obtained from:	jemalloc (commit 83b075789b4239035931c1ee212576d00153bbf0)
Fixes:		c43cad8717 ("jemalloc: Merge from jemalloc 5.3.0 vendor branch")
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2059

(cherry picked from commit 2c5cd07828ad76c332e3bedc29fc641809e85396)
2026-03-13 09:13:16 +00:00
Juhyung Park
3abef030d3 Set errno to ENOMEM on rallocx() OOM failures
realloc() and rallocx() shares path, and realloc() should set errno to
ENOMEM upon OOM failures.

PR:		291677
Obtained from:	jemalloc (commit 38056fea64c34ca4fef0a16212776eaa4de80b78)
Fixes:		c43cad8717 ("jemalloc: Merge from jemalloc 5.3.0 vendor branch")
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2059

(cherry picked from commit 5583b64f230fe0ea4e3d4bf4566205b521190fbb)
2026-03-13 09:13:08 +00:00
Tuukka Pasanen
d74dfe03ba camcontrol: Add SPDX-License-Identifier tag
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55269

(cherry picked from commit 25ed5ee654a8cd7d9f694307c62bb84ff4d16866)
2026-03-12 09:43:57 -04:00
Dmitry Lukhtionov
b1d4b8379f camcontrol: Print 'transport revision'
As described in Serial ATA Revision 3.5a

Reviewed by:	mav
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2044

(cherry picked from commit f4f9054dc47b430872d38c7a75fea753c6fe796f)
2026-03-12 09:43:38 -04:00
Lexi Winter
2a3d650552 packages: Don't create empty packages
If a package plist only contains directories, but no files, do not
create the package.

This fixes an issue where setting "package=foo" in mtree causes the
"foo" package to always be created, even if nothing else installs in
that package, because the mtree entry is always added to the plist.

This most often happens:

* With architecture-specific directories, because mtree can't install
  a directory conditionally based on architecture, and

* With packages that are completely empty when a particular src.conf
  knob is disabled, because mtree will still create the directories.

Although it's theoretically possible that we might want to create a
package that only contains directories, there are no such packages
today.

MFC after:	2 weeks (stable/15 only)
Reviewed by:	manu, des
Differential Revision:	https://reviews.freebsd.org/D55412
Sponsored by:	https://www.patreon.com/bsdivy

(cherry picked from commit 7965c93e4d4103ba6ed7ac1e5f1599c93cbcdbf7)
2026-03-12 01:38:01 +00:00
Warner Losh
1346ffb457 Makefile.inc1: Remove svn support
We don't need this, and we don't use this. It's left over from the svn
days. We stopped supporting svn as a project entirely when 12.x went
EOL. And VCS_REVSION isn't in any current ucl file or anywhere else in
the tree.

Sponsored by:		Netflix
Reviewed by	:	kevans, brd
Differential Revision:	https://reviews.freebsd.org/D52912

(cherry picked from commit 28b858f5059c8b25fa08be494699997000fce58c)

Makefile.inc1: Add back missing if

The .if defined(_MKSHOWCONFIG) covered an unusually large area, so it
should have not been removed in the last commit. I must have tested in
the wrong tree before pushing...

FixeS: 28b858f5059c
Sponsored by:		Netflix

(cherry picked from commit 106951f09fe39dc693fd7130ab4bc751e1438631)
2026-03-12 01:37:38 +00:00
Kenneth D. Merry
7fe98ee4d4 mt(1)/libmt: Add LTO-10 density codes and specs.
These were obtained from IBM specs and actual tapes/drives.

Standard LTO-10 cartriges hold 30TB raw, 75TB with 2.5:1 compression.
Premium LTO-10 cartridges hold 40TB raw, 100TB with 2.5:1 compression.
LTO-10 tape drives are not backward compatible with previous generation
LTO tapes. (This is a change from older generation drives.)

Since the Premium tape is a new thing for LTO, we'll call this density
code LTO-10P vs. the standard LTO-10.  The barcode identifier for LTO-10
tapes is "LA"; the barcode identifier for LTO-10P tapes is "PA".

LTO-10 cartridges contain 1035m of tape, while LTO-10 Premium
cartridges contain 1337m of tape and have slightly higher density.
(Obtained from MAM data on actual tape cartridges and the density
report, obtained via 'mt getdensity'.)  LTO-10 cartridges use a
polyethylene naphthalate (PEN) film substrate. LTO-10 Premium
cartridges use an Aramid (aromatic polyamide) substrate that is thinner
and stronger, allowing a longer tape to fit in the same cartridge form
factor.

usr.bin/mt/mt.1:
	Add density codes and specs for LTO-10 and LTO-10P.

lib/libmt/mtlib.c:
	Add density codes for LTO-10 and LTO-10P.

Sponsored by:	Spectra Logic

(cherry picked from commit 930486f9be5c884d1d2f0aae9f81a3f5af1f2718)
2026-03-11 14:33:17 -04:00
Jessica Clarke
b373cf4ff1 krb5: Include <features.h> on Linux so __GLIBC__ can be checked
__GLIBC__ is not pre-defined by the toolchain, it comes from features.h,
so we need to make sure that's included by this point.

Fixes:	4dd2b869cd07 ("krb5: Fix -Wint-conversion when bootstrapping on GNU/Linux")
(cherry picked from commit 34e7a57673c9730ee5d1f7ebb07e152567bd8e0b)
2026-03-11 10:36:36 -07:00
Jessica Clarke
fdddd0058e krb5: Fix -Wint-conversion when bootstrapping on GNU/Linux
This shows up in GitHub Actions as a warning, and some compilers can
default to it being an error.

(cherry picked from commit 4dd2b869cd078ed6f40c42d1ef429222da16a58f)
2026-03-11 10:36:36 -07:00
Bjoern A. Zeeb
4c7dbe9f79 usb: umass: add SCSIEJECT quirk and fix RTW8821CU_CD (USB mode switch)
Several Realtek (and lots other) USB dongles present themselves as
CDROM device first.  Upon eject they do a mode switch and suddenly
are a different kind of device (sometimes even with different IDs),
e.g., a wireless dongle.

In order to avoid the CDROM stage and rather than adding the quirk
handling to more drivers, add support to umass and if enabled
automatically eject the "CDROM" to make it the real device.

Longer-term some other drivers could stop using their hand-rolled
support for this.  It is unclear as-to how much we need the list of
(eject) quirks from u3g here, or if these are very specific to that
kind of devices.

Sponsored by:	The FreeBSD Foundation
Fixes:		b3b6a959c8, 9c0cce3283
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D54901

(cherry picked from commit b4daeded66b5e950ed8e618d66915b863c2414b1)
2026-03-11 16:53:25 +00:00
Bjoern A. Zeeb
68fcf0b94c net80211: fix VHT160/80P80/80 chanwidth selection in the "40-" case
Depending on the base channel ni_vht_chan2 - ni_vht_chan1 can be
negative.  Apply abs() as indicated in the comments right above
	| CCFS1 - CCFS0 | = 8  or > 16
in order to fix the channel width selection.

Sponsored by:	The FreeBSD Foundation
PR:		293645
Fixes:		4bf049bfee
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D55717

(cherry picked from commit 6cfd2b93e68061c7831016b91c2e308d01658764)
2026-03-11 16:53:24 +00:00
Bjoern A. Zeeb
86417d5b06 LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULL
Usually after a firmware crash, we see reports of crashes in
lkpi_sta_auth_to_scan().  One of the last ones was in the PR
mentioned below.

These crashes are often attributed as the problem while the real
problem happened before.

At this point try avoid the NULL pointer and to fail graciously if
lvif->iv_bss (lsta) is no longer set.  This way users have a chance
to possibly recover using netif restart wlan0 rather than dealing
with a panic.

See if this helps us to better track down the original problems
rather than the follow-up crash.

On a debug kernel the KASSERT should normally have caught that
condition as well but we see panics on page faults were the log
line was there but then the lsta->ni deref has happened, which is
after the KASSERT.  I have not checked if this is a reordering problem
or if the people reporting had IEEE80211_DEBUG on but not INVARIANTS.

Sponsored by:	The FreeBSD Foundation
PR:		286219 #c11

(cherry picked from commit 53c69fd933dc49f69d5603fb27ce51064ebe681e)
2026-03-11 16:53:24 +00:00
Ed Maste
9450995203 share/dict/web2: Sort
PR: 293659
Fixes: e49b6ead41 ("Add a number of five letter words to the dictionary")
(cherry picked from commit 72f0bc868bf00586cba1e50057d8f1998b4abe80)
2026-03-11 12:46:55 -04:00
Siva Mahadevan
56401a9c34 LinuxKPI: avoid -Werror=unused-value in sort() from BUILD_BUG_ON_ZERO()
The BUILD_BUG_ON_ZERO() macro returns an (int)0 if it does not fail
at build time. LinuxKPI sort() has it as a guard for an unsupported
argument but ignores the return value.

This leads to gcc complaining:

/usr/src/sys/compat/linuxkpi/common/include/linux/build_bug.h:60:33: error: statement with no effect [-Werror=unused-value]
   60 | #define BUILD_BUG_ON_ZERO(x)    ((int)sizeof(struct { int:-((x) != 0); }))
      |                                 ^
/usr/src/sys/compat/linuxkpi/common/include/linux/sort.h:37:9: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
   37 |         BUILD_BUG_ON_ZERO(swap);                        \
      |         ^~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/dev/rtw89/core.c:2575:9: note: in expansion of macro 'sort'
 2575 |         sort(drift, RTW89_BCN_TRACK_STAT_NR, sizeof(*drift), cmp_u16, NULL);

Change to BUILD_BUG_ON() for the statement version.

Reported by:	CI
Co-authored-by:	bz
Approved by:	emaste (mentor)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D55634

(cherry picked from commit f26cb4757eb74ceace39144933ae198ebf1b4f28)
2026-03-11 12:16:17 -04:00
Dag-Erling Smørgrav
c4c3753542 system(3): Address test robustness issue
Don't assume that SIGINT and SIGQUIT are set to SIG_DFL at the start
of the test.  Instead, retrieve their current dispositions and verify
that they are restored at the end of the test.

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

(cherry picked from commit 48368f702423742b2a7dff7ad3191625e8bf26f0)

system(3): Fix brain glitch in previous commit

We were saving SIGINT twice instead of SIGINT and SIGQUIT.

Also restore original order of operations (SIGINT then SIGQUIT), which
matches the order in which they're discussed in the POSIX description
of system(3).

MFC after:	1 week
Sponsored by:	Klara, Inc.
Fixes:		48368f702423 ("system(3): Address test robustness issue")

(cherry picked from commit 863b5c137a98d29dc6964cba0e0c4fe2a8bebab8)
2026-03-11 14:16:10 +01:00
Dag-Erling Smørgrav
3d394a1da0 system(3): Unwrap execve()
There is no need to call execl(), which will allocate an array and copy
our arguments into it, when we can use a static array and call execve()
directly.

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

(cherry picked from commit 40e52e0edd038460a2a2aca017b3ac5a513fe37b)
2026-03-11 14:16:00 +01:00
Eugene Grosbein
077da2a9e3 me.4: MFC: link if_me kernel module to its manual page.
(cherry picked from commit 46ba263d6eeb1c6029841b4c42f54912ad61de5c)
2026-03-11 14:19:59 +07:00
Konstantin Belousov
b5e307d41e Regen 2026-03-10 13:41:32 +02:00
Konstantin Belousov
3ccc39d38e renameat2(2): document
(cherry picked from commit 619e49b2ba58e1ffd2ab111fef6d1e87d77e7391)
2026-03-10 13:41:32 +02:00
Konstantin Belousov
1bb58ba12b libsys/rename.2: remove commented-out CAVEAT section
(cherry picked from commit 5f911eaba017645487a1eaee3609b26a77f0f174)
2026-03-10 13:41:32 +02:00
Konstantin Belousov
b2ae957e9c linuxolator: translate LINUX_RENAME_NOREPLACE into our AT_RENAME_NOREPLACE
(cherry picked from commit 8feb8d221cfb842ee11d744d22571baec6c18cd8)
2026-03-10 13:41:32 +02:00
Konstantin Belousov
72cf8b9e68 zfs: implement AT_RENAME_NOREPLACE
(cherry picked from commit 7a1217ff3bbdd1ef40d1b94170c53611fadeb026)
2026-03-10 13:41:31 +02:00
Konstantin Belousov
9c37c82f52 renameat2(2): implement AT_RENAME_NOREPLACE flag
(cherry picked from commit 7aaec5f3faecf98e377c97e24dddb9c65f4b2e75)
2026-03-10 13:41:31 +02:00
Konstantin Belousov
522dbeb9f2 sys: add renameat2(2) syscall
(cherry picked from commit 28599a1e5f1b90676a818e0a4818cddd0839ad25)
2026-03-10 13:41:31 +02:00
Konstantin Belousov
bbdf045677 kern_renameat(9): add flags argument
(cherry picked from commit 1f3020067ab3f3c5043d01ea1e3a3d2998a39d4a)
2026-03-10 13:41:31 +02:00
Konstantin Belousov
45401a4bde VOP_RENAME(9): add flags argument
(cherry picked from commit e486066cf48a89ba87fab6b3d2b56f271f50439b)
2026-03-10 13:41:31 +02:00
Konstantin Belousov
0b0bbdac18 zfs rename: properly cleanup on errors occuring before zfs_do_rename()
(cherry picked from commit ed87040311b88e2c95a791aa049f2c37c857f048)
2026-03-10 13:41:31 +02:00
Konstantin Belousov
b0ca929c27 x86: change signatures of ipi_{bitmap,swi}_handler() to take pointer
(cherry picked from commit fdc1f34506346fd26db8bfb80ba69d1af844c53a)
2026-03-10 13:41:31 +02:00
Konstantin Belousov
5061709d8f amd64: print userspace fsbase and gsbase for uprintf_signal
(cherry picked from commit 272ea451199462dffd55dd580532eb28ddc92174)
2026-03-10 13:41:31 +02:00