HardenedBSD/src 151d5a9lib/libifconfig libifconfig.c, sbin/ifconfig ifvfstatus.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+278-6sys/netlink/route/iface.c
+212-0sbin/ifconfig/ifvfstatus.c
+163-11sys/net/if.c
+166-7usr.sbin/iovctl/iovctl.c
+168-0sys/dev/pci/pci_iov.c
+129-0lib/libifconfig/libifconfig.c
+1,116-2440 files not shown
+2,197-4346 files

HardenedBSD/src e39d1e2lib/libifconfig libifconfig.c, sbin/ifconfig ifvfstatus.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+278-6sys/netlink/route/iface.c
+212-0sbin/ifconfig/ifvfstatus.c
+163-11sys/net/if.c
+166-7usr.sbin/iovctl/iovctl.c
+168-0sys/dev/pci/pci_iov.c
+129-0lib/libifconfig/libifconfig.c
+1,116-2440 files not shown
+2,197-4346 files

HardenedBSD/src b6b889blib/libc/stdlib merge.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+21-48lib/libc/stdlib/merge.c
+21-481 files

HardenedBSD/src da309edsys/dev/pci pci_iov.c, sys/sys iov.h

pci_iov: Use native types for status ioctl

IOV_CONFIG and IOV_GET_SCHEMA expose native pointers and size_t
lengths, and pci_iov has no compat32 ioctl translation.  Using
fixed-width fields for IOV_GET_STATUS alone does not make the
interface usable by 32-bit binaries on a 64-bit kernel.  It instead
complicates otherwise ordinary pointer and length handling.

Use void * and size_t like the existing ioctls.  This also makes the
%zu diagnostic in iovctl correct on ILP32 and removes the unneeded
PTRIN conversion.

Fixes:  6f8b3be1fbd6 ("pci: Add SR-IOV status reporting")
DeltaFile
+2-6sys/dev/pci/pci_iov.c
+3-5sys/sys/iov.h
+2-3usr.sbin/iovctl/iovctl.c
+7-143 files

HardenedBSD/src 8696cc6sys/net iflib.c

iflib: Avoid locking for unsupported VF status queries

ifconfig -v requests SR-IOV VF status from every interface.  iflib
previously acquired the context lock before dispatching the request even
for VFs and drivers using the default unsupported method.  Mailbox work
on a VF could therefore delay the complete interface listing.

VF status describes the children of an SR-IOV PF.  Reject requests on
VF contexts and classes using the default method without taking the
context lock.  Keep the lock for actual PF status providers.

Fixes:  1ccf543b21ef ("ifconfig: Add SR-IOV VF status output")
DeltaFile
+17-0sys/net/iflib.c
+17-01 files

HardenedBSD/src be97ef6lib/libc/stdlib merge.c

libc/merge.c: use memcpy() for copying

Currently mergesort() uses ICOPY_*() to copy data as four byte blocks
instead of one byte. However, this is only achievable when both size and
base arguments are aligned to four bytes.

Use of memcpy() is ideal as 1) it is cleaner and 2) the library will use
SIMD for copying when the hardware supports it. Compared to ICOPY_*(),
SIMD can support up to 64 bytes. When the SIMD-backed memcpy() find the
address is unaligned, it can first copy data up to the nearest aligned
address, and then use SIMD operations for faster transfer. Thus memcpy()
can give better performance than mergesort()'s own implementation.

This is benchmarked on amd64 where there isn't a SIMD-backed
implementation yet. However, the baseline implementation in assembly
already delivers better performance in unaligned cases although there is
some performance drops in aligned cases. The benchmark results and
script is available in the Phabricator review. Ideally, more performance
improvements will come when amd64 gets SIMD implementation of memcpy().

    [7 lines not shown]
DeltaFile
+21-48lib/libc/stdlib/merge.c
+21-481 files

HardenedBSD/src 185a03alib/libgcc_s Symbol.map

libgcc_s: export the IEEE-128 long double runtime on powerpc64le

On powerpc64le with IEEE-128 long double, the long-double compiler-runtime
helpers are the *kf* soft-float functions (built from the tf sources,
renamed via -D in lib/libcompiler_rt/Makefile.inc) plus the complex
multc3/__divtc3. They are compiled into libgcc_s.so by the powerpc64le
SRCF block, but were never added to Symbol.map, so they stayed local and
unexported.

