HardenedBSD/src 0b1bd69sys/dev/e1000 igb_txrx.c em_txrx.c, sys/dev/igc if_igc.h if_igc.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+174-151sys/dev/e1000/if_em.c
+162-141sys/dev/igc/if_igc.c
+53-8sys/dev/e1000/if_em.h
+52-8sys/dev/igc/if_igc.h
+25-4sys/dev/e1000/em_txrx.c
+22-3sys/dev/e1000/igb_txrx.c
+488-3153 files not shown
+538-3189 files

HardenedBSD/src a5b3b04share/man/man4 igc.4

igc(4): document adaptive interrupt moderation

Describe the disabled, adaptive, and low-latency settings and their
interrupt-rate tradeoffs.

(cherry picked from commit 297394e995e5ea1ea9bc85e609ca116255d51e97)
DeltaFile
+14-0share/man/man4/igc.4
+14-01 files

HardenedBSD/src adaa4c6sys/dev/igc igc_txrx.c

igc: count TSO wire segments in the AIM counters

The transmit path bills one packet of ipi_len bytes per request.  For
TSO that is the whole unsegmented payload, up to 64 KiB, rather than a
packet size that appears on the wire.

Count the segments the hardware emits and the header carried by each
segment.  Non-TSO accounting is unchanged.

(cherry picked from commit e389a05164ccb1dd41ee8d7f09203b475322dd72)
DeltaFile
+19-2sys/dev/igc/igc_txrx.c
+19-21 files

HardenedBSD/src 169f8c6sys/dev/igc if_igc.h if_igc.c

igc: use packet-size AIM

Use the packet-size calculation introduced for igb(4) in a69ed8dfb381
and retained there until the iflib conversion in f2d6ace4a684.  It
derives interrupt holdoff from average packet size, so RSS queue count
does not change its behavior.

The calculation follows the pre-iflib igb code.  Retain igc's normal and
low-latency rate caps, and keep the current setting when an interval has
no usable sample.

(cherry picked from commit 01e7acd38d411c78caba1c4078bb3683f586e1c2)
DeltaFile
+67-108sys/dev/igc/if_igc.c
+8-3sys/dev/igc/if_igc.h
+75-1112 files

HardenedBSD/src a00bd48sys/dev/igc if_igc.h if_igc.c

igc: synchronize interrupt moderation state

Keep the saved EITR value synchronized with hardware across
reinitialization.  Correct EITR encoding, decoding, and MSI-X register
selection, and reject nonpositive fallback rates.

Apply the packet-buffer fallback without permanently disabling AIM.

(cherry picked from commit e35533457530bb9db655e6137c2eea790e18b97b)
DeltaFile
+25-10sys/dev/igc/if_igc.c
+4-2sys/dev/igc/if_igc.h
+29-122 files

HardenedBSD/src d93ee05sys/dev/igc igc_txrx.c if_igc.h

igc: make AIM counter sampling coherent

Sample free-running counters by delta instead of clearing them from the
interrupt filter, which can race their producers.  Publish byte and
packet counts together at the TX and RX doorbells so each sample is
coherent.

Aggregate every TX ring assigned to the interrupt vector so unequal RX
and TX queue counts are safe.  Count RX bytes only after a frame is
accepted.

(cherry picked from commit 2290ea7f4311e899019fe77bf7c7775033af6b24)
DeltaFile
+72-25sys/dev/igc/if_igc.c
+41-4sys/dev/igc/if_igc.h
+3-1sys/dev/igc/igc_txrx.c
+116-303 files

HardenedBSD/src 37513bfsys/dev/igc igc_txrx.c

igc: fix RX accounting for multi-descriptor packets

The receive path adds the running packet length to rx_bytes for every
descriptor.  A packet spanning descriptors of length l1, l2, and l3 is
therefore counted as 3*l1 + 2*l2 + l3.

Add each descriptor length once.  Single-descriptor accounting remains
unchanged.

(cherry picked from commit bbf0372feeb321a5bfeff7b1e79576ab01240441)
DeltaFile
+1-1sys/dev/igc/igc_txrx.c
+1-11 files

