FreeBSD/src 9ac3919sys/netinet tcp_input.c, sys/netinet/tcp_stacks rack_bbr_common.c

tcp: improve SEG.SEQ validation for RST segments

A RST segment can be sent in response to
(a) received segment or
(b) by the upper layer protocol.

The SEG.SEQ validation consists of two checks:
(1) the in-window check of SEG.SEQ and
(2) the exact match check of SEG.SEQ.

For the in-window check (1), the left edge of the window needs to be
based on tp->last_ack_sent to cover the delayed ACK case, whereas the
right edge needs to be based on tp->rcv_nxt + tp->rcv_wnd. This both
assumes that tp->rcv_wnd is not zero. For the special case of
tp->rcv_wnd being zero, add checks against tp->last_ack_sent for (a)
and on tp->rcv_nxt for (b). This applies to all TCP stacks.

When the exact match (2) of SEG.SEQ is performed, it should be based
on tp->last_ack_sent for (a) and on tp->rcv_nxt for (b). To cover both,

    [9 lines not shown]
DeltaFile
+14-8sys/netinet/tcp_stacks/rack_bbr_common.c
+12-6sys/netinet/tcp_input.c
+26-142 files

FreeBSD/src e8d1ceesys/netinet tcp_timer.c

tcp: improve handling of stopped timers

When a TCP timer is stopped, t_timers[] is set to SBT_MAX. Adding the
corresponding t_precisions[], if it is not zero, would result in
overflows in tcp_timer_next(). To avoid this, skip stopped timers.

The problem was identified while debugging uperf by Lukas Book and
an initial patch was provided by him. The committed patch was
suggested by glebius.

The problem can be observed by running netstat -nxptcp and looking for
negative timer values and by observing very long running timers in
some cases.

Reported by:            Lukas Book <lkbook at outlook.de>
Reviewed by:            glebius
Differential Revision:  https://reviews.freebsd.org/D58484

(cherry picked from commit 52b7cbcb78c14e89f6faec8da5acc2caa3d37208)
DeltaFile
+2-0sys/netinet/tcp_timer.c
+2-01 files

FreeBSD/src cad0d57tests/sys/netinet ip_reass_test.c

tests: fix checksum computation

This fixes an endianness bug in sys/netinet/ip_reass_test.
Just use the code from RFC 1071.

Reported by:            glebius
Reviewed by:            glebius, Timo Völker
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D57988

(cherry picked from commit fbc039e512c3bb1635ad20cc8f70ad608ea818b7)
DeltaFile
+18-14tests/sys/netinet/ip_reass_test.c
+18-141 files

FreeBSD/src a2d2f7asys/net if_loop.c

loopback: use new names for checksum offloading flags

No functional change intended.

Reviewed by:            tuexen
Differential Revision:  https://reviews.freebsd.org/D57945

(cherry picked from commit bcf4e3c001f5ec9cc206b0d81f0954559d1424d8)
DeltaFile
+5-6sys/net/if_loop.c
+5-61 files

FreeBSD/src a5423ccsys/netinet/tcp_stacks rack_bbr_common.c

rack_bbr_common: don't use stale pointer after m_pullup()

Reviewed by:            tuexen
Differential Revision:  https://reviews.freebsd.org/D57816

(cherry picked from commit be23edc1e4028e32a46e8fe7118de787fd5d79a2)
DeltaFile
+2-2sys/netinet/tcp_stacks/rack_bbr_common.c
+2-21 files

FreeBSD/src 265b3e1share/man/man4 lo.4, sys/net if_loop.c

loopback: improve checksum offloading

* Allow disabling IFCAP_RXCSUM_IPV6 or IFCAP_TXCSUM_IPV6.
* Do not pretend the checksum is correct by setting the LO_CSUM_SET
  flags if IFCAP_RXCSUM_IPV6 or IFCAP_RXCSUM is enabled. Instead,
  remove the LO_CSUM_SET flags (in case they have been set somehow)
  if IFCAP_RXCSUM_IPV6 or IFCAP_RXCSUM is disabled.
* Do not unset the transmit checksum offload flags LO_CSUM_FEATURES or
  LO_CSUM_FEATURES6 since they now have a meaning for the receive path.

Reviewed by:            glebius, pouria, tuexen
Okayed by:              bz
Differential Revision:  https://reviews.freebsd.org/D57518

(cherry picked from commit d6c4cea7740d5c5c673a06ba37e4f1bdcddb2ece)
DeltaFile
+6-36sys/net/if_loop.c
+10-13share/man/man4/lo.4
+16-492 files

