epoch: Fix epoch_drain_callbacks()
This function is supposed to wait until all pending callbacks have been
executed. This is useful in some contexts where we tear down some
context (like a VNET jail and its associated UMA zones) synchronously,
and we want to make sure that all pending asynchronous callbacks (which
may free objects to said UMA zones) have run first.
The implementation schedules a callback on each CPU and waits for them
all to run. This assumes that, on a given CPU, callbacks are executed
in the order that they are pushed. This assumption depends on the
implementation of epoch_call_task() and ck_epoch_poll_deferred(), and it
is not true in general.
Callbacks are pushed onto a per-CPU stack in LIFO order.
ck_epoch_poll_deferred() first pulls out the callbacks from epoch - 2,
which are always safe to execute, and in so doing reorders them such
that the oldest callback as at the top of the stack, so in this case,
epoch_call_task() will execute them in order. However,
[22 lines not shown]
inotify: Ensure that "allocfail" is initialized in inotify_log_one()
Fixes: b70997c8c75a ("inotify: Unconditionally generate IN_IGNORED events for files/dirs")
taskqueue: Avoid unbounded epoch read sections
The taskqueue thread loop tries to avoid entering and exiting net epoch
read sections for every task. This reduces the overhead of net epoch
integration, but the implementation wasn't bounding the length of the
read section, so a busy taskqueue thread could hold an epoch open for an
unbounded period. This is easy to achieve with the epair task, for
instance.
Bound the number of tasks that we'll execute without observing the
global epoch, and provide a sysctl to control it. Let the default bound
be eight.
Reviewed by: glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D58031
timefd: Correct the required rights for timerfd_gettime()
Reviewed by: jfree
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58084
hrfkill: Add driver to report RFKILL button press
This driver only reports the RFKILL button presses.
This is needed for the "airplane" key on some Framework laptops.
Reviewed by: wulf, ziaee
Event: Halifax Hackathon 202606
Location: vishwin@'s car
Co-authored-by: Daniel Shaefer
Sponsored by: Framework Computer Inc
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57838
kern_writefile(): fix several regressions
sendfile(): for trailers uio, set uio_rw to UIO_WRITE instead of checking it
kern_filewrite(): remove unused argument offset
kern_writev(): the check should compare cnt against zero, not uio_resid
Reported by: markj
Fixes: dfad790c8cca ("sendfile: stop abusing kern_writev()")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
fwisound: add Apple FireWire audio driver
Expose audio capture from Apple FireWire devices as a standard
pcm(4)/dsp(4) device via the newpcm framework.
(adrian: I've tested this on an isight camera and looped
it back to USB speakers via "sox -t oss /dev/dsp3 -t oss /dev/dsp4")
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D58109
fwcam: retry ISO enable after re-powering camera
Some IIDC cameras power down the sensor when inactive (e.g. lens
cover closed) and reject ISO enable with EIO. Re-power the camera
and retry once before failing.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D58101
fwcam: defer ISO streaming to first read
Moved ISO start to first usage. Opening the device now
only validates state and increments the open count, allowing info
queries and mode changes without starting the camera. ISO streaming
begins on demand when userland first reads frame data.
This avoid the camera led to turn-on at attach.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D58100
linux: Fix sockopt copyout
The Linux getsockopt did not check the size of the provided buffer when
copying out the value, leading to buffer overflows (e.g., for TCP_INFO).
Fix is to use the smaller of the option value size and the provided
buffer.
(cherry picked from commit 471fdd91d9156aeab026dc420fb97d97be872d65)
linux: Add support for PR_SET_VMA to prctl(2)
Implement dummy support for PR_SET_VMA with PR_SET_VMA_ANON_NAME in
prctl(2). This prevents applications from receiving EINVAL when
attempting to name anonymous memory regions.
(cherry picked from commit a64148e21bb4ac976345cbedbd32942f97f07cc1)
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)
virtio/p9fs: Define the channel list mutex as static
No functional change intended.
MFC after: 1 week
(cherry picked from commit 2586f9f459adc6610957ba0d74a167b85fe24ac7)
p9fs: Remove the "cancel" transport method
Nothing calls it, and the existing virtio transport doesn't implement
it. No functional change intended.
MFC after: 1 week
(cherry picked from commit 94989248641a17f5c2afc367df4845e4113779a1)
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)
libnetbsd: Avoid bringing in all of sys/param.h in sys/types.h
It's okay to hard-code NBBY, as the value is somewhat unlikely to
change.
The pollution from sys/param.h makes it harder to import test code from
NetBSD since it can introduce conflicting definitions, e.g.,
MIN()/MAX().
Reviewed by: ngie
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57754
(cherry picked from commit 0976744085bcd7ebda9779b02d78a85254b3e352)