{
  "id": "CVE-2025-22035",
  "url": "https://poc.griffinguard.io/cve/CVE-2025-22035",
  "published_at": "2025-04-16T14:11:53.958Z",
  "title": "tracing: Fix use-after-free in print_graph_function_flags during tracer switching",
  "vendor": "Linux",
  "product": "Linux",
  "cvss": {
    "score": 7.8,
    "source": "cisa-adp",
    "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 use-after-free in print_graph_function_flags during tracer switching\n\nKairui reported a UAF issue in print_graph_function_flags() during\nftrace stress testing [1]. This issue can be reproduced if puting a\n'mdelay(10)' after 'mutex_unlock(\u0026trace_types_lock)' in s_start(),\nand executing the following script:\n\n  $ echo function_graph \u003e current_tracer\n  $ cat trace \u003e /dev/null \u0026\n  $ sleep 5  # Ensure the 'cat' reaches the 'mdelay(10)' point\n  $ echo timerlat \u003e current_tracer\n\nThe root cause lies in the two calls to print_graph_function_flags\nwithin print_trace_line during each s_show():\n\n  * One through 'iter-\u003etrace-\u003eprint_line()';\n  * Another through 'event-\u003efuncs-\u003etrace()', which is hidden in\n    print_trace_fmt() before print_trace_line returns.\n\nTracer switching only updates the former, while the latter continues\nto use the print_line function of the old tracer, which in the script\nabove is print_graph_function_flags.\n\nMoreover, when switching from the 'function_graph' tracer to the\n'timerlat' tracer, s_start only calls graph_trace_close of the\n'function_graph' tracer to free 'iter-\u003eprivate', but does not set\nit to NULL. This provides an opportunity for 'event-\u003efuncs-\u003etrace()'\nto use an invalid 'iter-\u003eprivate'.\n\nTo fix this issue, set 'iter-\u003eprivate' to NULL immediately after\nfreeing it in graph_trace_close(), ensuring that an invalid pointer\nis not passed to other tracers. Additionally, clean up the unnecessary\n'iter-\u003eprivate = NULL' during each 'cat trace' when using wakeup and\nirqsoff tracers.\n\n [1] https://lore.kernel.org/all/20231112150030.84609-1-ryncsn@gmail.com/",
  "cwe": "CWE-416",
  "cpes": [
    "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*"
  ],
  "cvss_by_source": {
    "cisa-adp": 7.8,
    "cna": 7.8
  },
  "repos": [],
  "remediation": {
    "affected": [
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "\u003e= 05319d707732c728eb721ac616a50e7978eb499a, \u003c 42561fe62c3628ea3bc9623f64f047605e98857f",
          "\u003e= b8205dfed68183dc1470e83863c5ded6d7fa30a9, \u003c de7b309139f862a44379ecd96e93c9133c69f813",
          "\u003e= ce6e2b14bc094866d9173db6935da2d752f06d8b, \u003c 81a85b12132c8ffe98f5ddbdc185481790aeaa1b",
          "\u003e= 2cb0c037c927db4ec928cc927488e52aa359786e, \u003c a2cce54c1748216535dda02e185d07a084be837e",
          "\u003e= eecb91b9f98d6427d4af5fdb8f108f52572a39e7, \u003c 099ef3385800828b74933a96c117574637c3fb3a",
          "\u003e= eecb91b9f98d6427d4af5fdb8f108f52572a39e7, \u003c c85efe6e13743cac6ba4ccf144cb91f44c86231a",
          "\u003e= eecb91b9f98d6427d4af5fdb8f108f52572a39e7, \u003c f14752d66056d0c7bffe5092130409417d3baa70",
          "\u003e= eecb91b9f98d6427d4af5fdb8f108f52572a39e7, \u003c 70be951bc01e4a0e10d443f3510bb17426f257fb",
          "\u003e= eecb91b9f98d6427d4af5fdb8f108f52572a39e7, \u003c 7f81f27b1093e4895e87b74143c59c055c3b1906",
          "d6b35c9a8d51032ed9890431da3ae39fe76c1ae3",
          "5d433eda76b66ab271f5924b26ddfec063eeb454",
          "2242640e9bd94e706acf75c60a2ab1d0e150e0fb",
          "\u003e= 5.4.255, \u003c 5.4.292",
          "\u003e= 5.10.193, \u003c 5.10.236",
          "\u003e= 5.15.129, \u003c 5.15.180",
          "\u003e= 6.1.50, \u003c 6.1.134",
          "\u003e= 4.14.324, \u003c 4.15",
          "\u003e= 4.19.293, \u003c 4.20",
          "\u003e= 6.4.13, \u003c 6.5"
        ],
        "fixed_in": [
          "42561fe62c3628ea3bc9623f64f047605e98857f",
          "de7b309139f862a44379ecd96e93c9133c69f813",
          "81a85b12132c8ffe98f5ddbdc185481790aeaa1b",
          "a2cce54c1748216535dda02e185d07a084be837e",
          "099ef3385800828b74933a96c117574637c3fb3a",
          "c85efe6e13743cac6ba4ccf144cb91f44c86231a",
          "f14752d66056d0c7bffe5092130409417d3baa70",
          "70be951bc01e4a0e10d443f3510bb17426f257fb",
          "7f81f27b1093e4895e87b74143c59c055c3b1906",
          "5.4.292",
          "5.10.236",
          "5.15.180",
          "6.1.134",
          "4.15",
          "4.20",
          "6.5"
        ]
      },
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "6.5"
        ],
        "fixed_in": [
          "0",
          "5.4.292",
          "5.10.236",
          "5.15.180",
          "6.1.134",
          "6.6.87",
          "6.12.23",
          "6.13.11",
          "6.14.2",
          "6.15"
        ]
      }
    ],
    "upgrade": [
      "Upgrade Linux to 42561fe62c3628ea3bc9623f64f047605e98857f or de7b309139f862a44379ecd96e93c9133c69f813 or 81a85b12132c8ffe98f5ddbdc185481790aeaa1b or a2cce54c1748216535dda02e185d07a084be837e or 099ef3385800828b74933a96c117574637c3fb3a or c85efe6e13743cac6ba4ccf144cb91f44c86231a or f14752d66056d0c7bffe5092130409417d3baa70 or 70be951bc01e4a0e10d443f3510bb17426f257fb or 7f81f27b1093e4895e87b74143c59c055c3b1906 or 5.4.292 or 5.10.236 or 5.15.180 or 6.1.134 or 4.15 or 4.20 or 6.5 or later.",
      "Upgrade Linux to 0 or 5.4.292 or 5.10.236 or 5.15.180 or 6.1.134 or 6.6.87 or 6.12.23 or 6.13.11 or 6.14.2 or 6.15 or later."
    ]
  },
  "exploit_refs": [],
  "hunt_profile": [],
  "rules": []
}
