snd_uaudio: Initialize mixer_lock with MTX_RECURSE
Fixes: fc9dc8482396 ("snd_uaudio: Lock usbd_transfer_start() in uaudio_mixer_ctl_set()")
PR: 296682
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
mlx5ib: use the eventfd_ctx API for DEVX event subscriptions
The DEVX_SUBSCRIBE_EVENT redirect path resolved the user's eventfd with
fdget(), which on FreeBSD only finds LinuxKPI files. rdma-core creates
the eventfd with the native FreeBSD eventfd(2), so the lookup failed and
subscription returned EBADF; the delivery side likewise assumed a
LinuxKPI-pollable file.
Use the LinuxKPI eventfd_ctx API instead: eventfd_ctx_fdget() resolves
the native eventfd, eventfd_signal() notifies it, and eventfd_ctx_put()
releases it. DEVX async events can then be delivered through a redirect
eventfd.
Reviewed by: kib
Sponsored by: Nvidia networking
MFC after: 1 month
bsd.cpu.mk: Add a workaround for erratum 843419
Add a workaround for the Arm Cortex-A53 erratum 843419. This has been
targeted when the build is either unoptimised for any CPU/architecture
or targets the Cortex-A53 or ARMv8.0 architecture.
PR: 296240
PR: 296395
Reported by: Hal Murray <halmurray+freebsd at sonic.net>
Reported by: Andreas Schuh <x55839 at icloud.com>
Reviewed by: cognet, mmel
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D58212
init(8): extract reroot transient code into reroot_seed
Since init become dynamically linked, reroot appeared to be broken
because init copies itself into a transient tmpfs mount to continue
controlling execution right after the reboot(REROOT) syscall. Because
the binary is dynamically linked, it cannot be properly executed.
Provide a minimal static binary 'reroot_seed' embedded into the init as
byte stream, which performs what the 'init -r' did, namely, the second
phase reroot.
For the static build of init as part of the /rescue crunch, keep the
inline reroot code.
Reported and tested by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58164
Revert "rk_gpio: defer level-IRQ EOI until source line is driven low"
There is a more correct / preferable scheme for handling of EOI.
Requested-by: mmel
This reverts commit 8ffb400bfd64102ac2a49639ccbbfffbe0c6f127.
tests: Add pjdfstest integration
Use ATF to wrap the new reimplementation of pjdfstest that came out of
GSOC 2022, now available in the ports tree as filesystems/pjdfstest.
So far I added tests for UFS (with several different option
combinations), tmpfs and ZFS, plus ZFS+nullfs. All of these create a
memory disk, initialize the filesystem, and point the pjdfstest
executable at it.
In the future it would be good to add tests for at least NFS and p9fs.
Reviewed by: asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D56605
(cherry picked from commit 8fd4d1c0fff8441b42dbab767810db7aeaf796c3)
linux/futex: Don't load a timeout when try-locking a mutex
linux_sys_futex() does not copyin a timespec for the timeout if the
operation is LINUX_FUTEX_TRYLOCK_PI, presumably because it doesn't make
sense to specify a timeout for a try-lock operation. However, this
means that we pass a userspace timespec pointer to
linux_umtx_abs_timeout_init().
Modify linux_futex_lock_pi() to not initialize the timeout if we're
try-locking.
Reviewed by: kib, dchagin
Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,
and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58061
(cherry picked from commit 407c7c339adb429efcb6658accd16399031c34ca)
install: Explicitly include sys/param.h for MAXPATHLEN
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit ca89b0fa1a93744a5bbf7a5c949826bbee4e2559)
makefs/zfs: Explicitly include sys/param.h for nitems()
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 88deb1cff92cb3620c248f32fa6e7bdbc5301213)
librpcsec_gss: Fix an off-by-one in rpc_gss_get_principal_name()
Include an extra byte for the nul-terminator, otherwise we may end up
with an out-of-bounds write.
The corresponding bug in the kernel implementation was fixed by commit
e3081f7e3e2d ("kgssapi(4): Fix string overrun in Kerberos principal construction").
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D57738
(cherry picked from commit 635ad6f2ec97e9c6b1f15620cd5ee84eb632082f)
Reset kvo_laundry to prevent it being cumulative
`sysctl vm.objects`, used by `vmstat -o` was not resetting the
laundry counter to 0 inside the loop, causing it to show the sum of
the laundry count for all previous objects instead of only the laundry
count for the current object.
Fixes: a86373bc93ee1c850943e8585d0d426479378145
Reviewed by: markj
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D50907
(cherry picked from commit 32f9c9699a5a56ef8ef1da8e2974a8b34e2b84f5)
kinst/arm64: Fix return values from kinst_invop()
After commit 853cd8723494 it became invalid for kinst_invop() to return
0: dtrace_invop_start() would convert this to a sentinel value
indicating that it did not consume the breakpoint, and so we'd just
call kdb_trap() to handle it.
Change kinst_invop() to return NOP_INSTR after handling a matching
breakpoint. NOP_INSTR is handled by advancing the ELR, so we have to
compensate by subtracting INSTR_SIZE before returning.
Reviewed by: christos
MFC after: 1 week
Fixes: 853cd8723494 ("arm64: Clean up usage of the dtrace invop handler")
Differential Revision: https://reviews.freebsd.org/D56987
(cherry picked from commit d6f0e671d0797b56011880f84d12ce5fb20bf099)
sound: track kqueue low watermark per-knote for mmaped channels
Use kn->kn_sdata to track the last bs->total value for each knote
attached to an mmaped channel. An event is delivered only when the total
byte counter has advanced by at least c->lw since the last delivery.
After delivery kn_sdata is updated to the current total.
Each knote tracks its own watermark independently, so multiple knotes
attached to the same mmaped channel all receive events correctly.
Non-mmap channels keep the existing level-triggered behavior via
chn_polltrigger().
MFC after: 1 week
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D57833
(cherry picked from commit 24576c39789ca13846b9450155923ee0e377aeb4)
libalias: Serialize updates to the global instance list
libalias maintains a global list of all libalias handles. The list was
updated without any locking, but nothing prevents updates from running
concurrently.
MFC after: 1 week
(cherry picked from commit 2ff705f32a2033201a8f83f1ade5ddbc0460387d)
kernel: Enable -fstack-protector-strong by default
This extends stack canary use to all functions which define arrays on
the stack, not just those which operate on byte buffers. This option
would have made it harder to exploit SA-26:18.setcred and
SA-26:08.rpcsec_gss.
The change bloats the amd64 kernel text by about 350KB and increases the
number of covered functions from ~1500 to ~9000 (within the kernel
itself, i.e., not counting kernel modules).
Reviewed by: olce, olivier, emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D56870
(cherry picked from commit 8deebce931fa9b469cf28a082038a64caf972602)
ucode: Fix validation on Intel platforms
The check for the extended signature table was backwards, so we always
ignored it.
We should verify that the extended signature table fits within the total
image size.
Reviewed by: jrm, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D57209
(cherry picked from commit 0beb172898499fff51eed4df3d9284cd1094afbb)
linuxkpi: Add `acpi_video_get_edid()`
Like the rest of <acpi/video.h>, this function is unimplemented and
returns `-ENODEV`.
The amdgpu DRM driver started to use it in Linux 6.13.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57576
mlx5ib: initialize DEVX subscription state before the eventfd fdget()
In the DEVX_SUBSCRIBE_EVENT handler the eventfd path can fail and
"goto err" before the subscription's xa keys and ev_file have been set;
they are still zeroed from kzalloc(). The cleanup then looks up a
level-1 xa entry with key 0, gets NULL, and faults dereferencing it.
Initialize the fields the cleanup path relies on right after the
subscription is allocated, before it is linked and before the fallible
fdget(), so a later failure unwinds cleanly.
Reviewed by: kib
Sponsored by: Nvidia networking
MFC after: 1 month
ena: Put taskqueues into correct domain if !RSS
When compiled without 'options RSS', the ena driver created taskqueues
using taskqueue_start_threads_cpuset passing a mask value of NULL,
both in the ena_setup_tx_resources path (for enqueues) and in the
ena_create_io_queues path (for the completion-processing).
In the default configuration, on most EC2 instances, this results in
taskqueues running in the right NUMA domain, but only by accident; in
non-default configurations (e.g. with with multiple EBS volumes
attached and associated NVMe taskqueues) the taskqueues may land in
the wrong NUMA domain even on instance types where the one-EBS-one-ENA
case produces the desired results.
Set (struct ena_que)->domain and use that to inform the choice of CPU
sets. On a c8gn.48xlarge EC2 instance this doubles throughput on a
32-TCP-stream benchmark.
Reviewed by: akiyano
[3 lines not shown]
routing: Include <sys/eventhandler.h> in nhop_ctl.h
Fix missing Include which is currently leaked through vnet code.
Reported by: bz
Fixes: d05d1f256082 ("routing: Subscribe nhops to ifnet link events")
Differential Revision: https://reviews.freebsd.org/D57375