)]}'
{
  "commit": "3cc38b2d32801910b05816b8d7d7a30fb9457ef2",
  "tree": "a6a858b7bd01cca8cb6f63e5cf9b9d94569cd797",
  "parents": [
    "8d236fa91a4baa4fecff05dfc1ed216de3f3e34f"
  ],
  "author": {
    "name": "Willem de Bruijn",
    "email": "willemb@google.com",
    "time": "Mon Jul 29 16:10:12 2024 -0400"
  },
  "committer": {
    "name": "Michael Kochera",
    "email": "kochera@google.com",
    "time": "Thu Sep 19 19:24:13 2024 +0000"
  },
  "message": "net: drop bad gso csum_start and offset in virtio_net_hdr\n\ncommit 89add40066f9ed9abe5f7f886fe5789ff7e0c50e upstream.\n\nTighten csum_start and csum_offset checks in virtio_net_hdr_to_skb\nfor GSO packets.\n\nThe function already checks that a checksum requested with\nVIRTIO_NET_HDR_F_NEEDS_CSUM is in skb linear. But for GSO packets\nthis might not hold for segs after segmentation.\n\nSyzkaller demonstrated to reach this warning in skb_checksum_help\n\n\toffset \u003d skb_checksum_start_offset(skb);\n\tret \u003d -EINVAL;\n\tif (WARN_ON_ONCE(offset \u003e\u003d skb_headlen(skb)))\n\nBy injecting a TSO packet:\n\nWARNING: CPU: 1 PID: 3539 at net/core/dev.c:3284 skb_checksum_help+0x3d0/0x5b0\n ip_do_fragment+0x209/0x1b20 net/ipv4/ip_output.c:774\n ip_finish_output_gso net/ipv4/ip_output.c:279 [inline]\n __ip_finish_output+0x2bd/0x4b0 net/ipv4/ip_output.c:301\n iptunnel_xmit+0x50c/0x930 net/ipv4/ip_tunnel_core.c:82\n ip_tunnel_xmit+0x2296/0x2c70 net/ipv4/ip_tunnel.c:813\n __gre_xmit net/ipv4/ip_gre.c:469 [inline]\n ipgre_xmit+0x759/0xa60 net/ipv4/ip_gre.c:661\n __netdev_start_xmit include/linux/netdevice.h:4850 [inline]\n netdev_start_xmit include/linux/netdevice.h:4864 [inline]\n xmit_one net/core/dev.c:3595 [inline]\n dev_hard_start_xmit+0x261/0x8c0 net/core/dev.c:3611\n __dev_queue_xmit+0x1b97/0x3c90 net/core/dev.c:4261\n packet_snd net/packet/af_packet.c:3073 [inline]\n\nThe geometry of the bad input packet at tcp_gso_segment:\n\n[   52.003050][ T8403] skb len\u003d12202 headroom\u003d244 headlen\u003d12093 tailroom\u003d0\n[   52.003050][ T8403] mac\u003d(168,24) mac_len\u003d24 net\u003d(192,52) trans\u003d244\n[   52.003050][ T8403] shinfo(txflags\u003d0 nr_frags\u003d1 gso(size\u003d1552 type\u003d3 segs\u003d0))\n[   52.003050][ T8403] csum(0x60000c7 start\u003d199 offset\u003d1536\nip_summed\u003d3 complete_sw\u003d0 valid\u003d0 level\u003d0)\n\nMitigate with stricter input validation.\n\ncsum_offset: for GSO packets, deduce the correct value from gso_type.\nThis is already done for USO. Extend it to TSO. Let UFO be:\nudp[46]_ufo_fragment ignores these fields and always computes the\nchecksum in software.\n\ncsum_start: finding the real offset requires parsing to the transport\nheader. Do not add a parser, use existing segmentation parsing. Thanks\nto SKB_GSO_DODGY, that also catches bad packets that are hw offloaded.\nAgain test both TSO and USO. Do not test UFO for the above reason, and\ndo not test UDP tunnel offload.\n\nGSO packet are almost always CHECKSUM_PARTIAL. USO packets may be\nCHECKSUM_NONE since commit 10154dbded6d6 (\"udp: Allow GSO transmit\nfrom devices with no checksum offload\"), but then still these fields\nare initialized correctly in udp4_hwcsum/udp6_hwcsum_outgoing. So no\nneed to test for ip_summed \u003d\u003d CHECKSUM_PARTIAL first.\n\nThis revises an existing fix mentioned in the Fixes tag, which broke\nsmall packets with GSO offload, as detected by kselftests.\n\nBUG\u003db/365630179\nTEST\u003dpresubmit\nRELEASE_NOTE\u003dNone\n\ncos-patch: bug\nLink: https://syzkaller.appspot.com/bug?extid\u003de1db31216c789f552871\nLink: https://lore.kernel.org/netdev/20240723223109.2196886-1-kuba@kernel.org\nFixes: e269d79c7d35 (\"net: missing check virtio\")\nCc: stable@vger.kernel.org\nChange-Id: Ic723842e91d7096522ea6fc9dcbbaaff452e345e\nSigned-off-by: Willem de Bruijn \u003cwillemb@google.com\u003e\nLink: https://patch.msgid.link/20240729201108.1615114-1-willemdebruijn.kernel@gmail.com\nSigned-off-by: Jakub Kicinski \u003ckuba@kernel.org\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@linuxfoundation.org\u003e\nReviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/81669\nReviewed-by: Oleksandr Tymoshenko \u003covt@google.com\u003e\nTested-by: Cusky Presubmit Bot \u003cpresubmit@cos-infra-prod.iam.gserviceaccount.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "137357fb6a574f3371a125736837e4fe79d64d19",
      "old_mode": 33188,
      "old_path": "include/linux/virtio_net.h",
      "new_id": "823e28042f41072d158b24503aed5900520f2d37",
      "new_mode": 33188,
      "new_path": "include/linux/virtio_net.h"
    },
    {
      "type": "modify",
      "old_id": "4851211aa60d6eaf7d1c5e4f90bbcf621ee4c69b",
      "old_mode": 33188,
      "old_path": "net/ipv4/tcp_offload.c",
      "new_id": "72a645bf05c9269af47c0859ff6079d08ad770eb",
      "new_mode": 33188,
      "new_path": "net/ipv4/tcp_offload.c"
    },
    {
      "type": "modify",
      "old_id": "9140df60f09571979c58a73e13ffa01aae9cc653",
      "old_mode": 33188,
      "old_path": "net/ipv4/udp_offload.c",
      "new_id": "9a9d01d977308523a37c5e2bdb3cf001dd45da42",
      "new_mode": 33188,
      "new_path": "net/ipv4/udp_offload.c"
    }
  ]
}
