)]}'
{
  "commit": "6df8b2fe474014977f6ded9b55866c0bd4c77275",
  "tree": "d4c4d71de59fda7546541656b27c30cb306071f4",
  "parents": [
    "29e2558848be2c023015ae86dd1a80a08f8cad50"
  ],
  "author": {
    "name": "Florian Westphal",
    "email": "fw@strlen.de",
    "time": "Tue Mar 26 11:18:41 2024 +0100"
  },
  "committer": {
    "name": "COS Cherry Picker",
    "email": "cloud-image-release@prod.google.com",
    "time": "Fri May 03 03:09:39 2024 -0700"
  },
  "message": "inet: inet_defrag: prevent sk release while still in use\n\n[ Upstream commit 18685451fc4e546fc0e718580d32df3c0e5c8272 ]\n\nip_local_out() and other functions can pass skb-\u003esk as function argument.\n\nIf the skb is a fragment and reassembly happens before such function call\nreturns, the sk must not be released.\n\nThis affects skb fragments reassembled via netfilter or similar\nmodules, e.g. openvswitch or ct_act.c, when run as part of tx pipeline.\n\nEric Dumazet made an initial analysis of this bug.  Quoting Eric:\n  Calling ip_defrag() in output path is also implying skb_orphan(),\n  which is buggy because output path relies on sk not disappearing.\n\n  A relevant old patch about the issue was :\n  8282f27449bf (\"inet: frag: Always orphan skbs inside ip_defrag()\")\n\n  [..]\n\n  net/ipv4/ip_output.c depends on skb-\u003esk being set, and probably to an\n  inet socket, not an arbitrary one.\n\n  If we orphan the packet in ipvlan, then downstream things like FQ\n  packet scheduler will not work properly.\n\n  We need to change ip_defrag() to only use skb_orphan() when really\n  needed, ie whenever frag_list is going to be used.\n\nEric suggested to stash sk in fragment queue and made an initial patch.\nHowever there is a problem with this:\n\nIf skb is refragmented again right after, ip_do_fragment() will copy\nhead-\u003esk to the new fragments, and sets up destructor to sock_wfree.\nIOW, we have no choice but to fix up sk_wmem accouting to reflect the\nfully reassembled skb, else wmem will underflow.\n\nThis change moves the orphan down into the core, to last possible moment.\nAs ip_defrag_offset is aliased with sk_buff-\u003esk member, we must move the\noffset into the FRAG_CB, else skb-\u003esk gets clobbered.\n\nThis allows to delay the orphaning long enough to learn if the skb has\nto be queued or if the skb is completing the reasm queue.\n\nIn the former case, things work as before, skb is orphaned.  This is\nsafe because skb gets queued/stolen and won\u0027t continue past reasm engine.\n\nIn the latter case, we will steal the skb-\u003esk reference, reattach it to\nthe head skb, and fix up wmem accouting when inet_frag inflates truesize.\n\nBUG\u003db/335700702\nTEST\u003dpresubmit\nRELEASE_NOTE\u003dFixed CVE-2024-26921 in the Linux kernel.\n\ncos-patch: security-high\nFixes: 7026b1ddb6b8 (\"netfilter: Pass socket pointer down through okfn().\")\nDiagnosed-by: Eric Dumazet \u003cedumazet@google.com\u003e\nReported-by: xingwei lee \u003cxrivendell7@gmail.com\u003e\nReported-by: yue sun \u003csamsun1006219@gmail.com\u003e\nReported-by: syzbot+e5167d7144a62715044c@syzkaller.appspotmail.com\nSigned-off-by: Florian Westphal \u003cfw@strlen.de\u003e\nReviewed-by: Eric Dumazet \u003cedumazet@google.com\u003e\nLink: https://lore.kernel.org/r/20240326101845.30836-1-fw@strlen.de\nSigned-off-by: Paolo Abeni \u003cpabeni@redhat.com\u003e\nSigned-off-by: Sasha Levin \u003csashal@kernel.org\u003e\n(cherry picked from commit 7d0567842b78390dd9b60f00f1d8f838d540e325)\nSigned-off-by: Robert Kolchmeyer \u003crkolchmeyer@google.com\u003e\nChange-Id: Icf5b863469d9d83377836eeee95f664dae881b20\nReviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/71052\nReviewed-by: Oleksandr Tymoshenko \u003covt@google.com\u003e\nMain-Branch-Verified: Cusky Presubmit Bot \u003cpresubmit@cos-infra-prod.iam.gserviceaccount.com\u003e\nTested-by: Cusky Presubmit Bot \u003cpresubmit@cos-infra-prod.iam.gserviceaccount.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7ed1d4472c0c8bb1a9412ba771f22222fb82338f",
      "old_mode": 33188,
      "old_path": "include/linux/skbuff.h",
      "new_id": "d0f60318246416fc9a059592c36cc1d993402161",
      "new_mode": 33188,
      "new_path": "include/linux/skbuff.h"
    },
    {
      "type": "modify",
      "old_id": "341096807100cd65c4667031384ef59622771dac",
      "old_mode": 33188,
      "old_path": "net/ipv4/inet_fragment.c",
      "new_id": "7e38170111999897a0e667ccaf9d79b955a7f49e",
      "new_mode": 33188,
      "new_path": "net/ipv4/inet_fragment.c"
    },
    {
      "type": "modify",
      "old_id": "fad803d2d711ef0d97f7150f0f710a35ac822946",
      "old_mode": 33188,
      "old_path": "net/ipv4/ip_fragment.c",
      "new_id": "ec2264adf2a6a5b6f8e935bcbeb459b55642d7ae",
      "new_mode": 33188,
      "new_path": "net/ipv4/ip_fragment.c"
    },
    {
      "type": "modify",
      "old_id": "5c47be29b9ee9832069aa4b9e97852e22dd4278b",
      "old_mode": 33188,
      "old_path": "net/ipv6/netfilter/nf_conntrack_reasm.c",
      "new_id": "d5424a7862109017ae212b10a46e6096efaa7ca7",
      "new_mode": 33188,
      "new_path": "net/ipv6/netfilter/nf_conntrack_reasm.c"
    }
  ]
}
