)]}'
{
  "commit": "c77c7593477e9de7ab4faa631ca5f6dba6b70eb5",
  "tree": "798dcf97f69edd0009c8cf23bae0aea3d40f0a52",
  "parents": [
    "23d2f1d2897d5b28994e764bd6fdc813fac302cf"
  ],
  "author": {
    "name": "Quang Le",
    "email": "quanglex97@gmail.com",
    "time": "Mon Feb 03 16:58:38 2025 -0800"
  },
  "committer": {
    "name": "Arnav Kansal",
    "email": "rnv@google.com",
    "time": "Mon Mar 17 11:24:26 2025 -0700"
  },
  "message": "pfifo_tail_enqueue: Drop new packet when sch-\u003elimit \u003d\u003d 0\n\ncommit 647cef20e649c576dff271e018d5d15d998b629d upstream.\n\nExpected behaviour:\nIn case we reach scheduler\u0027s limit, pfifo_tail_enqueue() will drop a\npacket in scheduler\u0027s queue and decrease scheduler\u0027s qlen by one.\nThen, pfifo_tail_enqueue() enqueue new packet and increase\nscheduler\u0027s qlen by one. Finally, pfifo_tail_enqueue() return\n`NET_XMIT_CN` status code.\n\nWeird behaviour:\nIn case we set `sch-\u003elimit \u003d\u003d 0` and trigger pfifo_tail_enqueue() on a\nscheduler that has no packet, the \u0027drop a packet\u0027 step will do nothing.\nThis means the scheduler\u0027s qlen still has value equal 0.\nThen, we continue to enqueue new packet and increase scheduler\u0027s qlen by\none. In summary, we can leverage pfifo_tail_enqueue() to increase qlen by\none and return `NET_XMIT_CN` status code.\n\nThe problem is:\nLet\u0027s say we have two qdiscs: Qdisc_A and Qdisc_B.\n - Qdisc_A\u0027s type must have \u0027-\u003egraft()\u0027 function to create parent/child relationship.\n   Let\u0027s say Qdisc_A\u0027s type is `hfsc`. Enqueue packet to this qdisc will trigger `hfsc_enqueue`.\n - Qdisc_B\u0027s type is pfifo_head_drop. Enqueue packet to this qdisc will trigger `pfifo_tail_enqueue`.\n - Qdisc_B is configured to have `sch-\u003elimit \u003d\u003d 0`.\n - Qdisc_A is configured to route the enqueued\u0027s packet to Qdisc_B.\n\nEnqueue packet through Qdisc_A will lead to:\n - hfsc_enqueue(Qdisc_A) -\u003e pfifo_tail_enqueue(Qdisc_B)\n - Qdisc_B-\u003eq.qlen +\u003d 1\n - pfifo_tail_enqueue() return `NET_XMIT_CN`\n - hfsc_enqueue() check for `NET_XMIT_SUCCESS` and see `NET_XMIT_CN` \u003d\u003e hfsc_enqueue() don\u0027t increase qlen of Qdisc_A.\n\nThe whole process lead to a situation where Qdisc_A-\u003eq.qlen \u003d\u003d 0 and Qdisc_B-\u003eq.qlen \u003d\u003d 1.\nReplace \u0027hfsc\u0027 with other type (for example: \u0027drr\u0027) still lead to the same problem.\nThis violate the design where parent\u0027s qlen should equal to the sum of its childrens\u0027qlen.\n\nBug impact: This issue can be used for user-\u003ekernel privilege escalation when it is reachable.\n\nBUG\u003db/395542172\nTEST\u003dpresubmit\nRELEASE_NOTE\u003dFixed KCTF-647cef2 in the Linux kernel.\n\ncos-patch: security-high\nFixes: 57dbb2d83d10 (\"sched: add head drop fifo queue\")\nReported-by: Quang Le \u003cquanglex97@gmail.com\u003e\nChange-Id: I38b08deb68181839bde211f3d4da681411d4ba1d\nSigned-off-by: Quang Le \u003cquanglex97@gmail.com\u003e\nSigned-off-by: Cong Wang \u003ccong.wang@bytedance.com\u003e\nLink: https://patch.msgid.link/20250204005841.223511-2-xiyou.wangcong@gmail.com\nSigned-off-by: Jakub Kicinski \u003ckuba@kernel.org\u003e\nSigned-off-by: Lee Jones \u003clee@kernel.org\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@linuxfoundation.org\u003e\nSigned-off-by: Kernel CVE Triage Automation \u003ccloud-image-kernel-cve-triage-automation@prod.google.com\u003e\nReviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/96299\nReviewed-by: Arnav Kansal \u003crnv@google.com\u003e\nTested-by: Cusky Presubmit Bot \u003cpresubmit@cos-infra-prod.iam.gserviceaccount.com\u003e\nReviewed-by: Shuo Yang \u003cgshuoy@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e1040421b79797fefaa26b8d7d3f44b91896e1de",
      "old_mode": 33188,
      "old_path": "net/sched/sch_fifo.c",
      "new_id": "af5f2ab69b8d26d32b9ad31d0f84cc6d036ccb4e",
      "new_mode": 33188,
      "new_path": "net/sched/sch_fifo.c"
    }
  ]
}
