FreeBSD/src a48a807sys/dev/sound/pcm sound.c

sound: Centralize and improve hot-swapping

Introduce pcm_hotswap(), which is responsible for sending devctl
SND/CONN notifications.

There are two user-visible improvements with this patch:

First, in pcm_unregister(), instead of just sending a SND/CONN/NODEV
notification when all devices have detached, we also switch to the new
default device if the previously default one has detached, but there are
more left.

Second, in pcm_register(), if the device happens to also be the new
default device, we hot-swap to it. Additionally, if hw.snd.default_auto
is set to 2, then we will essentially be hot-swapping to the newest
attached device.

The latter is especially useful for laptops like the Framework 16, which
comes with a built-in snd_hda(4) speaker-microphone-only device, and

    [18 lines not shown]
DeltaFile
+36-11sys/dev/sound/pcm/sound.c
+36-111 files

FreeBSD/src 91167d0libexec/rc/rc.d virtual_oss

rc: virtual_oss: Handle absent pidfile properly

Instead of throwing errors from the programs that use it, print a
warning if the file does not exist.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    0mp, jrm
Pull-Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/33

(cherry picked from commit b2677d002edbe9308b1f8cecd1a5fc515d2a5deb)
DeltaFile
+11-6libexec/rc/rc.d/virtual_oss
+11-61 files

FreeBSD/src b8a97cclibexec/rc/rc.d virtual_oss

rc: virtual_oss: Wait for process to exit

Sometimes virtual_oss processes do not exit immediatelly. If we do not
wait for the processes to fully exit before returning from
virtual_oss_stop(), then the service restart operation might call
virtual_oss_start() too early and fail, because it will think the
service wasn't stopped and is still running.

Reported by:    jrm
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    0mp, jrm
Pull-Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/33

(cherry picked from commit 803f686938ec2472d54a26bff668e48cc4999558)
DeltaFile
+3-1libexec/rc/rc.d/virtual_oss
+3-11 files

FreeBSD/src 4910c5alibexec/rc rc.conf, libexec/rc/rc.d virtual_oss

rc: virtual_oss: Define some variables in rc.conf

They will now be part of /etc/defaults/rc.conf and be accessible by
sysrc(8).

Fixes:          70e27ecba518 ("virtual_oss: Introduce virtual_oss_default_control_device rc variable")
PR:             295560
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Reviewed by:    0mp, jrm
Pull-Reqeust:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/33

(cherry picked from commit a576e5140ef352af6cf227528d1bfc6b964516c8)
DeltaFile
+1-11libexec/rc/rc.d/virtual_oss
+5-1libexec/rc/rc.conf
+6-122 files

FreeBSD/src 93221c2tools/build depend-cleanup.sh

depend-cleanup.sh: rebuild strrchr.o on riscv64 if it came from strrchr.S

We have to switch back to the previous rule once the temporary
build fix has been replaced with a permanent fix.

PR:             295823
See also:       4996ebdb720042239a197ebec2d265cdfdf1bbf3
Reported by:    siva
MFC after:      1 week
DeltaFile
+5-2tools/build/depend-cleanup.sh
+5-21 files

FreeBSD/src c3f6dcelib/msun/src s_rsqrtf.c s_rsqrtl.c

msun: Fix up for recent rsqrt[fl] functions

Paul Zimmermann (of Core-Math and MPFR fame) graciously tested
the recently committed rsqrt[fl]() functions.  He identified 127
incorrectly rounded values for rsqrtf() in round-to-nearest mode.
This patch fixes the rounding in RN.  Exhaustive testing now shows
that rsqrtf() is corrected rounded for RN.  He also tested rsqrt()
and rsqrtl() in the interval [1,4).  Both appear to be correctly
rounded.  Finally, the patch includes small changes to comments.

A concise list of changes is

* lib/msun/src/s_rsqrt.c:
  . Fix comments.

* lib/msun/src/s_rsqrtf.c
  . Fix comments.
  . Exhaustive testing by Paul Zimmermann found 127 incorrectly
    rounded values in round-to-nearests.  These gave have the

    [10 lines not shown]
