)]}'
{
  "commit": "05c681778c35de2f2d841ee97d13d100fea84d3f",
  "tree": "417d5995f61e92b1af8bc90cef6508c099b7d9ae",
  "parents": [
    "814bc3a642d6ce391345375d72d8bb4e20f8ea8f"
  ],
  "author": {
    "name": "Zhang Zhengming",
    "email": "zhang.zhengming@h3c.com",
    "time": "Wed Apr 19 12:02:03 2023 +0800"
  },
  "committer": {
    "name": "Anil Altinay",
    "email": "aaltinay@google.com",
    "time": "Wed Jun 28 08:34:58 2023 +0000"
  },
  "message": "relayfs: fix out-of-bounds access in relay_file_read\n\ncommit 43ec16f1450f4936025a9bdf1a273affdb9732c1 upstream.\n\nThere is a crash in relay_file_read, as the var from\npoint to the end of last subbuf.\n\nThe oops looks something like:\npc : __arch_copy_to_user+0x180/0x310\nlr : relay_file_read+0x20c/0x2c8\nCall trace:\n __arch_copy_to_user+0x180/0x310\n full_proxy_read+0x68/0x98\n vfs_read+0xb0/0x1d0\n ksys_read+0x6c/0xf0\n __arm64_sys_read+0x20/0x28\n el0_svc_common.constprop.3+0x84/0x108\n do_el0_svc+0x74/0x90\n el0_svc+0x1c/0x28\n el0_sync_handler+0x88/0xb0\n el0_sync+0x148/0x180\n\nWe get the condition by analyzing the vmcore:\n\n1). The last produced byte and last consumed byte\n    both at the end of the last subbuf\n\n2). A softirq calls function(e.g __blk_add_trace)\n    to write relay buffer occurs when an program is calling\n    relay_file_read_avail().\n\n        relay_file_read\n                relay_file_read_avail\n                        relay_file_read_consume(buf, 0, 0);\n                        //interrupted by softirq who will write subbuf\n                        ....\n                        return 1;\n                //read_start point to the end of the last subbuf\n                read_start \u003d relay_file_read_start_pos\n                //avail is equal to subsize\n                avail \u003d relay_file_read_subbuf_avail\n                //from  points to an invalid memory address\n                from \u003d buf-\u003estart + read_start\n                //system is crashed\n                copy_to_user(buffer, from, avail)\n\nBUG\u003db/289032052\nTEST\u003dpresubmit\nRELEASE_NOTE\u003dFixed CVE-2023-3268 in the Linux kernel.\n\ncos-patch: security-high\nLink: https://lkml.kernel.org/r/20230419040203.37676-1-zhang.zhengming@h3c.com\nFixes: 8d62fdebdaf9 (\"relay file read: start-pos fix\")\nSigned-off-by: Zhang Zhengming \u003czhang.zhengming@h3c.com\u003e\nReviewed-by: Zhao Lei \u003czhao_lei1@hoperun.com\u003e\nReviewed-by: Zhou Kete \u003czhou.kete@h3c.com\u003e\nReviewed-by: Pengcheng Yang \u003cyangpc@wangsu.com\u003e\nCc: Jens Axboe \u003caxboe@kernel.dk\u003e\nCc: \u003cstable@vger.kernel.org\u003e\nChange-Id: I838faf09bd5f130a4d47960039f5e7dc0c2ad623\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@linuxfoundation.org\u003e\nReviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/51279\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": "067769b80d4ab9322c9e9985e931cdfe8de6d96a",
      "old_mode": 33188,
      "old_path": "kernel/relay.c",
      "new_id": "f6826dec210332f925a22687f01f512e61679b7e",
      "new_mode": 33188,
      "new_path": "kernel/relay.c"
    }
  ]
}