HardenedBSD/src 871efe1share/man/man4 em.4

em(4): document adaptive interrupt moderation

Describe the disabled, adaptive, and low-latency settings and their
interrupt-rate tradeoffs.

(cherry picked from commit b6b379b94781da5d4328f6f57273fbe7bd9dc687)
DeltaFile
+14-0share/man/man4/em.4
+14-01 files

HardenedBSD/src 3845087sys/dev/e1000 igb_txrx.c em_txrx.c

e1000: count TSO wire segments in the AIM counters

The transmit paths billed one packet of ipi_len bytes per request.  For
TSO that is the whole unsegmented payload, up to 64KB, so the average
size the moderation calculation sees is not a size that appears on the
wire.

Count the segments the hardware will put on the wire and the header each
of them carries.

Non-TSO accounting is unchanged.

(cherry picked from commit 072e0983d7bce80356740324973993393e77023a)
DeltaFile
+19-2sys/dev/e1000/igb_txrx.c
+19-2sys/dev/e1000/em_txrx.c
+38-42 files

HardenedBSD/src 5b380c2sys/dev/e1000 if_em.h if_em.c

e1000: restore packet-size AIM

Restore the packet-size calculation introduced in a69ed8dfb381 and used
by igb(4) until the iflib conversion in f2d6ace4a684.  It derives
interrupt holdoff from average packet size, so RSS queue count does not
change its behavior.

The calculation follows the pre-iflib code.  Retain the current normal
and low-latency rate caps, and keep the current setting when an interval
has no usable sample.

Fixes:          3e501ef89667 ("e1000: Re-add AIM")

(cherry picked from commit dc4a5087b160c1a94d135ab636642defe2c71c20)
DeltaFile
+67-107sys/dev/e1000/if_em.c
+8-3sys/dev/e1000/if_em.h
+75-1102 files

HardenedBSD/src 1c8d599sys/dev/e1000 if_em.h if_em.c

e1000: synchronize interrupt moderation state

Keep the saved EITR and PBA values synchronized with hardware across
reinitialization.  Correct EITR encoding, decoding, and MSI-X register
selection, and reject nonpositive fallback rates.

Treat only sub-gigabit links as sub-gigabit and apply the packet-buffer
fallback without permanently disabling AIM.

(cherry picked from commit 6ef368a29b11ebc769e7929566809b75ae2c1e90)
DeltaFile
+38-22sys/dev/e1000/if_em.c
+4-2sys/dev/e1000/if_em.h
+42-242 files

HardenedBSD/src e8cf1bfsys/dev/e1000 igb_txrx.c em_txrx.c

e1000: make AIM counter sampling coherent

Sample free-running counters by delta instead of clearing them from the
interrupt filter, which can race their producers.  Publish byte and
packet counts together at the TX and RX doorbells so each sample is
coherent.

Aggregate every TX ring assigned to the interrupt vector so unequal RX
and TX queue counts are safe.  Count RX bytes only after a frame is
accepted.

(cherry picked from commit bc5e7b0cbbb555ffebc7d73b273c421f9ee24c23)
DeltaFile
+72-25sys/dev/e1000/if_em.c
+42-4sys/dev/e1000/if_em.h
+6-2sys/dev/e1000/em_txrx.c
+3-1sys/dev/e1000/igb_txrx.c
+123-324 files

HardenedBSD/src c08594elib/libsys pdfork.2, sys/kern sys_procdesc.c kern_exit.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+39-51tests/sys/capsicum/procdesc.cc
+53-36sys/kern/kern_exit.c
+58-19sys/kern/sys_procdesc.c
+57-4lib/libsys/pdfork.2
+11-8tests/sys/kern/pdwait.c
+13-4sys/sys/procdesc.h
+231-1228 files not shown
+264-13914 files

HardenedBSD/src 50a237elib/libsys pdfork.2, sys/kern sys_procdesc.c kern_exit.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+39-51tests/sys/capsicum/procdesc.cc
+53-36sys/kern/kern_exit.c
+58-19sys/kern/sys_procdesc.c
+57-4lib/libsys/pdfork.2
+11-8tests/sys/kern/pdwait.c
+13-4sys/sys/procdesc.h
+231-1228 files not shown
+264-13914 files

