CVE-2024-50140: sched/core: Disable page allocation in task_tick_mm_cid()

Published Nov 7, 2024
·
Updated

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

sched/core: Disable page allocation in tasktickmmcid()

With KASAN and PREEMPTRT enabled, calling taskworkadd() in tasktickmmcid() may cause the following splat.

[ 63.696416] BUG: sleeping function called from invalid context at kernel/locking/spinlockrt.c:48 [ 63.696416] inatomic(): 1, irqsdisabled(): 1, nonblock: 0, pid: 610, name: modprobe [ 63.696416] preemptcount: 10001, expected: 0 [ 63.696416] RCU nest depth: 1, expected: 1

This problem is caused by the following call trace.

schedtick() [ acquire rq->lock ] -> tasktickmmcid() -> taskworkadd() -> kasanrecordauxstack() -> kasansavestack() -> stackdepotsaveflags() -> allocpagesmpolnoprof() -> allocpagesnoprof() -> getpagefromfreelist() -> rmqueue() -> rmqueuepcplist() -> rmqueuepcplist() -> rmqueuebulk() -> rtspinlock()

The rq lock is a rawspinlockt. We can't sleep while holding it. IOW, we can't call allocpages() in stackdepotsaveflags().

The tasktickmmcid() function with its taskworkadd() call was introduced by commit 223baf9d17f2 ("sched: Fix performance regression introduced by mmcid") in v6.4 kernel.

Fortunately, there is a kasanrecordauxstacknoalloc() variant that calls stackdepotsaveflags() while not allowing it to allocate new pages. To allow tasktickmmcid() to use taskwork without page allocation, a new TWAFNOALLOC flag is added to enable calling kasanrecordauxstacknoalloc() instead of kasanrecordauxstack() if set. The tasktickmmcid() function is modified to add this new flag.

The possible downside is the missing stack trace in a KASAN report due to new page allocation required when taskworkaddnoallloc() is called which should be rare.

Affected Software

6 affected componentsFixes available
Linux Linux kernel>=6.4<6.6.59
Linux Linux kernel>=6.7<6.11.6
Linux Linux kernel=6.12-rc1
Linux Linux kernel=6.12-rc2
Linux Linux kernel=6.12-rc3
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.22-16.12.25-1

Event History

Nov 7, 2024
CVE Published
via MITRE·09:31 AM
Data Sourced
via MITRE·09:31 AM
Description
Data Sourced
via NVD·10:15 AM
RemedyDescriptionSeverityAffected Software
Apr 29, 2025
Data Sourced
via Ubuntu·01:00 AM
RemedyDescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-50140?

CVE-2024-50140 is considered a moderate severity vulnerability affecting the Linux kernel.

2

How do I fix CVE-2024-50140?

To mitigate CVE-2024-50140, update to a patched version of the Linux kernel, such as 5.10.223-1, 6.1.123-1, or later.

3

Which versions of the Linux kernel are affected by CVE-2024-50140?

CVE-2024-50140 affects Linux kernel versions from 6.4 to 6.6.59, and specific release candidates 6.12-rc1, 6.12-rc2, and 6.12-rc3.

4

What triggers the vulnerability in CVE-2024-50140?

CVE-2024-50140 is triggered by calling task_work_add() within task_tick_mm_cid() when KASAN and PREEMPT_RT are enabled.

5

Is CVE-2024-50140 related to memory allocation issues?

Yes, CVE-2024-50140 involves an issue with page allocation that can lead to kernel errors under certain conditions.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203