Commit Graph

308225 Commits

Author SHA1 Message Date
Ed Maste e8dac3944d Makefile.inc1: Remove extraneous }
Reported by:	tijl
Fixes: 17494c6e6b ("build: Boostrap LLVM_BINUTILS for cross-tools")
2026-03-26 23:15:51 -04:00
Konstantin Belousov 5f08cdc1fb x86: move the NUM_ISA_IRQS symbol from atpic.c into x86/isa/icu.h
This is not the best location, but works for now.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56003
2026-03-27 03:20:42 +02:00
Mark Johnston f404109e90 vm_fault: Avoid creating clean, writeable superpage mappings
The pmap layer requires writeable superpage mappings to be dirty.
Otherwise, during demotion, we may miss a hw update of the PDE which
sets the dirty bit.

When creating a managed superpage mapping without promotion, i.e., with
pmap_enter(psind == 1), we must therefore ensure that a writeable
mapping is created with the dirty bit pre-set.  To that end,
vm_fault_soft_fast(), when handling a map entry with write permissions,
checks whether all constituent pages are dirty, and if so, converts the
fault to a write fault, so that pmap_enter() does the right thing.  If
one or more pages is not dirty, we simply create a 4K mapping.

vm_fault_populate(), which may also create superpage mappings, did not
do this, and thus could create mappings which violate the invariant
described above.  Modify it to instead check whether all constituent
pages are already dirty, and if so, convert the fault to a write fault.
Otherwise the mapping is downgraded to read-only.

Reported by:	ashafer
Reviewed by:	alc, kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D55536
2026-03-27 00:25:31 +00:00
Mark Johnston 8f3227f527 kqueue: Fix a race when adding an fd-based knote to a queue
When registering a new kevent backed by a file descriptor, we first look
up the file description with fget(), then lock the kqueue, then see if a
corresponding knote is already registered.  If not, and KN_ADD is
specified, we add the knote to the kqueue.

closefp_impl() interlocks with this process by calling knote_fdclose(),
which locks each kqueue and checks to see if the fd is registered with a
knote.  But, if userspace closes an fd while a different thread is
registering it, i.e., after fget() succeeds but before the kqueue is
locked, then we may end up with a mismatch in the knote table, where the
knote kn_fp field points to a different file description than the knote
ident.

Fix the problem by double-checking before registering a knote.  Add a
new fget_noref_unlocked() helper for this purpose.  It is a clone of
fget_noref().  We could simply use fget_noref(), but I like having an
explicit unlocked variant.

PR:		293382
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D55852
2026-03-27 00:24:18 +00:00
Alex S 9f16078b5f rtld: add a test for rtld_set_var (with LIBRARY_PATH_FDS)
PR:	294054
Reviewed by:	kib
MFC after:	1 week
2026-03-27 01:41:23 +02:00
Konstantin Belousov f7b368d25f rtld_get_var(3): provide explicit list of rtld vars that can be modified
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56055
2026-03-27 01:41:23 +02:00
Konstantin Belousov b9f046d941 rtld: properly handle update of several vars in rtld_set_var()
Besides setting the value in the array of the values, rtld sometimes
needs to recalculate some internal control variable for the change to
take effect.  Allow the variable description to supply a method called
on the update.  Lock the function with the bind lock for safe operation.

Mark several variables as allowed for update, since the on_update method
is provided for them.  The list is LD_BIND_NOW, LD_BIND_NOT,
LD_LIBMAP_DISABLE, LD_LOADFLTR.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56055
2026-03-27 01:41:23 +02:00
Konstantin Belousov f39754d51b fenv.h: stop declaring feclearexcept() extern inline
The function is already exported from libm.  We only need to stop
declare it extern inline, and instead provide a macro which uses the
internal inline function __feclearexcept_int() instead.

PR:	277958
Reviewed by:	dim (x86)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D55975
2026-03-27 01:41:14 +02:00
Matt Delco 7e7d4e711f x86: Handle when MPERF/APERF MSRs aren't writable
For performance and/or correct reasons some hypervisors allow
MPERF/APERF MSRs to be read but not written to. This change
modifies the handling of these MSRs to not rely on writes.
This patch is part of Google Cloud Engine (GCE) C4-LSSD turnup.

