Remove {ATF,PLAIN}_REQUIRE_KERNEL_MODULE macros
These macros predated the `require.kmod` (ATF) and `required_kmods`
(kyua) test metadata and are no longer needed.
Add a hint to freebsd_test_suite/macros.h about the `*FEATURE*` macros
going away soon. See [this kyua issue][kyua-issue] for more details.
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D61082
[kyua-issue]: https://github.com/freebsd/kyua/issues/346
mii: call only PHY_STATUS() from mii_pollstat()
When we are in mii_pollstat() which effectively is called only from
ue_mii_sts methods of various drivers, we are interested in polling the
status and not making any actions.
What PHY_SERVICE(,, MII_POLLSTAT) effectively did was PHY_STATUS()
followed by mii_phy_update(). The latter is undesired, as we already may
be servicing a link state change event and posting a second one is not
what we want. Usually mostly harmless, this second event would panic when
device is calling into mii during its detach (e.g. USB device).
NB: there are few drivers that would do extra stuff between PHY_STATUS()
and mii_phy_update() in their mii_service methods. This seems irrelevant
to me when we are in ue_mii_stat/mii_pollstat. But I could be wrong.
See the PR for longer discussion.
PR: 290417
tests/ssl_sendfile: size socket buffers before connecting
The :grow, :truncate and :eagain_vs_eof cases rely on the socket buffers
filling up before the whole file has been sent. :grow and :truncate shrank
SO_SNDBUF and SO_RCVBUF only after the connection was established, when
the receiver had already advertised a window based on the default buffer
size; TCP does not shrink an advertised window. :eagain_vs_eof used the
default, autosized buffers. With a large net.inet.tcp.recvspace, or once
autosizing has grown the buffers, the whole 2 MB file fits in the socket
buffers:
:grow and :truncate: sendfile(2) returns before the file is resized, and
the poll loop that waits for the sender to block spins forever on a
writable socket.
:eagain_vs_eof: the loop that keeps writing until
EAGAIN never sees it, since sendfile(2) returns 0 at EOF.
Either way kyua reports a timeout, which is why doubling the timeouts did
not help. Apply a 128 KB buffer size to the listening socket, which the
[12 lines not shown]
bhyve/riscv: fix PCIe FDT interrupt-map entry stride
In bhyve arm64, each PCIe interrupt-map entry spans 10 cells because the
ARM GIC specifies #interrupt-cells = 3. On RISC-V, the APLIC uses
#interrupt-cells = 2, so each entry spans only 9 cells.
When the PCIe FDT code was originally adapted from arm64, the property
allocation size and cell assignments were reduced to 9 cells per entry,
but the loop multiplier retained the 10-cell stride. This caused the
interrupt-map array to be packed incorrectly with gaps, breaking PCI
interrupt routing in guest operating systems and overflowing the
allocation by 16 cells.
Correct the loop stride to 9 cells so the interrupt map is properly
formed.
Reviewed by: jrtc27
Fixes: 7ab1a32cd43c ("bhyve/riscv: Initial import")
MFC after: 3 days
[3 lines not shown]
Revert "bhyve/riscv: fix PCIe FDT interrupt-map entry stride"
Thanks to past me's foolish choice not to alter the commit message such
that none of its lines start with a #, Git got very confused the
cherry-pick and included its own commented-out instructions. Reverting
to re-land with a fixed body.
This is a direct commit to stable/15.
This reverts commit 69f76efd01a72fe0d6cb68442d2c15d3174a268f.
bhyve/riscv: fix PCIe FDT interrupt-map entry stride
In bhyve arm64, each PCIe interrupt-map entry spans 10 cells because the
ARM GIC specifies #interrupt-cells = 3. On RISC-V, the APLIC uses
#interrupt-cells = 2, so each entry spans only 9 cells.
When the PCIe FDT code was originally adapted from arm64, the property
allocation size and cell assignments were reduced to 9 cells per entry,
but the loop multiplier retained the 10-cell stride. This caused the
interrupt-map array to be packed incorrectly with gaps, breaking PCI
interrupt routing in guest operating systems and overflowing the
allocation by 16 cells.
Correct the loop stride to 9 cells so the interrupt map is properly
formed.
Reviewed by: jrtc27
Fixes: 7ab1a32cd43c ("bhyve/riscv: Initial import")
MFC after: 3 days
[25 lines not shown]
style.9: Avoid C++ keywords
Headers may be included by C++ code, and sometimes we might like to
use exinst code as C++. Encourage authors to avoid C++ keywords as
identifiers.
Reviewed by: des, imp (earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61767
ipfw: fix off-by-one in the IP_FW_XADD rule count check
Restore the pre-4a77657cbc0 ">=" comparison, otherwise parse_rules_v1()
writes one rule_check_info beyond the allocated buffer.
Do the same in ip_fw_compat.c, which has a copy of the loop but is not
built at the moment.
stable/14 is not affected.
Reviewed by: ae
Fixes: 4a77657cbc0 ("ipfw: migrate ipfw to 32-bit size rule numbers")
MFC after: 1 week
MFC to: stable/15
Found with: Claude Code Opus 5.5
Differential Revision: https://reviews.freebsd.org/D61727
bhyve.8: mention VM nodes in /dev/vmm
Currently, VM nodes in /dev/vmm are only described in the
EXAMPLES section of bhyvectl.8. Add a FILES section to bhyve.8
to make this information easier to find.
Update the bhyvectl.8 example to say "Existing VMs"
instead of "Running VMs" as the VMs listed in /dev/vmm
are not necessarily running.
Update bhyvectl.8 to refer to vmm(4).
Reviewed by: ziaee
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61623
tests/sys/pmc: Skip pmc_ss and getmsr_refusals without a hardware PMC
In a guest without a PMU, hwpmc(4) registers only the SOFT class, but
the "instructions" alias still resolves from the pmu-events tables, so
pmc_allocate() fails with EINVAL. pmc_ss_test checked only the alias
and getmsr_refusals required the allocation, so both failed in CI
instead of skipping.
Probe the allocation the tests make and skip if it fails, as
rdpmc_reads_own_counter already does.
PR: 300856 (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300856)
Reported by: ngie
Reviewed by: mhorne, ngie
Fixes: d546356523f3 ("tests/sys/pmc: add PERF, RDPMC, row, sampling and unload tests")
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D61689
hwpmc: keep AMD UMC counters from saturating
UMC counters saturate at 2^48 instead of wrapping, after about a day
and a half of memory clock cycles. Clear bit 47 on a read once it is
set and count the carries in the per-CPU overflow count of the PMC,
like the arm64 and armv7 drivers do for their 32-bit counters.
Reviewed by: mhorne
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D60771
bhyve.8: mention config files for VM parameters
Mention that virtual CPUs, memory and other options can be configured
with a configuration file, and refer to the -k option.
Reviewed by: ziaee
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61718
top: fix off-by-one in screenbuf
There is a heap overflow for screenbuf originating from
the top import to the tree. The i_process()/u_process() functions
write a terminating NUL one byte past each screenbuf line slot
when the line fills the slot, which is a 1-byte heap overflow on the last slot.
The display_resize() function allocates screen_width bytes per line.
i_process() and u_process() cut lines to screen_width characters and
then stpcpy() them into the slot, which writes screen_width + 1 bytes.
line_update() can do the same with *old = ch. For inner slots,
the NUL lands in byte 0 of the next slot. This can corrupt the saved
contents used when updating the next line. For the last slot, it writes
one byte past the end of screenbuf.
Fix by allocating (screen_width + 1) bytes per line and updating the
line offsets to fit the terminating NUL.
Reviewed by: kib
[5 lines not shown]
pf: fix nat46 ICMP handling
When porting from OpenBSD I typo'd the variable where we store the ICMP
type, in the nat46 direction. The nat64 direction was correct. Fix this
so ICMP translation works for nat46.
Add a test case for this, as well as basic TCP and UDP cases because
nat46 was entirely untested.
PR: 300461
MFC after: 1 week
Submitted by: Charles Marshall <charles at wozi.com> (pf patch)
Sponsored by: Rubicon Communications, LLC ("Netgate")
pf: fix sctp normalisation cleanup
If we fail to allocate the dst scrub structure we should free the src
one too, but we passed src rather than src->scrub.
Reported by: llm-postcr
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
pf tests: test pfTablesTblCount in snmp_pf
This works fine on main, but not on stable/15 so add a test.
PR: 300818
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
pf tests: run the ioctl tests in their own vnet too
Fix the validation:settflags test, because using a NULL buffer succeeds
if there's no table to set tflags in. Create a table to fix the test.
Sponsored by: Rubicon Communications, LLC ("Netgate")
pause fail point: affirm sleeping without a lock
The previous patch to fail_point_pause removed a lock wrapping a sleep.
INVARIANTS assertions require we affirm we are deliberately sleeping
without a lock or timeout via the PNOLOCK flag.
Reported by: netchild
Reviewed by: netchild
Fixes: 331613ddd8a5 ("Pause failpoint: replace mtx_sleep with tsleep")
Differential Revision: https://reviews.freebsd.org/D61730
ctld: Fix namespace IDs for exported NVMe namespaces
NVMe namespace IDs are 1-based, but CTL LUN IDs are 0-based. The
in-kernel NVMe ctl(4) target accounts for this by adding one to the
LUN ID to compute a namespace ID. ctld was attempting to handle this
by translating namespace IDs from config files to internal LUN IDs,
but it did this incorrectly resulting in the namespace configured for
as namespace N actually showing up as namespace N + 1.
Fixes: 66b5296f1b29 ("ctld: Add support for NVMe over Fabrics")
Sponsored by: Chelsio Communications
(cherry picked from commit 9c8be6518e2e5f396055ecdab8098ce19c4b2218)