DeltaFile
+22-15lib/msun/src/s_rsqrtf.c
+3-5lib/msun/src/s_rsqrtl.c
+2-2lib/msun/src/s_rsqrt.c
+27-223 files

FreeBSD/src 4996ebdlib/libc/riscv/string Makefile.inc

libc/riscv64: temporarily unhook strrchr() from the build

A bug was discovered in the riscv64 assembly implementation of
this function.  Fall back to the generic implementation until a
fix can be developed.

PR:             295823
Reported by:    siva
MFC after:      1 week
DeltaFile
+1-2lib/libc/riscv/string/Makefile.inc
+1-21 files

FreeBSD/src 26a1180lib/libc/stdlib qsort.3

qsort.3: Document mergesort() behaviour on size overflow

Signed-off-by:  Faraz Vahedi <kfv at kfv.io>
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2243
Reviewed by:    fuz
MFC after:      1 week
DeltaFile
+11-3lib/libc/stdlib/qsort.3
+11-31 files

FreeBSD/src 5f73274lib/libc/stdlib memory.3, lib/libc/stdlib/malloc free_sized.3 free_aligned_sized.c

libc: Add free_sized() and free_aligned_sized() as per C23

Add C23 sized deallocation entry points as thin wrappers around free(3).
Implementations may ignore size and alignment hints, so behaviour stays
correct for existing allocations without validating caller metadata yet.

When jemalloc is updated to 5.3.1, rewire these to je_free_sized() and
je_free_aligned_sized() so deallocation can use the allocator's sized
deallocation (free_sized for fast paths and free_aligned_sized for
correct aligned hints.)

Please note this change satisfies the standard interface only. Both
functions should be delegated to jemalloc after the upgrade so callers
get the intended allocator behaviour; until then, hints are unused and
neither sized nor aligned-sized deallocation optimizations apply.

Signed-off-by:  Faraz Vahedi <kfv at kfv.io>
Reviewed by:    fuz
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2201
MFC after:      1 month
DeltaFile
+100-0lib/libc/stdlib/malloc/free_sized.3
+21-0lib/libc/stdlib/malloc/free_aligned_sized.c
+20-0lib/libc/stdlib/malloc/free_sized.c
+16-1lib/libc/stdlib/memory.3
+9-0lib/libc/stdlib/malloc/Makefile.inc
+7-0lib/libc/stdlib/malloc/Symbol.map
+173-11 files not shown
+175-17 files

FreeBSD/src 3501eeclib/libc/stdlib merge.c

libc: Guard mergesort() allocation size arithmetic

Signed-off-by:  Faraz Vahedi <kfv at kfv.io>
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2243
Reviewed by:    fuz
MFC after:      1 week
DeltaFile
+11-5lib/libc/stdlib/merge.c
+11-51 files

FreeBSD/src b1b4871sys/contrib/openzfs/module/os/freebsd/zfs sysctl_os.c

zfs: fix sysctl_os.c

Correctly declare vfs.zfs.metaslab.condense_pct

The following sysctls have moved to metaslab.c:
vfs.zfs.metaslab.df_alloc_threshold
vfs.zfs.metaslab.df_free_pct
vfs.zfs.metaslab.sm_blksz_no_log
vfs.zfs.metaslab.sm_blksz_with_log

Reported by:    dim at FreeBSD.org
DeltaFile
+1-54sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c
+1-541 files

FreeBSD/src b1ad740sys/dev/vt vt_buf.c vt_core.c

vt: Avoid integer overflow in CONS_HISTORY ioctl

Reviewed by:    markj, vexeduxr
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57250

(cherry picked from commit 0ae946e7223df5ef3f7980af1d774d7f593f6421)
(cherry picked from commit deaaddf1d3c4283649945553ad7e3208c8424308)
(cherry picked from commit b5a4f4bfbc95d5d5361da708728f7f4a6db2ee60)
DeltaFile
+4-5sys/dev/vt/vt_buf.c
+4-2sys/dev/vt/vt_core.c
+8-72 files

FreeBSD/src b5a4f4bsys/dev/vt vt_buf.c vt_core.c

