authpf(8) read_config() should chop off trailing white space
if administrator mistakenly types into configuration file
anchor=authpf_test
where 'authpf_test' is followed by white space, the authpf(8)
is going to use anchor 'authpf_test ' instead of the 'authpf_test'
which is defined in pf.conf(5) as 'anchor authpf_test/*'
issue kindly reported and patch submitted by
Avinash Duduskar <avinash.duduskar (_at_) gmail (_dot_) com>
OK sashan@
PR: 296958
MFC after: 1 week
Obtained from: OpenBSD, sashan <sashan at openbsd.org>, 2d12a8e44d
Sponsored by: Rubicon Communications, LLC ("Netgate")
exec: Avoid overflow when computing the size of the exec map
On a test system with 1024 cores the size of exec map exceeds 4GB, and
all of the operands in the size calculation are 32-bit integers.
Tested by: Jim Huang Chen <jim.chen.1827 at gmail.com>
MFC after: 1 week
Sponsored by: AMD (hardware)
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
(cherry picked from commit 954001a9dd363da9184706657eb34f9622bb220f)
loader: Allocate trampoline as EfiLoaderCode, not Data
Firmware on a test machine applied NX to non-code allocations, which
resulted in a fault when jumping to the trampoline.
Reviewed by: kib
Tested by: Jim Huang Chen <jim.chen.1827 at gmail.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58383
exterror tests: harden the checks
Skip the message-content check on kernels that do not advertise the
exterr_strings feature, and pin the output format by clearing
EXTERROR_VERBOSE.
Reviewed by: kib
MFC after: 1 week
Assisted-by: Claude Code (Fable 5)
Differential Revision: https://reviews.freebsd.org/D58322
exterror: advertise error strings via kern.features.exterr_strings
Allow userland, in particular test cases for EXTERROR conversions,
to detect at run time whether extended errors include the
descriptive message strings, which depends on the EXTERR_STRINGS
kernel option and cannot be probed in any other way.
Reviewed by: kib
MFC after: 1 week
Assisted-by: Claude Code (Fable 5)
Differential Revision: https://reviews.freebsd.org/D58321
watchdog: Fix a couple type issues
* Force the type of the literal `1` passed to nstosbt() to ensure it's a
64-bit type (or larger). Otherwise it gets inconveniently typed to
int, resulting in truncation.
* Use `flsll()` when converting sbt to power-of-2-nanoseconds to fix
32-bit compatibility.
PR: 292616
Obtained from: Hewlett Packard Enterprise
Fixes: 26d6617f3 ("watchdog: Convert to using sbintime_t format")
(cherry picked from commit d08cb1dc17486920c1506f175d77259e0ac3f3a3)
vtnet: Accept VIRTIO_NET_F_CTRL_RX_EXTRA
Although the driver does not issue the extra receive-mode commands
accepting the feature is harmless and some devices, notably Apple's
Virtualization.framework, offer their control-queue features as a
group and refuse FEATURES_OK unless the whole set is acknowledged.
Signed-off-by: Faraz Vahedi <kfv at kfv.io>
Reviewed by: adrian
Pull Request: https://github.com/freebsd/freebsd-src/pull/2322
vtnet: Implement VIRTIO_NET_F_GUEST_ANNOUNCE
When the device sets VIRTIO_NET_S_ANNOUNCE in the config status
field, for example after a VM migrates to a new host, announce
the interface's presence on the network so peers and switches
learn the new attachment point, then acknowledge the request
with the VIRTIO_NET_CTRL_ANNOUNCE_ACK control command, as per
VirtIO v1.3, 5.1.6.5.4.
The announcement raises iflladdr_event: the stack sends gratuitous
ARPs and unsolicited neighbor advertisements for the interface's
addresses, and stacked interfaces such as vlan(4) propagate the
event and announce theirs as well. The event handlers may sleep,
so the work is deferred from the config change interrupt to a task
on taskqueue_thread; that context also allows the acknowledgement
to be skipped safely if the interface was stopped in the meantime,
in which case the device keeps the bit set and the request is
re-delivered with the next config change interrupt.
[3 lines not shown]
vtnet: Retry feature negotiation without offloads
A device is permitted to reject an otherwise valid subset of its
offered features by refusing to accept FEATURES_OK (VirtIO v1.3,
2.2.2). Apple's Virtualization.framework does this in practice;
it treats the offered CSUM/TSO offloads as all-or-nothing, while
vtnet's default request contains only part of that group because
of hw.vtnet.lro_disable that would drop the guest TSO bits, thus
negotiation fails and the device does not attach.
If FEATURES_OK is rejected, retry the negotiation once with every
offload-related feature stripped. Changing the feature set after
a failed FEATURES_OK requires re-initialising from device reset
(VirtIO v1.3, 3.1.1), so the retry goes through virtio_reinit().
A NIC without offloads is preferable to no NIC at all. Devices
that accept the initial feature set are unaffected, while those
that also reject the reduced set continue to fail attachment as
before.
[4 lines not shown]
LinuxKPI: 802.11: always lock around (*set_{frag,rts}_threshold)
We would lock the downcalls during normal operation but not during
vap (vif) creation as there was no need for locking.
Add the missing locking there as drivers seem to always expect it
(by assertion) and cannot distinguish between state.
Add the assertions to the downcalls as we need both of them locked
and both of them can sleep.
PR: 296185 ("rtw89(4) freezes the system with INVARIANTS kernel")
Debugged by: Artem Bunichev (temcbun gmail.com)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
contigmalloc.9: Note that M_WAITOK may still return NULL
Reviewed by: markj, bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58382
hwpmc: Add EXTERROR diagnostics to the hwpmc syscall path
Annotate validation failures in the PMC syscall handlers (allocate,
attach, read/write) with EXTERROR(), so pmc(3) callers see which
precondition failed, not a bare errno.
Register HWPMC_MOD in exterr_cat.h and the generated filenames.h.
Signed-off-by: Andre Silva <andasilv at amd.com>
Reviewed by: Ali Mashtizadeh <ali at mashtizadeh.com>, mhorne
Sponsored by: AMD
Pull Request: https://github.com/freebsd/freebsd-src/pull/2180
hwpmc: Add EXTERROR diagnostics to the AMD and IBS allocators
Replace bare EINVAL in AMD/IBS allocation and config-validation with
EXTERROR(), so a failed pmc(3) allocation names the check and value.
Register HWPMC_AMD in exterr_cat.h and the generated filenames.h.
Signed-off-by: Andre Silva <andasilv at amd.com>
Reviewed by: Ali Mashtizadeh <ali at mashtizadeh.com>, mhorne
Sponsored by: AMD
Pull Request: https://github.com/freebsd/freebsd-src/pull/2180
fetch: Stop setting an alarm
Now that fetchTimeout works reliably, setting an alarm is not only no
longer necessary but counterproductive, as it will trigger even if the
connection is not actually stalled but merely slow.
While here, improve the wording of the manual page's description of the
various options for setting a timeout.
MFC after: 1 week
Reviewed by: op
Differential Revision: https://reviews.freebsd.org/D57911
(cherry picked from commit 3dddfe29248c47d1a80dc96a76a308ae910b2a24)
libfetch: Add read buffering
Previously, we would read FTP control connection messages and HTTP
reponse headers one character at a time. Now, we read as much as will
fit in our buffer and look for a newline. If there is data left over,
it will be reused by the next fetch_getln() call. This also requires
the addition of a fetch_bufread() which takes the buffer into account,
otherwise the start of the HTTP response body will be stuck in the
buffer after we read the last line of the header.
This should noticeably improve HTTP performance, especially for small
transfers.
MFC after: 1 week
Reviewed by: op
Differential Revision: https://reviews.freebsd.org/D57907
(cherry picked from commit a1978277379cf65f1339ab062f335c6f1fa6239f)
libfetch: Apply timeout to connection attempts
Mark the socket non-blocking before connecting and poll for completion,
applying fetchTimeout if set.
MFC after: 1 week
Reviewed by: op
Differential Revision: https://reviews.freebsd.org/D57909
(cherry picked from commit 848f360c8f9ae8d1d97c61f5d63fc624926d5dcd)