FreeBSD/src 245157fsys/kern kern_synch.c kern_ktrace.c, sys/sys ktrace.h

ktrcsw(): should not be called when the thread is owning interlock or on sleepq

The issue is that for ktrcsw() we lock the ktrace_mtx mutex while owning
the interlock from a subsystem that called msleep().  In particular, the
VM subsystem might call msleep() if page allocation failed.  This
establishes order VM locks (e.g. domain free queue lock) -> ktrace_mtx.
Calling free() while owning ktrace_mtx gives the reverse order.

Worse, msleep_spin_sbt() call s ktrcsw() while the thread is put on
sleep queue.  Then, since the mutex might be contested, the thread needs
to be put on turnstil, which cannot work.

Move the ktrcsw() call for switch-out after the wakeup, when the thread
does not yet re-obtained any locks.  From there, we call a special
version of ktrcsw(), which is passed the actual time when the context
switch occured.

The drawback is that the switch-out record is only written in the
ktrace.out file after the switch-in occurred, but this is probably not

    [7 lines not shown]
DeltaFile
+11-15sys/kern/kern_synch.c
+16-2sys/kern/kern_ktrace.c
+1-0sys/sys/ktrace.h
+28-173 files

FreeBSD/src bda8028release/pkg_repos release-dvd.conf, release/scripts pkg-stage.sh

release: Ship firmware from kmods repo on DVD

The packages for X.Y-RELEASE are a snapshot of the quarterly branch
for stable/X, i.e. typically built on X.(Y-1)-RELEASE.  (The case of
Y=0 is an exception for obvious reasons.)  This works for most ports
but not for kernel modules, which may need to be built on the release
in question; this is why we have a separate "kmods" repository.

Make sure that we put the packages from the kmods repository onto the
mini-pkg-repo on the DVD rather than shipping unusable firmware.

Reviewed by:    bz
MFC after:      1 week
Sponsored by:   https://www.patreon.com/cperciva
Differential Revision:  https://reviews.freebsd.org/D52581
DeltaFile
+18-7release/scripts/pkg-stage.sh
+7-0release/pkg_repos/release-dvd.conf
+25-72 files

FreeBSD/src 93d3ac1sys/arm64/arm64 vfp.c

arm64: Fix kernel panic in get_arm64_sve during core dump

The coredump logic calls get_arm64_sve twice: once to get the note size,
and once to get the data. The note size calculation depended on the
volatile `PCB_FP_SVEVALID` flag. If this flag was cleared between the
two calls (e.g., due to a context switch clearing the flag to comply
with the ABI), the second call would expect a smaller buffer size than
the first, triggering a KASSERT panic ("invalid size").

Fix this by ensuring the SVE state is saved to the PCB before we decide
whether to use SVE or VFP.

PR: 292195
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D54532
DeltaFile
+3-3sys/arm64/arm64/vfp.c
+3-31 files

FreeBSD/src 78274fd. Makefile.inc1

native-xtools: use static LLVM libraries

Set the MK_LLVM_LINK_STATIC_LIBRARIES knob to "yes" when building the
native-xtools target. This reverts to the behaviour prior to
2e47f35be5dc.

This avoids a build failure that occurs otherwise, where compilation
fails looking for a libllvmprivate.so that was not built.

It is unclear if this addresses the issue in all instances---some
replies in the PRs indicate otherwise. Still, some report success, and
in my own testing this fixed creation of a cross-compiled poudriere
jail. Commit this while we continue to investigate...

PR:             286710, 291409
Tested by:      marck, rdunkle at smallcatbrain.com
Reviewed by:    emaste
MFC after:      3 days
Fixes:  2e47f35be5dc ("Convert libllvm, libclang and liblldb into private shared libraries").

    [4 lines not shown]
DeltaFile
+1-0Makefile.inc1
+1-01 files

FreeBSD/src 3eac385share/man/man5 src.conf.5

src.conf.5: Regen after addition of MK_SOUND

A description for WITHOUT_SOUND is still missing though.