Every other IEEE-128 architecture already exports its scalar long-double
runtime -- aarch64 and riscv list the tf helpers in GCC_4.6.0. powerpc64le
was simply missed.

Because the helpers are unexported, any clang-built shared library that uses
long double leaves them undefined (permitted in a DSO), and linking an
executable against that DSO then fails under lld's default
--no-allow-shlib-undefined. For example science/harminv fails to link its
binary against its own libharminv.so with undefined multc3/divtc3; at
-O0, mulkf3/addkf3/__subkf3/__unordkf2 appear as well.

    [8 lines not shown]
DeltaFile
+34-0lib/libgcc_s/Symbol.map
+34-01 files

HardenedBSD/src 776ba7busr.bin/fortune/datfiles freebsd-tips

freebsd-tips: Tip about drivers licenses

Reviewed by:    fuz, ngie
Co-authored-by: Robert Clausecker <fuz at FreeBSD.org>
Differential Revision:  https://reviews.freebsd.org/D58727
DeltaFile
+4-0usr.bin/fortune/datfiles/freebsd-tips
+4-01 files

HardenedBSD/src 6a1703csys/dev/ixgbe ixgbe_mbx.h

ixgbe: Add missing mailbox API 1.6 definition

The SR-IOV status change reports mailbox API 1.6 but omitted its enum
definition, leaving main unable to compile.

API 1.6 is an established ixgbe mailbox wire revision.  Add it at the
end of the revision enum, before the unknown sentinel as required by
the stable numbering contract.  Naming the revision does not enable
negotiation or operations which will come with the E610 support.

Reported by:    Herbert J. Skuhra <herbert at gojira.at>
Fixes:  c30021fe0df9 ("ixgbe: Report SR-IOV VF status")
DeltaFile
+1-0sys/dev/ixgbe/ixgbe_mbx.h
+1-01 files

HardenedBSD/src fb1820drescue/rescue Makefile, tools/bsdbox Makefile.net Makefile

rescue: Satisfy libifconfig's libnv dependency in crunched links

libifconfig now calls nv(9) routines for the SR-IOV VF status query, so
crunched builds that link the static library must also provide libnv.

The per-program CRUNCH_LIBS_ifconfig hook cannot do this: crunchgen
partially links per-program libraries into the program object and
crunchide then localizes every symbol except the stub entry, so members
absorbed there cannot satisfy references from another archive on the
final link's library list.

List libnv globally next to libifconfig.a in rescue(8) and bsdbox. This
also makes the existing per-program libnv links redundant; remove them
to avoid embedding private localized copies in the crunched binary.

Fixes:  2d6114f6d26b ("libifconfig: Add an SR-IOV VF status query")
DeltaFile
+3-4rescue/rescue/Makefile
+0-1tools/bsdbox/Makefile.net
+1-0tools/bsdbox/Makefile
+4-53 files

HardenedBSD/src c30021fsys/dev/ixgbe ixgbe_sriov.h if_ix.c

ixgbe: Report SR-IOV VF status

Expose cached VF configuration, policy, and runtime state through the
iflib VF status method.  Include access or trunk VLAN mode, the queue
count selected by the current virtualization mode, negotiated mailbox
API, whether traffic is enabled, and the MDD-blocked and quarantine
state.

The query runs under the iflib context lock and does not issue mailbox
requests or read hardware registers.
DeltaFile
+90-0sys/dev/ixgbe/if_sriov.c
+1-0sys/dev/ixgbe/ixgbe_sriov.h
+1-0sys/dev/ixgbe/if_ix.c
+92-03 files

HardenedBSD/src d15f255share/man/man4 rtnetlink.4, sys/netlink netlink_snl_route_parsers.h

rtnetlink: Report SR-IOV VF status

Honor RTEXT_FILTER_VF on RTM_GETLINK requests and expose the versioned
SR-IOV VF status through typed nested FreeBSD attributes.  Report
IFLA_NUM_VF with a successful requested query and preserve per-provider
errors in the status container.

Map the common nvlist schema to native integer, boolean, string, and
binary attributes.  Carry namespaced driver extensions as packed
versioned nvlists so adding a driver-specific field does not expand the
common netlink ABI.