HardenedBSD/src 0b65614sys/dev/ena ena.h ena.c, usr.sbin/vidcontrol vidcontrol.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+15-14sys/dev/ena/ena_datapath.c
+7-6sys/dev/ena/ena.c
+5-2usr.sbin/vidcontrol/vidcontrol.c
+2-2sys/dev/ena/ena.h
+29-244 files

HardenedBSD/src 9ddd9ffusr.sbin/vidcontrol vidcontrol.c

vidcontrol: Disallow -i mode with vt(4)

vt(4) does not (currently) support changing the video mode.  Report that
-i mode is not supported rather than printing an empty list.

PR:             207411
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58163

(cherry picked from commit c3e38c0093f2dbfafdfcc585a2f06b0313e7f6b1)
DeltaFile
+5-2usr.sbin/vidcontrol/vidcontrol.c
+5-21 files

HardenedBSD/src ae462f7sys/dev/ena ena_datapath.c

ena: Batch RX statistics updates

Move per-packet counter_enter/counter_exit pairs out of the RX
processing loop and batch them into a single update after the
loop completes.

Previously, each received packet triggered two separate
counter_enter/counter_exit blocks -- one for bytes and one for
packet count. This commit accumulates totals in local variables
and updates all four counters (ring and hw stats for both packets
and bytes) in a single counter_enter/counter_exit block after the
loop.

Also move the stats update to after the refill and LRO flush
so that the error path (goto update_stats) and the normal path
converge at the same label, avoiding code duplication.

Submitted by: David Arinzon <darinzon at amazon.com>
MFC after: 2 weeks

    [5 lines not shown]
DeltaFile
+12-11sys/dev/ena/ena_datapath.c
+12-111 files

HardenedBSD/src ff519easys/dev/ena ena.h ena_datapath.c

ena: Fix false 'missing TX completions' warnings due to timestamp race

Sporadic 'Found a Tx that wasn't completed on time' warnings appear
under sustained TX load, always reporting '1 msecs since last cleanup'
despite the 5-second timeout threshold.

The per-packet TX timestamp uses struct bintime (128 bits: two 64-bit
fields sec and frac) which is read and written non-atomically. A race
exists between the missing TX completion check
(check_missing_comp_in_tx_queue reading the timestamp) and the TX
submit path or cleanup path writing it on another CPU. Since the two
fields are not updated atomically, the check can observe a partially
written timestamp - one field from the old value and one from the new.
This can produce a timestamp with {sec=0, frac=valid}, causing the
check to compute a time offset equal to system uptime and falsely
exceeding the 5-second timeout.

Confirmed by instrumentation showing all occurrences had sec=0 with
valid frac/mbuf, cleanup_running=0, and ticks==last_cleanup_ticks.

    [24 lines not shown]
DeltaFile
+7-6sys/dev/ena/ena.c
+2-2sys/dev/ena/ena_datapath.c
+1-1sys/dev/ena/ena.h
+10-93 files

HardenedBSD/src dd075ffsys/dev/ena ena.h

ena: Update driver version to v2.8.4

Bug Fixes:
* Fix false 'missing TX completions' warnings due to timestamp race
* Put taskqueues into correct NUMA domain if !RSS

Minor Changes:
* Batch RX statistics updates
* Swap RX/TX completions cleanup order

Submitted by: Arthur Kiyanovski <akiyano at amazon.com>
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D58242

(cherry picked from commit 605e699cd6ca4feae6c73c5c5ea8337054897116)
DeltaFile
+1-1sys/dev/ena/ena.h
+1-11 files

HardenedBSD/src 109a12asys/dev/ena ena_datapath.c

ena: Swap cleanup order

As RX processing is heavier than TX completions processing, swap the
order and process TX completions first, in order to avoid starving the
completions and causing potential missing TX completions.

Submitted by: Ofir Tabachnik <ofirt at amazon.com>
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D58239

(cherry picked from commit f08def9ed97f45700eb0611a3fd9240210c9303e)
DeltaFile
+1-1sys/dev/ena/ena_datapath.c
+1-11 files