(cherry picked from commit 3f2f3c52e6f192df435bdb5861018402ec1167d0)
DeltaFile
+6-0share/man/man5/src.conf.5
+6-01 files

FreeBSD/src 33c49c3libexec/rc rc.conf

Set virtual_oss_enable="NO" in /etc/defaults/rc.conf

This prevents 'service -e' from emitting (/var/log/messages):

/usr/sbin/service: WARNING: $virtual_oss_enable is not set properly - see rc.conf(5)

Pull Request:   https://github.com/freebsd/freebsd-src/pull/1987
Reviewed by:    christos
Signed-off-by:  eborisch at gmail.com
MFC after:      1 week

(cherry picked from commit 1b2d495a24c36d81b14178a2f898025946bff2d8)
DeltaFile
+1-0libexec/rc/rc.conf
+1-01 files

FreeBSD/src dcdb18bsys/netgraph/bluetooth/include ng_hci.h

bluetooth: Don't use a non-string to initialize NG_HCI_BDADDR_ANY

Explicitly use an array of 6 zeroes instead of a C string containing
nul characters.  GCC 15 warns about the truncation, but this is
cleaner regardless.

In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/bluetooth.h:51,
                 from usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c:45:
usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c: In function 'register_sdp':
usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c:96:13: error: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (7 chars into 6 available) [-Werror=unterminated-string-initialization]
   96 |             NG_HCI_BDADDR_ANY, (const uint8_t *)&record, sizeof(record),
      |             ^~~~~~~~~~~~~~~~~

Reviewed by:    dim
Differential Revision:  https://reviews.freebsd.org/D54869

(cherry picked from commit 72a6991b80c6e6c47a3b84337f62f0a02bd30391)
DeltaFile
+2-2sys/netgraph/bluetooth/include/ng_hci.h
+2-21 files

FreeBSD/src f388826lib/virtual_oss Makefile.inc, lib/virtual_oss/bt Makefile

lib/virtual_oss: don't (over)link to libsamplerate

These plugins require samplerate.h due to virtual_oss's int.h including
it, but don't use any symbols directly so don't link to the library.

Centralize adding the include path.

Reviewed by:    christos
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D54705

(cherry picked from commit d78291b0e9736f39f22c55c163978c1b92e601e4)
(cherry picked from commit c88f012faa13c39f13efdcef88d3141253a300ab)
DeltaFile
+1-3lib/virtual_oss/sndio/Makefile
+1-2lib/virtual_oss/bt/Makefile
+0-3lib/virtual_oss/null/Makefile
+0-3lib/virtual_oss/oss/Makefile
+2-0lib/virtual_oss/Makefile.inc
+4-115 files

FreeBSD/src 352d405lib/virtual_oss Makefile, usr.sbin/virtual_oss Makefile

virtual_oss: remove needless .include in intermediate Makefile

It doesn't define anything we use.

Reviewed by:    christos
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D54702

(cherry picked from commit 497a13601fb74c264e28eff7cd3f9ac74f0f212b)
DeltaFile
+0-1lib/virtual_oss/Makefile
+0-1usr.sbin/virtual_oss/Makefile
+0-22 files

FreeBSD/src 9be3ccdlib/virtual_oss Makefile.inc, lib/virtual_oss/bt Makefile

virtual_oss: build system tidying

general:
 - find libsamplerate's headers in the temporary sysroot instead of
   digging in the source tree.
 - use LIBADD where possible

lib/virtual_oss:
 - centralize SHLIBDIR define
 - centralize include path for internal headers
 - don't try to find libsamplerate directly in .OBJDIR

No functional changes.

Reviewed by:    christos
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D54704

(cherry picked from commit 373c72ad5044d5f84b7f3fa169d37e7214729f74)
DeltaFile
+4-5usr.sbin/virtual_oss/virtual_oss/Makefile
+2-5lib/virtual_oss/bt/Makefile
+4-2lib/virtual_oss/Makefile.inc
+1-3lib/virtual_oss/null/Makefile
+1-3lib/virtual_oss/oss/Makefile
+1-3lib/virtual_oss/sndio/Makefile
+13-212 files not shown
+14-248 files