vt: Avoid integer overflow in CONS_HISTORY ioctl

Reviewed by:    markj, vexeduxr
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57250

(cherry picked from commit 0ae946e7223df5ef3f7980af1d774d7f593f6421)
(cherry picked from commit deaaddf1d3c4283649945553ad7e3208c8424308)
DeltaFile
+4-5sys/dev/vt/vt_buf.c
+4-2sys/dev/vt/vt_core.c
+8-72 files

FreeBSD/src deaaddfsys/dev/vt vt_buf.c vt_core.c

vt: Avoid integer overflow in CONS_HISTORY ioctl

Reviewed by:    markj, vexeduxr
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57250

(cherry picked from commit 0ae946e7223df5ef3f7980af1d774d7f593f6421)
DeltaFile
+4-5sys/dev/vt/vt_buf.c
+4-2sys/dev/vt/vt_core.c
+8-72 files

FreeBSD/src d949721sys/contrib/openzfs/module/zfs zap.c zap_micro.c, sys/contrib/openzfs/tests/unit munit.c test_zap.c

zfs: merge openzfs/zfs at a170134fe

Notable upstream pull request merges:
 #18372 eaaea55b6 Consistently encode DRR_BEGIN packed nvlist payloads with
                  NV_ENCODE_XDR
 #18410 891e379d0 Fix failfast default and usage
 #18470 a2d053329 zdb: Add some more file layout output, triggered by -v
 #18472 d50f5b6d0 dsl_dir: avoid dd_lock during snapshots_changed updates
 #18493 d65015938 Vdev allocation bias/class change
 #18497 8fdc86675 zfs: annotate nested dd_lock in reservation sync
                  accounting
 #18494 956deba27 zdb: detect BRT and DDT leaks during block traversal
 #18499 c7cfe0805 zarcstat: detect attached L2ARC device with no data
 #18503 439b802e7 sa: fix sa_add_projid lock ordering
 #18508 968f4db03 zpool-attach.8: add EXAMPLES section
 #18513 45dddc452 zfs.4: Fix documentation of zfs_arc_dnode_reduce_percent
 #18516 8ff64005a zap: split implementation out into more files
 #18520 181e1b522 Fix double free for blocks cloned after DDT prune
 #18535 -multiple zstream: fix crashes when refcount tracking enabled

    [28 lines not shown]
DeltaFile
+1,119-1,529sys/contrib/openzfs/module/zfs/zap.c
+2,458-0sys/contrib/openzfs/tests/unit/munit.c
+15-1,608sys/contrib/openzfs/module/zfs/zap_micro.c
+1,458-0sys/contrib/openzfs/module/zfs/zap_fat.c
+1,170-0sys/contrib/openzfs/tests/unit/test_zap.c
+575-0sys/contrib/openzfs/tests/unit/munit.h
+6,795-3,137190 files not shown
+14,745-4,032196 files

FreeBSD/src 4a299efsys/dev/firewire firewire.c

firewire: clean up XXX comments

Remove stale and misleading XXX comments throughout firewire.c.
Most were from the original 2002 codebase and either described
correct behavior or noted aspirational improvements that never
happended.

Two actionable items retained as TODO: config ROM CRC validation
and pending xfer cleanup on detach.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D57466
DeltaFile
+9-16sys/dev/firewire/firewire.c
+9-161 files

FreeBSD/src a620746sys/dev/firewire if_fwe.c

fix(fwe): add missing net epoch around ether_input

Wrap the if_input() call in fwe_as_input() with NET_EPOCH_ENTER/EXIT.
The network stack requires epoch protection when delivering packets
via if_input, and fwe was missing it.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D57459
DeltaFile
+3-0sys/dev/firewire/if_fwe.c
+3-01 files

FreeBSD/src 390ae06sys/kern kern_procctl.c

procctl(PROC_REAP_GETPIDS): re-validate reaper after relock of proctree_lock

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57487
DeltaFile
+32-11sys/kern/kern_procctl.c
+32-111 files

FreeBSD/src 261c97bsys/kern kern_procctl.c