FreeBSD/src f059fcfsys/dev/virtio/pci virtio_pci_modern.c

virtio_pci_modern: Remove endianness conversion for config space

The bus_* functions already handle converting from PCI endianness
(i.e. little-endian) to native endianness when accessing the config
space (see ofw_pcib_bus_get_bus_tag), so converting again with
virtio_htogX/virtio_gtohX undoes any byte-swapping and breaks
big-endian systems. They should only be used for operating on shared
memory.
Note part of this reverts commit fb53b42e36a9 ("virtio-modern: fix PCI
common read/write functions on big endian targets").

PR:                     294706
Reviewed by:            adrian, tuexen
Fixes:                  fb53b42e36a9 ("virtio-modern: fix PCI common read/write functions on big endian targets")
Fixes:                  9da9560c4dd3 ("virtio: Add VirtIO PCI modern (V1) support")
Differential Revision:  https://reviews.freebsd.org/D57392

(cherry picked from commit 07b5d1ca52b113cecad3cda73ff5e782d8f4d07d)
DeltaFile
+10-17sys/dev/virtio/pci/virtio_pci_modern.c
+10-171 files

FreeBSD/src 9f49131sys/netinet tcp_syncache.c

tcp: cleanup resource handling in SYN handling

Handle cred, ipopts, and maclabel using the same pattern:
allocate at the beginning and set to NULL when the object is
transferred to a struct syncache. When exiting the function, free
these objects if not transferred or when transferred to the on-stack
struct syncache. This makes use of a new function syncache_release().

This fixes a use after free problem: ipopts should only be freed,
if the on-stack struct syncache is used and the pointer in this
structure still points to the allocated ipopts. If the ipopts
are moved from the struct syncache to the struct inpcb in
syncache_socket(), which is called by syncache_tfo_expand(),
the pointer in the struct syncache is set to NULL.

In a FreeBSD default setup this problem is mitigated by
1. TCP fast open support on the server side not being enabled
   (the sysctl-variable net.inet.tcp.fastopen.server_enable is 0).
2. Incoming IP packet with source routing options are not being

    [12 lines not shown]
DeltaFile
+30-44sys/netinet/tcp_syncache.c
+30-441 files

FreeBSD/src 1f3b673sys/kern kern_exec.c

kern_execve(): avoid storing non-VDIR into p_textdvp

(cherry picked from commit 930f2e4da96487f18a82f912275c6302c39b9bd2)
DeltaFile
+36-2sys/kern/kern_exec.c
+36-21 files

FreeBSD/src d3c3a70sys/fs/autofs autofs_vfsops.c

autofs: try to avoid waiting for timeouts of in-flight requests for forced unmounts

Do the advisory aborts of the in-flight requests before flushing the
vnodes.  It should mostly eliminate the waits due to requests busying
the mp.

Reported and reviewed by:       rew
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58637
DeltaFile
+28-0sys/fs/autofs/autofs_vfsops.c
+28-01 files

FreeBSD/src 976f400sys/dev/e1000 if_em.c

igb: Stop writing the legacy TADV register

TADV is an em-class interrupt delay register and is absent from the
82575 and later register model. The igb attach path does not expose or
initialize that control, but transmit initialization still wrote its
zero valued storage into a reserved queue-window offset.

Apply the same igb_mac_min boundary already used for TIDV and the
absolute-delay sysctls.

Sponsored by:   BBOX.io

(cherry picked from commit c637d474045a41b1763c17a8b4b7763d4159504f)
DeltaFile
+1-1sys/dev/e1000/if_em.c
+1-11 files

FreeBSD/src 8ef5d8bsys/dev/e1000 if_em.c

igb: Reprogram descriptor queues while disabled

Disable each igb-class transmit and receive queue and flush before
changing its descriptor-ring registers. Restore the head and tail
indices that Intel documents as surviving a VF reset.

Use the igb queue-enable control instead of programming legacy TXDCTL
granularity, low-water, and reserved bits that do not belong to the
82575 and later.

Sponsored by:   BBOX.io

(cherry picked from commit f879d1cd7df3c5afa69428cc2b07e1675d7776c9)
DeltaFile
+21-5sys/dev/e1000/if_em.c
+21-51 files

FreeBSD/src c410920sys/dev/e1000 igb_txrx.c

igb: Correct I350 loopback VLAN byte order

I350 loopback receive descriptors report VLAN tags byte-swapped for
both PFs and VFs. The receive path handled the PF device types but
omitted e1000_vfadapt_i350, causing an admitted VF VLAN packet to be
delivered untagged to the VF parent.

Include the I350 VF type in the existing correction. This matches the
dedicated IGB_RXQ_FLAG_LB_BSWAP_VLAN handling in DPDK igbvf.

Sponsored by:   BBOX.io

(cherry picked from commit 7eb7ff6459219e802d51add3ba9d1d9d874db561)
DeltaFile
+2-1sys/dev/e1000/igb_txrx.c
+2-11 files

FreeBSD/src 799f8ebsys/dev/pci pci_iov.c

pci_iov: Clear NumVFs when configuration fails

pci_iov_config() programs NumVFs before validating the final VF RID
layout and allocating all generic resources. A subsequent error ran the
driver uninit callback but left the hardware NumVFs register programmed
while the software VF count returned to zero.

Clear NumVFs in the error path after the driver uninit callback,
matching normal SR-IOV teardown ordering. This prevents stale hardware
state after a failed configuration and permits a clean retry.

Sponsored by:   BBOX.io

(cherry picked from commit 621498b58cdab36a237d5f0b5c902952ad743fa9)
DeltaFile
+3-1sys/dev/pci/pci_iov.c
+3-11 files

FreeBSD/src fbdb872sys/dev/e1000 if_em.c

igb: Stop writing the legacy TADV register

TADV is an em-class interrupt delay register and is absent from the
82575 and later register model. The igb attach path does not expose or
initialize that control, but transmit initialization still wrote its
zero valued storage into a reserved queue-window offset.

Apply the same igb_mac_min boundary already used for TIDV and the
absolute-delay sysctls.

Sponsored by:   BBOX.io

(cherry picked from commit c637d474045a41b1763c17a8b4b7763d4159504f)
DeltaFile
+1-1sys/dev/e1000/if_em.c
+1-11 files

FreeBSD/src 908706bsys/dev/e1000 if_em.c

igb: Reprogram descriptor queues while disabled

Disable each igb-class transmit and receive queue and flush before
changing its descriptor-ring registers. Restore the head and tail
indices that Intel documents as surviving a VF reset.

Use the igb queue-enable control instead of programming legacy TXDCTL
granularity, low-water, and reserved bits that do not belong to the
82575 and later.

Sponsored by:   BBOX.io

(cherry picked from commit f879d1cd7df3c5afa69428cc2b07e1675d7776c9)
DeltaFile
+21-5sys/dev/e1000/if_em.c
+21-51 files

FreeBSD/src 86000d1sys/dev/e1000 igb_txrx.c

igb: Correct I350 loopback VLAN byte order

I350 loopback receive descriptors report VLAN tags byte-swapped for
both PFs and VFs. The receive path handled the PF device types but
omitted e1000_vfadapt_i350, causing an admitted VF VLAN packet to be
delivered untagged to the VF parent.

Include the I350 VF type in the existing correction. This matches the
dedicated IGB_RXQ_FLAG_LB_BSWAP_VLAN handling in DPDK igbvf.

Sponsored by:   BBOX.io

(cherry picked from commit 7eb7ff6459219e802d51add3ba9d1d9d874db561)
DeltaFile
+2-1sys/dev/e1000/igb_txrx.c
+2-11 files

FreeBSD/src 9858800sys/dev/pci pci_iov.c

pci_iov: Clear NumVFs when configuration fails

pci_iov_config() programs NumVFs before validating the final VF RID
layout and allocating all generic resources. A subsequent error ran the
driver uninit callback but left the hardware NumVFs register programmed
while the software VF count returned to zero.

Clear NumVFs in the error path after the driver uninit callback,
matching normal SR-IOV teardown ordering. This prevents stale hardware
state after a failed configuration and permits a clean retry.

Sponsored by:   BBOX.io

(cherry picked from commit 621498b58cdab36a237d5f0b5c902952ad743fa9)
DeltaFile
+3-1sys/dev/pci/pci_iov.c
+3-11 files

FreeBSD/src c2bd655sys/conf files.x86, sys/dev/gpio/intel tglhgpio.c

gpio: add Intel Tiger Lake-H GPIO driver

Add a GPIO driver for the Intel Tiger Lake-H platform based on the generic
intelgpio framework. The driver defines five GPIO communities with pad groups
GPP_A through GPP_K, vGPIO and JTAG, and matches ACPI hardware ID INT34C6.
The kernel module build infrastructure and the wiring into files.x86 are
included.

Reviewed by:            vexeduxr
MFC after:              1 week
Sponsored by:           Beckhoff Automation GmbH & Co. KG
Pull Request:           https://github.com/freebsd/freebsd-src/pull/2205
DeltaFile
+106-0sys/dev/gpio/intel/tglhgpio.c
+6-0sys/modules/tglhgpio/Makefile
+2-1sys/conf/files.x86
+2-0sys/modules/Makefile
+116-14 files

FreeBSD/src 8c7a3ccsys/conf files.x86, sys/dev/gpio/intel adlngpio.c

gpio: add Intel Alder Lake-N GPIO driver

Add a GPIO driver for the Intel Alder Lake-N platform based on the generic
intelgpio framework. The driver provides pad group definitions for four GPIO
communities covering groups GPP_A through GPP_T, vGPIO and HVCMOS, and matches
ACPI hardware IDs INTC1056, INTC1057 and INTC1085. The kernel module build
infrastructure and the wiring into files.x86 are included.

Reviewed by:            vexeduxr
MFC after:              1 week
Sponsored by:           Beckhoff Automation GmbH & Co. KG
Pull Request:           https://github.com/freebsd/freebsd-src/pull/2205
DeltaFile
+94-0sys/dev/gpio/intel/adlngpio.c
+6-0sys/modules/adlngpio/Makefile
+2-0sys/modules/Makefile
+2-0sys/conf/files.x86
+104-04 files

FreeBSD/src 5349a46sys/dev/gpio/intel intelgpio.h intelgpio.c

gpio: add generic Intel GPIO pin controller framework

Add a platform-independent driver framework for Intel GPIO pin controllers
found on modern Intel SoCs. The driver accesses GPIO pad registers through
ACPI-provided memory-mapped resources and implements the gpio interface [1]
including pin enumeration, capability reporting, configuration, and
read/write/toggle operations. A common data model of communities and pad groups
allows individual SoC-specific drivers to supply their own pad tables and ACPI
hardware IDs while sharing all register-level logic.

[1] https://wiki.freebsd.org/GPIO

Reviewed by:            vexeduxr
MFC after:              1 week
Sponsored by:           Beckhoff Automation GmbH & Co. KG
Pull Request:           https://github.com/freebsd/freebsd-src/pull/2205
DeltaFile
+415-0sys/dev/gpio/intel/intelgpio.c
+64-0sys/dev/gpio/intel/intelgpio.h
+479-02 files

FreeBSD/src 74f7500sys/netinet sctp_output.c

sctp: initialize inp to avoid uninitialized use

If we take an early goto out_unlocked inp is uninitialized and then
may be used in SCTP_LTRACE_ERR_RET().  Initialize inp to NULL
to avoid warnings.

Found with:     gcc15 tinderbox build
Reviewed by:    tuexen, pouria
Differential Revision: https://reviews.freebsd.org/D56503

(cherry picked from commit 4cdbcc2b6a2e551529f7133665ef406869b48bf7)
DeltaFile
+1-0sys/netinet/sctp_output.c
+1-01 files

FreeBSD/src 1c62c8bsys/netinet tcp_input.c, sys/netinet/tcp_stacks rack_bbr_common.c

tcp: improve SEG.SEQ validation for RST segments

A RST segment can be sent in response to
(a) received segment or
(b) by the upper layer protocol.

The SEG.SEQ validation consists of two checks:
(1) the in-window check of SEG.SEQ and
(2) the exact match check of SEG.SEQ.

For the in-window check (1), the left edge of the window needs to be
based on tp->last_ack_sent to cover the delayed ACK case, whereas the
right edge needs to be based on tp->rcv_nxt + tp->rcv_wnd. This both
assumes that tp->rcv_wnd is not zero. For the special case of
tp->rcv_wnd being zero, add checks against tp->last_ack_sent for (a)
and on tp->rcv_nxt for (b). This applies to all TCP stacks.

When the exact match (2) of SEG.SEQ is performed, it should be based
on tp->last_ack_sent for (a) and on tp->rcv_nxt for (b). To cover both,

    [9 lines not shown]
DeltaFile
+14-8sys/netinet/tcp_stacks/rack_bbr_common.c
+12-6sys/netinet/tcp_input.c
+26-142 files

FreeBSD/src 85485a5sys/netinet tcp_timer.c

tcp: improve handling of stopped timers

When a TCP timer is stopped, t_timers[] is set to SBT_MAX. Adding the
corresponding t_precisions[], if it is not zero, would result in
overflows in tcp_timer_next(). To avoid this, skip stopped timers.

The problem was identified while debugging uperf by Lukas Book and
an initial patch was provided by him. The committed patch was
suggested by glebius.

The problem can be observed by running netstat -nxptcp and looking for
negative timer values and by observing very long running timers in
some cases.

Reported by:            Lukas Book <lkbook at outlook.de>
Reviewed by:            glebius
Differential Revision:  https://reviews.freebsd.org/D58484

(cherry picked from commit 52b7cbcb78c14e89f6faec8da5acc2caa3d37208)
DeltaFile
+2-0sys/netinet/tcp_timer.c
+2-01 files

FreeBSD/src 0ef3c91tests/sys/netinet ip_reass_test.c

tests: fix checksum computation

This fixes an endianness bug in sys/netinet/ip_reass_test.
Just use the code from RFC 1071.

Reported by:            glebius
Reviewed by:            glebius, Timo Völker
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D57988

(cherry picked from commit fbc039e512c3bb1635ad20cc8f70ad608ea818b7)
DeltaFile
+18-10tests/sys/netinet/ip_reass_test.c
+18-101 files

FreeBSD/src 9a1511esys/net if_loop.c

loopback: use new names for checksum offloading flags

No functional change intended.

Reviewed by:            tuexen
Differential Revision:  https://reviews.freebsd.org/D57945

(cherry picked from commit bcf4e3c001f5ec9cc206b0d81f0954559d1424d8)
DeltaFile
+5-6sys/net/if_loop.c
+5-61 files

FreeBSD/src 1cd388dsys/netinet/tcp_stacks rack_bbr_common.c

rack_bbr_common: don't use stale pointer after m_pullup()

Reviewed by:            tuexen
Differential Revision:  https://reviews.freebsd.org/D57816

(cherry picked from commit be23edc1e4028e32a46e8fe7118de787fd5d79a2)
DeltaFile
+2-2sys/netinet/tcp_stacks/rack_bbr_common.c
+2-21 files

FreeBSD/src fd3582eshare/man/man4 lo.4, sys/net if_loop.c

loopback: improve checksum offloading

* Allow disabling IFCAP_RXCSUM_IPV6 or IFCAP_TXCSUM_IPV6.
* Do not pretend the checksum is correct by setting the LO_CSUM_SET
  flags if IFCAP_RXCSUM_IPV6 or IFCAP_RXCSUM is enabled. Instead,
  remove the LO_CSUM_SET flags (in case they have been set somehow)
  if IFCAP_RXCSUM_IPV6 or IFCAP_RXCSUM is disabled.
* Do not unset the transmit checksum offload flags LO_CSUM_FEATURES or
  LO_CSUM_FEATURES6 since they now have a meaning for the receive path.

Reviewed by:            glebius, pouria, tuexen
Okayed by:              bz
Differential Revision:  https://reviews.freebsd.org/D57518

(cherry picked from commit d6c4cea7740d5c5c673a06ba37e4f1bdcddb2ece)
DeltaFile
+6-36sys/net/if_loop.c
+10-13share/man/man4/lo.4
+16-492 files

FreeBSD/src b1afe19sys/dev/virtio/pci virtio_pci_modern.c

virtio_pci_modern: Remove endianness conversion for config space

The bus_* functions already handle converting from PCI endianness
(i.e. little-endian) to native endianness when accessing the config
space (see ofw_pcib_bus_get_bus_tag), so converting again with
virtio_htogX/virtio_gtohX undoes any byte-swapping and breaks
big-endian systems. They should only be used for operating on shared
memory.
Note part of this reverts commit fb53b42e36a9 ("virtio-modern: fix PCI
common read/write functions on big endian targets").

PR:                     294706
Reviewed by:            adrian, tuexen
Fixes:                  fb53b42e36a9 ("virtio-modern: fix PCI common read/write functions on big endian targets")
Fixes:                  9da9560c4dd3 ("virtio: Add VirtIO PCI modern (V1) support")
Differential Revision:  https://reviews.freebsd.org/D57392

(cherry picked from commit 07b5d1ca52b113cecad3cda73ff5e782d8f4d07d)
DeltaFile
+10-17sys/dev/virtio/pci/virtio_pci_modern.c
+10-171 files

FreeBSD/src 2733e05usr.bin/lorder/tests lorder_test.sh

tests/lorder_test: Update test case description from copy/paste

MFC after:      3 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 5a674a0694836616eaaff448345823594742ad76)
DeltaFile
+1-1usr.bin/lorder/tests/lorder_test.sh
+1-11 files