CVE-2025-37747 (GCVE-0-2025-37747)
Vulnerability from cvelistv5
Published
2025-05-01 12:55
Modified
2025-05-26 05:20
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: perf: Fix hang while freeing sigtrap event Perf can hang while freeing a sigtrap event if a related deferred signal hadn't managed to be sent before the file got closed: perf_event_overflow() task_work_add(perf_pending_task) fput() task_work_add(____fput()) task_work_run() ____fput() perf_release() perf_event_release_kernel() _free_event() perf_pending_task_sync() task_work_cancel() -> FAILED rcuwait_wait_event() Once task_work_run() is running, the list of pending callbacks is removed from the task_struct and from this point on task_work_cancel() can't remove any pending and not yet started work items, hence the task_work_cancel() failure and the hang on rcuwait_wait_event(). Task work could be changed to remove one work at a time, so a work running on the current task can always cancel a pending one, however the wait / wake design is still subject to inverted dependencies when remote targets are involved, as pictured by Oleg: T1 T2 fd = perf_event_open(pid => T2->pid); fd = perf_event_open(pid => T1->pid); close(fd) close(fd) <IRQ> <IRQ> perf_event_overflow() perf_event_overflow() task_work_add(perf_pending_task) task_work_add(perf_pending_task) </IRQ> </IRQ> fput() fput() task_work_add(____fput()) task_work_add(____fput()) task_work_run() task_work_run() ____fput() ____fput() perf_release() perf_release() perf_event_release_kernel() perf_event_release_kernel() _free_event() _free_event() perf_pending_task_sync() perf_pending_task_sync() rcuwait_wait_event() rcuwait_wait_event() Therefore the only option left is to acquire the event reference count upon queueing the perf task work and release it from the task work, just like it was done before 3a5465418f5f ("perf: Fix event leak upon exec and file release") but without the leaks it fixed. Some adjustments are necessary to make it work: * A child event might dereference its parent upon freeing. Care must be taken to release the parent last. * Some places assuming the event doesn't have any reference held and therefore can be freed right away must instead put the reference and let the reference counting to its job.
Impacted products
Vendor Product Version
Linux Linux Version: 3a5465418f5fd970e86a86c7f4075be262682840
Version: 3a5465418f5fd970e86a86c7f4075be262682840
Version: 3a5465418f5fd970e86a86c7f4075be262682840
Version: 3a5465418f5fd970e86a86c7f4075be262682840
Version: 9ad46f1fef421d43cdab3a7d1744b2f43b54dae0
Version: ed2c202dac55423a52d7e2290f2888bf08b8ee99
Version: 104e258a004037bc7dba9f6085c71dad6af57ad4
Version: f34d8307a73a18de5320fcc6f40403146d061891
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "include/linux/perf_event.h",
            "kernel/events/core.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "fa1827fa968c0674e9b6fca223fa9fb4da4493eb",
              "status": "affected",
              "version": "3a5465418f5fd970e86a86c7f4075be262682840",
              "versionType": "git"
            },
            {
              "lessThan": "665b87b8f8b3aeb49083ef3b65c4953e7753fc12",
              "status": "affected",
              "version": "3a5465418f5fd970e86a86c7f4075be262682840",
              "versionType": "git"
            },
            {
              "lessThan": "1267bd38f161c1a27d9b722de017027167a225a0",
              "status": "affected",
              "version": "3a5465418f5fd970e86a86c7f4075be262682840",
              "versionType": "git"
            },
            {
              "lessThan": "56799bc035658738f362acec3e7647bb84e68933",
              "status": "affected",
              "version": "3a5465418f5fd970e86a86c7f4075be262682840",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "9ad46f1fef421d43cdab3a7d1744b2f43b54dae0",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "ed2c202dac55423a52d7e2290f2888bf08b8ee99",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "104e258a004037bc7dba9f6085c71dad6af57ad4",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "f34d8307a73a18de5320fcc6f40403146d061891",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "include/linux/perf_event.h",
            "kernel/events/core.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.11"
            },
            {
              "lessThan": "6.11",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.12.*",
              "status": "unaffected",
              "version": "6.12.24",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.13.*",
              "status": "unaffected",
              "version": "6.13.12",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.14.*",
              "status": "unaffected",
              "version": "6.14.3",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.15",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.12.24",
                  "versionStartIncluding": "6.11",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.13.12",
                  "versionStartIncluding": "6.11",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.14.3",
                  "versionStartIncluding": "6.11",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.15",
                  "versionStartIncluding": "6.11",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionStartIncluding": "5.15.165",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionStartIncluding": "6.1.103",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionStartIncluding": "6.6.44",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionStartIncluding": "6.10.3",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nperf: Fix hang while freeing sigtrap event\n\nPerf can hang while freeing a sigtrap event if a related deferred\nsignal hadn\u0027t managed to be sent before the file got closed:\n\nperf_event_overflow()\n   task_work_add(perf_pending_task)\n\nfput()\n   task_work_add(____fput())\n\ntask_work_run()\n    ____fput()\n        perf_release()\n            perf_event_release_kernel()\n                _free_event()\n                    perf_pending_task_sync()\n                        task_work_cancel() -\u003e FAILED\n                        rcuwait_wait_event()\n\nOnce task_work_run() is running, the list of pending callbacks is\nremoved from the task_struct and from this point on task_work_cancel()\ncan\u0027t remove any pending and not yet started work items, hence the\ntask_work_cancel() failure and the hang on rcuwait_wait_event().\n\nTask work could be changed to remove one work at a time, so a work\nrunning on the current task can always cancel a pending one, however\nthe wait / wake design is still subject to inverted dependencies when\nremote targets are involved, as pictured by Oleg:\n\nT1                                                      T2\n\nfd = perf_event_open(pid =\u003e T2-\u003epid);                  fd = perf_event_open(pid =\u003e T1-\u003epid);\nclose(fd)                                              close(fd)\n    \u003cIRQ\u003e                                                  \u003cIRQ\u003e\n    perf_event_overflow()                                  perf_event_overflow()\n       task_work_add(perf_pending_task)                        task_work_add(perf_pending_task)\n    \u003c/IRQ\u003e                                                 \u003c/IRQ\u003e\n    fput()                                                 fput()\n        task_work_add(____fput())                              task_work_add(____fput())\n\n    task_work_run()                                        task_work_run()\n        ____fput()                                             ____fput()\n            perf_release()                                         perf_release()\n                perf_event_release_kernel()                            perf_event_release_kernel()\n                    _free_event()                                          _free_event()\n                        perf_pending_task_sync()                               perf_pending_task_sync()\n                            rcuwait_wait_event()                                   rcuwait_wait_event()\n\nTherefore the only option left is to acquire the event reference count\nupon queueing the perf task work and release it from the task work, just\nlike it was done before 3a5465418f5f (\"perf: Fix event leak upon exec and file release\")\nbut without the leaks it fixed.\n\nSome adjustments are necessary to make it work:\n\n* A child event might dereference its parent upon freeing. Care must be\n  taken to release the parent last.\n\n* Some places assuming the event doesn\u0027t have any reference held and\n  therefore can be freed right away must instead put the reference and\n  let the reference counting to its job."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-05-26T05:20:01.376Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/fa1827fa968c0674e9b6fca223fa9fb4da4493eb"
        },
        {
          "url": "https://git.kernel.org/stable/c/665b87b8f8b3aeb49083ef3b65c4953e7753fc12"
        },
        {
          "url": "https://git.kernel.org/stable/c/1267bd38f161c1a27d9b722de017027167a225a0"
        },
        {
          "url": "https://git.kernel.org/stable/c/56799bc035658738f362acec3e7647bb84e68933"
        }
      ],
      "title": "perf: Fix hang while freeing sigtrap event",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-37747",
    "datePublished": "2025-05-01T12:55:54.028Z",
    "dateReserved": "2025-04-16T04:51:23.936Z",
    "dateUpdated": "2025-05-26T05:20:01.376Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2025-37747\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-05-01T13:15:53.417\",\"lastModified\":\"2025-05-02T13:53:20.943\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nperf: Fix hang while freeing sigtrap event\\n\\nPerf can hang while freeing a sigtrap event if a related deferred\\nsignal hadn\u0027t managed to be sent before the file got closed:\\n\\nperf_event_overflow()\\n   task_work_add(perf_pending_task)\\n\\nfput()\\n   task_work_add(____fput())\\n\\ntask_work_run()\\n    ____fput()\\n        perf_release()\\n            perf_event_release_kernel()\\n                _free_event()\\n                    perf_pending_task_sync()\\n                        task_work_cancel() -\u003e FAILED\\n                        rcuwait_wait_event()\\n\\nOnce task_work_run() is running, the list of pending callbacks is\\nremoved from the task_struct and from this point on task_work_cancel()\\ncan\u0027t remove any pending and not yet started work items, hence the\\ntask_work_cancel() failure and the hang on rcuwait_wait_event().\\n\\nTask work could be changed to remove one work at a time, so a work\\nrunning on the current task can always cancel a pending one, however\\nthe wait / wake design is still subject to inverted dependencies when\\nremote targets are involved, as pictured by Oleg:\\n\\nT1                                                      T2\\n\\nfd = perf_event_open(pid =\u003e T2-\u003epid);                  fd = perf_event_open(pid =\u003e T1-\u003epid);\\nclose(fd)                                              close(fd)\\n    \u003cIRQ\u003e                                                  \u003cIRQ\u003e\\n    perf_event_overflow()                                  perf_event_overflow()\\n       task_work_add(perf_pending_task)                        task_work_add(perf_pending_task)\\n    \u003c/IRQ\u003e                                                 \u003c/IRQ\u003e\\n    fput()                                                 fput()\\n        task_work_add(____fput())                              task_work_add(____fput())\\n\\n    task_work_run()                                        task_work_run()\\n        ____fput()                                             ____fput()\\n            perf_release()                                         perf_release()\\n                perf_event_release_kernel()                            perf_event_release_kernel()\\n                    _free_event()                                          _free_event()\\n                        perf_pending_task_sync()                               perf_pending_task_sync()\\n                            rcuwait_wait_event()                                   rcuwait_wait_event()\\n\\nTherefore the only option left is to acquire the event reference count\\nupon queueing the perf task work and release it from the task work, just\\nlike it was done before 3a5465418f5f (\\\"perf: Fix event leak upon exec and file release\\\")\\nbut without the leaks it fixed.\\n\\nSome adjustments are necessary to make it work:\\n\\n* A child event might dereference its parent upon freeing. Care must be\\n  taken to release the parent last.\\n\\n* Some places assuming the event doesn\u0027t have any reference held and\\n  therefore can be freed right away must instead put the reference and\\n  let the reference counting to its job.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: perf: Se soluciona el bloqueo al liberar el evento sigtrap Perf puede bloquearse al liberar un evento sigtrap si no se ha logrado enviar una se\u00f1al diferida relacionada antes de que se cerrara el archivo: perf_event_overflow() task_work_add(perf_pending_task) fput() task_work_add(____fput()) task_work_run() ____fput() perf_release() perf_event_release_kernel() _free_event() perf_pending_task_sync() task_work_cancel() -\u0026gt; FAILED rcuwait_wait_event() Una vez que task_work_run() se est\u00e1 ejecutando, la lista de devoluciones de llamadas pendientes se elimina de task_struct y desde este punto, task_work_cancel() no puede eliminar ning\u00fan elemento de trabajo pendiente y a\u00fan no iniciado, de ah\u00ed el error de task_work_cancel() y el bloqueo de rcuwait_wait_event(). El trabajo de la tarea se puede cambiar para eliminar un trabajo a la vez, de modo que un trabajo que se ejecuta en la tarea actual siempre puede cancelar uno pendiente, sin embargo, el dise\u00f1o de espera/activaci\u00f3n a\u00fan est\u00e1 sujeto a dependencias invertidas cuando se involucran objetivos remotos, como lo ilustra Oleg: T1 T2 fd = perf_event_open(pid =\u0026gt; T2-\u0026gt;pid); fd = perf_event_open(pid =\u0026gt; T1-\u0026gt;pid); close(fd) close(fd)   perf_event_overflow() perf_event_overflow() task_work_add(perf_pending_task) task_work_add(perf_pending_task)   fput() fput() task_work_add(____fput()) task_work_add(____fput()) task_work_run() task_work_run() ____fput() ____fput() perf_release() perf_release() perf_event_release_kernel() perf_event_release_kernel() _free_event() _free_event() perf_pending_task_sync() perf_pending_task_sync() rcuwait_wait_event() rcuwait_wait_event() Por lo tanto, la \u00fanica opci\u00f3n que queda es adquirir el recuento de referencias de evento al poner en cola el trabajo de la tarea de rendimiento y liberarlo del trabajo de la tarea. Tal como se hizo antes de 3a5465418f5f (\\\"perf: Corregir fuga de eventos al ejecutar y liberar archivos\\\"), pero sin las fugas corregidas. Se requieren algunos ajustes para que funcione: * Un evento secundario podr\u00eda desreferenciar a su padre al liberarse. Se debe tener cuidado de liberar al padre al final. * Algunos sitios, al asumir que el evento no tiene ninguna referencia retenida y, por lo tanto, puede liberarse de inmediato, deben colocar la referencia y dejar que el recuento de referencias contin\u00fae.\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/1267bd38f161c1a27d9b722de017027167a225a0\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/56799bc035658738f362acec3e7647bb84e68933\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/665b87b8f8b3aeb49083ef3b65c4953e7753fc12\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/fa1827fa968c0674e9b6fca223fa9fb4da4493eb\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…