HardenedBSD/src c035552libexec/rc rc.subr, libexec/rc/tests svcj_test.sh

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+1,178-0libexec/rc/tests/svcj_test.sh
+153-54sys/dev/igc/if_igc.c
+29-2libexec/rc/rc.subr
+21-3share/man/man4/igc.4
+2-18sys/compat/linuxkpi/common/include/linux/pci.h
+20-0sys/dev/igc/igc_mac.c
+1,403-7718 files not shown
+1,489-10224 files

HardenedBSD/src eb6bd71libexec/rc rc.subr, libexec/rc/tests svcj_test.sh

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+1,178-0libexec/rc/tests/svcj_test.sh
+153-54sys/dev/igc/if_igc.c
+29-2libexec/rc/rc.subr
+21-3share/man/man4/igc.4
+2-18sys/compat/linuxkpi/common/include/linux/pci.h
+20-0sys/dev/igc/igc_mac.c
+1,403-7718 files not shown
+1,489-10224 files

HardenedBSD/src 5076e9binclude assert.h time.h, sys/sys stdatomic.h

libc: Fix C23 version macro visibility

In headers that existed prior to C23, these should be visible only in
C23 or BSD mode.

Fixes:          0fe73dcf7c32 ("libc: Add <assert.h> C23 feature test macro")
Fixes:          1f09e354297c ("sys/limits.h: Add BOOL_MAX, BITINT_MAXWIDTH, and C23 feature test macro")
Fixes:          cd0727ec709b ("libc: Add <stdio.h> C23 feature test macro")
Fixes:          fc9d02cb29ed ("libc: Add <time.h> C23 feature test macro")
Fixes:          4aeed6e9d213 ("libc: Add <setjmp.h> C23 feature test macro")
Reviewed by:    fuz, kfv, dteske
Differential Revision:  https://reviews.freebsd.org/D59272
DeltaFile
+4-2sys/sys/stdatomic.h
+4-2include/time.h
+4-2include/stdio.h
+4-2include/setjmp.h
+4-2include/limits.h
+2-0include/assert.h
+22-106 files

HardenedBSD/src b5dcd8flibexec/rc/tests Makefile svcj_test.sh

rc.subr tests: service jail behaviour of run_rc_command

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)
DeltaFile
+1,178-0libexec/rc/tests/svcj_test.sh
+1-1libexec/rc/tests/Makefile
+1,179-12 files

HardenedBSD/src be834d6share/man/man5 rc.conf.5

rc.conf.5: note that a negative nice value does not reach a service jail

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
DeltaFile
+8-0share/man/man5/rc.conf.5
+8-01 files

HardenedBSD/src 9125bc0libexec/rc rc.subr, share/man/man5 rc.conf.5

rc.subr: svcj - add a setaudit option

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
DeltaFile
+5-1share/man/man5/rc.conf.5
+3-0libexec/rc/rc.subr
+8-12 files

HardenedBSD/src 327dae5libexec/rc rc.subr

rc.subr: svcj - run a service's own restart and status methods in its jail

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:                  2efbd480f1d3 rc: add service jails framework
MFC after:              1 week
MFC to:                 stable/15
Assisted-by:    Claude Code (Opus 5)
DeltaFile
+17-1libexec/rc/rc.subr
+17-11 files

HardenedBSD/src a70ca1elibexec/rc rc.subr

rc.subr: svcj - remove the service jail when the service is not running

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:                  2efbd480f1d3 rc: add service jails framework
MFC after:              1 week
MFC to:                 stable/15
Assisted-by:    Claude Code (Opus 5)
DeltaFile
+4-0libexec/rc/rc.subr
+4-01 files

HardenedBSD/src 21e53eelibexec/rc rc.conf rc.subr

rc.subr: svcj - let svcj_all_enable enable service jails

Fix the logic for svcj_all_enable.

Fixes:          2efbd480f1d3 rc: add service jails framework
MFC after:      1 week
MFC to:         stable/15
DeltaFile
+2-1libexec/rc/rc.subr
+2-0libexec/rc/rc.conf
+4-12 files

HardenedBSD/src 6155e17libexec/rc rc.subr

rc.subr: svcj - send the stop signal from inside the service jail

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 8a5ceebece03 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
DeltaFile
+3-0libexec/rc/rc.subr
+3-01 files

