Recently, the Linux kernel maintainers addressed a vulnerability registered as CVE-2024-56583 involving the sched/deadline code. This bug didn't allow for direct privilege escalation, but it led to kernel warnings that could destabilize real-time workloads or open the door to a potential Denial of Service (DoS) if abused. In this post, you'll get a layman's breakdown of the issue, see relevant kernel code snippets, learn how the bug triggers, and find links to upstream discussions and patches.
## What is sched/deadline?
The Linux kernel supports various scheduler classes. The SCHED_DEADLINE policy is used in real-time systems for tasks with strict timing requirements. Any bug in this area can jeopardize system stability and predictability.
The Vulnerability: What Happened?
When running stress tests involving cyclic workloads, Linux could emit severe kernel warnings traced back to kernel/sched/deadline.c, such as:
while true; do
stress-ng --cyclic 30 --timeout 30s --minimize --quiet
done
Eventually, you may spot this in your dmesg
WARNING: CPU: 43 PID: 2848 at kernel/sched/deadline.c:794
setup_new_dl_entity+x13e/x180
...
enqueue_dl_entity+x631/x6e
enqueue_task_dl+x7d/x120
__do_set_cpus_allowed+xe3/x280
migrate_enable+x7e/x150
...
What did this mean?
When a boosted task (one temporarily given higher priority due to rt_mutex_setprio) was migrated by changing its allowed CPUs, the kernel would try to re-initialize its deadline scheduling parameters—*even though these had already been set*. This triggered a WARN_ON in setup_new_dl_entity due to this duplicate, unnecessary setup.
A quick walk-through
1. A real-time process is running on SCHED_DEADLINE and its scheduling domain is changed (possibly by affinity changes).
2. set_cpus_allowed() is called, which dequeues and enqueues the task with the ENQUEUE_RESTORE flag.
3. If this task is "boosted" (due to rt_mutex_setprio during priority inheritance), the kernel calls setup_new_dl_entity() again.
Relevant kernel code prior to the fix (kernel/sched/deadline.c)
void setup_new_dl_entity(struct sched_dl_entity *dl_se, ...)
{
...
WARN_ON_ONCE(dl_task_boosted(task));
...
}
Stack trace visualization
migrate_enable()
└── __set_cpus_allowed_ptr()
└── __set_cpus_allowed_ptr_locked()
└── __do_set_cpus_allowed()
└── enqueue_task_dl()
└── enqueue_dl_entity()
└── setup_new_dl_entity() [WARN triggers here]
Exploit Details
On its own, this bug is not a security flaw that allows for privileges escalation, arbitrary code execution, or similar—it does, however, result in kernel warnings, which are a red-flag in production and real-time environments. Repeated triggering could lead to system instability or a denial-of-service via log flooding and undefined kernel behavior.
You can reproduce this on a vulnerable kernel (before the fix) using
while true; do
stress-ng --cyclic 30 --timeout 30s --minimize --quiet
done
Watch dmesg for warnings citing setup_new_dl_entity and dl_task_boosted.
The Patch: How Was It Fixed?
The fix is a straightforward check. Before re-initializing the deadline entity, the code now skips calling setup_new_dl_entity *if the task is boosted.*
Patch excerpt
// Old code:
setup_new_dl_entity(...);
// New code:
if (!dl_task_boosted(task))
setup_new_dl_entity(...);
This way, boosted tasks maintain their correct scheduling parameters and the kernel warning is never triggered.
Commit message summary (from upstream LKML)
> Check if we are requeueing a boosted task and avoid calling setup_new_dl_entity if that's the case.
Official Patch (LKML):
sched/deadline: Fix warning in migrate_enable for boosted tasks
CVE Entry:
Original kernel bug report:
LKML Thread for sched/deadline bug
stress-ng utility:
Kernel warned upon task scheduling manipulation with SCHED_DEADLINE boosted tasks.
- Risk: Potential DoS via log flooding/instability in real-time environments.
The patch adds a check that fixes the logic cleanly and simply.
Upgrade your kernel if you run SCHED_DEADLINE tasks in any sensitive or production environment!
_This post is independently summarized for clarity. For enterprise usage, always review official advisories and test patches in your staging environment before deployment._
Timeline
Published on: 12/27/2024 15:15:17 UTC
Last modified on: 05/04/2025 13:00:54 UTC