CVE-2026-139346 (GCVE-0-2026-139346)

Vulnerability from cvelistv5 – Published: 2026-11-30 13:33 – Updated: 2026-11-30 13:33
VLAI
Title
bpf: Fix NULL task dereference in task work cancellation
Summary
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix NULL task dereference in task work cancellation bpf_task_work_irq() publishes ctx->work with task_work_add() before changing the context from SCHEDULING to SCHEDULED. The target task can run the callback on another CPU before the handler reaches its final state transition. The handler then reloads ctx->task for cancellation if its final cmpxchg observes FREED. By that point the callback or context destruction may already have cleared ctx->task, causing task_work_cancel() to dereference a NULL task pointer. One concrete interleaving is: 1. CPU 0 changes PENDING to SCHEDULING and successfully queues ctx->work with task_work_add(), but has not attempted the final state cmpxchg. 2. The target task on CPU 1 runs the callback. It changes SCHEDULING to RUNNING, executes the BPF subprogram, resets ctx->task, publishes STANDBY and drops the callback's context reference. 3. CPU 2 deletes the map value. It changes STANDBY to FREED and drops the map's context reference without queuing asynchronous cancellation. 4. CPU 0 resumes. Its SCHEDULING-to-SCHEDULED cmpxchg observes FREED, and the cancellation attempt passes NULL to task_work_cancel(). If deletion publishes FREED before the callback claims RUNNING, the callback takes its FREED exit and drops its context reference. Context destruction can then clear ctx->task before CPU 0 attempts cancellation. A controlled reproducer with a delay before the final cmpxchg triggered the following fault on a v7.3-rc3 based x86-64 KVM guest: BUG: kernel NULL pointer dereference, address: 0000000000000890 RIP: 0010:task_work_cancel+0xd/0xa0 RDI: 0000000000000000 CR2: 0000000000000890 Call Trace: <IRQ> bpf_task_work_irq+0x95/0x100 irq_work_run_list+0x4f/0x90 irq_work_run+0x18/0x50 </IRQ> 0x890 is the task_struct::task_works offset in that build, read through the NULL task argument. Capture ctx->task before task_work_add() publishes the callback and use that pointer for the handler's cancellation attempt. The round still holds its task reference when the pointer is captured. Releasing that reference uses bpf_task_release(), which calls put_task_struct_rcu_user(), so the handler's existing RCU read-side section keeps the captured task alive even if ctx->task is subsequently cleared. The asynchronous cancellation path reads ctx->task directly, which is safe there: queuing it requires deletion to observe SCHEDULED, and that xchg wins against the callback's transition to RUNNING, so the callback takes its FREED exit without resetting ctx->task, while the map reference transferred to the cancellation handler prevents context destruction until cancellation completes. The handler-tail and asynchronous cancellation attempts are mutually exclusive: asynchronous cancellation is queued only if deletion observes SCHEDULED after the scheduling handler's final cmpxchg has succeeded. If that cmpxchg instead observes FREED, the scheduling handler attempts cancellation with the captured pointer.
Severity
No CVSS data available.
Assigner
Linux CNA under the mitre root
CNA scorecard D 52/100 over 8585 records in the last 180 days details
Impacted products
Vendor Product Version CPE status
Linux Linux Affected: 38aa7003e369802f81a078f6673d10d97013f04f , < fd91c41b1d4ab85ce806d61c8e5b7add292046dc (git)
Affected: 38aa7003e369802f81a078f6673d10d97013f04f , < 2fd1c3f2128a59d118e6656dcbd065a588a5aac7 (git)
Affected: 38aa7003e369802f81a078f6673d10d97013f04f , < c961f7b41a108313a4705baac7b27d2174cc8035 (git)
guessed Create a notification for this product.
Linux Linux Affected: 6.18
Unaffected: 0 , < 6.18 (semver)
Unaffected: 6.18.65 , ≤ 6.18.* (semver)
Unaffected: 7.3.6 , ≤ 7.3.* (semver)
Unaffected: 7.4-rc1 , ≤ * (original_commit_for_fix)
guessed Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "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": "fd91c41b1d4ab85ce806d61c8e5b7add292046dc",
              "status": "affected",
              "version": "38aa7003e369802f81a078f6673d10d97013f04f",
              "versionType": "git"
            },
            {
              "lessThan": "2fd1c3f2128a59d118e6656dcbd065a588a5aac7",
              "status": "affected",
              "version": "38aa7003e369802f81a078f6673d10d97013f04f",
              "versionType": "git"
            },
            {
              "lessThan": "c961f7b41a108313a4705baac7b27d2174cc8035",
              "status": "affected",
              "version": "38aa7003e369802f81a078f6673d10d97013f04f",
              "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": "6.18"
            },
            {
              "lessThan": "6.18",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.18.*",
              "status": "unaffected",
              "version": "6.18.65",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "7.3.*",
              "status": "unaffected",
              "version": "7.3.6",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "7.4-rc1",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.18.65",
                  "versionStartIncluding": "6.18",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "7.3.6",
                  "versionStartIncluding": "6.18",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "7.4-rc1",
                  "versionStartIncluding": "6.18",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix NULL task dereference in task work cancellation\n\nbpf_task_work_irq() publishes ctx-\u003ework with task_work_add() before\nchanging the context from SCHEDULING to SCHEDULED.  The target task can\nrun the callback on another CPU before the handler reaches its final\nstate transition.\n\nThe handler then reloads ctx-\u003etask for cancellation if its final cmpxchg\nobserves FREED.  By that point the callback or context destruction may\nalready have cleared ctx-\u003etask, causing task_work_cancel() to dereference\na NULL task pointer.\n\nOne concrete interleaving is:\n\n  1. CPU 0 changes PENDING to SCHEDULING and successfully queues\n     ctx-\u003ework with task_work_add(), but has not attempted the final\n     state cmpxchg.\n\n  2. The target task on CPU 1 runs the callback.  It changes SCHEDULING\n     to RUNNING, executes the BPF subprogram, resets ctx-\u003etask,\n     publishes STANDBY and drops the callback\u0027s context reference.\n\n  3. CPU 2 deletes the map value.  It changes STANDBY to FREED and drops\n     the map\u0027s context reference without queuing asynchronous\n     cancellation.\n\n  4. CPU 0 resumes.  Its SCHEDULING-to-SCHEDULED cmpxchg observes FREED,\n     and the cancellation attempt passes NULL to task_work_cancel().\n\nIf deletion publishes FREED before the callback claims RUNNING, the\ncallback takes its FREED exit and drops its context reference.  Context\ndestruction can then clear ctx-\u003etask before CPU 0 attempts cancellation.\n\nA controlled reproducer with a delay before the final cmpxchg triggered\nthe following fault on a v7.3-rc3 based x86-64 KVM guest:\n\n  BUG: kernel NULL pointer dereference, address: 0000000000000890\n  RIP: 0010:task_work_cancel+0xd/0xa0\n  RDI: 0000000000000000\n  CR2: 0000000000000890\n  Call Trace:\n   \u003cIRQ\u003e\n   bpf_task_work_irq+0x95/0x100\n   irq_work_run_list+0x4f/0x90\n   irq_work_run+0x18/0x50\n   \u003c/IRQ\u003e\n\n0x890 is the task_struct::task_works offset in that build, read through\nthe NULL task argument.\n\nCapture ctx-\u003etask before task_work_add() publishes the callback and use\nthat pointer for the handler\u0027s cancellation attempt.  The round still\nholds its task reference when the pointer is captured.  Releasing that\nreference uses bpf_task_release(), which calls put_task_struct_rcu_user(),\nso the handler\u0027s existing RCU read-side section keeps the captured task\nalive even if ctx-\u003etask is subsequently cleared.\n\nThe asynchronous cancellation path reads ctx-\u003etask directly, which is\nsafe there: queuing it requires deletion to observe SCHEDULED, and that\nxchg wins against the callback\u0027s transition to RUNNING, so the callback\ntakes its FREED exit without resetting ctx-\u003etask, while the map\nreference transferred to the cancellation handler prevents context\ndestruction until cancellation completes.\n\nThe handler-tail and asynchronous cancellation attempts are mutually\nexclusive: asynchronous cancellation is queued only if deletion observes\nSCHEDULED after the scheduling handler\u0027s final cmpxchg has succeeded.\nIf that cmpxchg instead observes FREED, the scheduling handler attempts\ncancellation with the captured pointer."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-11-30T13:33:54.743Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/fd91c41b1d4ab85ce806d61c8e5b7add292046dc"
        },
        {
          "url": "https://git.kernel.org/stable/c/2fd1c3f2128a59d118e6656dcbd065a588a5aac7"
        },
        {
          "url": "https://git.kernel.org/stable/c/c961f7b41a108313a4705baac7b27d2174cc8035"
        }
      ],
      "title": "bpf: Fix NULL task dereference in task work cancellation",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2026-139346",
    "datePublished": "2026-11-30T13:33:54.743Z",
    "dateReserved": "2026-11-30T13:22:15.928Z",
    "dateUpdated": "2026-11-30T13:33:54.743Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "epss": {
      "cve": "CVE-2026-139346",
      "date": "2026-12-04",
      "epss": "0.00198",
      "percentile": "0.10095"
    },
    "microsoft_vex": {
      "current_release_date": "2026-12-01T01:23:17.000Z",
      "cve": "CVE-2026-139346",
      "id": "msrc_CVE-2026-139346",
      "initial_release_date": "2026-12-01T01:23:17.000Z",
      "product_status:under_investigation": "1",
      "source": "Microsoft CSAF VEX",
      "status": "final",
      "title": "bpf: Fix NULL task dereference in task work cancellation",
      "url": "https://msrc.microsoft.com/csaf/vex/2026/msrc_cve-2026-139346.json",
      "version": "1"
    },
    "nvd": {
      "cve": {
        "affected": [
          {
            "affectedData": [
              {
                "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": "fd91c41b1d4ab85ce806d61c8e5b7add292046dc",
                    "status": "affected",
                    "version": "38aa7003e369802f81a078f6673d10d97013f04f",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "2fd1c3f2128a59d118e6656dcbd065a588a5aac7",
                    "status": "affected",
                    "version": "38aa7003e369802f81a078f6673d10d97013f04f",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "c961f7b41a108313a4705baac7b27d2174cc8035",
                    "status": "affected",
                    "version": "38aa7003e369802f81a078f6673d10d97013f04f",
                    "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": "6.18"
                  },
                  {
                    "lessThan": "6.18",
                    "status": "unaffected",
                    "version": "0",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "6.18.*",
                    "status": "unaffected",
                    "version": "6.18.65",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "7.3.*",
                    "status": "unaffected",
                    "version": "7.3.6",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "*",
                    "status": "unaffected",
                    "version": "7.4-rc1",
                    "versionType": "original_commit_for_fix"
                  }
                ]
              }
            ],
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
          }
        ],
        "cveTags": [],
        "descriptions": [
          {
            "lang": "en",
            "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix NULL task dereference in task work cancellation\n\nbpf_task_work_irq() publishes ctx-\u003ework with task_work_add() before\nchanging the context from SCHEDULING to SCHEDULED.  The target task can\nrun the callback on another CPU before the handler reaches its final\nstate transition.\n\nThe handler then reloads ctx-\u003etask for cancellation if its final cmpxchg\nobserves FREED.  By that point the callback or context destruction may\nalready have cleared ctx-\u003etask, causing task_work_cancel() to dereference\na NULL task pointer.\n\nOne concrete interleaving is:\n\n  1. CPU 0 changes PENDING to SCHEDULING and successfully queues\n     ctx-\u003ework with task_work_add(), but has not attempted the final\n     state cmpxchg.\n\n  2. The target task on CPU 1 runs the callback.  It changes SCHEDULING\n     to RUNNING, executes the BPF subprogram, resets ctx-\u003etask,\n     publishes STANDBY and drops the callback\u0027s context reference.\n\n  3. CPU 2 deletes the map value.  It changes STANDBY to FREED and drops\n     the map\u0027s context reference without queuing asynchronous\n     cancellation.\n\n  4. CPU 0 resumes.  Its SCHEDULING-to-SCHEDULED cmpxchg observes FREED,\n     and the cancellation attempt passes NULL to task_work_cancel().\n\nIf deletion publishes FREED before the callback claims RUNNING, the\ncallback takes its FREED exit and drops its context reference.  Context\ndestruction can then clear ctx-\u003etask before CPU 0 attempts cancellation.\n\nA controlled reproducer with a delay before the final cmpxchg triggered\nthe following fault on a v7.3-rc3 based x86-64 KVM guest:\n\n  BUG: kernel NULL pointer dereference, address: 0000000000000890\n  RIP: 0010:task_work_cancel+0xd/0xa0\n  RDI: 0000000000000000\n  CR2: 0000000000000890\n  Call Trace:\n   \u003cIRQ\u003e\n   bpf_task_work_irq+0x95/0x100\n   irq_work_run_list+0x4f/0x90\n   irq_work_run+0x18/0x50\n   \u003c/IRQ\u003e\n\n0x890 is the task_struct::task_works offset in that build, read through\nthe NULL task argument.\n\nCapture ctx-\u003etask before task_work_add() publishes the callback and use\nthat pointer for the handler\u0027s cancellation attempt.  The round still\nholds its task reference when the pointer is captured.  Releasing that\nreference uses bpf_task_release(), which calls put_task_struct_rcu_user(),\nso the handler\u0027s existing RCU read-side section keeps the captured task\nalive even if ctx-\u003etask is subsequently cleared.\n\nThe asynchronous cancellation path reads ctx-\u003etask directly, which is\nsafe there: queuing it requires deletion to observe SCHEDULED, and that\nxchg wins against the callback\u0027s transition to RUNNING, so the callback\ntakes its FREED exit without resetting ctx-\u003etask, while the map\nreference transferred to the cancellation handler prevents context\ndestruction until cancellation completes.\n\nThe handler-tail and asynchronous cancellation attempts are mutually\nexclusive: asynchronous cancellation is queued only if deletion observes\nSCHEDULED after the scheduling handler\u0027s final cmpxchg has succeeded.\nIf that cmpxchg instead observes FREED, the scheduling handler attempts\ncancellation with the captured pointer."
          }
        ],
        "id": "CVE-2026-139346",
        "lastModified": "2026-11-30T14:18:59.780",
        "metrics": {},
        "published": "2026-11-30T14:18:59.780",
        "references": [
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/2fd1c3f2128a59d118e6656dcbd065a588a5aac7"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/c961f7b41a108313a4705baac7b27d2174cc8035"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/fd91c41b1d4ab85ce806d61c8e5b7add292046dc"
          }
        ],
        "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "vulnStatus": "Received"
      }
    },
    "redhat_vex": {
      "aggregate_severity": "Moderate",
      "current_release_date": "2026-12-01T08:32:09+00:00",
      "cve": "CVE-2026-139346",
      "id": "CVE-2026-139346",
      "initial_release_date": "2026-11-30T13:33:54.743000+00:00",
      "product_status:known_affected": "77",
      "product_status:known_not_affected": "203",
      "source": "Red Hat CSAF VEX",
      "status": "final",
      "title": "kernel: kernel: Denial of Service via NULL pointer dereference in BPF task work cancellation",
      "url": "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-139346.json",
      "version": "3"
    }
  }
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.