CVE-2024-46797: powerpc/qspinlock: Fix deadlock in MCS queue

Published Sep 18, 2024
·
Updated

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

powerpc/qspinlock: Fix deadlock in MCS queue

If an interrupt occurs in queuedspinlockslowpath() after we increment qnodesp->count and before node->lock is initialized, another CPU might see stale lock values in gettailqnode(). If the stale lock value happens to match the lock on that CPU, then we write to the "next" pointer of the wrong qnode. This causes a deadlock as the former CPU, once it becomes the head of the MCS queue, will spin indefinitely until it's "next" pointer is set by its successor in the queue.

Running stress-ng on a 16 core (16EC/16VP) shared LPAR, results in occasional lockups similar to the following:

$ stress-ng --all 128 --vm-bytes 80% --aggressive \ --maximize --oomable --verify --syslog \ --metrics --times --timeout 5m

watchdog: CPU 15 Hard LOCKUP ...... NIP [c0000000000b78f4] queuedspinlockslowpath+0x1184/0x1490 LR [c000000001037c5c] rawspinlock+0x6c/0x90 Call Trace: 0xc000002cfffa3bf0 (unreliable) rawspinlock+0x6c/0x90 rawspinrqlocknested.part.135+0x4c/0xd0 schedttwupending+0x60/0x1f0 flushsmpcallfunctionqueue+0x1dc/0x670 smpipidemuxrelaxed+0xa4/0x100 xivemuxedipiaction+0x20/0x40 handleirqeventpercpu+0x80/0x240 handleirqeventpercpu+0x2c/0x80 handlepercpuirq+0x84/0xd0 generichandleirq+0x54/0x80 doirq+0xac/0x210 doIRQ+0x74/0xd0 0x0 doIRQ+0x8c/0x170 hardwareinterruptcommonvirt+0x29c/0x2a0 --- interrupt: 500 at queuedspinlockslowpath+0x4b8/0x1490 ...... NIP [c0000000000b6c28] queuedspinlockslowpath+0x4b8/0x1490 LR [c000000001037c5c] rawspinlock+0x6c/0x90 --- interrupt: 500 0xc0000029c1a41d00 (unreliable) rawspinlock+0x6c/0x90 futexwake+0x100/0x260 dofutex+0x21c/0x2a0 sysfutex+0x98/0x270 systemcallexception+0x14c/0x2f0 systemcallvectoredcommon+0x15c/0x2ec

The following code flow illustrates how the deadlock occurs. For the sake of brevity, assume that both locks (A and B) are contended and we call the queuedspinlockslowpath() function.

CPU0 CPU1 ---- ---- spinlockirqsave(A) | spinunlockirqrestore(A) | spinlock(B) | | | ▼ | id = qnodesp->count++; | (Note that nodes[0].lock == A) | | | ▼ | Interrupt | (happens before "nodes[0].lock = B") | | | ▼ | spinlockirqsave(A) | | | ▼ | id = qnodesp->count++ | nodes[1].lock = A | | | ▼ | Tail of MCS queue | | spinlockirqsave(A) ▼ | Head of MCS queue ▼ | CPU0 is previous tail ▼ | Spin indefinitely ▼ (until "nodes[1].next != NULL") prev = gettailqnode(A, CPU0) | ▼ prev == &qnodes[CPU0].nodes[0] (as qnodes ---truncated---

Other sources

This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.

Launchpad

Affected Software

11 affected componentsFixes available
Linux Linux kernel>=6.2<6.6.51
Linux Linux kernel>=6.7<6.10.10
Linux Linux kernel=6.11-rc1
Linux Linux kernel=6.11-rc2
Linux Linux kernel=6.11-rc3
Linux Linux kernel=6.11-rc4
Linux Linux kernel=6.11-rc5
Linux Linux kernel=6.11-rc6
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.22-16.12.25-1
Microsoft azl3 kernel 6.6.47.1-1
Microsoft azl3 kernel 6.6.51.1-5

Event History

Sep 18, 2024
CVE Published
via MITRE·07:12 AM
Data Sourced
via MITRE·07:12 AM
Description
Oct 16, 2024
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity
Dec 12, 2024
Data Sourced
via Launchpad·06:26 PM
Description
Jan 9, 2025
Data Sourced
via Ubuntu·06:32 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-46797?

CVE-2024-46797 is regarded as a medium severity vulnerability in the Linux kernel.

2

How do I fix CVE-2024-46797?

To resolve CVE-2024-46797, update your Linux kernel to a patched version provided by your distribution.

3

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

CVE-2024-46797 affects Linux kernel versions from 6.2 up to 6.6.51 and versions between 6.7 and 6.10.10.

4

Is CVE-2024-46797 present in the release candidates of the Linux kernel?

Yes, CVE-2024-46797 is also present in the release candidate versions of the Linux kernel 6.11 (rc1 to rc6).

5

What can CVE-2024-46797 lead to if exploited?

If exploited, CVE-2024-46797 could lead to a deadlock situation in the Linux kernel, potentially causing system instability.

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