HardenedBSD/src 90bee82share/man/man4 igc.4, sys/dev/igc if_igc.h igc_defines.h

igc: Correct Wake-on-LAN filter programming

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

    [47 lines not shown]
DeltaFile
+153-54sys/dev/igc/if_igc.c
+21-3share/man/man4/igc.4
+20-0sys/dev/igc/igc_mac.c
+3-4sys/dev/igc/igc_defines.h
+3-4sys/dev/igc/igc_base.c
+1-3sys/dev/igc/if_igc.h
+201-682 files not shown
+203-698 files

HardenedBSD/src c4e24e9share/man/man9 Makefile pci.9, sys/compat/linuxkpi/common/include/linux pci.h

pci: Expose PME support by power state

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
DeltaFile
+2-18sys/compat/linuxkpi/common/include/linux/pci.h
+18-1share/man/man9/pci.9
+19-0sys/dev/pci/pci.c
+1-0sys/dev/pci/pcivar.h
+1-0share/man/man9/Makefile
+41-195 files

HardenedBSD/src 9e863c1usr.bin/whereis whereis.1 whereis.c, usr.sbin/mixer mixer.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+54-66usr.bin/whereis/whereis.c
+0-4usr.bin/whereis/whereis.1
+3-1usr.sbin/mixer/mixer.c
+57-713 files

HardenedBSD/src fe8652cusr.bin/whereis whereis.1 whereis.c, usr.sbin/mixer mixer.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+54-66usr.bin/whereis/whereis.c
+0-4usr.bin/whereis/whereis.1
+3-1usr.sbin/mixer/mixer.c
+57-713 files

HardenedBSD/src 9f5cfe6usr.sbin/mixer mixer.c

mixer: Improve error messages

Use better diagnostic messages when unit numbers are wrong.

Reviewed by:    arrowd@, christos@, kevans@
Approved by:    christos@
Differential Revision:  https://reviews.freebsd.org/D56845
DeltaFile
+3-1usr.sbin/mixer/mixer.c
+3-11 files

HardenedBSD/src 0b3fc7fusr.bin/whereis whereis.1 whereis.c

Revert "whereis(1): Respect PORTSDIR variable"

This reverts commit edadc3f9051595a9c2e693d8ab666a50b9e7a21a.
DeltaFile
+54-66usr.bin/whereis/whereis.c
+0-4usr.bin/whereis/whereis.1
+54-702 files

HardenedBSD/src 6f8fb0ashare/man/man4 ntb_hw_intel.4 ntb_hw_amd.4, sys/dev/dpaa fman_xmdio.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+25-28share/man/man4/ntb_hw_plx.4
+45-6sys/dev/dpaa/fman_xmdio.c
+19-21share/man/man4/ntb.4
+17-20share/man/man4/ntb_hw_amd.4
+18-19share/man/man4/em.4
+8-12share/man/man4/ntb_hw_intel.4
+132-1063 files not shown
+146-1209 files

HardenedBSD/src 7a1838fshare/man/man4 ixv.4, sys/dev/e1000 e1000_defines.h if_em.c

Merge remote-tracking branch 'rad/hardened/15-stable/main' into hardened/15-stable/pledge
DeltaFile
+895-17sys/dev/e1000/if_em.c
+104-67sys/dev/ixgbe/if_ixv.c
+98-0share/man/man4/ixv.4
+70-20sys/dev/ixgbe/if_ix.c
+63-0sys/dev/e1000/e1000_defines.h
+38-24sys/dev/igc/if_igc.c
+1,268-12815 files not shown
+1,508-15721 files

HardenedBSD/src da1a7b9share/man/man4 ntb_hw_intel.4 ntb_hw_amd.4, sys/dev/dpaa fman_xmdio.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+25-28share/man/man4/ntb_hw_plx.4
+45-6sys/dev/dpaa/fman_xmdio.c
+19-21share/man/man4/ntb.4
+17-20share/man/man4/ntb_hw_amd.4
+18-19share/man/man4/em.4
+8-12share/man/man4/ntb_hw_intel.4
+132-1063 files not shown
+146-1209 files

HardenedBSD/src b10f92ashare/man/man4 ixv.4, sys/dev/e1000 e1000_defines.h if_em.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+895-17sys/dev/e1000/if_em.c
+104-67sys/dev/ixgbe/if_ixv.c
+98-0share/man/man4/ixv.4
+70-20sys/dev/ixgbe/if_ix.c
+63-0sys/dev/e1000/e1000_defines.h
+38-24sys/dev/igc/if_igc.c
+1,268-12815 files not shown
+1,508-15721 files

