HardenedBSD/src c770519sys/dev/aq aq2_fw.c aq_main.c, sys/dev/e1000 if_em.c if_igbv.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+159-14sys/dev/e1000/if_igbv.c
+114-9sys/dev/aq/aq_irq.c
+83-14sys/dev/aq/aq_main.c
+45-22sys/dev/e1000/if_em.c
+66-0sys/dev/aq/aq2_fw.c
+43-6sys/net/iflib.c
+510-6524 files not shown
+677-10330 files

HardenedBSD/src 8999ddbsys/dev/aq aq2_fw.c aq_main.c, sys/dev/e1000 if_em.c if_igbv.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+159-14sys/dev/e1000/if_igbv.c
+114-9sys/dev/aq/aq_irq.c
+83-14sys/dev/aq/aq_main.c
+45-22sys/dev/e1000/if_em.c
+66-0sys/dev/aq/aq2_fw.c
+43-6sys/net/iflib.c
+510-6523 files not shown
+675-10329 files

HardenedBSD/src 3aec8e8share/man/man7 d.7

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+9-1share/man/man7/d.7
+9-11 files

HardenedBSD/src 612f87csys/dev/e1000 if_em.h e1000_vf.c

igbv: Recover when the PF mailbox is unavailable

A VF reset can sanitize its retained queue registers even when the PF
does not complete the cooperative mailbox handshake.  Keep those two
states separate.  Do not program or enable the rings until both queue
sanitation and mailbox initialization have succeeded.

Report either initialization failure to iflib so the interface remains
stopped.  Stopped admin and media-status passes now publish cached
link-down state without polling the mailbox.  While the VF remains
administratively up, retry complete initialization after 250 ms, one
second, four seconds, and then at a capped eight-second interval.
Conditional iflib reset requests ensure an intervening administrative
down cancels a queued retry.

Avoid a redundant mailbox reset in the stop half of an immediate iflib
reinitialization; the following init performs the required reset.
Preserve the reset on an ordinary administrative stop and keep the
existing bounded queue-sanitation retry policy independent from
mailbox liveness recovery.
DeltaFile
+159-14sys/dev/e1000/if_igbv.c
+45-22sys/dev/e1000/if_em.c
+17-15sys/dev/e1000/e1000_vf.c
+11-0sys/dev/e1000/if_em.h
+232-514 files

HardenedBSD/src 9328a7eshare/man/man9 Makefile iflibdd.9, sys/net iflib.h iflib.c

iflib: Support recoverable initialization failure

The ifdi_init method cannot report an error, so iflib always marks an
interface running and enables its interrupts after the callback returns.
Drivers whose hardware initialization depends on an unavailable peer can
only return early and leave a falsely running interface.

Add iflib_init_failed() so a callback can leave the interface stopped.
Also add a conditional reset request for asynchronous recovery: it is
discarded if the interface is administratively down when the admin task
runs, preventing a queued retry from resurrecting a stopped interface.

Do not restore saved driver flags after an MTU or capability change when
initialization failed.  Restoring the pre-init flags would overwrite the
stopped result with stale RUNNING state.

Document that reset requests require the caller to schedule the admin
task, that output remains blocked during recovery, and that iflib rather
than the driver owns the driver flags.

    [2 lines not shown]
DeltaFile
+43-6sys/net/iflib.c
+35-0share/man/man9/iflibdi.9
+7-4share/man/man9/iflibdd.9
+5-0sys/net/iflib.h
+3-0share/man/man9/Makefile
+93-105 files

HardenedBSD/src 9fd963bshare/man/man9 acl.9

acl(9): fix typo (ACL_ACL -> ACL)

MFC after:      1 week
DeltaFile
+1-1share/man/man9/acl.9
+1-11 files

HardenedBSD/src 8eced03share/man/man9 atomic.9

atomic(9): add missing .Nm entries

MFC after:      1 week
Reported by:    make manlint
DeltaFile
+3-0share/man/man9/atomic.9
+3-01 files

HardenedBSD/src 4fa245eshare/man/man9 alq.9

alq(9): add missing .Nm entry for ALQ(9)

MFC after:      1 week
Reported by:    make manlint
DeltaFile
+1-0share/man/man9/alq.9
+1-01 files

HardenedBSD/src b96a063share/man/man9 DB_COMMAND.9

DB_COMMAND(9): correct mdoc markup for .Nm entries

Add missing commas after .Nm entries.

MFC after:      1 week
Reported by:    make manlint
DeltaFile
+2-2share/man/man9/DB_COMMAND.9
+2-21 files

HardenedBSD/src 5007a5dshare/man/man9 cpuset.9

cpuset(9): correct markup

- Remove `\(em` from .Nm section as it's not valid mandoc markup.
- Remove the section from the .Nm directive (it's handled under the .Dt
  directive).

MFC after:      1 week
Reported by:    make manlint
DeltaFile
+1-2share/man/man9/cpuset.9
+1-21 files