Sponsored by:		Google
Tested by:		NetApp (previous)
PR:			292808
MFC after:		3 days
Co-authored-by:		Jim Mattson <jmattson@google.com>
Reviewed by:		jrtc27, imp, kib, markj, olce, obiwac
Differential Revision:	https://reviews.freebsd.org/D55996
2026-03-26 15:02:22 -04:00
Matt Delco c505fc1468 x86: Guard clock frequency against a divide by 0
We may be running in a Virtual Machine which may not fully support
hardware performance counters. If the MPERF counter somehow ends up
at zero, return an error and fail gracefully instead of panicking.
This patch is part of Google Cloud Engine (GCE) C4-LSSD turnup.

Sponsored by:		Google
Tested by:		NetApp (previous)
PR:			292808
MFC after:		3 days
Co-authored-by:		Aymeric Wibo <obiwac@google.com>
Co-authored-by:		Jim Mattson <jmattson@google.com>
Suggested by:		jrtc27 (split out this part)
Reviewed by:		imp, obiwac, olce
Differential Revision:	https://reviews.freebsd.org/D56056
2026-03-26 15:02:06 -04:00
Jake Freeland 4b16ff49bf timerfd: Guard expected performance failure
During the timerfd__periodic_timer_performance test, only expect
failures when the expiration count is less than 400000000. This
prevents the test from being reported as a true failure in environments
where scheduling latency is high enough to delay timerfd wakeups.

Fixes:		cb692380f1 ("timerfd: Expect periodic timer ...")
MFC after:	1 week
2026-03-26 11:47:32 -05:00
Alexander Ziaee 04d58d529a manuals: System message vs kernel message
Wordsmith mentions throughout the manual of syslog and dmesg, to clearly
differentiate them in an externally consisteny way, increasing operator
onboarding speed and elegance.

The daemon that handles general system messages, syslog, describes them
as "system messages", and "messages" is the standard filename. Rewrite
syslog related manual titles to align search results with this, and hier
entries to align the index. Use care to maintain keywords and not add
extra lines. Newsyslog trades "maintain" with "rotate" for visibility.

MFC after:	3 days
Reviewed by:	markj
Closes:		https://github.com/freebsd/freebsd-src/pull/2067
2026-03-26 09:19:01 -04:00
Artem Bunichev 1e2c9bcc4e kldload.2: Provide more info about file argument
The information is basically taken from kldload(8).

Reviewed by:		kib, ziaee
Differential Revision:	https://reviews.freebsd.org/D55170
2026-03-26 09:11:28 -04:00
Robert Clausecker 23d6516773 libc/amd64/strrchr.S: fix rebase error
I accidentally dropped a part of the patch on squash rebase.
Should be fine now.

Fixes:		253f15c016
PR:		293915
MFC after:	1 week
2026-03-26 14:01:57 +01:00
Robert Clausecker 253f15c016 libc/amd64/strrchr.S: rewrite and fix scalar implementation
The original scalar implementation of strrchr() had incorrect
logic that failed if the character searched for was the NUL
character.  It was also possibly affected by the issue fixed
in 3d8ef251a for strchrnul().

Rewrite the function with logic that actually works.  We defer
checking for the character until after we have checked for NUL.
When we encounter the final NUL byte, we mask out the characters
beyond the tail before checking for a match.

This bug only affects users running on amd64 with ARCHLEVEL=scalar
(cf. simd(7)).  The default configuration is not affected.

The bug was unfortunately not caught by the unit test inherited
from NetBSD.  An extended unit test catching the issue is proposed
in D56037.