Add SNL parsers, parser verification, a constructed nested-status test,
and an RTM_GETLINK test for an interface without SR-IOV support.
Document the query contract and every attribute.
DeltaFile
+278-6sys/netlink/route/iface.c
+117-1share/man/man4/rtnetlink.4
+117-0tests/atf_python/sys/netlink/netlink_route.py
+112-0sys/netlink/netlink_snl_route_parsers.h
+89-0tests/sys/netlink/test_snl.c
+81-1sys/netlink/route/interface.h
+794-83 files not shown
+835-99 files

HardenedBSD/src ceb282bsys/dev/e1000 if_igb_iov.h if_em.c

igb: Report SR-IOV VF status

Expose the cached per-VF configuration through the iflib VF status
method.  Report mailbox handshake state, MAC address, access or trunk
VLAN mode, hardware queue count, administrator policy, and MDD blocking
state without issuing mailbox requests or reading hardware registers.
DeltaFile
+58-0sys/dev/e1000/if_igb_iov.c
+1-0sys/dev/e1000/if_igb_iov.h
+1-0sys/dev/e1000/if_em.c
+60-03 files

HardenedBSD/src 6f8b3besys/dev/pci pci_iov.c, sys/sys iov.h

pci: Add SR-IOV status reporting

Add a generic packed-nvlist status query to each /dev/iov/<PF>
control device.  Report the live VF Enable state, configured and total
VF counts, and one record for each configured VF.

Each VF record contains its PF-local index, computed PCI location,
newbus attachment state, attached driver, and ppt binding.  Construct
records for hardware VFs whose newbus child is absent so attachment
failures remain visible.

Version the extensible schema in sys/iov.h.  Use fixed-width request
fields so the ioctl command and layout are identical for 32-bit callers.
Serialize the topology snapshot with Giant, then pack and copy it after
releasing Giant.
DeltaFile
+173-1sys/dev/pci/pci_iov.c
+46-0sys/sys/iov.h
+219-12 files

HardenedBSD/src 25de742sbin/ifconfig ifconfig.8, usr.sbin/iovctl iovctl.conf.5 iovctl.8

iovctl: Report SR-IOV status

Add -L to query the generic packed-nvlist IOV_GET_STATUS interface.
Report PF enable state and configured and total VF counts.  For each VF,
print its PCI address, newbus attachment, bound driver, and ppt state.

Retry size negotiation if the topology changes between ioctls and reject
malformed or incompatible status records.

Keep NIC-specific operational state in ifconfig -v; iovctl owns the
device-neutral PCI topology and applies to any SR-IOV device class.

Relnotes:       yes
DeltaFile
+167-7usr.sbin/iovctl/iovctl.c
+22-3usr.sbin/iovctl/iovctl.8
+8-2usr.sbin/iovctl/iovctl.conf.5
+3-1sbin/ifconfig/ifconfig.8
+200-134 files

HardenedBSD/src 2d6114flib/libifconfig Makefile Symbol.map, sbin/ifconfig ifvfstatus.c

libifconfig: Add an SR-IOV VF status query

Provide a public helper which retrieves, unpacks, and validates the
versioned VF status nvlist.  Validate the required VF indices and the
shape and version of driver-specific extension namespaces while allowing
unknown optional fields.

The ioctl argument is not copied back when the command returns EFBIG.
Start with a practical buffer and grow it geometrically rather than
relying on the required length being observable.

Use the helper in ifconfig so other consumers share the same transport
and validation behavior.
DeltaFile
+129-0lib/libifconfig/libifconfig.c
+7-53sbin/ifconfig/ifvfstatus.c
+11-0lib/libifconfig/libifconfig.h
+2-2share/mk/src.libnames.mk
+4-0lib/libifconfig/Symbol.map
+1-1lib/libifconfig/Makefile
+154-566 files

HardenedBSD/src 2c04cfasbin/ifconfig ifconfig.8 ifvfstatus.c, sys/dev/ixl if_ixl.c

ifconfig: Use nvlist to report SR-IOV VF status

Replace the records with a versioned nvlist transported through struct
ifreq, following SIOCGIFCAPNV.  The network stack now packs and copies
results, supports bounded retry for larger results, and handles native
and 32-bit callers centrally.  Drivers only populate a kernel nvlist
while their state is locked.

