{
  "id": "CVE-2025-21899",
  "url": "https://poc.griffinguard.io/cve/CVE-2025-21899",
  "published_at": "2025-04-01T15:26:50.791Z",
  "title": "tracing: Fix bad hist from corrupting named_triggers list",
  "vendor": "Linux",
  "product": "Linux",
  "cvss": {
    "score": 7.8,
    "source": "cna",
    "vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  },
  "kev": {
    "in_kev": false,
    "added_at": null,
    "days_after_publication": null
  },
  "first_poc": null,
  "poc_repo_count": 0,
  "exploit_count": 0,
  "suspicious_repo_count": 0,
  "edge_device": null,
  "description": "In the Linux kernel, the following vulnerability has been resolved:\n\ntracing: Fix bad hist from corrupting named_triggers list\n\nThe following commands causes a crash:\n\n ~# cd /sys/kernel/tracing/events/rcu/rcu_callback\n ~# echo 'hist:name=bad:keys=common_pid:onmax(bogus).save(common_pid)' \u003e trigger\n bash: echo: write error: Invalid argument\n ~# echo 'hist:name=bad:keys=common_pid' \u003e trigger\n\nBecause the following occurs:\n\nevent_trigger_write() {\n  trigger_process_regex() {\n    event_hist_trigger_parse() {\n\n      data = event_trigger_alloc(..);\n\n      event_trigger_register(.., data) {\n        cmd_ops-\u003ereg(.., data, ..) [hist_register_trigger()] {\n          data-\u003eops-\u003einit() [event_hist_trigger_init()] {\n            save_named_trigger(name, data) {\n              list_add(\u0026data-\u003enamed_list, \u0026named_triggers);\n            }\n          }\n        }\n      }\n\n      ret = create_actions(); (return -EINVAL)\n      if (ret)\n        goto out_unreg;\n[..]\n      ret = hist_trigger_enable(data, ...) {\n        list_add_tail_rcu(\u0026data-\u003elist, \u0026file-\u003etriggers); \u003c\u003c\u003c---- SKIPPED!!! (this is important!)\n[..]\n out_unreg:\n      event_hist_unregister(.., data) {\n        cmd_ops-\u003eunreg(.., data, ..) [hist_unregister_trigger()] {\n          list_for_each_entry(iter, \u0026file-\u003etriggers, list) {\n            if (!hist_trigger_match(data, iter, named_data, false))   \u003c- never matches\n                continue;\n            [..]\n            test = iter;\n          }\n          if (test \u0026\u0026 test-\u003eops-\u003efree) \u003c\u003c\u003c-- test is NULL\n\n            test-\u003eops-\u003efree(test) [event_hist_trigger_free()] {\n              [..]\n              if (data-\u003ename)\n                del_named_trigger(data) {\n                  list_del(\u0026data-\u003enamed_list);  \u003c\u003c\u003c\u003c-- NEVER gets removed!\n                }\n              }\n           }\n         }\n\n         [..]\n         kfree(data); \u003c\u003c\u003c-- frees item but it is still on list\n\nThe next time a hist with name is registered, it causes an u-a-f bug and\nthe kernel can crash.\n\nMove the code around such that if event_trigger_register() succeeds, the\nnext thing called is hist_trigger_enable() which adds it to the list.\n\nA bunch of actions is called if get_named_trigger_data() returns false.\nBut that doesn't need to be called after event_trigger_register(), so it\ncan be moved up, allowing event_trigger_register() to be called just\nbefore hist_trigger_enable() keeping them together and allowing the\nfile-\u003etriggers to be properly populated.",
  "cwe": "CWE-476",
  "cpes": [
    "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:6.14:rc1:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:6.14:rc2:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:6.14:rc3:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:6.14:rc4:*:*:*:*:*:*"
  ],
  "cvss_by_source": {
    "cna": 7.8,
    "nvd": 5.5
  },
  "repos": [],
  "remediation": {
    "affected": [
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "\u003e= 067fe038e70f6e64960d26a79c4df5f1413d0f13, \u003c 5ae1b18f05ee2b849dc03b6c15d7da0c1c6efa77",
          "\u003e= 067fe038e70f6e64960d26a79c4df5f1413d0f13, \u003c 43b254d46c740bf9dbe65709afa021dd726dfa99",
          "\u003e= 067fe038e70f6e64960d26a79c4df5f1413d0f13, \u003c 435d2964af815aae456db554c62963b4515f19d0",
          "\u003e= 067fe038e70f6e64960d26a79c4df5f1413d0f13, \u003c f1ae50cfb818ce1ac7a674406dfadb7653e2552d",
          "\u003e= 067fe038e70f6e64960d26a79c4df5f1413d0f13, \u003c 6f86bdeab633a56d5c6dccf1a2c5989b6a5e323e"
        ],
        "fixed_in": [
          "5ae1b18f05ee2b849dc03b6c15d7da0c1c6efa77",
          "43b254d46c740bf9dbe65709afa021dd726dfa99",
          "435d2964af815aae456db554c62963b4515f19d0",
          "f1ae50cfb818ce1ac7a674406dfadb7653e2552d",
          "6f86bdeab633a56d5c6dccf1a2c5989b6a5e323e"
        ]
      },
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "4.17"
        ],
        "fixed_in": [
          "0",
          "6.1.130",
          "6.6.81",
          "6.12.18",
          "6.13.6",
          "6.14"
        ]
      }
    ],
    "upgrade": [
      "Upgrade Linux to 5ae1b18f05ee2b849dc03b6c15d7da0c1c6efa77 or 43b254d46c740bf9dbe65709afa021dd726dfa99 or 435d2964af815aae456db554c62963b4515f19d0 or f1ae50cfb818ce1ac7a674406dfadb7653e2552d or 6f86bdeab633a56d5c6dccf1a2c5989b6a5e323e or later.",
      "Upgrade Linux to 0 or 6.1.130 or 6.6.81 or 6.12.18 or 6.13.6 or 6.14 or later."
    ]
  },
  "exploit_refs": [],
  "hunt_profile": [],
  "rules": []
}