PR:		293915
Reported by:	safonov.paul@gmail.com
Tested by:	safonov.paul@gmail.com
Fixes:		2ed514a220
See also:	https://reviews.freebsd.org/D56037
MFC after:	1 week
2026-03-26 12:41:49 +01:00
Baptiste Daroussin 9b98c4b053 diff: handle read(2) failures
MFC After:	1 week
2026-03-26 10:25:50 +01:00
Baptiste Daroussin 33424fd50e diff3: plug fd leak
MFC After:	1 week
Reported by:	kib
2026-03-26 08:40:29 +01:00
Baptiste Daroussin 6d8b2ac449 diff: prefer posix_spawn over pdfork/execl
MFC After:		1 week
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D56076
2026-03-26 08:36:55 +01:00
Baptiste Daroussin 5f7f0efe8e diff3: prefer posix_spawn over pdfork/execlp
MFC After:		1 week
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D56075
2026-03-26 08:36:55 +01:00
Mark Johnston 143293c14f rpcsec_gss: Fix a stack overflow in svc_rpc_gss_validate()
svc_rpc_gss_validate() copies the input message into a stack buffer
without ensuring that the buffer is large enough.  Sure enough,
oa_length may be up to 400 bytes, much larger than the provided space.
This enables an unauthenticated user to trigger an overflow and obtain
remote code execution.

Add a runtime check which verifies that the copy won't overflow.

Approved by:	so
Security:	FreeBSD-SA-26:08.rpcsec_gss
Security:	CVE-2026-4747
Reported by:	Nicholas Carlini <npc@anthropic.com>
Reviewed by:	rmacklem
Fixes:		a9148abd9d
2026-03-25 18:11:54 -07:00
Michael Tuexen 6b2d6ccad2 tcp: plug an mbuf leak
When a challenge ACK should be sent via tcp_send_challenge_ack(),
but the rate limiter suppresses the sending, free the mbuf chain.
The caller of tcp_send_challenge_ack() expects this similar to the
callers of tcp_respond().

Approved by:	so
Security:	FreeBSD-SA-26:06.tcp
Security:	CVE-2026-4247
Reviewed by:	lstewart
Tested by:	lstewart
Sponsored by:	Netflix, Inc.
2026-03-25 18:11:54 -07:00
Jake Freeland cb692380f1 timerfd: Expect periodic timer performance failures
The current timerfd implementation fails to correctly count events on a
nanosecond callout interval. The timerfd__periodic_timer_performance
test detects this and reports failure.

Mark this test as an expected failure so it isn't flagged by CI. A link
to the bug report is attached to the test for reference.

While we're here, clean up some minor style and Make issues.

Fixes:		834c1ba793 ("timerfd: Add tests")
MFC after:	1 week
2026-03-25 19:22:55 -05:00
Rick Macklem 41b423cc4e clnt_bck.c: Delete a couple of old diagnostic printfs
There were two debug printf()s that were left in the
code while debugging the handling of callbacks over
a NFSv4.1/4.2 backchannel was being done.

This patch removes them, since they are no longer
of benefit and cause "noise".

Requested by:	wollman
MFC after:	2 weeks
2026-03-25 13:53:22 -07:00
Ali Mashtizadeh 98bedca0a4 pmc: Fix copyright in previous commits
Fix the copyright attribution to Netflix and the date and missing SPDX
line in pmc.ibs man page.

Sponsored by: Netflix

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2094
2026-03-25 15:24:18 -06:00
Gleb Smirnoff f698988084 tests/netinet: add raw:reconnect test
It tests repetitive connect(2) on AF_INET/SOCK_RAW including connect(2)
to INADDR_ANY that puts socket back into receive-all mode.
2026-03-25 12:58:28 -07:00
Olivier Cochard 648d0fefd7 ipfw: skip tests if required sysctl is not set
Since this is a configuration prerequisite rather than a test failure, use
atf_skip instead.

Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D56069
2026-03-25 16:55:57 +01:00
Lexi Winter 6900d8b5c3 packages: Remove stale libsdp-all.ucl
This package no longer exists since it was merged into bluetooth.

Fixes:	41ee4321cc ("libsdp: Move to bluetooth-lib package")
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D55822
Sponsored by:		https://www.patreon.com/bsdivy
2026-03-25 10:36:31 +00:00
Lexi Winter ea25f494b3 packages: Remove stale ftpd-all.ucl
This file was missed when ftpd(8) was removed.