Define optional common fields for identity, configuration and handshake
state, VLAN policy, queue resources, runtime blocks, PF link state, and
namespaced driver extensions.  Document the extension and versioning
contract and require providers to omit values they cannot observe.

Improve the ixl provider to track its mailbox handshake and report the
expanded common policy.  Render the expanded status as grouped output
under ifconfig -v.
DeltaFile
+204-24sbin/ifconfig/ifvfstatus.c
+163-11sys/net/if.c
+71-15sys/net/if.h
+53-1sbin/ifconfig/ifconfig.8
+33-19sys/dev/ixl/if_ixl.c
+10-2usr.sbin/iovctl/iovctl.8
+534-727 files not shown
+555-8713 files

HardenedBSD/src 1ccf543sbin/ifconfig ifconfig_netlink.c ifvfstatus.c, sys/dev/ixl if_ixl.c

ifconfig: Add SR-IOV VF status output

- Adds SR-IOV VF status to the existing ifconfig "-v" output
- Adds ioctl command for reporting VF status info from drivers
- Adds support to iflib for drivers to handle this new ioctl
- Add support for ioctl in ixl(4)

Signed-off-by: Eric Joyner <erj at freebsd.org>

Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D19647
DeltaFile
+78-0sbin/ifconfig/ifvfstatus.c
+34-1sys/dev/ixl/if_ixl.c
+15-0sys/net/if.h
+12-0sys/net/iflib.c
+12-0sys/net/ifdi_if.m
+2-1sbin/ifconfig/ifconfig_netlink.c
+153-24 files not shown
+159-210 files

HardenedBSD/src a446e40sys/dev/e1000 if_igbv.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+4-1sys/dev/e1000/if_igbv.c
+4-11 files

HardenedBSD/src 85af43esys/dev/e1000 if_igbv.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+4-1sys/dev/e1000/if_igbv.c
+4-11 files

HardenedBSD/src 75538a0sys/dev/e1000 if_igbv.c

igbv: Do not replay VLANs while stopped

iflib clears IFF_DRV_RUNNING before the driver stop callback but leaves
IFF_DRV_OACTIVE set.  Consequently, an already queued admin task can
run after the VF reset.  If that task consumes a pending timer sample,
it can retry failed VLAN mailbox operations and restore PF filters for
the stopped VF.

Continue sampling statistics, but only run the VLAN retry worker while
the interface is running.
DeltaFile
+4-1sys/dev/e1000/if_igbv.c
+4-11 files

HardenedBSD/src 408f8f7sys/dev/axgbe if_axgbe_pci.c, sys/dev/e1000 if_em.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+190-52sys/dev/e1000/if_em.c
+114-59sys/dev/ixgbe/if_ixv.c
+87-58sys/dev/ixgbe/if_ix.c
+68-62sys/dev/ixgbe/if_sriov.c
+31-44sys/dev/axgbe/if_axgbe_pci.c
+42-26sys/dev/enic/if_enic.c
+532-30122 files not shown
+665-38328 files

HardenedBSD/src 01fb274sys/dev/e1000 if_em.h if_em.c, sys/dev/igc igc_defines.h if_igc.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+189-29sys/dev/e1000/if_em.c
+65-29sys/dev/ixgbe/if_ixv.c
+32-9sys/dev/e1000/if_em.h
+7-12sys/dev/igc/if_igc.c
+8-8sys/dev/igc/igc_defines.h
+4-6sys/dev/ixgbe/if_ix.c
+305-931 files not shown
+313-937 files

HardenedBSD/src 679efdcsys/kern vfs_mountroot.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+6-1sys/kern/vfs_mountroot.c
+6-11 files

HardenedBSD/src 192a5eesys/kern vfs_mountroot.c

vfs_mountroot: unmute console in interactive prompt

If boot_mute is set the system appears to hang during the mountroot
prompt. Temporarily unmute the console so the prompt is visible.

Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D58549

(cherry picked from commit e96f1cbd690e68594fc8812de634f43c6711aa97)
DeltaFile
+6-1sys/kern/vfs_mountroot.c
+6-11 files

HardenedBSD/src 018864brelease/pkg_repos release-dvd.conf, release/scripts pkg-stage.sh

