# CVE-2026-139558: sched: Set TIF_NEED_RESCHED before calling __trace_set_need_resched()


- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 30 Nov 2026
- **Updated:** 30 Nov 2026
- **Also known as:** BELL-CVE-2026-139558, DEBIAN-CVE-2026-139558, GHSA-h4q9-r22j-qvc9, UBUNTU-CVE-2026-139558

## What is CVE-2026-139558?

CVE-2026-139558 is a vulnerability in Linux, published on 30 Nov 2026. 

### Official description

In the Linux kernel, the following vulnerability has been resolved:

sched: Set TIF_NEED_RESCHED before calling __trace_set_need_resched()

set_tsk_need_resched() tests TIF_NEED_RESCHED, calls
__trace_set_need_resched() if the flag is clear, then sets it via
set_tsk_thread_flag().  A BPF raw_tp program attached to
sched_set_need_resched executes synchronously inside __bpf_trace_run().
On return, __bpf_trace_run() drops the RCU lock with
rcu_read_unlock_migrate(), which on the preempt-or-BH-disabled path
calls set_need_resched_current() -> set_tsk_need_resched() again.

set_tsk_thread_flag() follows the tracepoint call, so every re-entrant
frame sees TIF_NEED_RESCHED clear and calls __trace_set_need_resched()
again:

  BUG: TASK stack guard page was hit at ffffc9001224ff98
  Oops: stack guard page: 0000 [#1] SMP KASAN PTI
  RIP: 0010:__bpf_trace_sched_set_need_resched_tp+0x1c/0x190
  Call Trace:
   trace_sched_set_need_resched_tp+0x110/0x130
   set_tsk_need_resched include/linux/sched.h:2076
   set_need_resched_current include/linux/sched.h:2094
   rcu_read_unlock_special+0x43a/0x440
   __rcu_read_unlock+0x9e/0x120
   rcu_read_unlock_migrate+0xa9/0x240
   __bpf_trace_run+0x131/0x180
   bpf_trace_run3+0x333/0x430
   __bpf_trace_sched_set_need_resched_tp+0x13a/0x190
   trace_sched_set_need_resched_tp+0x110/0x130
   set_tsk_need_resched include/linux/sched.h:2076
   ...

__resched_curr() has the same ordering, firing the tracepoint before
setting the flag via set_ti_thread_flag() or set_nr_and_not_polling().
Fix it for consistency.

Replace the separate test_tsk_thread_flag() + set_tsk_thread_flag() pair
in set_tsk_need_resched() with test_and_set_tsk_thread_flag().  In
__resched_curr(), move the tracepoint call after the flag is set in
each path.

## Which versions are affected by CVE-2026-139558?


## How do I fix CVE-2026-139558?

Upgrade to a fixed version.

## Is CVE-2026-139558 being exploited?

There is no known exploitation of CVE-2026-139558 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-139558 and fix it if it is affected.

What it is: CVE-2026-139558 is a vulnerability in Linux, published on 30 Nov 2026. 
Exploitation: There is no known exploitation of CVE-2026-139558 in the wild and no public exploit code.

Affected product: Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-139558/ (Markdown: https://insights.sbomify.com/CVE-2026-139558/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-139558
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-139558
- OSV: https://osv.dev/vulnerability/CVE-2026-139558

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-139558/
Summaries are generated and may contain mistakes; the official description above is the record.