Fixes:	614c8750ce ("Remove ftpd(8)")
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D55820
Sponsored by:		https://www.patreon.com/bsdivy
2026-03-25 10:36:03 +00:00
Jaeyoon Choi e2083e8d3a ufshci: Support ACPI
Supports UFS host controller attachment via ACPI. Tested on the
Samsung Galaxy Book 4 Edge using Qualcomm Snapdragon X Elite.
Additionally, a quirk related to power mode change has been added.

For reference, it doesn't reach maximum speed yet. I plan to improve
it later.

Sponsored by:           Samsung Electronics
Reviewed by:		imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D55986
2026-03-25 01:45:34 +09:00
Jaeyoon Choi 085028463f ufshci: add uic powermode parameter to sysctl
Adds parameters related to the performance of the UFS device.
Also update man page for the missing sysctl entries.

Sponsored by:           Samsung Electronics
Reviewed by:		imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D55985
2026-03-25 01:45:31 +09:00
Jaeyoon Choi c4386988ba ufshci: fix bug in ufshci_req_sdb_enable
When enabling the request queue, safely reset the list base address.
This was added due to a quirk in the Qualcomm UFS controller during
the process of activating it.

Sponsored by:           Samsung Electronics
Reviewed by:		imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D55984
2026-03-25 01:45:27 +09:00
Ed Maste 61f78130c2 stand: Force disable RETPOLINE for boot loaders
Boot loaders do not require speculative execution protection, and may be
too large if enabled.

Reported by:	Shawn Webb
Reviewed by:	dim, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56068
2026-03-24 22:33:43 -04:00
Kristofer Peterson 615f1b9eb1 kern/amd64/machdep: Replace memset in wrmsr_early_safe_end
GENERIC-KASAN kernel failed to boot on a Dell PowerEdge C6615 with
an AMD EPYC 8224P CPU; UEFI BIOS caught a #GP exception with %RIP
in kasan_memset where %GS relative pointer (curthread->td_pflags2)
was dereferenced. Investigation led to wrmsr_early_safe_end which
calls memset to clear early #GP IDT entry. Replacing memset with
__builtin_memset_inline still resulted in the compiler emitting a
call to the memset resolver in GENERIC-KASAN build and the kernel
stil faulted during boot. This version which has been successfully
tested with both GENERIC and GENERIC-KASAN kernels uses memset_early.

Signed-off-by: Kristofer Peterson <kris@tranception.com>
Reviewed-by: kib
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2069
2026-03-24 21:24:17 -05:00
Christos Longros 930a790c2a rge: make rx_process_limit a sysctl tunable
The number of packets processed per interrupt was hardcoded to 16.
Add a per-interface sysctl dev.rge.%d.rx_process_limit tunable so
users can adjust this value at runtime.

Signed-off-by: Christos Longros <chris.longros@gmail.com>

Reviewed by:	ziaee, adrian
Differential Revision:	https://reviews.freebsd.org/D56014
2026-03-24 18:27:14 -07:00
Christos Longros 8f36a012d6 rge.4: fix incorrect speed range in HARDWARE section
The HARDWARE section stated "PCIe 1GB to 1GB Ethernet devices"
which is incorrect. The RTL8125/8126/8127 chips support speeds
from 1Gbps to 10Gbps. Correct the range.

Signed-off-by: Christos Longros <chris.longros@gmail.com>

rge.4: note that the driver manages PHY directly

The rge(4) driver does not use the miibus(4) interface for PHY
management. Instead, it accesses PHY registers directly via the
chip's OCP (On-Chip Peripheral) bus. Document this in the
DESCRIPTION section.

Signed-off-by: Christos Longros <chris.longros@gmail.com>

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D55995
2026-03-24 18:26:10 -07:00
Brad Smith f7fd4e79fa rge: handle interface flags changes
Handle interface flags like other drivers do.

Reviewed by:	zlei, adrian
Differential Revision:	https://reviews.freebsd.org/D55728
2026-03-24 18:22:52 -07:00
Dag-Erling Smørgrav 41474e78c4 m4: Misc style fixes
MFC after:	1 week