FreeBSD/src 00964aalib/virtual_oss Makefile, usr.sbin/virtual_oss Makefile

virtual_oss: build commands/libs in parallel

Reviewed by:    christos
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D54703

(cherry picked from commit adab1dd6a70e9f2d7ac4500b186e7231afd02e04)
DeltaFile
+2-0lib/virtual_oss/Makefile
+2-0usr.sbin/virtual_oss/Makefile
+4-02 files

FreeBSD/src c88f012lib/virtual_oss/sndio Makefile

lib/virtual_oss/sndio: Remove trailing backslash

Fixes:          d78291b0e973 ("lib/virtual_oss: don't (over)link to libsamplerate")
Reported by:    pkg-fallout
Sponsored by:   The FreeBSD Foundation
MFC after:      2 days
DeltaFile
+1-1lib/virtual_oss/sndio/Makefile
+1-11 files

FreeBSD/src b928974share/mk src.opts.mk

src.opts: Remove MK_SOUND artifact

Fixes:          f74f891581bc ("src.opts: Introduce MK_SOUND")
PR:             291853
Sponsored by:   The FreeBSD Foundation
MFC after:      4 days
DeltaFile
+0-5share/mk/src.opts.mk
+0-51 files

FreeBSD/src 1539a65tests/sys/netinet6 test_ip6_output.py

ip6_output tests: Remove an unused import

No functional change intended.

MFC after:      1 week
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
DeltaFile
+0-1tests/sys/netinet6/test_ip6_output.py
+0-11 files

FreeBSD/src a03eabfsys/netinet6 ip6_mroute.c

ip6_mroute: Mark functions as static

No functional change intended.

MFC after:      2 weeks
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
DeltaFile
+10-10sys/netinet6/ip6_mroute.c
+10-101 files

FreeBSD/src 574d46bshare/man/man4 epair.4, sys/net if_epair.c

epair: add VLAN_HWTAGGING

Add capability VLAN_HWTAGGING to the epair interface and enable it by
default.
When sending a packet over a VLAN interface that uses an epair
interface, the flag M_VLANTAG and the ether_vtag (which contains the
VLAN ID and/or PCP) are set in the mbuf to inform the hardware that
the VLAN header has to be added. The sending epair end does not need
to actually add a VLAN header. It can just pass the mbuf with this
setting to the other epair end, which receives the packet. The
receiving epair end can just pass the mbuf with this setting to the
upper layer. Due to this setting, the upper layer believes that there
was a VLAN header that has been removed by the interface.
If the packet later leaves the host, the outgoing physical interface
can add the VLAN header in hardware if it supports VLAN_HWTAGGING.
If not, the implementation of Ethernet or bridge adds the VLAN header
in software.

Reviewed by:            zlei, tuexen

    [2 lines not shown]
DeltaFile
+16-12sys/net/if_epair.c
+19-1share/man/man4/epair.4
+35-132 files

FreeBSD/src 33596d9sys/dev/dpaa2 dpaa2_ni.c

dpaa2: add support for several interface counters

Add support for IFCOUNTER_IPACKETS, IFCOUNTER_OPACKETS,
IFCOUNTER_OBYTES, IFCOUNTER_OMCASTS, IFCOUNTER_OERRORS, and
IFCOUNTER_OQDROPS.
This allows tools like systat to report the incoming and outgoing
bandwidth.

Reviewed by:            dsl, Timo Völker
MFC after:              1 week
Differential Revision:  https://reviews.freebsd.org/D54893
DeltaFile
+14-0sys/dev/dpaa2/dpaa2_ni.c
+14-01 files

FreeBSD/src d76b8a9sys/powerpc/powermac platform_powermac.c

powerpc: explicitly cast the timebase printfs

This is causing compilation issues on powerpc:powerpc GENERIC.

