# CVE-2021-47209: sched/fair: Prevent dead task groups from regaining cfs\_rq's

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.29% (percentile 14, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2024-04-10T19:01:51.363Z
- **Modified:** 2026-08-05T08:46:44.525Z

## Who should check

- Anyone running Linux \>= a7b359fc6a37faaf472125867c8dc5a068c90982, \< 512e21c150c1c3ee298852660f3a796e267e62ec; \>= a7b359fc6a37faaf472125867c8dc5a068c90982, \< b027789e5e50494c2325cc70c8642e7fd6059479
- Anyone running Linux 5.13

## Description

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

sched/fair: Prevent dead task groups from regaining cfs\_rq's

Kevin is reporting crashes which point to a use-after-free of a cfs\_rq
in update\_blocked\_averages(). Initial debugging revealed that we've
live cfs\_rq's (on\_list=1) in an about to be kfree()'d task group in
free\_fair\_sched\_group(). However, it was unclear how that can happen.

His kernel config happened to lead to a layout of struct sched\_entity
that put the 'my\_q' member directly into the middle of the object
which makes it incidentally overlap with SLUB's freelist pointer.
That, in combination with SLAB\_FREELIST\_HARDENED's freelist pointer
mangling, leads to a reliable access violation in form of a \#GP which
made the UAF fail fast.

Michal seems to have run into the same issue\[1\]. He already correctly
diagnosed that commit a7b359fc6a37 ("sched/fair: Correctly insert
cfs\_rq's to list on unthrottle") is causing the preconditions for the
UAF to happen by re-adding cfs\_rq's also to task groups that have no
more running tasks, i.e. also to dead ones. His analysis, however,
misses the real root cause and it cannot be seen from the crash
backtrace only, as the real offender is tg\_unthrottle\_up() getting
called via sched\_cfs\_period\_timer() via the timer interrupt at an
inconvenient time.

When unregister\_fair\_sched\_group() unlinks all cfs\_rq's from the dying
task group, it doesn't protect itself from getting interrupted. If the
timer interrupt triggers while we iterate over all CPUs or after
unregister\_fair\_sched\_group() has finished but prior to unlinking the
task group, sched\_cfs\_period\_timer() will execute and walk the list of
task groups, trying to unthrottle cfs\_rq's, i.e. re-add them to the
dying task group. These will later -- in free\_fair\_sched\_group() -- be
kfree()'ed while still being linked, leading to the fireworks Kevin
and Michal are seeing.

To fix this race, ensure the dying task group gets unlinked first.
However, simply switching the order of unregistering and unlinking the
task group isn't sufficient, as concurrent RCU walkers might still see
it, as can be seen below:

    CPU1:                                      CPU2:
      :                                        timer IRQ:
      :                                          do\_sched\_cfs\_period\_timer():
      :                                            :
      :                                            distribute\_cfs\_runtime():
      :                                              rcu\_read\_lock();
      :                                              :
      :                                              unthrottle\_cfs\_rq():
    sched\_offline\_group():                             :
      :                                                walk\_tg\_tree\_from(…,tg\_unthrottle\_up,…):
      list\_del\_rcu(&tg-\>list);                           :
 (1)  :                                                  list\_for\_each\_entry\_rcu(child, &parent-\>children, siblings)
      :                                                    :
 (2)  list\_del\_rcu(&tg-\>siblings);                         :
      :                                                    tg\_unthrottle\_up():
      unregister\_fair\_sched\_group():                         struct cfs\_rq \*cfs\_rq = tg-\>cfs\_rq\[cpu\_of(rq)\];
        :                                                    :
        list\_del\_leaf\_cfs\_rq(tg-\>cfs\_rq\[cpu\]);               :
        :                                                    :
        :                                                    if (!cfs\_rq\_is\_decayed(cfs\_rq) \|\| cfs\_rq-\>nr\_running)
 (3)    :                                                        list\_add\_leaf\_cfs\_rq(cfs\_rq);
      :                                                      :
      :                                                    :
      :                                                  :
      :                                                :
      :                           
---truncated---

## Affected and fixed versions

- Linux: \>= a7b359fc6a37faaf472125867c8dc5a068c90982, \< 512e21c150c1c3ee298852660f3a796e267e62ec; \>= a7b359fc6a37faaf472125867c8dc5a068c90982, \< b027789e5e50494c2325cc70c8642e7fd6059479 (cvelist)
- Linux: 5.13 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47209. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47209.md
Affected: Linux >= a7b359fc6a37faaf472125867c8dc5a068c90982, < 512e21c150c1c3ee298852660f3a796e267e62ec; >= a7b359fc6a37faaf472125867c8dc5a068c90982, < b027789e5e50494c2325cc70c8642e7fd6059479; Linux 5.13
Fixed in: Linux 512e21c150c1c3ee298852660f3a796e267e62ec

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47209 being exploited?

There is no confirmed exploitation: CVE-2021-47209 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.29% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-47209?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2021-47209?

Linux \>= a7b359fc6a37faaf472125867c8dc5a068c90982, \< 512e21c150c1c3ee298852660f3a796e267e62ec; \>= a7b359fc6a37faaf472125867c8dc5a068c90982, \< b027789e5e50494c2325cc70c8642e7fd6059479; Linux 5.13.

### Is there a fix for CVE-2021-47209?

Yes. Fixed in Linux 512e21c150c1c3ee298852660f3a796e267e62ec. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2021-47209?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/512e21c150c1c3ee298852660f3a796e267e62ec>
- patch: <https://git.kernel.org/stable/c/b027789e5e50494c2325cc70c8642e7fd6059479>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47209>

HTML: <https://flawdb.com/CVE-2021-47209> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47209>
