Supersedes: <[email protected]> ("[PATCH 00/11] net, hw/net: Harden common code against bogus offsets")
This 14-patch revision combines the IPv6 parser fixes from v1 with ten patches from Peter Maydell's networking hardening series. The series tightens L2, IPv4, TCP and SCTP header bounds checks. It also corrects IPv6 Fragment and Authentication Header lengths and stops parsing extension headers in noninitial fragments. The checksum and segmentation changes guard against length underflows, invalid GSO sizes and header-length overflow. The Type 2 Routing Header length check is also moved into the RSS destination address helper, alongside the Routing Type and Segments Left checks. The IPv4 and TCP bounds checks precede the IPv6 parser fixes, so that correcting an IPv6 header offset does not expose an unchecked TCP data offset to callers. The IPv6 parser fixes replace Peter's separate IPv6 bounds-check patch. Both this series and the igb patch series [1] have been stalled on the mailing list for a while. Jason used to submit pull requests for network patches like these, but he hasn't been active recently. Could someone please pick these up? [1] https://lore.kernel.org/qemu-devel/[email protected]/ Signed-off-by: Akihiko Odaki <[email protected]> --- Changes in v2: - Split the IPv4 and TCP bounds checks from the IPv6 parser fixes. - Add L2 offset and header-length bounds checks. - Adopt Peter's IPv4 checks, including the minimum header length, and use subtraction for the IPv4 and TCP bounds checks. - Incorporate Peter's related parser, checksum and segmentation hardening patches, correcting the SCTP header-presence condition. - Move the Type 2 Routing Header length check into the RSS destination address helper, alongside the Routing Type and Segments Left checks. - Add comments explaining the Fragment and Authentication Header length rules and why parsing stops at noninitial fragments. - Link to v1: https://lore.kernel.org/qemu-devel/[email protected] --- Akihiko Odaki (4): net/eth.c: Check for undersized L2 headers in eth_get_protocols() net/eth.c: In eth_get_protocols(), don't report TCP data offset off end of packet net/eth.c: In eth_parse_ipv6_hdr(), fix check of input size net/eth.c: Move the Routing Header Hdr Ext Len check Peter Maydell (10): hw/net/net_rx_pkt: Handle bogus l4hdr_off when validating SCTP checksum net/eth.c: Check for undersized IPv4 headers in eth_get_protocols() net/eth.c: In eth_get_protocols(), don't report SCTP header off end of packet net/eth.c: Harden _eth_tcp_has_data() against short lengths net/eth.c: Tighten size checks in eth_get_l3_proto() include/net/eth.h: Make eth_get_l2_hdr_length_iov() check protocol hw/net/net_tx_pkt: Sanity check GSO headers in net_tx_pkt_build_vheader() hw/net/net_tx_pkt: Sanity check virt hdr len in net_tx_tcp_fragment_init hw/net/net_tx_pkt: Sanity check L2+L3 header len in net_tx_pkt_parse_headers() hw/net/net_rx_pkt: Check for overflow in _net_rx_pkt_calc_l4_csum() include/net/eth.h | 4 +- hw/net/net_rx_pkt.c | 22 +++++---- hw/net/net_tx_pkt.c | 20 ++++++++- net/eth.c | 125 ++++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 137 insertions(+), 34 deletions(-) --- base-commit: 74f7bf4c59e6b6d50dbc6e124d93440be8be4386 change-id: 20260920-eth-022349fda27e Best regards, -- Akihiko Odaki <[email protected]>
