CVE-2024-50140
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
07/11/2024
Last modified:
01/10/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
sched/core: Disable page allocation in task_tick_mm_cid()<br />
<br />
With KASAN and PREEMPT_RT enabled, calling task_work_add() in<br />
task_tick_mm_cid() may cause the following splat.<br />
<br />
[ 63.696416] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48<br />
[ 63.696416] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 610, name: modprobe<br />
[ 63.696416] preempt_count: 10001, expected: 0<br />
[ 63.696416] RCU nest depth: 1, expected: 1<br />
<br />
This problem is caused by the following call trace.<br />
<br />
sched_tick() [ acquire rq->__lock ]<br />
-> task_tick_mm_cid()<br />
-> task_work_add()<br />
-> __kasan_record_aux_stack()<br />
-> kasan_save_stack()<br />
-> stack_depot_save_flags()<br />
-> alloc_pages_mpol_noprof()<br />
-> __alloc_pages_noprof()<br />
-> get_page_from_freelist()<br />
-> rmqueue()<br />
-> rmqueue_pcplist()<br />
-> __rmqueue_pcplist()<br />
-> rmqueue_bulk()<br />
-> rt_spin_lock()<br />
<br />
The rq lock is a raw_spinlock_t. We can&#39;t sleep while holding<br />
it. IOW, we can&#39;t call alloc_pages() in stack_depot_save_flags().<br />
<br />
The task_tick_mm_cid() function with its task_work_add() call was<br />
introduced by commit 223baf9d17f2 ("sched: Fix performance regression<br />
introduced by mm_cid") in v6.4 kernel.<br />
<br />
Fortunately, there is a kasan_record_aux_stack_noalloc() variant that<br />
calls stack_depot_save_flags() while not allowing it to allocate<br />
new pages. To allow task_tick_mm_cid() to use task_work without<br />
page allocation, a new TWAF_NO_ALLOC flag is added to enable calling<br />
kasan_record_aux_stack_noalloc() instead of kasan_record_aux_stack()<br />
if set. The task_tick_mm_cid() function is modified to add this new flag.<br />
<br />
The possible downside is the missing stack trace in a KASAN report due<br />
to new page allocation required when task_work_add_noallloc() is called<br />
which should be rare.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.4 (including) | 6.6.59 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.11.6 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.12:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc3:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page



