Description
In the Linux kernel, the following vulnerability has been resolved:
ipc/mqueue, msg, sem: avoid relying on a stack reference past its expiry
do_mq_timedreceive calls wq_sleep with a stack local address. The
sender (do_mq_timedsend) uses this address to later call pipelined_send.
This leads to a very hard to trigger race where a do_mq_timedreceive
call might return and leave do_mq_timedsend to rely on an invalid
address, causing the following crash:
RIP: 0010:wake_q_add_safe+0x13/0x60
Call Trace:
__x64_sys_mq_timedsend+0x2a9/0x490
do_syscall_64+0x80/0x680
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f5928e40343
The race occurs as:
1. do_mq_timedreceive calls wq_sleep with the address of `struct
ext_wait_queue` on function stack (aliased as `ewq_addr` here) - it
holds a valid `struct ext_wait_queue *` as long as the stack has not
been overwritten.
2. `ewq_addr` gets added to info->e_wait_q[RECV].list in wq_add, and
do_mq_timedsend receives it via wq_get_first_waiter(info, RECV) to call
__pipelined_op.
3. Sender calls __pipelined_op::smp_store_release(&this->state,
STATE_READY). Here is where the race window begins. (`this` is
`ewq_addr`.)
4. If the receiver wakes up now in do_mq_timedreceive::wq_sleep, it
will see `state == STATE_READY` and break.
5. do_mq_timedreceive returns, and `ewq_addr` is no longer guaranteed
to be a `struct ext_wait_queue *` since it was on do_mq_timedreceive's
stack. (Although the address may not get overwritten until another
function happens to touch it, which means it can persist around for an
indefinite time.)
6. do_mq_timedsend::__pipelined_op() still believes `ewq_addr` is a
`struct ext_wait_queue *`, and uses it to find a task_struct to pass to
the wake_q_add_safe call. In the lucky case where nothing has
overwritten `ewq_addr` yet, `ewq_addr->task` is the right task_struct.
In the unlucky case, __pipelined_op::wake_q_add_safe gets handed a
bogus address as the receiver's task_struct causing the crash.
do_mq_timedsend::__pipelined_op() should not dereference `this` after
setting STATE_READY, as the receiver counterpart is now free to return.
Change __pipelined_op to call wake_q_add_safe on the receiver's
task_struct returned by get_task_struct, instead of dereferencing `this`
which sits on the receiver's stack.
As Manfred pointed out, the race potentially also exists in
ipc/msg.c::expunge_all and ipc/sem.c::wake_up_sem_queue_prepare. Fix
those in the same way.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| Linux | Linux | 5.6 | 5.10.40 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | linux | 5.10.40-1 | — |
| Debian 13 | linux | 5.10.40-1 | — |
| Debian 12 | linux | 5.10.40-1 | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 22.04 LTS | linux-riscv +20 | No fix yet | — |
| Ubuntu 20.04 LTS | linux-gke +26 | No fix yet | — |
| Ubuntu 18.04 LTS | linux-gcp +14 | No fix yet | — |
| Ubuntu 16.04 LTS | linux-hwe-edge | No fix yet | — |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 8 | kernel-rt +12 | 4.18.0-553.8.1.rt7.349.el8_10 | RHSA-2024:4352 |
| RHEL 8 | perf +26 | 4.18.0-553.8.1.el8_10 | RHSA-2024:4211 |
Show 4 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 8.8 EUS | perf +26 | 4.18.0-477.70.1.el8_8 | RHSA-2024:6206 |
| RHEL 8.6 TUS | perf +16 | 4.18.0-372.119.1.el8_6 | RHSA-2024:5692 |
| RHEL 8.6 E4S | perf +24 | 4.18.0-372.119.1.el8_6 | RHSA-2024:5692 |
| RHEL 8.6 AUS | perf +16 | 4.18.0-372.119.1.el8_6 | RHSA-2024:5692 |
AlmaLinux
Errata ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux 8 | kernel-rt +11 | 4.18.0-553.8.1.rt7.349.el8_10 | ALSA-2024:4352 |
| AlmaLinux 8 | perf +24 | 4.18.0-553.8.1.el8_10 | ALSA-2024:4211 |
Rocky Linux
Errata ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Rocky Linux 8 | kernel | 4.18.0-553.8.1.el8_10 | RLSA-2024:4211 |
| Rocky Linux 8 | kernel-rt | 4.18.0-553.8.1.rt7.349.el8_10 | RLSA-2024:4352 |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 15 SP3 | kernel-64kb +6 | 5.3.18-150300.59.153.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLES 15 SP3 | kernel-default-base | 5.3.18-150300.59.153.2.150300.18.90.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLES 15 SP3 | kernel-syms | 5.3.18-150300.59.153.1 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLES 15 SP2 | kernel-default-base | 5.3.18-150200.24.183.1.150200.9.93.2 | SUSE-SU-2024:3565-1, SUSE-SU-2024:1454-1, SUSE-SU-2024:0926-1 |
| SLES 15 SP2 | kernel-docs +5 | 5.3.18-150200.24.183.1 | SUSE-SU-2024:3565-1, SUSE-SU-2024:1454-1, SUSE-SU-2024:0926-1 |
Show 9 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES for SAP 15 SP3 | kernel-default-base | 5.3.18-150300.59.153.2.150300.18.90.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLES for SAP 15 SP3 | kernel-docs +4 | 5.3.18-150300.59.153.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLES for SAP 15 SP3 | kernel-syms | 5.3.18-150300.59.153.1 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLES for SAP 15 SP2 | kernel-default-base | 5.3.18-150200.24.183.1.150200.9.93.2 | SUSE-SU-2024:3565-1, SUSE-SU-2024:1454-1, SUSE-SU-2024:0926-1 |
| SLES for SAP 15 SP2 | kernel-docs +5 | 5.3.18-150200.24.183.1 | SUSE-SU-2024:3565-1, SUSE-SU-2024:1454-1, SUSE-SU-2024:0926-1 |
| SLE Micro 5.2 | kernel-default | 5.3.18-150300.59.153.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE Micro 5.2 | kernel-default-base | 5.3.18-150300.59.153.2.150300.18.90.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE Micro 5.2 | kernel-rt +1 | 5.3.18-150300.161.1 | SUSE-SU-2024:0856-1 |
| SLE Micro 5.1 | kernel-default | 5.3.18-150300.59.153.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE Micro 5.1 | kernel-default-base | 5.3.18-150300.59.153.2.150300.18.90.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE Micro 5.1 | kernel-rt +1 | 5.3.18-150300.161.1 | SUSE-SU-2024:0856-1 |
| SLE Live Patching 15 SP3 | kernel-default | 5.3.18-150300.59.153.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE Live Patching 15 SP3 | kernel-livepatch-SLE15-SP3_Update_42 +1 | 1-150300.7.3.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:0857-1 |
| SLE Live Patching 15 SP3 | kernel-livepatch-SLE15-SP3_Update_43 | 1-150300.7.3.5 | SUSE-SU-2024:1489-1 |
| SLE Live Patching 15 SP2 | kernel-default | 5.3.18-150200.24.183.1 | SUSE-SU-2024:3565-1, SUSE-SU-2024:1454-1, SUSE-SU-2024:0926-1 |
| SLE Live Patching 15 SP2 | kernel-livepatch-SLE15-SP2_Update_46 | 1-150200.5.3.2 | SUSE-SU-2024:0926-1 |
| SLE Live Patching 15 SP2 | kernel-livepatch-SLE15-SP2_Update_47 | 1-150200.5.3.3 | SUSE-SU-2024:1454-1 |
| SLE Live Patching 15 SP2 | kernel-livepatch-SLE15-SP2_Update_53 | 1-150200.5.3.1 | SUSE-SU-2024:3565-1 |
| SLE HPC 15 SP3 | kernel-64kb +5 | 5.3.18-150300.59.153.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE HPC 15 SP3 | kernel-default-base | 5.3.18-150300.59.153.2.150300.18.90.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE HPC 15 SP3 | kernel-syms | 5.3.18-150300.59.153.1 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SLE HPC 15 SP2 | kernel-default-base | 5.3.18-150200.24.183.1.150200.9.93.2 | SUSE-SU-2024:3565-1, SUSE-SU-2024:1454-1, SUSE-SU-2024:0926-1 |
| SLE HPC 15 SP2 | kernel-docs +5 | 5.3.18-150200.24.183.1 | SUSE-SU-2024:3565-1, SUSE-SU-2024:1454-1, SUSE-SU-2024:0926-1 |
| SUSE Enterprise Storage 7.1 | kernel-64kb +5 | 5.3.18-150300.59.153.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SUSE Enterprise Storage 7.1 | kernel-default-base | 5.3.18-150300.59.153.2.150300.18.90.2 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
| SUSE Enterprise Storage 7.1 | kernel-syms | 5.3.18-150300.59.153.1 | SUSE-SU-2024:3585-1, SUSE-SU-2024:1489-1, SUSE-SU-2024:0857-1 |
Oracle Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Oracle Linux 8 | perf +19 | 4.18.0-553.8.1.el8_10 | ELSA-2024-4211 |
Advisories 18
- RHSA-2024:6206 Red Hat Security Advisory: kernel security update Red Hat Security Advisories (RHSA) · Nov 13, 2026
- ALSA-2024:4211 Important: kernel security and bug fix update AlmaLinux Security Advisories · Oct 29, 2026
- ALSA-2024:4352 Important: kernel-rt security and bug fix update AlmaLinux Security Advisories · Oct 29, 2026
- RHSA-2024:4352 Red Hat Security Advisory: kernel-rt security and bug fix update Red Hat Security Advisories (RHSA) · Oct 15, 2026
- RHSA-2024:4211 Red Hat Security Advisory: kernel security and bug fix update Red Hat Security Advisories (RHSA) · Oct 15, 2026
- WID-SEC-2024-0534 Linux Kernel: Mehrere Schwachstellen BSI CERT-Bund (WID) · Sep 3, 2026
- RHSA-2024:5692 Red Hat Security Advisory: kernel security update Red Hat Security Advisories (RHSA) · Aug 6, 2026
- RLSA-2024:4352 Important: kernel-rt security and bug fix update Rocky Linux Security Advisories · Feb 4, 2026
- RLSA-2024:4211 Important: kernel security and bug fix update Rocky Linux Security Advisories · Feb 4, 2026
- SUSE-SU-2024:1489-1 Security update for the Linux Kernel SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2024:0926-1 Security update for the Linux Kernel SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2024:1454-1 Security update for the Linux Kernel SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2024:3585-1 Security update for the Linux Kernel SUSE / openSUSE Security Updates · Feb 4, 2026
- WID-SEC-2024-1905 IBM QRadar SIEM: Mehrere Schwachstellen BSI CERT-Bund (WID) · Jun 3, 2025
- SUSE-SU-2024:3565-1 Security update for the Linux Kernel SUSE / openSUSE Security Updates · May 2, 2025
- SUSE-SU-2024:0857-1 Security update for the Linux Kernel SUSE / openSUSE Security Updates · May 2, 2025
- SUSE-SU-2024:0856-1 Security update for the Linux Kernel SUSE / openSUSE Security Updates · May 2, 2025
- ELSA-2024-4211 Important: kernel security and bug fix update (Oracle Linux 8) Oracle Linux Security Advisories (ELSA) · Jul 2, 2024