kern_procctl: add get_reaper_or_p() helper

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57487
DeltaFile
+10-6sys/kern/kern_procctl.c
+10-61 files

FreeBSD/src a845480sys/kern kern_procctl.c

procctl(): do not allow the process to exit inside kern_procctl_single()

Requested and reviewed by:      markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57491
DeltaFile
+15-21sys/kern/kern_procctl.c
+15-211 files

FreeBSD/src e5ef12clibexec/nuageinit nuageinit.7 nuageinit, libexec/nuageinit/tests nuageinit.sh

nuageinit: install certs in /usr/share/certs/trusted

Suggested by:   kevans
DeltaFile
+2-2libexec/nuageinit/tests/nuageinit.sh
+1-1libexec/nuageinit/nuageinit.7
+1-1libexec/nuageinit/nuageinit
+4-43 files

FreeBSD/src a170134man/man4 zfs.4, module/os/freebsd/zfs sysctl_os.c

metaslab: expose df_alloc_threshold and df_free_pct on Linux

Expose metaslab_df_alloc_threshold and metaslab_df_free_pct as module
parameters on Linux, matching their existing FreeBSD sysctls.

Reviewed-by: Alexander Motin <alexander.motin at TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Christos Longros <chris.longros at gmail.com>
Closes #18632
DeltaFile
+0-26module/os/freebsd/zfs/sysctl_os.c
+12-0man/man4/zfs.4
+8-0module/zfs/metaslab.c
+20-263 files

FreeBSD/src b35bf7etests/zfs-tests/tests/functional/cli_root/zpool_import zpool_import_parallel_pos.ksh

ZTS: relax zpool_import_parallel_pos.ksh timing

Occasionally in the CI this test will fail because the parallel import
took longer than half of the serial time (but still less than the full
serial time).  Increase the cutoff to 3/4 of the serial time to preserve
the intent yet try and avoid these false positive failures.

Reviewed-by: Chris Longros <chris.longros at gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #18634
DeltaFile
+2-2tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_parallel_pos.ksh
+2-21 files

FreeBSD/src 1ee4b5fsys/kern kern_fork.c

fork: Drop an uneeded PHOLD/PRELE pair

Support for swapping out kernel stacks was removed, so the PHOLD has no
purpose.  (And even before that, it's not clear why a swapout here would
have been problematic.)

Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D57486
DeltaFile
+0-9sys/kern/kern_fork.c
+0-91 files

FreeBSD/src 85195c0sys/netipsec ipsec_output.c

ipsec: Free entire mbuf chain on failure

Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57475
DeltaFile
+1-1sys/netipsec/ipsec_output.c
+1-11 files

FreeBSD/src 232021fsys/compat/linuxkpi/common/src linux_80211.c

linuxkpi 802.11: Free entire mbuf chain on failure

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Fixes: 0936c648ad0ee ("LinuxKPI: 802.11: update the ni/lsta reference cycle")
Fixes: c816f64e66a0d ("LinuxKPI: 802.11: plug mbuf leak")
Differential Revision: https://reviews.freebsd.org/D57477
DeltaFile
+2-2sys/compat/linuxkpi/common/src/linux_80211.c
+2-21 files

FreeBSD/src 5a7f41esys/net if_stf.c

if_stf: Free entire mbuf chain on failure

Reported by:     Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Reviewed by:    markj, bz, kp
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57476
DeltaFile
+2-2sys/net/if_stf.c
+2-21 files

FreeBSD/src 8d9dff2. Makefile.inc1

check-old-libs: Show information about packages

If pkg is installed, for each old library found to still be present,
check if any installed packages either provide or require the library,
and inform the user.

MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D53977
DeltaFile
+9-0Makefile.inc1
+9-01 files

FreeBSD/src bad3c15libexec/nuageinit nuageinit.7

nuageinit: update documentation for phone_home and final_message
DeltaFile
+32-1libexec/nuageinit/nuageinit.7
+32-11 files

FreeBSD/src 68e60bblibexec/nuageinit nuage.lua

nuageinit: expose decode_base64 to fix tests
DeltaFile
+1-0libexec/nuageinit/nuage.lua
+1-01 files