(cherry picked from commit 03e4cc9fdeb2a6445f13cd41b471927a0f722fff)
DeltaFile
+8-8sys/powerpc/powermac/platform_powermac.c
+8-81 files

FreeBSD/src 10a0132sys/powerpc/powermac platform_powermac.c

powerpc: explicitly cast the timebase printfs

This is causing compilation issues on powerpc:powerpc GENERIC.

(cherry picked from commit 03e4cc9fdeb2a6445f13cd41b471927a0f722fff)
DeltaFile
+8-8sys/powerpc/powermac/platform_powermac.c
+8-81 files

FreeBSD/src 03e4cc9sys/powerpc/powermac platform_powermac.c

powerpc: explicitly cast the timebase printfs

This is causing compilation issues on powerpc:powerpc GENERIC.
DeltaFile
+8-8sys/powerpc/powermac/platform_powermac.c
+8-81 files

FreeBSD/src efd7c55sys/powerpc/aim moea64_native.c

powerpc: disable the TLBIE lock, it's not needed for POWER8

According to POWER8_UM_v1.3_16MAR2016 3.8.3 Translation Lookaside
Buffer (TLB), POWER8 supports lockless TLBIE operations.

Locally Tested:

* IBM POWER8 Revision 2.0, dual socket, 160 threads

Differential Revision:  https://reviews.freebsd.org/D54855
Approved by:    jhibbits

(cherry picked from commit 9a5baa9c585652fb7bd4ccd45d567204caf349f2)
DeltaFile
+5-0sys/powerpc/aim/moea64_native.c
+5-01 files

FreeBSD/src f7358bcsys/powerpc/powermac platform_powermac.c

powerpc: add a best-effort SMP time base sync for G5's that need it

There's no timebase freeze platform routine registered on my dual 2.3GHz
G5 PPC970FX Apple PowerMac.

For platforms without an explicit timebase freeze/unfreeze, we'll have to
make do with what we have - which for now is an explicit hand-crafted
spinlock/rendezvous method.

* For existing platforms, they'll still continue to clock freeze /
  rendezvous; albeit with some stronger atomic bits now (from jhibbits@.)
* Instead of the fallback being "no timesync", implement a
  best-effort one which does a similar rendezvous barrier between
  BSP and APs, but instead of freeze/unfreeze the first instruction
  after the CPUs all register they're ready is to set the timebase.

This has resulted in many reboots of my Powermac G5 dual-socket device
correctly starting and running in SMP mode.


    [4 lines not shown]
DeltaFile
+90-9sys/powerpc/powermac/platform_powermac.c
+90-91 files

FreeBSD/src 8baa4e9release/powerpc mkisoimages.sh

powerpc: fix release image building for Apple partitions

awk changed somewhere between 14 and 15 and it stopped accepting
a hexadecimal number as its input - it will always return 0.
This results in a very badly written apple boot block.

So just remove it; do the math in shell.

PR:             kern/292341
Differential Revision:  https://reviews.freebsd.org/D54639
Reviewed by:    imp
MFC after:      1 week

(cherry picked from commit 7afa03963c448a14b1735a10eaf84941b0b74862)
DeltaFile
+1-1release/powerpc/mkisoimages.sh
+1-11 files

FreeBSD/src 6665996sys/powerpc/powerpc swtch32.S swtch64.S

powerpc: put the isync inside the TD_LOCK() checking loop

Fix a narrow window where the lock is unlocked but the checking CPU
hasn't flushed things appropriately.

Inside this window the CPU inside cpu_switch() will loop forever thinking
the destination thread is still blocked/locked even though it is not.

This manifests as the system hanging after starting all APs.

I've seen this reliably trigger in qemu-system-ppc64 running power9 pseries
guests; the more CPUs the more likely it triggers at boot.

PR: kern/292167
Differential Revision:  https://reviews.freebsd.org/D54478
Reviewed by:    jhibbits
MFC after:      1 week
Relnotes:       yes