HardenedBSD/src 16e47f3libexec/rc/rc.d nuageinit_user_data_script

nuageinit: Allow the userdata script to run before firstboot* rc services

Allowing nuageinit user scripts to run before these makes it possible to
customize official BASIC-CI and BASIC-CLOUDINIT FreeBSD images.

This was requested by KDE for their CI.

Approved by:    cperciva
Pull-Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/60
DeltaFile
+1-0libexec/rc/rc.d/nuageinit_user_data_script
+1-01 files

HardenedBSD/src 9c799e5sys/dev/ixl ixl_pf_iov.c, sys/kern vfs_mountroot.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+6-1sys/kern/vfs_mountroot.c
+1-2sys/dev/ixl/ixl_pf_iov.c
+7-32 files

HardenedBSD/src 99542fasys/dev/ixl ixl_pf_iov.c, sys/kern vfs_mountroot.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+6-1sys/kern/vfs_mountroot.c
+1-2sys/dev/ixl/ixl_pf_iov.c
+7-32 files

HardenedBSD/src 77d6c45tests/sys/capsicum syscalls.h procdesc.cc

tests/sys/capsicum: adjust tests for the new reaping behavior

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58569
DeltaFile
+39-51tests/sys/capsicum/procdesc.cc
+1-0tests/sys/capsicum/syscalls.h
+40-512 files

HardenedBSD/src a96f285tests/sys/kern reaper.c procdesc.c

tests/sys/kern: adjust tests for the new reaping behavior

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58530
DeltaFile
+11-8tests/sys/kern/pdwait.c
+4-5tests/sys/kern/ptrace_test.c
+4-2tests/sys/kern/procdesc.c
+1-0tests/sys/kern/reaper.c
+20-154 files

HardenedBSD/src c491985lib/libsys wait.2 pdfork.2

pdwait(2), wait(2): document interaction between pdopenpid() and waitpid()

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58264
DeltaFile
+57-4lib/libsys/pdfork.2
+0-9lib/libsys/wait.2
+57-132 files

HardenedBSD/src bcdb6basys/kern kern_fork.c sys_procdesc.c, sys/sys procdesc.h proc.h

processes: add zombie references, each of them prevents reap

Add the p_zombieref bitmask into struct proc, which enumerates all
legitimate waiters on the process exit status. Among them are parent
for PZOMBIEREF_PARENT, and the holder of the process descriptor for
PZOMBIEREF_PROCDESC, if the process was created by pdfork().

Require all zombie refs to be cleared to reap zombie. This prevents
stealing the exit status from the parent by pdwait()ing on a procdesc
obtained by pdopenpid(), or by waitpid() by debugger from the real
parent.

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58264
DeltaFile
+33-25sys/kern/kern_exit.c
+33-15sys/kern/sys_procdesc.c
+11-1sys/sys/proc.h
+9-0sys/kern/kern_fork.c
+4-2sys/sys/procdesc.h
+90-435 files

HardenedBSD/src 7da4eddsys/kern kern_exit.c sys_procdesc.c, sys/sys procdesc.h

pdwait(2): change handling of the exited processes

Instead of accessing the struct proc and gathering data from it,
memoize the data needed for pdwait() on exited process in struct
procdesc, at the time of process termination.

This allows unlimited number of calls to pdwait(2) on procdesc for
terminated process.

Change the locking requirements for pd_flags to proctree_lock. This does
not modify the pre-patch locking regime, but the change requires it.

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58407
DeltaFile
+25-4sys/kern/sys_procdesc.c
+18-9sys/kern/kern_exit.c
+9-2sys/sys/procdesc.h
+52-153 files

HardenedBSD/src a24674esys/kern kern_exit.c, sys/sys proc.h

kern/kern_exit.c: make wait_fill_siginfo/wrusage global

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58407
DeltaFile
+2-2sys/kern/kern_exit.c
+2-0sys/sys/proc.h
+4-22 files

HardenedBSD/src e96f1cbsys/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
DeltaFile
+6-1sys/kern/vfs_mountroot.c
+6-11 files