HardenedBSD/src 1911838sys/dev/dpaa fman_xmdio.c

dpaa/fman_xmdio: Make xmdio a "real" MDIO

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.
DeltaFile
+45-6sys/dev/dpaa/fman_xmdio.c
+45-61 files

HardenedBSD/src 32b99a2sys/dev/dpaa fman.c

dpaa/fman: Pad the qman channel search array

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.
DeltaFile
+3-3sys/dev/dpaa/fman.c
+3-31 files

HardenedBSD/src 26d5c4fsys/powerpc/pseries xics.c

powerpc64/powernv: Migrate XICS to PIC_AP_INIT

Get rid of the powernv-specific AP callback and use the new-ish
PIC_AP_INIT() PIC KPI instead.
DeltaFile
+7-10sys/powerpc/pseries/xics.c
+7-101 files

HardenedBSD/src a416bbfshare/man/man4 ntb_hw_plx.4

ntb_hw_plx.4: Canonicalize

+ tag SPDX
+ canonicalize SYNOPSIS, LOADER TUNABLES, and HARDWARE
+ switch X to %d for clarity and consistency

MFC after:      3 days
DeltaFile
+25-28share/man/man4/ntb_hw_plx.4
+25-281 files

HardenedBSD/src 9cdadb3share/man/man4 ntb.4

ntb.4: Canonicalize SYNOPSIS and LOADER TUNABLES

Also tag SPDX, and switch X to %d for clarity and consistency.

MFC after:      3 days
DeltaFile
+19-21share/man/man4/ntb.4
+19-211 files

HardenedBSD/src 63ecc9ashare/man/man4 ntb_hw_amd.4

ntb_hw_amd.4: Canonicalize SYNOPSIS and SYSCTLs

Also tag SPDX.

MFC after:      3 days
DeltaFile
+17-20share/man/man4/ntb_hw_amd.4
+17-201 files

HardenedBSD/src 6acf079share/man/man4 ntb_hw_intel.4

ntb_hw_intel.4: Canonicalize SYNOPSIS + tag SPDX

MFC after:      3 days
DeltaFile
+6-10share/man/man4/ntb_hw_intel.4
+6-101 files

HardenedBSD/src 8a6c20asys/dev/e1000 if_em.c

igb: Guard register dump during queue setup

The register-dump sysctl is installed before iflib allocates the queue
arrays and remains visible while they are freed. Return ENXIO outside
the queue lifetime instead of dereferencing a NULL or stale array.

Sponsored by:   BBOX.io

(cherry picked from commit bcb62ec0e3d592892f0f304269ed2722d1bae75a)
DeltaFile
+7-0sys/dev/e1000/if_em.c
+7-01 files

HardenedBSD/src b91c0fcsys/dev/pci pci_iov.c

pci_iov: Permit non-ARI VFs on a secondary bus

A non-zero VF device number does not always require ARI. The Intel
82576 and I350 [1] explicitly support a non-ARI layout that places VFs
on the next bus.

Check every requested VF RID and reject a non-zero device only when it
is on the PF bus. This retains the ARI guard for invalid same-bus
layouts while permitting the documented second-bus layout.

[1] Intel I350 Datasheet, sections 7.8.2.6.1.2, 9.6.4.6

Sponsored by:   BBOX.io

(cherry picked from commit e795a31cb4d66368bdbe5ac7f61c0899d3ed39f8)
DeltaFile
+18-3sys/dev/pci/pci_iov.c
+18-31 files

HardenedBSD/src 7827d43sys/dev/e1000 if_em.h if_em.c

e1000: Recover from the 82574 PHY hang

The shared code provides e1000_check_phy_82574() to recognize a PHY
hang from saturated receive error and idle error counters, but em(4)
never calls it.

Run the check from timer driven admin work.  Match Intel e1000e by
requiring two consecutive positive samples before requesting a full
iflib reset.

MFC after:      2 weeks
Sponsored by:   BBOX.io

(cherry picked from commit 81d5356799a1db1701cb3f91146131c34dede413)
DeltaFile
+24-1sys/dev/e1000/if_em.c
+1-0sys/dev/e1000/if_em.h
+25-12 files