HBSD: Resolve merge conflicts

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+1-9release/scripts/pkg-stage.sh
+0-4release/pkg_repos/release-dvd.conf
+1-132 files

HardenedBSD/src 9c169e1sys/dev/e1000 if_em.c, sys/dev/igc if_igc.c igc_base.c

Merge remote-tracking branch 'rad/freebsd/15-stable/main' into hardened/15-stable/main

Conflicts:
        release/pkg_repos/release-dvd.conf (unresolved)
        release/scripts/pkg-stage.sh (unresolved)
DeltaFile
+55-0sys/dev/igc/igc_base.c
+46-0sys/dev/igc/if_igc.c
+25-17sys/dev/ixgbe/if_sriov.c
+28-2sys/dev/ixgbe/ixgbe_mbx.c
+21-0sys/dev/e1000/if_em.c
+17-3sys/dev/ixgbe/ixgbe_phy.c
+192-2255 files not shown
+354-11561 files

HardenedBSD/src 98fad62sys/dev/ixgbe if_ixv.c

ixv: Negotiate VF queue-set limits

ixv uses one queue set on 82599 and X540 VFs and assumes two on
X550-family VFs.  The PF reports the queues assigned to each VF with
GET_QUEUES after mailbox API 1.1 negotiation.

Query the PF during attach.  Bound symmetric iflib queue sets by the PF
grant and available MSI-X data vectors.  Retain one queue set per data
vector: ixgbe VFs expose at most three vectors and one is reserved for
the mailbox.  The hardware permits each pool to use a subset of its RSS
queues, so a two-queue ceiling is valid when the PF assigns four.

This enables the second data vector on 82599 and X540 while avoiding an
assumed second queue when an X550-family VF is granted only one.  Keep
the existing family limits if the mailbox is unavailable or the PF uses
an older API.

MFC after:      2 weeks
DeltaFile
+61-9sys/dev/ixgbe/if_ixv.c
+61-91 files

HardenedBSD/src 0baf0fasys/dev/ixgbe if_ixv.c ixgbe.h

ix/ixv: Match Tx writeback thresholds to iflib

PTHRESH controls when the device prefetches transmit descriptors,
HTHRESH controls how many host descriptors must be ready, and WTHRESH
controls completion writeback batching.

iflib places RS on selected descriptors and reclaims through those
checkpoints.  The data sheets require WTHRESH to be zero when software
uses RS.  Clear WTHRESH while retaining the established PTHRESH 32 and
HTHRESH 1 fetch policy.

This also follows DPDK in pairing sparse RS descriptors with
WTHRESH zero.  DPDK defaults to 32/0/0, while Linux ixgbevf uses
32/1/8.  The 32/1/0 setting preserves FreeBSD's prefetch policy and the
data-sheet requirement that HTHRESH be nonzero when PTHRESH is used.

MFC after:      2 weeks
DeltaFile
+4-6sys/dev/ixgbe/if_ix.c
+8-0sys/dev/ixgbe/ixgbe.h
+2-2sys/dev/ixgbe/if_ixv.c
+14-83 files

HardenedBSD/src e2aff50sys/dev/igc igc_defines.h if_igc.c

igc: Correct descriptor control programming

The transmit-ring setup was copied from the e1000 path.  On I225
and I226, bits 22 through 24 are reserved and bit 25 enables the
queue; it is not a legacy low-water threshold.  Correct the field
masks, remove the nonapplicable legacy definitions, and program only
defined fields.

Use PTHRESH=8 and HTHRESH=1.  Keep WTHRESH at zero so the hardware
honors sparse RS descriptors issued by iflib.  Linux and DPDK use a
writeback threshold of 16, but request status on every packet.  A
nonzero threshold makes hardware ignore individual RS bits and is
unsuitable for the iflib completion model.

The receive-ring setup likewise used a magic mask that left bit 20
of the five-bit WTHRESH field untouched.  Define the receive threshold
fields and replace them exactly before installing the established
PTHRESH=8, HTHRESH=8, WTHRESH=4 policy.

MFC after:      2 weeks
DeltaFile
+7-12sys/dev/igc/if_igc.c
+8-8sys/dev/igc/igc_defines.h
+15-202 files