linker: Recognize SHT_INIT_ARRAY sections as constructor sections
We do this already for ET_REL files, but it was missed here. Note that
this function operates only on dynamically loaded files, not on
preloaded files.
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58245
stand: Recognize SHT_INIT_ARRAY sections as constructor sections
Pass such a section to the kernel using modinfo, otherwise link_elf.c
won't execute constructors for the file. This is required for KASAN,
otherwise redzones for global buffers are not poisoned during boot.
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58244
pfctl: fix incorrect errno checks
These calls return an error value, they do not set errno. Check their
return values.
Sponsored by: Rubicon Communications, LLC ("Netgate")
mbuf: make m_unshare() allow unmapped mbufs
m_unshare() had crashed if unmapped mbufs exist in the mbuf chain.
This was because memcpy() with mtod() was used without making sure that
the mbuf was mapped. Use m_copydata() that cares unmapped mbufs instead.
Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D58189
pfctl: fix CREATE_TABLE error handling
pfr_add_table() does not set errno, it returns an error (now).
Read the error code from the return value so we display the correct
error message to the user.
Sponsored by: Rubicon Communications, LLC ("Netgate")
exterr: allow exterr to fit pointers on CHERI targets
Switch to uint64ptr_t which is a uint64_t on traditional architectures
and a uintptr_t on CHERI architectures. This has no ABI impact on
non-CHERI kernels.
Fix truncation of 64-bit values on 32-bit kernels.
Reviewed by: kib
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D58056
sound: Pass format and speed as arguments to sndbuf_create()
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit 815dc35b7b5ed694fc1986d054149e375b8a17bd)
sound: Remove dead code in dsp_ioctl()
Sponsored by; The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit 69c4e2b68a588272de6ab86e302d87188bfef2a6)
virtio: Accept VIRTIO_F_RING_RESET in the modern PCI transport
Accept per-virtqueue reset when the device offers it, alongside
the V1 flag. Negotiating the feature merely permits the use of
per-virtqueue reset and imposes no obligation on a driver that
never uses it, while refusing capability-only transport features
can make strict devices reject the feature set altogether.
No functional change on hosts that do not offer RING_RESET.
Signed-off-by: Faraz Vahedi <kfv at kfv.io>
Reviewed-by: ngie
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2319
fibs_test: Mark same_ip_multiple_ifaces_fib0 as expected to fail
The test relies on being able to assign the same interface address to
two different tap interfaces; it then removes one of the addresses,
which at one point would trigger a kernel panic.
Since 361a8395f0b0 it is not possible to assign an address multiple
times this way, so the test fails. Just mark it as expected to fail for
now: if the kernel's behaviour here changes again, this test might be a
useful seatbelt.
MFC after: 2 weeks
(cherry picked from commit 6bdc9743d8f8c9727e5101d6cb6f2a85a13c5acb)
accept_filter: return different errors for non-listener and a busy socket
The fact that an accept filter needs to be cleared first before setting to
a different one isn't properly documented. The requirement that the
socket needs already be listening, although trivial, isn't documented
either. At least return a more meaningful error than EINVAL for an
existing filter. Cover this with a test case.
(cherry picked from commit 19307b86d31b7dea4bb5c3f7e233ee0e59049258)
netinet6: Remove ndpr_raf_ra_derived flag
This flag was introduced at 8036234c72c9361711e867cc1a0c6a7fe0babd84
to prevent the SIOCSPFXFLUSH_IN6 ioctl from removing manually-added
entries. However, this flag did actually not work due to an
incomplete implementation making prelist_update() not handle it before
calling nd6_prelist_add().
This patch removes the flag because a prefix is derived from an RA
always has an entry in the ndpr_advrtrs member in the struct
nd_prefix. Having a separate flag is not a good idea because it can
cause a mismatch between the flag and the ndpr_advrtrs entry. Testing
using LIST_EMPTY() is simpler for the origial goal.
This also removes in a prefix check in the ICMPV6CTL_ND6_PRLIST sysctl
to exclude manually-added entries. This ioctl is designed to list all
entries, and there is no relationship to SIOCSPFXFLUSH_IN6.
Differential Revision: https://reviews.freebsd.org/D46441
[2 lines not shown]
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)