cve-2024-41045
Vulnerability from cvelistv5
Published
2024-07-29 14:32
Modified
2024-11-05 09:35
Severity ?
Summary
bpf: Defer work in bpf_timer_cancel_and_free
Impacted products
Vendor Product Version
Linux Linux Version: 5.15
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-02T04:46:51.645Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/7aa5a19279c3639ae8b758b63f05d0c616a39fa1"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69"
          }
        ],
        "title": "CVE Program Container"
      },
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2024-41045",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-09-10T16:23:00.726132Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-09-11T17:34:02.451Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "kernel/bpf/helpers.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "7aa5a19279c3",
              "status": "affected",
              "version": "b00628b1c7d5",
              "versionType": "git"
            },
            {
              "lessThan": "a6fcd19d7eac",
              "status": "affected",
              "version": "b00628b1c7d5",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "kernel/bpf/helpers.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "5.15"
            },
            {
              "lessThan": "5.15",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.9.*",
              "status": "unaffected",
              "version": "6.9.10",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.10",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Defer work in bpf_timer_cancel_and_free\n\nCurrently, the same case as previous patch (two timer callbacks trying\nto cancel each other) can be invoked through bpf_map_update_elem as\nwell, or more precisely, freeing map elements containing timers. Since\nthis relies on hrtimer_cancel as well, it is prone to the same deadlock\nsituation as the previous patch.\n\nIt would be sufficient to use hrtimer_try_to_cancel to fix this problem,\nas the timer cannot be enqueued after async_cancel_and_free. Once\nasync_cancel_and_free has been done, the timer must be reinitialized\nbefore it can be armed again. The callback running in parallel trying to\narm the timer will fail, and freeing bpf_hrtimer without waiting is\nsufficient (given kfree_rcu), and bpf_timer_cb will return\nHRTIMER_NORESTART, preventing the timer from being rearmed again.\n\nHowever, there exists a UAF scenario where the callback arms the timer\nbefore entering this function, such that if cancellation fails (due to\ntimer callback invoking this routine, or the target timer callback\nrunning concurrently). In such a case, if the timer expiration is\nsignificantly far in the future, the RCU grace period expiration\nhappening before it will free the bpf_hrtimer state and along with it\nthe struct hrtimer, that is enqueued.\n\nHence, it is clear cancellation needs to occur after\nasync_cancel_and_free, and yet it cannot be done inline due to deadlock\nissues. We thus modify bpf_timer_cancel_and_free to defer work to the\nglobal workqueue, adding a work_struct alongside rcu_head (both used at\n_different_ points of time, so can share space).\n\nUpdate existing code comments to reflect the new state of affairs."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-11-05T09:35:35.808Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/7aa5a19279c3639ae8b758b63f05d0c616a39fa1"
        },
        {
          "url": "https://git.kernel.org/stable/c/a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69"
        }
      ],
      "title": "bpf: Defer work in bpf_timer_cancel_and_free",
      "x_generator": {
        "engine": "bippy-9e1c9544281a"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2024-41045",
    "datePublished": "2024-07-29T14:32:02.866Z",
    "dateReserved": "2024-07-12T12:17:45.624Z",
    "dateUpdated": "2024-11-05T09:35:35.808Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2024-41045\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-07-29T15:15:12.873\",\"lastModified\":\"2024-11-21T09:32:07.857\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbpf: Defer work in bpf_timer_cancel_and_free\\n\\nCurrently, the same case as previous patch (two timer callbacks trying\\nto cancel each other) can be invoked through bpf_map_update_elem as\\nwell, or more precisely, freeing map elements containing timers. Since\\nthis relies on hrtimer_cancel as well, it is prone to the same deadlock\\nsituation as the previous patch.\\n\\nIt would be sufficient to use hrtimer_try_to_cancel to fix this problem,\\nas the timer cannot be enqueued after async_cancel_and_free. Once\\nasync_cancel_and_free has been done, the timer must be reinitialized\\nbefore it can be armed again. The callback running in parallel trying to\\narm the timer will fail, and freeing bpf_hrtimer without waiting is\\nsufficient (given kfree_rcu), and bpf_timer_cb will return\\nHRTIMER_NORESTART, preventing the timer from being rearmed again.\\n\\nHowever, there exists a UAF scenario where the callback arms the timer\\nbefore entering this function, such that if cancellation fails (due to\\ntimer callback invoking this routine, or the target timer callback\\nrunning concurrently). In such a case, if the timer expiration is\\nsignificantly far in the future, the RCU grace period expiration\\nhappening before it will free the bpf_hrtimer state and along with it\\nthe struct hrtimer, that is enqueued.\\n\\nHence, it is clear cancellation needs to occur after\\nasync_cancel_and_free, and yet it cannot be done inline due to deadlock\\nissues. We thus modify bpf_timer_cancel_and_free to defer work to the\\nglobal workqueue, adding a work_struct alongside rcu_head (both used at\\n_different_ points of time, so can share space).\\n\\nUpdate existing code comments to reflect the new state of affairs.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: bpf: Aplazar el trabajo en bpf_timer_cancel_and_free Actualmente, el mismo caso del parche anterior (dos devoluciones de llamada de temporizador que intentan cancelarse entre s\u00ed) tambi\u00e9n se puede invocar a trav\u00e9s de bpf_map_update_elem, o m\u00e1s precisamente, liberando mapa elementos que contienen temporizadores. Dado que esto tambi\u00e9n depende de hrtimer_cancel, es propenso a la misma situaci\u00f3n de punto muerto que el parche anterior. Ser\u00eda suficiente usar hrtimer_try_to_cancel para solucionar este problema, ya que el temporizador no se puede poner en cola despu\u00e9s de async_cancel_and_free. Una vez que se haya realizado async_cancel_and_free, el temporizador debe reinicializarse antes de poder armarse nuevamente. La devoluci\u00f3n de llamada que se ejecuta en paralelo al intentar armar el temporizador fallar\u00e1, y liberar bpf_hrtimer sin esperar es suficiente (dado kfree_rcu), y bpf_timer_cb devolver\u00e1 HRTIMER_NORESTART, evitando que el temporizador se rearme nuevamente. Sin embargo, existe un escenario UAF en el que la devoluci\u00f3n de llamada arma el temporizador antes de ingresar a esta funci\u00f3n, de modo que si la cancelaci\u00f3n falla (debido a que la devoluci\u00f3n de llamada del temporizador invoca esta rutina o la devoluci\u00f3n de llamada del temporizador de destino se ejecuta simult\u00e1neamente). En tal caso, si la expiraci\u00f3n del temporizador est\u00e1 significativamente lejos en el futuro, la expiraci\u00f3n del per\u00edodo de gracia de RCU que ocurra antes liberar\u00e1 el estado bpf_hrtimer y junto con \u00e9l la estructura hrtimer, que est\u00e1 en cola. Por lo tanto, est\u00e1 claro que la cancelaci\u00f3n debe ocurrir despu\u00e9s de async_cancel_and_free y, sin embargo, no se puede realizar en l\u00ednea debido a problemas de interbloqueo. Por lo tanto, modificamos bpf_timer_cancel_and_free para diferir el trabajo a la cola de trabajo global, agregando un work_struct junto con rcu_head (ambos usados en _diferentes_ puntos de tiempo, por lo que pueden compartir espacio). Actualice los comentarios del c\u00f3digo existente para reflejar la nueva situaci\u00f3n.\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/7aa5a19279c3639ae8b758b63f05d0c616a39fa1\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/7aa5a19279c3639ae8b758b63f05d0c616a39fa1\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"},{\"url\":\"https://git.kernel.org/stable/c/a6fcd19d7eac1335eb76bc16b6a66b7f574d1d69\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\"}]}}"
  }
}


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.