(cherry picked from commit 8df2e542146801fd01675e56724eaa567d04c209)
DeltaFile
+1-1sys/powerpc/powerpc/swtch32.S
+1-1sys/powerpc/powerpc/swtch64.S
+2-22 files

FreeBSD/src 0a45c88sys/powerpc/aim moea64_native.c

powerpc: disable the TLBIE lock, it's not needed for POWER8

According to POWER8_UM_v1.3_16MAR2016 3.8.3 Translation Lookaside
Buffer (TLB), POWER8 supports lockless TLBIE operations.

Locally Tested:

* IBM POWER8 Revision 2.0, dual socket, 160 threads

Differential Revision:  https://reviews.freebsd.org/D54855
Approved by:    jhibbits

(cherry picked from commit 9a5baa9c585652fb7bd4ccd45d567204caf349f2)
DeltaFile
+5-0sys/powerpc/aim/moea64_native.c
+5-01 files

FreeBSD/src b30d064sys/powerpc/powermac platform_powermac.c

powerpc: add a best-effort SMP time base sync for G5's that need it

There's no timebase freeze platform routine registered on my dual 2.3GHz
G5 PPC970FX Apple PowerMac.

For platforms without an explicit timebase freeze/unfreeze, we'll have to
make do with what we have - which for now is an explicit hand-crafted
spinlock/rendezvous method.

* For existing platforms, they'll still continue to clock freeze /
  rendezvous; albeit with some stronger atomic bits now (from jhibbits@.)
* Instead of the fallback being "no timesync", implement a
  best-effort one which does a similar rendezvous barrier between
  BSP and APs, but instead of freeze/unfreeze the first instruction
  after the CPUs all register they're ready is to set the timebase.

This has resulted in many reboots of my Powermac G5 dual-socket device
correctly starting and running in SMP mode.


    [4 lines not shown]
DeltaFile
+90-9sys/powerpc/powermac/platform_powermac.c
+90-91 files

FreeBSD/src c443f5dshare/man/man9 intro.9

intro.9: grammar
DeltaFile
+1-1share/man/man9/intro.9
+1-11 files

FreeBSD/src 7f537f4share/man/man9 intro.9

intro.9: deduplicate vm_page Xrs

PR:             292820
Submitted by:   Kraytonian
MFC after:      1 week
DeltaFile
+0-2share/man/man9/intro.9
+0-21 files

FreeBSD/src f54f362tools/tools/nanobsd/embedded common

nanobsd: embedded: Stub out experimental functions

Stub out both experimental functions introduced in ecc039be7fdd when
doing embedded builds.

Fixes:          ecc039be7fdd ("nanobsd: Add a NO_ROOT build option")
MFC after:      3 days
DeltaFile
+7-0tools/tools/nanobsd/embedded/common
+7-01 files

FreeBSD/src 2b22e05lib/libc/net getnetbydns.c

libc: Don't use uninitialised string for getnetbyaddr[_r](0) DNS lookup

If net is all-zero, the loop to extract all leading non-zero octets will
iterate zero times and leave nn with the value 4, which the following
switch statement to initialise qbuf does not handle. As a result,
_dns_getnetbyaddr will look up the PTR record for this uninitialised
string, which will leak the pre-existing contents of that stack memory
to the DNS resolver and, if remote and not otherwise protected, network.

Note that _dns_getnetbyaddr is only used if nsswitch.conf is configured
to enable the "dns" source for the "networks" database, which is not the
default configuration in FreeBSD.

For glibc this same bug, in code also derived from BIND's, was issued
CVE-2026-0915. This commit adopts the same behaviour as glibc's fix,
which is to regard a net of 0 as being for 0.0.0.0. Apparently NetBSD
will return NS_UNAVAIL instead, which may or may not make more sense,
but in general glibc compatibility tends to cause less friction when
there's not a good reason to avoid it.

    [7 lines not shown]
DeltaFile
+3-0lib/libc/net/getnetbydns.c
+3-01 files