HardenedBSD/src 503f161usr.sbin/pmc view.cc display.cc

pmc(8): add missing headers to not rely on header pollution

This mutes a number of complains from g++ about needing specific headers
for functionality related to C strings and other function prototypes.

Reported by:    g++ 14
DeltaFile
+2-0usr.sbin/pmc/view.hh
+1-0usr.sbin/pmc/view.cc
+1-0usr.sbin/pmc/display.cc
+1-0usr.sbin/pmc/cmd_pmc_summary.cc
+5-04 files

HardenedBSD/src fd80914usr.sbin/pmc view.hh

pmc(8): resolve -Wshadow issues

- Prefix all structs with the struct keyword to avoid collisions between
  the types and variables with the same "name".
- Use `_` suffixed variables in initializers to distinguish input
  parameters from public members [1].

Resolve some trailing whitespace issues while here.

NOTE: this doesn't resolve the -pedantic issue reported by g++ with
`pmchdr_cpuidinfo::cpuid` about the field being a flexible array in an
otherwise empty struct.

1. I generally do this the other way around, i.e., suffix private/protected
   members with `_`, but these are public members in structs and I don't want
   to introduce a lot of churn in calling code.

Reported by:    g++14 with FreeBSD CI (powerpc64 tinderbox)
Fixes:  ce6ab51f ("pmc: enable the new pmc commands")
DeltaFile
+8-8usr.sbin/pmc/view.hh
+8-81 files

HardenedBSD/src 7f0932csys/modules/video Makefile

HBSD: Enable -ftrivial-var-auto-init=zero for video(4)

FreeBSD introduced a new driver: video(4). Let's build it with that
mentioned in the subject line.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+2-0sys/modules/video/Makefile
+2-01 files

HardenedBSD/src d444d82share/man/man7 d.7

d.7: Document no support for ddi_pathnam(), getmajor(), and getminor()

MFC after:      3 days

(cherry picked from commit d04da19acbef62f8aee36f5350470dcbf5ba2931)
DeltaFile
+9-1share/man/man7/d.7
+9-11 files

HardenedBSD/src af3f2ddshare/man/man4 aq.4, sys/dev/aq aq_hw.h aq_fw.h

aq(4): report link transitions and previously silent failures

A link flap left nothing in the log to work from.  Both the link up and
link down messages were gated on bootverbose while the message for a
speed change that keeps carrier was not, so a default kernel was silent
about a flap yet loud about a downshift -- the inverse of what an
operator wants.  The generic message from if_link_state_change() carries
no speed, so gating the driver's own left the negotiated rate
unrecorded.  Report both transitions unconditionally.

Say more than the rate.  aq_hw_get_link_state() already negotiates flow
control and throws it away, and Atlantic 2 reports duplex and EEE in the
same link status word the rate comes from; decode them through a new
get_link_info firmware op and name all of it on the up transition.  EEE
matters for a flap: low power idle transitions are a common source of
marginal link trouble on multi-gigabit copper, and whether it was active
is otherwise invisible.

Give the down transition a cause.  The PHY global fault code was only

    [73 lines not shown]
DeltaFile
+114-9sys/dev/aq/aq_irq.c
+83-14sys/dev/aq/aq_main.c
+66-0sys/dev/aq/aq2_fw.c
+30-1share/man/man4/aq.4
+9-0sys/dev/aq/aq_fw.h
+6-0sys/dev/aq/aq_hw.h
+308-242 files not shown
+311-248 files

HardenedBSD/src d38b3a5lib/libpmc libpmc_pmu_util.c, lib/libpmc/pmu-events jevents.c

libpmc: Fix AMD L3 counter parameter parsing

Fix two small bugs affecting the event parsing of AMD L3 counters.
AMD's manual and JSON disagree about the naming scheme on recent
processors.  I use the naming scheme present in the recent PPRs to be
consistent, so in the JSON parser we rename 'allslices' to 'allsources'
just as we already do with sliceid and sourceid.  Also ensure that we
parse the 0x prefix present in the newer JSON files.

Reviewed by:    mhorne
Sponsored by:   Netflix
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2180
DeltaFile
+8-1lib/libpmc/pmu-events/jevents.c
+4-4lib/libpmc/libpmc_pmu_util.c
+12-52 files

HardenedBSD/src 0343ab8sys/sys videoio.h

video: disable the static assertions for now

The previous version of this work included the definitions but
not the static asserts.  It's tripping up in some CI builds, likely
due to compat API building.

Since this isn't any more or less broken than before, disable the
static assertions until we figure out a proper path for this.

Fixes: 9c9428825f4c55e3cb37412c661bb9d385db4c68 (video: add generic video(4) capture framework)
DeltaFile
+6-0sys/sys/videoio.h
+6-01 files

