CVE-2024-26987: mm/memory-failure: fix deadlock when hugetlb_optimize_vmemmap is enabled

Published May 1, 2024
·
Updated

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

mm/memory-failure: fix deadlock when hugetlboptimizevmemmap is enabled

The Linux kernel CVE team has assigned CVE-2024-26987 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024050143-CVE-2024-26987-507c@gregkh/T

Other sources

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

mm/memory-failure: fix deadlock when hugetlboptimizevmemmap is enabled

When I did hard offline test with hugetlb pages, below deadlock occurs:

====================================================== WARNING: possible circular locking dependency detected 6.8.0-11409-gf6cef5f8c37f #1 Not tainted ------------------------------------------------------ bash/46904 is trying to acquire lock: ffffffffabe68910 (cpuhotpluglock){++++}-{0:0}, at: statickeyslowdec+0x16/0x60

but task is already holding lock: ffffffffabf92ea8 (pcpbatchhighlock){+.+.}-{3:3}, at: zonepcpdisable+0x16/0x40

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (pcpbatchhighlock){+.+.}-{3:3}: mutexlock+0x6c/0x770 pagealloccpuonline+0x3c/0x70 cpuhpinvokecallback+0x397/0x5f0 cpuhpinvokecallbackrange+0x71/0xe0 cpuup+0xeb/0x210 cpuup+0x91/0xe0 cpuhpbringupmask+0x49/0xb0 bringupnonbootcpus+0xb7/0xe0 smpinit+0x25/0xa0 kernelinitfreeable+0x15f/0x3e0 kernelinit+0x15/0x1b0 retfromfork+0x2f/0x50 retfromforkasm+0x1a/0x30

-> #0 (cpuhotpluglock){++++}-{0:0}: lockacquire+0x1298/0x1cd0 lockacquire+0xc0/0x2b0 cpusreadlock+0x2a/0xc0 statickeyslowdec+0x16/0x60 hugetlbvmemmaprestorefolio+0x1b9/0x200 dissolvefreehugepage+0x211/0x260 pagehandlepoison+0x45/0xc0 memoryfailure+0x65e/0xc70 hardofflinepagestore+0x55/0xa0 kernfsfopwriteiter+0x12c/0x1d0 vfswrite+0x387/0x550 ksyswrite+0x64/0xe0 dosyscall64+0xca/0x1e0 entrySYSCALL64afterhwframe+0x6d/0x75

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1 ---- ---- lock(pcpbatchhighlock); lock(cpuhotpluglock); lock(pcpbatchhighlock); rlock(cpuhotpluglock);

DEADLOCK

5 locks held by bash/46904: #0: ffff98f6c3bb23f0 (sbwriters#5){.+.+}-{0:0}, at: ksyswrite+0x64/0xe0 #1: ffff98f6c328e488 (&of->mutex){+.+.}-{3:3}, at: kernfsfopwriteiter+0xf8/0x1d0 #2: ffff98ef83b31890 (kn->active#113){.+.+}-{0:0}, at: kernfsfopwriteiter+0x100/0x1d0 #3: ffffffffabf9db48 (mfmutex){+.+.}-{3:3}, at: memoryfailure+0x44/0xc70 #4: ffffffffabf92ea8 (pcpbatchhighlock){+.+.}-{3:3}, at: zonepcpdisable+0x16/0x40

stack backtrace: CPU: 10 PID: 46904 Comm: bash Kdump: loaded Not tainted 6.8.0-11409-gf6cef5f8c37f #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dumpstacklvl+0x68/0xa0 checknoncircular+0x129/0x140 lockacquire+0x1298/0x1cd0 lockacquire+0xc0/0x2b0 cpusreadlock+0x2a/0xc0 statickeyslowdec+0x16/0x60 hugetlbvmemmaprestorefolio+0x1b9/0x200 dissolvefreehugepage+0x211/0x260 pagehandlepoison+0x45/0xc0 memoryfailure+0x65e/0xc70 hardofflinepagestore+0x55/0xa0 kernfsfopwriteiter+0x12c/0x1d0 vfswrite+0x387/0x550 ksyswrite+0x64/0xe0 dosyscall64+0xca/0x1e0 entrySYSCALL64afterhwframe+0x6d/0x75 RIP: 0033:0x7fc862314887 Code: 10 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 RSP: 002b:00007fff19311268 EFLAGS: 00000246 ORIGRAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fc862314887 RDX: 000000000000000c RSI: 000056405645fe10 RDI: 0000000000000001 RBP: 000056405645fe10 R08: 00007fc8623d1460 R09: 000000007fffffff R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000c R13: 00007fc86241b780 R14: 00007fc862417600 R15: 00007fc862416a00

In short, below scene breaks the ---truncated---

NVD

Affected Software

19 affected componentsFixes available
Linux Linux kernel>=5.18<6.1.88
Linux Linux kernel>=6.2<6.6.29
Linux Linux kernel>=6.7<6.8.8
Linux Linux kernel=6.9-rc1
Linux Linux kernel=6.9-rc2
Linux Linux kernel=6.9-rc3
Linux Linux kernel=6.9-rc4
Fedoraproject Fedora=38
Fedoraproject Fedora=39
Fedoraproject Fedora=40
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.25-16.12.27-1
redhat/kernel<6.1.88
6.1.88
redhat/kernel<6.6.29
6.6.29
redhat/kernel<6.8.8
6.8.8
redhat/kernel<6.9
6.9
Microsoft azl3 kernel 6.6.22.1-2
Microsoft azl3 hyperv-daemons 6.6.22.1-2
Microsoft azl3 hyperv-daemons 6.6.35.1-1
Microsoft azl3 kernel 6.6.35.1-5

Event History

May 1, 2024
CVE Published
via MITRE·05:27 AM
Data Sourced
via MITRE·05:27 AM
Description
Data Sourced
via NVD·06:15 AM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via Red Hat·07:19 PM
DescriptionSeverityAffected Software
Jul 11, 2024
Data Sourced
via Launchpad·07:45 PM
Description
Sep 11, 2024
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
SeverityAffected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity
Dec 2, 2024
Data Sourced
via Ubuntu·08:15 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-26987?

CVE-2024-26987 has been categorized with a high severity rating due to the potential for causing deadlocks in the Linux kernel.

2

How do I fix CVE-2024-26987?

To fix CVE-2024-26987, update your Linux kernel to versions 6.1.88, 6.6.29, 6.8.8, or 6.9.

3

Who is affected by CVE-2024-26987?

Users of the Linux kernel versions prior to 6.1.88, 6.6.29, 6.8.8, and 6.9 may be affected by CVE-2024-26987.

4

What systems are vulnerable to CVE-2024-26987?

Systems running affected versions of the Linux kernel, including various versions of Red Hat and Fedora, are vulnerable to CVE-2024-26987.

5

Does CVE-2024-26987 have a public exploit?

As of now, there is no known public exploit for CVE-2024-26987, but it is important to secure vulnerable systems.

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