)]}'
{
  "commit": "9a84362b55bff693850b983fb45dc5e77cf56980",
  "tree": "3ef26a81ddcc8ebe87274e47c5a8b13471fe3b8b",
  "parents": [
    "5a81723cd0c31c839f5ed9208369a3abf71487fd"
  ],
  "author": {
    "name": "Donggeun Yoo",
    "email": "donggeunyoo.kernel@gmail.com",
    "time": "Wed Oct 14 07:58:23 2026 +0000"
  },
  "committer": {
    "name": "android-test-infra-autosubmit@system.gserviceaccount.com",
    "email": "android-test-infra-autosubmit@system.gserviceaccount.com",
    "time": "Mon Nov 16 06:58:54 2026 -0800"
  },
  "message": "UPSTREAM: tracing: Set the trace clock before registering the histogram trigger\n\n[ Upstream commit 6ede78d0563a2a3ae3e46f9c07cedb5d79645429 ]\n\nhist_register_trigger() puts the trigger on the global named_triggers\nlist in cmd_ops-\u003einit(), and only then sets the trace clock:\n\n\tif (data-\u003ecmd_ops-\u003einit) {\n\t\tret \u003d data-\u003ecmd_ops-\u003einit(data);\n\t\tif (ret \u003c 0)\n\t\t\tgoto out;\n\t}\n\n\tif (hist_data-\u003eenable_timestamps) {\n\t\tret \u003d tracing_set_clock(file-\u003etr, hist_data-\u003eattrs-\u003eclock);\n\t\tif (ret) {\n\t\t\thist_err(tr, HIST_ERR_SET_CLOCK_FAIL, errpos(clock));\n\t\t\tgoto out;\n\t\t}\n\nThe clock string is not checked anywhere before that call, so a named\ntrigger using common_timestamp with an unknown clock fails after it has\nalready become findable. event_hist_trigger_parse() then frees it\nwithout taking it off the list, and the next lookup by name reads the\nfreed object:\n\n ~# cd /sys/kernel/tracing/events/sched/sched_switch\n ~# echo \u0027hist:name\u003dfoo:keys\u003dcommon_pid:ts\u003dcommon_timestamp:clock\u003dbogus\u0027 \u003e trigger\n bash: echo: write error: Invalid argument\n ~# echo \u0027hist:name\u003dfoo:keys\u003dcommon_pid\u0027 \u003e trigger\n\n  BUG: KASAN: slab-use-after-free in find_named_trigger+0xac/0xc0\n  Read of size 8 at addr ffff88800915d760 by task init/1\n   find_named_trigger+0xac/0xc0\n   hist_register_trigger+0xc1/0x900\n   event_hist_trigger_parse+0x3146/0x6af0\n   event_trigger_write+0xce/0x160\n  Freed by task 63:\n   kfree+0x154/0x420\n   trigger_kthread_fn+0xfd/0x160\n\nSet the clock before the trigger is registered, so that nothing which\ncan fail runs after it is published, the way commit 6f86bdeab633\n(\"tracing: Fix bad hist from corrupting named_triggers list\") moved the\nregistration below the rest of the setup.\n\ntracing_set_filter_buffering() is reference counted, so the init failure\npath has to drop the reference that the clock block now takes first.\n\nBug: 546568743\nCc: stable@vger.kernel.org\nFixes: a4072fe85ba3 (\"tracing: Add a clock attribute for hist triggers\")\nLink: https://patch.msgid.link/20260907091415.554535-1-donggeunyoo.kernel@gmail.com\nChange-Id: I2e5b994c953e62c05995a0f26f2614e310c7ddaf\nSigned-off-by: Donggeun Yoo \u003cdonggeunyoo.kernel@gmail.com\u003e\nSigned-off-by: Steven Rostedt \u003crostedt@goodmis.org\u003e\n[Lee: Call data-\u003eops-\u003einit(data-\u003eops, data) and\n      tracing_set_time_stamp_abs() as b052d70f7c9c (\"tracing: Merge\n      struct event_trigger_ops into struct event_command\"), 476705419518\n      (\"tracing: Remove redundant trigger_ops params\") and b94bc80df648\n      (\"tracing: Use a no_filter_buffering_ref to stop using the filter\n      buffer\") are not present]\nSigned-off-by: Lee Jones \u003clee@kernel.org\u003e\nSigned-off-by: Sasha Levin \u003csashal@kernel.org\u003e\n(cherry picked from commit 85e6df6e9cd489de8e238596a68b89eee0c03b88)\nSigned-off-by: Lee Jones \u003cjoneslee@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "085a6a54c3def4f3d8ea4e65fb2cd1f1f8bd3ec0",
      "old_mode": 33188,
      "old_path": "kernel/trace/trace_events_hist.c",
      "new_id": "75488d0f4b61c684e37ed5edee3ce3c519836283",
      "new_mode": 33188,
      "new_path": "kernel/trace/trace_events_hist.c"
    }
  ]
}