HardenedBSD/src 7f23ff7sys/dev/firewire fwcam.c, sys/dev/usb/video uvideo_v4l2.h uvideo.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+501-1,327sys/dev/usb/video/uvideo.c
+1,382-0sys/dev/video/video.c
+528-292sys/dev/firewire/fwcam.c
+512-0sys/sys/videoio.h
+0-502sys/dev/usb/video/uvideo_v4l2.h
+0-450usr.sbin/fwcamctl/fwcamctl.c
+2,923-2,57117 files not shown
+3,506-2,84323 files

HardenedBSD/src dc98fc9sys/dev/firewire fwcam.c, sys/dev/usb/video uvideo_v4l2.h uvideo.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+501-1,327sys/dev/usb/video/uvideo.c
+1,382-0sys/dev/video/video.c
+528-292sys/dev/firewire/fwcam.c
+512-0sys/sys/videoio.h
+0-502sys/dev/usb/video/uvideo_v4l2.h
+0-450usr.sbin/fwcamctl/fwcamctl.c
+2,923-2,57117 files not shown
+3,506-2,84323 files

HardenedBSD/src 33fd5d1sys/dev/usb/video uvideo.c

uvideo: do not reject unsupported pixel formats

Reviewed by:    adrian, bapt
Differential Revision:  https://reviews.freebsd.org/D58503
DeltaFile
+67-23sys/dev/usb/video/uvideo.c
+67-231 files

HardenedBSD/src a8165edsys/dev/firewire fwcam.c

fwcam: release the IR DMA channel when starting the stream fails

Disabled the IR DMA channel on the error path, which clears the flag and
frees the descriptor blocks before the chunks go away.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58502
DeltaFile
+3-0sys/dev/firewire/fwcam.c
+3-01 files

HardenedBSD/src ad9cc3fsys/dev/usb/video uvideo.h

uvideo: limit isochronous transfers to 32 frames

Raising UVIDEO_NFRAMES_MAX from 40 to 128 in 3b6f833c95eb improved
throughput on xhci but made every camera on an ehci bus fail to
stream. Integrated webcams became unusable.

Measured on a MacBookPro9,2 with two ehci(4) FaceTime HD cameras and an
xhci(4) Logitech C920:

                          128            32
  ehci, 12 captures       0 ok           12 ok
  xhci 1920x1080          5 fps           5 fps
  xhci 1280x720          10 fps          10 fps

Fixes:          3b6f833c95eb

Reviewed by:    bapt
Differential Revision:  https://reviews.freebsd.org/D58501
DeltaFile
+1-1sys/dev/usb/video/uvideo.h
+1-11 files

HardenedBSD/src 5d0258dsys/dev/firewire fwcam.h, usr.sbin Makefile

fwcamctl: remove, superseded by the video(4) interface

fwcam(4) no longer creates its own character device or implements the
FWCAM_* ioctls; it registers with video(4) and is driven through the
standard V4L2 interface on /dev/videoN.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58500
DeltaFile
+0-450usr.sbin/fwcamctl/fwcamctl.c
+0-156usr.sbin/fwcamctl/fwcamctl.8
+1-79sys/dev/firewire/fwcam.h
+0-9usr.sbin/fwcamctl/Makefile
+0-1usr.sbin/Makefile
+1-6955 files

HardenedBSD/src f5dc226share/man/man4 fwcam.4, sys/dev/firewire fwcam.h fwcam.c

fwcam: convert to video(4) framework

Replaced the monolithic cdevsw implementation with the video(4)
framework.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58369
DeltaFile
+525-292sys/dev/firewire/fwcam.c
+16-12share/man/man4/fwcam.4
+8-7sys/dev/firewire/fwcam.h
+2-1sys/modules/firewire/fwcam/Makefile
+551-3124 files

HardenedBSD/src 8cdcf4bshare/man/man4 uvideo.4, sys/dev/usb/video uvideo.c

uvideo: convert to video(4) framework

Replaced the monolithic cdevsw implementation with the video(4)
framework.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58368
DeltaFile
+435-1,305sys/dev/usb/video/uvideo.c
+3-2share/man/man4/uvideo.4
+2-1sys/modules/usb/uvideo/Makefile
+440-1,3083 files

HardenedBSD/src 9c94288sys/dev/usb/video uvideo_v4l2.h, sys/dev/video video_internal.h video.h

video: add generic video(4) capture framework

Add a new video(4) framework that provides /dev/videoN, buffer
management, mmap lifetime, and V4L2 ioctl dispatch for video capture
drivers. Hardware drivers implement struct video_hw_ops callbacks
and use video_buf_acquire/write/done to deliver frames.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58367
DeltaFile
+1,382-0sys/dev/video/video.c
+512-0sys/sys/videoio.h
+0-502sys/dev/usb/video/uvideo_v4l2.h
+196-0sys/dev/video/video_if.m
+117-0sys/dev/video/video_internal.h
+117-0sys/dev/video/video.h
+2,324-5026 files not shown
+2,444-50512 files

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