Reviewed by:	fuz
Differential Revision:	https://reviews.freebsd.org/D55794
2026-03-25 01:41:23 +01:00
Marc Espie f8f6f1cbd5 m4: Stop abbreviating builtin names
* Stop abbreviating macro names half-randomly to 8 chars, this is no
  longer 1990.

* Likewise for function names (in particular use doindex for a function
  that is notably different from the classic index function).

* Rename a few things for more fidelity: eval is the builtin name, not
  expr and your maketemp/mkstemp conform to mkstemp semantics for better
  security.

* Rewrap a few comments that were ludicrously short.

No functional changes except improved accuracy of some error messages.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55793
2026-03-25 01:41:18 +01:00
Pouria Mousavizadeh Tehrani 769a6f803d tcp_usrreq: Only allocate TFO counter when required
During tcp_usr_listen(), only allocate TFO counter when required.

Reviewed by: tuexen, glebius
Differential Revision: https://reviews.freebsd.org/D56067
2026-03-25 01:32:45 +03:30
Gleb Smirnoff cd05c88058 tests/netinet: add test for getsockname() on a disconnected TCP socket
Stack it into existing file that exercises an other corner case of our
TCP and rename the file to a more generic name.
2026-03-24 14:24:58 -07:00
Ed Maste fadebab18d Vendor import of libfido2 1.16.0
Sponsored by:	The FreeBSD Foundation
2026-03-23 13:24:10 -04:00
Ed Maste c06c65e030 Vendor import of libfido2 1.15.0
Sponsored by:	The FreeBSD Foundation
2026-03-23 13:23:05 -04:00
Olivier Certner 954aaf3958 MAC/do: Comments: Rephrase one, fix a typo in another
No functional change.

MFC after:      3 days
Event:          AsiaBSDCon 2026
Sponsored by:   The FreeBSD Foundation
2026-03-21 14:39:04 +01:00
Christos Margiolis 82a066b859 snd_dummy: Fix sys/conf/files entry
Fixes:		72e85a4d97 ("snd_dummy: Add to sys/conf/files and sys/conf/NOTES")
Report by:	CI
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D56065
2026-03-24 15:10:44 +01:00
Pouria Mousavizadeh Tehrani cbac897a7b in6_mcast: Acquire ref to ifp and exit epoch earlier in sysctl
This patch reduces the number of witness warnings during ifmcstat(8) calls.

Reviewed by: glebius, zlei
Differential Revision: https://reviews.freebsd.org/D56052
2026-03-24 17:07:23 +03:30
Dag-Erling Smørgrav e6a77f81d1 cd9660: Partial style sweep of Rock Ridge code
This mostly just fixes indentation and continuations and adds spaces
after commas and around binary operators and parentheses around return
values, but cd9660_rrip_extref() was so egregiously unreadable I
rewrote it.  Note that this was done manually, so I may have missed a
few spots, and I made no attempt to fix over-long lines.

MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55865
2026-03-24 12:29:37 +01:00
Dag-Erling Smørgrav fa03f93e88 file: Parse some UFS2 flags
This allows libmagic to recognize the FS_DOSOFTDEP, FS_SUJ, FS_GJOURNAL,
FS_ACLS, and FS_NFS4ACLS flags on a UFS2 file system.

Accepted upstream as 482259e5e952.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56010
2026-03-24 12:02:32 +01:00
Dag-Erling Smørgrav 828de702ad syslogd: Allow killing when in foreground
Normally, syslogd reacts only to SIGTERM, and ignores SIGINT and SIGQUIT
unless in debug mode.  Extend that to also apply when running in the
foreground.  Take this opportunity to comment the event loop.

MFC after:	1 week
Reviewed by:	jfree
Differential Revision:	https://reviews.freebsd.org/D55886
2026-03-24 11:58:53 +01:00
Christos Margiolis 2e1cf24229 sound: Remove unimplemented chn_reinit() definition
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-03-24 11:38:42 +01:00
Christos Margiolis d048cec5fb sound: Remove dead code in pcm/ac97.c
ac97_uninitmixer() does not exist also.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D56045
2026-03-24 11:38:42 +01:00