to not leak information about unused pids or system processes' pids.
Reviewed by: markj
Fixes: 73c92a978c ("pdopenpid(2): allow in capability mode with restrictions")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59252
Prior to FreeBSD 11, vm_cnt was named cnt. When it was renamed, vmstat
was modified to fall back to the old name if the new name was not found.
It's time we dropped this.
Reviewed by: kib, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D59255
Fix nlist(3) consumers that either expected our toolchain to prepend an
underscore to symbol names or expected nlist(3) to ignore the mismatch,
as it did until we overhauled it back in May.
While here, also fix cases where the last element in the list had an
empty string instead of NULL as sentinel.
MFC after: 3 days
Fixes: 4617a6cb82 ("nlist: Handle multiple symbol tables")
Reviewed by: kib, jhb
Differential Revision: https://reviews.freebsd.org/D59254
umtxq_hash() multiplies the key by 0x9E370001 and keeps the high bits. That
constant is 0x9E37 * 2^16 + 1, so it degenerates for keys whose spacing carries
trailing zero bits: at a 64 KiB stride it puts 128 of 512 parked waiters onto a
single chain mutex, and at 16 KiB and up it uses only a handful of the 512
chains. Base-system consumers never hit this because libthr places its own wait
words 128 bytes apart, but a Linux-ABI runtime waiting on addresses it allocates
itself lands squarely on the floor. Switch to 0x61C88647, which leaves at most 3
waiters per chain at the same stride; Linux made this exact change in 2016, after
judging the sparse constants "actively bad for hashing".
Approved by: adrian (mentor)
Reviewed by: kib, adrian, emaste
Differential Revision: https://reviews.freebsd.org/D58337
Signed-off-by: Nick Price <[email protected]>
FreeBSD's bxe hardwires CNIC_SUPPORT() to 0, so bxe_ilt_set_info()
never enters the block that initializes the SRC and TM ILT clients.
Those two clients are left zeroed (page_size 0, flags 0), yet
ecore_ilt_init_page_size() calls ecore_ilt_init_client_psz() for all
four clients unconditionally. For SRC and TM that evaluates
ILOG2(page_size >> 12), i.e. ilog2(0). On an INVARIANTS kernel ilog2()
asserts "ilog argument must be nonzero" and panics the machine the
first time the interface is brought up (bxe_init -> bxe_nic_load ->
bxe_init_hw -> ecore_ilt_init_page_size). On a non-INVARIANTS kernel
it silently programs a bogus page-size register instead.
Restore the else branch that upstream Linux bnx2x carries: when CNIC
is not supported, mark the SRC and TM clients with ILT_CLIENT_SKIP_INIT
and ILT_CLIENT_SKIP_MEM so ecore_ilt_init_client_psz() skips them.
Root-caused from a crash dump on a BCM57810 (device 0x168e): the ILT
clients showed CDU and QM populated and SRC and TM zeroed with no skip
flag set.
Reviewed by: adrian
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D58587
Signed-off-by: Nick Price <[email protected]>
Pandaboard (sys/arm/ti/omap4) is removed due to lack of HW.
Remove the pandaboard config file for nanobsd aswell.
Approved by: imp, jlduran, manu(mentor)
Diffrential revision: https://reviews.freebsd.org/D54319
lkpi_cfg80211_calculate_bitrate_vht() was constantly showing up
in my debug traces as a TODO with rtw89 so I went ahead and implemented
the HT and VHT versions. Realtek seems to limit amsdu sizes based
on the value and ask for it whether needed or not.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
When _task_fn_admin() is active, it will regularly call
IFDI_UPDATE_ADMIN_STATUS(). So there is no need to do it in
iflib_media_status. This can be fairly expensive on some drivers (long
DELAY busywait loops waiting for a NIC command), and there is no need
to pause a userspace app in this DELAY() if it is happening
asynchronously anyway.
Note the logic to detect if _task_fn_admin() is regularly calling
IFDI_UPDATE_ADMIN_STATUS() was copied from that function.
Reviewed by: erj, kbowling
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54096
The strtoul function sets errno on error, but does not clear it on
success; when using strtoul and checking errno (as one should) for
ERANGE / EINVAL afterwards, it's important to zero errno first.
While here, remove a dead store.
Reviewed by: phk
Fixes: 4fe8c1b67b ("Add error and range checking ... ")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D59270
In a WITHOUT_INET6 build the only assignment to netid2 is compiled out and
the non-INET6 arm returns early, so netid2 is unconditionally NULL and the
rpcb_set() call guarded by it is dead code. clang does not prove it dead
and reports nbuf2 as uninitialized where it is passed as a const pointer,
No functional change.
MFC after: 1 week
Reported by: clang (-Wuninitialized-const-pointer)
Suggested by: dim
Approved by: ngie (co-mentor)
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D59277
This compatibility alias for kern.elf{32,64}.fallback_brand has been
marked for removal since FreeBSD 6.0.
Signed-off-by: Christos Longros <[email protected]>
Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D56085
There seems to be another possible race with net80211 state machine
changing the bss from under us (another lvif_bss_synched case).
Just do the != NULL check to avoid a NULL pointer deref in
ieee80211_ratectl_rate().
(bz extended the original comment and wrote the commit message).
Sponosred by: The FreeBSD Foundation (commit)
PR: 297184
MFC after: 3 days
The extra DELAY seems to no longer be needed and the dump_stack()
is definitively a problem now. Remove all this.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
The 82576 and I350 retain VF queue enable and DMA address state
across VFLR. iflib enables PCI bus mastering before driver attach, so
stale state left by a previous owner can otherwise issue DMA before
igbvf has completed its first reset and queue sanitization.
Disable PCI bus mastering immediately after mapping the VF BAR. Keep
it disabled until reset and queue sanitization succeed, verify both
disable and enable through PCI command-register readback, and wait for
pending transactions before treating the fence as complete.
Resanitize on stop before iflib releases queue mappings.
The sanitizer and recovery were exercised on I350 and 82576 VFs. Forced
queue-disable failure left the VF down, and a later administrative
down/up recovered it; successful I350 VFs passed bidirectional traffic
with no errors or drops.
Sponsored by: BBOX.io
The PCH suspend path kept a wake link fully powered and did not restore
the negotiated EEE modes after its stop-time reset. Intel provides the
ULP entry and exit machinery in the shared code, but FreeBSD did not
invoke its Sx policy.
Enter ULP on LPT and newer PCH controllers when wake is armed without
directed-unicast, multicast, or broadcast filters, which ULP cannot
preserve. For a link retained by host wake or management, restore the
100BASE-TX and 1000BASE-T LPI controls selected by the local
advertisement and the cached link-partner ability.
Keep these power reductions best-effort: wake filters and PME are
already configured independently, and a ULP or EEE failure is logged
without converting an optional power optimization into a suspend
failure. The existing PCH resume workaround forcibly exits ULP and
clears automatic Sx LPI state before normal initialization.
Validated on a ThinkPad T440p with an I217-LM. FBT confirmed that the
helper received the magic-wake mask during device suspend. The shared
ULP helper returned its documented no-op for the initial I217 device ID.
A full S3 cycle resumed cleanly.
On a ThinkPad P51 with an I219, full S3 waited for a magic packet and
then resumed with the 1-Gbps link and traffic restored.
MFC after: 2 weeks
Sponsored by: BBOX.io
For non listening TCP endpoints, increment the tcps_sig_err_sigopt
counter when TCP MD5 is not enabled in the TCP connection, but a
segment containing a TCP MD5 option is received.
Also increment the counter when using the RACK or BBR stack.
Reported by: Hannes Elfert
Reviewed by: rrs
MFC after: 1 week
MFC to: stable/14
MFC to: stable/15
Differential Revision: https://reviews.freebsd.org/D59249
The driver used the NVM APME default as both the hardware-support
decision and the mutable filter mask. Consequently, an NVM-disabled
but capable port did not advertise wake support, disabling a wake mode
once could keep it disabled across later suspends, and directed-unicast
wake could never be selected.
Require the PCI power management capability to report D3hot PME support
before advertising or arming wake. A PM capability alone does not mean
the function can signal PME from the state used during system sleep.
Separate the board and port capability matrix from the NVM-selected
magic packet default. Read the proper per function NVM word on igb
controllers, cover the newer PCH generations, and retain the documented
legacy, multi-port, and OEM restrictions. Decode the distinct APM
Enable locations used by 82544, 82541EI/82547EI, and the later 8254x
parts. Do not advertise wake on the 82541ER, whose power-management
logic cannot assert PME for wake events. For I210/I211 internal iNVM,
use the hardware-loaded WUC.APME state; the shared reader does not
expose the optional Initialization Control 3 word.
Build WUFC from the enabled ifnet capabilities for each suspend.
Reconstruct RAR0, the multicast table, and the receive filter after the
stop-time reset so unicast and multicast wake use the current interface
state. Fill the MTA on legacy PCI/PCI-X controllers and 82575 through
82580 when the address list overflows; their multicast wake matchers
require the indexed MTA bit and do not use RCTL.MPE as a substitute.
Do not access PF-only wake CSRs from the igb VF suspend and resume
paths.
Use the shared BM page access helpers and propagate every PHY receive
address and wake-register programming failure. On resume, perform the
required LCD reset before clearing host PHY-wake ownership, report the
saved PHY or MAC wake cause, and clear PCI PME after removing the device
wake source. Preserve management engine wake ownership throughout.
Keep WUC.APME set only when early 82545EM/82546EB manageability needs
its D3 clock-tree workaround; ordinary host wake uses PCI PME.
Keep the link powered while host wake is armed. With no host wake,
evaluate management pass-through at each suspend. Leave a
management-owned link untouched and keep PCI PME enabled. Otherwise,
use the Intel shared code PHY power-down hook, or its matching SerDes
shutdown hook on igb fiber and SerDes devices. Track that state and
restore the link without another PHY reset before hardware
initialization. Ordinary ifconfig down behavior is unchanged.
Apply and undo the PCH Sx workarounds across their full supported range.
Use controller-specific CTRL and laser semantics, and restore RCTL when
wake setup fails. Always run the pending PCIe-transaction drain and
bus-master-disable sequence before D3. Suspend reports a
wake programming failure rather than sleeping without wake, shutdown
logs it and continues through the fencing sequence.
Do not apply the ICH/PCH IGP3 D3 power-down workaround to igb
controllers. The merged driver inherited an unconditional call from the
em-only driver. On 82575 and 82576 it asserted CTRL.PHY_RST after the
wake filters were armed, preventing the link from receiving wake
traffic.
The implementation was checked against the Intel controller data
sheets, the Intel Linux e1000, e1000e, and igb lifecycle code, DPDK,
and the Intel FreeBSD em-7.7.8 and igb-2.5.31 drivers. The 8254x audit
also covered the PCI/PCI-X Software Developer's Manual, the 82541/82547
NVM guide, and the 82544, 82545, and 82546 specification updates. The
out of tree drivers carry the family-specific power down and reset block
hooks but do not call them from suspend. DPDK supplies the stop/start
pairing.
On PCH controllers including an 82579LM, I217-LM, and various I219s,
device-only D3 tests observed PME and BM_WUS.MAG for a magic packet, no
PME with every host filter disabled, and BM_WUS.EX with only
directed-unicast wake enabled. With dev.em.0.wake enabled, ACPI S3
slept until a delayed magic packet and resumed with the interface
operational. After wake traffic stopped and resume completed, a second
cycle again waited for a newly delayed magic packet. Traffic restored
after both host and firmware wake were enabled.
An 82574L woke from S3 after one magic packet, reported MAC wakeup
status, and returned with link and traffic operational.
On 82571EB and 82573L adapters, device-only D3 tests observed WUS.MAG
and PCI PME status after a magic packet, then returned to D0 with link
and traffic operational. Full S3 did not wake either add-in card.
The positive device tests and negative S3 isolate the remaining failure
outside the MAC filter programming and my cards may lack aux power
wiring because the link was off in S3.
On 82575EB and 82576 adapters, pre-fix device only D3 tests left PMCSR
at 0x2103 despite ten verified magic packets, and the handoff showed
CTRL.PHY_RST asserted. With the em-family gate, identical tests changed
PMCSR from 0x2103 to 0xa103, resume reported WUS.MAG, and both links
returned operational. S3 testing on these separated controller from
board behavior. An Intel 82576 card retained link in S3 and woke the
system from a delayed magic packet, reported WUS.MAG, and returned with
interface operational. The tested 82575 add-in card lost its
link LED in S3 and retained no WUS cause after manual resume, although
its identical D3hot test passed. That points the 82575 S3 result to
card aux power wiring as well.
D3 tests were performed on I210 and I350 but S3 has not yet been
attempted on them.
lem(4) testing has not been attempted yet.
Community reports of success and failure are welcome.
PR: 232708, 238411, 295443, 296675
MFC after: 2 weeks
Sponsored by: BBOX.io
Support cat -A, -E and -T, which are commonly used by Linux shell
scripts. -E prints a "$" at the end of each line, -T renders tabs
as ^I, and -A is equivalent to -vET.
MFC After: 1 week
Discussed with: jrtc27
Reviewed by: jrtc27, ziaee
Differential Revision: https://reviews.freebsd.org/D59250
This version contains several minor changes related to documentation and
new C++ standards conformance (C++-20+ is now required to build the
project).
This change also uses the version from the official release tarball whereas
the prior imported version (0.4) was committed directly from a git clone.
Obtained from: https://github.com/freebsd/lutok/releases/tag/lutok-0.6.2
This patch adds a new nfs_client_rdma_enable variable
to /etc/rc.d/nfsclient to enable the client side of
NFS over RDMA. The client side of NFS over RDMA
requires the nfsclrdma.ko module, which is still under
test/review.
I wanted to get the "glue" into main so that others
could test the module more easily. Avaliability of
the module will be announced on freebsd-current@ soon.
It should not affect non-RDMA operation.
I've specified a long MFC, since the module still
requires extensive testing and, hopefully, a review.
MFC after: 3 months
This patch adds assorted bits needed by the nfsclrdma.ko
module that implements client side NFS over RDMA.
With this commit, the glue required by the nfsclrdma.ko
module is complete and it should load ok.
It should not affect non-RDMA operation.
I've specified a long MFC, since the module still
requires extensive testing and, hopefully, a review.
MFC after: 3 months
This patch adds assorted bits needed by the nfsclrdma.ko
module that implements client side NFS over RDMA.
It should not affect non-RDMA operation.
Some additional glue is needed for the nfsclrdma.ko
module within the NFS code. That will be added as
a separate commit.
I've specified a long MFC, since the module still
requires extensive testing and, hopefully, a review.
MFC after: 3 months
kqueue returns a value != -1 on error. Test for that instead of any
non-zero value to confirm that success was achieved when calling
`kqueue`.
This issue exists with ATF 0.22+ [1].
MFC after: 2 weeks
Reported by: clang (-Wparenthesis)
[1]: https://github.com/freebsd/atf/pull/72
Do not assign `b` in the `ATF_REQUIRE` macro. Set and test `b`
separately to avoid the issue cited by clang++/g++ after
implementing the change referenced in [1].
MFC after: 2 weeks
Reported by: clang (-Wparenthesis)
Reference: https://github.com/freebsd/atf/pull/72
In bridge_input, sc is initialized to NULL and doesn't get
resolved until after the Ethernet header pullup.
So the pullup's failure path ends up dereferencing the NULL sc
when bumping up IFCOUNTER_IERRORS.
The m_freem call right under it is redundant as the failure path in
m_pullup already freed the chain.
Drop both lines, matching what we have in bridge_output.
ether_input_internal() discards frames shorter than ETHER_HDR_LEN
before the bridge hook, so it is unlikely that it will fire.
We still keep the guard as lagg(4) and ng_ether(4) may replace
the mbuf before the bridge hook.
Signed-off-by: Aaron Espinoza <[email protected]>
Reviewed by: pouria
Pull Request: https://github.com/freebsd/freebsd-src/pull/2393
In headers that existed prior to C23, these should be visible only in
C23 or BSD mode.
Fixes: 0fe73dcf7c ("libc: Add <assert.h> C23 feature test macro")
Fixes: 1f09e35429 ("sys/limits.h: Add BOOL_MAX, BITINT_MAXWIDTH, and C23 feature test macro")
Fixes: cd0727ec70 ("libc: Add <stdio.h> C23 feature test macro")
Fixes: fc9d02cb29 ("libc: Add <time.h> C23 feature test macro")
Fixes: 4aeed6e9d2 ("libc: Add <setjmp.h> C23 feature test macro")
Reviewed by: fuz, kfv, dteske
Differential Revision: https://reviews.freebsd.org/D59272
Twenty cases over where each rc option and each method executes for a
jailed service, the jail's lifetime, and the svcj option handling. Each
case drives the service inside a chroot built in its ATF work directory.
MFC after: 1 week
MFC to: stable/15
Assisted-by: Claude Code (Opus 5)
Raising a process' priority is not permitted inside a jail, and nice(1)
warns and executes the command anyway, so the service comes up at its login
class priority.
Not changing the date, as a commit a moment before this, one changed it
already.
MFC after: 1 week
MFC to: stable/15
setaudit(8) is prefixed to the command inside the jail when
${name}_audit_user is set, and needs allow.setaudit.
This is not added automatically when ${name}_audit_user is set, this
needs an administrative setting of the options on purpose.
MFC after: 1 week
MFC to: stable/15
A script that defines non-default restart_cmd or status_cmd should
execute them in the service jail. Where there is no jail to enter,
restart starts the service instead of failing.
Fixes: 2efbd480f1 rc: add service jails framework
MFC after: 1 week
MFC to: stable/15
Assisted-by: Claude Code (Opus 5)
A service whose tracked process had died while another process of its own
kept the jail alive, therefore left svcj-${name} behind, and the next start
would fail.
Fixes: 2efbd480f1 rc: add service jails framework
MFC after: 1 week
MFC to: stable/15
Assisted-by: Claude Code (Opus 5)
A service running under ${name}_user was signalled from the host as that
user, which the parent of a jail may no longer do: since 8a5ceebece an
unprivileged process would need allow.unprivileged_parent_tampering.
Stop and reload therefore failed and left both the service and its jail
running.
MFC after: 1 week
MFC to: stable/15
The attach path translated WUC.APME into a saved link-change filter,
then advertised magic-packet wake. Suspend removed unselected magic,
unicast, and multicast bits from that saved value, commonly leaving no
hardware wake filter at all. The destructive masking also made later
capability changes ineffective.
Advertise the I225/I226 wake filters whenever PCI power management is
available and enable magic-packet wake by default. Build a fresh WUFC
mask for every suspend, and explicitly clear WUC, WUFC, and PCI PME when
wake is disabled.
Require the PCI power-management capability to report D3hot PME support
before advertising or arming wake. A PM capability alone does not mean
the function can signal PME from the state used during system sleep.
Reconstruct RAR0, the multicast table, and the receive filter after the
stop-time reset so unicast and multicast wake use the current interface
state. Keep the PHY powered while wake is armed, drain pending PCIe
transactions, and disable bus mastering before D3.
Clear the sticky base and extended wake status before arming filters.
On resume, report the saved hardware wake cause, clear the device wake
source, and then clear PCI PME. Run the DMA-fencing sequence even when
wake programming fails, while allowing shutdown to continue after
logging the failure. Explicitly restore PCI bus mastering during
initialization so an iflib-local resume after another child rejects
suspend can restart the device.
Restore the Intel shared code PHY power down test from DPDK. The
FreeBSD split inverted the reset-block condition, so its dormant hook
would power down only when firmware explicitly vetoed the operation.
Do not copy the generic legacy management test verbatim. The I225 and
I226 define MANC bits 0 and 1 as flow-control and NC-SI discard
controls, not SMBus and ASF enable bits. Preserve the link when the
documented TCO receive path is enabled; the shared reset-block test
separately honors the firmware keep-link-up veto. This follows section
8.21.1 of the Foxville Software User Manual.
Evaluate management pass-through at each suspend. When neither a host
wake filter nor management requires the link, invoke the shared-code
power-down hook before D3. Leave a management-owned link untouched and
restore a link previously powered down by the driver without another
PHY reset. This follows DPDK's stop/start pairing without changing
ordinary ifconfig down behavior.
The implementation was checked against the Intel I225/I226 programming
model, the Intel Linux igc lifecycle, and DPDK.
On an I225-LM, a device-only D3 test observed PME for a valid magic
packet and no PME with every host wake filter disabled. Both cases
resumed to D0 with the link and configured addresses operational.
The I225 system also completed a full ACPI S3 cycle and resumed with
link, configured addresses, and traffic operational.
On an I226-V, a device-only D3 test changed PMCSR accordingly after a
magic packet. With dev.igc.0.wake enabled, a full ACPI S3 cycle
remained asleep until a delayed magic packet and resumed with link,
addresses, and traffic operational.
PR: 282140
Obtained from: DPDK (shared-code power-down structure)
MFC after: 2 weeks
The presence of the PCI power management capability does not imply that
a function can signal PME# from every power state. Drivers which
advertise wake based only on pci_has_pm() can consequently expose wake
modes that cannot work.
Add pci_has_pme() to query the PME_Support bitmap for a specific state.
Use it to implement LinuxKPI pci_pme_capable(), removing its duplicate
PME_Support decoder.
Validated the helper against PCI PMC capability values from 82571EB,
82573L, 82579LM, I210, I225, and I226-V controllers. The 82571 and
82573 reported PMC 0xc822, while the I226-V reported 0xc823. In both
values, bits 15, 14, and 11 advertise PME from D3cold, D3hot, and D0;
the low-bit difference is only the PM capability version.
MFC after: 2 weeks
Sponsored by: BBOX.io
Use better diagnostic messages when unit numbers are wrong.
Reviewed by: arrowd@, christos@, kevans@
Approved by: christos@
Differential Revision: https://reviews.freebsd.org/D56845
Instead of forcing an `mdio` pseudo-device to hang off the xmdio, rename
xmdio to "mdio" and make it an ofw bus device, akin to the mii_fdt
driver, so that children can get the device tree goodies.
The loop goes over the qman channel total (16), so if a port ID is not
found in the list it could walk off the end of the list and return
garbage. Not a problem in practice, as only valid ports are included in
our device trees, but protect it anyway.