Skip to content

CVE-2025-39989 x86/mce: use is_copy_from_user() to determine copy-from-user context

MediumCVSS 5.5 EPSS 0.29%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: partial
Technology
Linux KernelUbuntuDebian

Description

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

x86/mce: use is_copy_from_user() to determine copy-from-user context

Patch series "mm/hwpoison: Fix regressions in memory failure handling",
v4.

1. What am I trying to do:

This patchset resolves two critical regressions related to memory failure
handling that have appeared in the upstream kernel since version 5.17, as
compared to 5.10 LTS.

- copyin case: poison found in user page while kernel copying from user space
- instr case: poison found while instruction fetching in user space

2. What is the expected outcome and why

  • For copyin case:

Kernel can recover from poison found where kernel is doing get_user() or
copy_from_user() if those places get an error return and the kernel return
-EFAULT to the process instead of crashing. More specifily, MCE handler
checks the fixup handler type to decide whether an in kernel #MC can be
recovered. When EX_TYPE_UACCESS is found, the PC jumps to recovery code
specified in _ASM_EXTABLE_FAULT() and return a -EFAULT to user space.

  • For instr case:

If a poison found while instruction fetching in user space, full recovery
is possible. User process takes #PF, Linux allocates a new page and fills
by reading from storage.

3. What actually happens and why

  • For copyin case: kernel panic since v5.17

Commit 4c132d1d844a ("x86/futex: Remove .fixup usage") introduced a new
extable fixup type, EX_TYPE_EFAULT_REG, and later patches updated the
extable fixup type for copy-from-user operations, changing it from
EX_TYPE_UACCESS to EX_TYPE_EFAULT_REG. It breaks previous EX_TYPE_UACCESS
handling when posion found in get_user() or copy_from_user().

  • For instr case: user process is killed by a SIGBUS signal due to #CMCI
    and #MCE race

When an uncorrected memory error is consumed there is a race between the
CMCI from the memory controller reporting an uncorrected error with a UCNA
signature, and the core reporting and SRAR signature machine check when
the data is about to be consumed.

Background: why UNcorrected errors tied to CMCI in Intel platform [1]

Prior to Icelake memory controllers reported patrol scrub events that
detected a previously unseen uncorrected error in memory by signaling a
broadcast machine check with an SRAO (Software Recoverable Action
Optional) signature in the machine check bank. This was overkill because
it's not an urgent problem that no core is on the verge of consuming that
bad data. It's also found that multi SRAO UCE may cause nested MCE
interrupts and finally become an IERR.

Hence, Intel downgrades the machine check bank signature of patrol scrub
from SRAO to UCNA (Uncorrected, No Action required), and signal changed to
#CMCI. Just to add to the confusion, Linux does take an action (in
uc_decode_notifier()) to try to offline the page despite the UCNA
signature name.

Background: why #CMCI and #MCE race when poison is consuming in

Intel platform [1]

Having decided that CMCI/UCNA is the best action for patrol scrub errors,
the memory controller uses it for reads too. But the memory controller is
executing asynchronously from the core, and can't tell the difference
between a "real" read and a speculative read. So it will do CMCI/UCNA if
an error is found in any read.

Thus:

  1. Core is clever and thinks address A is needed soon, issues a
    speculative read.

  2. Core finds it is going to use address A soon after sending the read
    request

  3. The CMCI from the memory controller is in a race with MCE from the
    core that will soon try to retire the load from address A.

Quite often (because speculation has got better) the CMCI from the memory
controller is delivered before the core is committed to the instruction
reading address A, so the interrupt is taken, and Linux offlines the page
(marking it as poison).

Why user process is killed for instr case

Commit 046545a661af ("mm/hwpoison: fix error page recovered but reported
"not
---truncated---

Upgrade path

11 packages: 7 fixed, 4 with no fix yet.

PackageAffectedFixed inStatus
cbl-mariner kernel(CBL-Mariner 2.0) All versions No fix listed No fix yet
ubuntu/linux(Ubuntu 22.04) All versions No fix listed No fix yet
ubuntu/linux-kvm(Ubuntu 22.04) All versions No fix listed No fix yet
ubuntu/linux-raspi(Ubuntu 22.04) All versions No fix listed No fix yet
azure linux kernel(Azure Linux 3.0) < 6.6.92.2-1 6.6.92.2-1 Fixed
debian/linux(Debian 12) < 6.1.192-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +55 more 6.1.192-1 Fixed
debian/linux(Debian 13) < 6.12.25-1 6.12.25-1 Fixed
debian/linux(Debian 14) < 6.12.25-1 6.12.25-1 Fixed
Linux kernel < 6.1.191; < 6.6.89; < 6.12.23; < 6.13.11 +15 more 0b8388e97ba6a8c033f9a8b5565af41af07f9345, 1a15bb8303b6b104e78028b6c68f76a0d4562134, 3e3d8169c0950a0b3cd5105f6403a78350dcac80, 5.16, 6.1.191, 6.6.89, 6.12.23, 6.13.11, 6.14.2, 6.15, 7a1168257e81954fa1b5b1ce86f47d2567e734ab, 449413da90a337f343cc5a73070cbd68e92e8a54, 5724654a084f701dc64b08d34a0e800f22f0e6e4 Fixed
ubuntu/linux(Ubuntu 24.04) < 6.8.0-100.100 6.8.0-100.100 Fixed
ubuntu/linux-raspi(Ubuntu 24.04) < 6.8.0-1047.51 6.8.0-1047.51 Fixed

Affected products

ProductAffected versionsFixed in
azure linux kernel(Azure Linux:3.0) < 6.6.92.2-1 6.6.92.2-1
cbl-mariner kernel(CBL-Mariner:2.0) All versions No fix listed
Linux kernel >= 4c132d1d844a53fc4e4b5c34e36ef10d6124b783, < 7a1168257e81954fa1b5b1ce86f47d2567e734ab 7a1168257e81954fa1b5b1ce86f47d2567e734ab
Linux kernel >= 4c132d1d844a53fc4e4b5c34e36ef10d6124b783, < 5724654a084f701dc64b08d34a0e800f22f0e6e4 5724654a084f701dc64b08d34a0e800f22f0e6e4
Linux kernel >= 4c132d1d844a53fc4e4b5c34e36ef10d6124b783, < 3e3d8169c0950a0b3cd5105f6403a78350dcac80 3e3d8169c0950a0b3cd5105f6403a78350dcac80
Linux kernel >= 4c132d1d844a53fc4e4b5c34e36ef10d6124b783, < 449413da90a337f343cc5a73070cbd68e92e8a54 449413da90a337f343cc5a73070cbd68e92e8a54
Linux kernel >= 4c132d1d844a53fc4e4b5c34e36ef10d6124b783, < 0b8388e97ba6a8c033f9a8b5565af41af07f9345 0b8388e97ba6a8c033f9a8b5565af41af07f9345
Linux kernel >= 4c132d1d844a53fc4e4b5c34e36ef10d6124b783, < 1a15bb8303b6b104e78028b6c68f76a0d4562134 1a15bb8303b6b104e78028b6c68f76a0d4562134
Linux kernel = 88eded8104d2ca0429703755dd250f8cbecc1447 No fix listed
Linux kernel >= 5.15.58, < 5.16 5.16
Linux kernel = 5.17 No fix listed
Linux kernel < 6.1.191 6.1.191
Linux kernel < 6.6.89 6.6.89
Linux kernel < 6.12.23 6.12.23
Linux kernel < 6.13.11 6.13.11
Linux kernel < 6.14.2 6.14.2
Linux kernel < 6.15 6.15
ubuntu/linux(Ubuntu:22.04) All versions No fix listed
ubuntu/linux-kvm(Ubuntu:22.04) All versions No fix listed
ubuntu/linux-raspi(Ubuntu:22.04) All versions No fix listed
ubuntu/linux(Ubuntu:24.04) < 6.8.0-100.100 6.8.0-100.100
ubuntu/linux-raspi(Ubuntu:24.04) < 6.8.0-1047.51 6.8.0-1047.51
Linux kernel >= 5.17, < 6.6.89 6.6.89
Linux kernel >= 6.7, < 6.12.23 6.12.23
Linux kernel >= 6.13, < 6.13.11 6.13.11
Show 62 more
ProductAffected versionsFixed in
Linux kernel >= 6.14, < 6.14.2 6.14.2
debian/linux(Debian:12) < 6.1.192-1 6.1.192-1
debian/linux(Debian:12) = 6.1.106-1 No fix listed
debian/linux(Debian:12) = 6.1.106-2 No fix listed
debian/linux(Debian:12) = 6.1.106-3 No fix listed
debian/linux(Debian:12) = 6.1.112-1 No fix listed
debian/linux(Debian:12) = 6.1.115-1 No fix listed
debian/linux(Debian:12) = 6.1.119-1 No fix listed
debian/linux(Debian:12) = 6.1.123-1 No fix listed
debian/linux(Debian:12) = 6.1.124-1 No fix listed
debian/linux(Debian:12) = 6.1.128-1 No fix listed
debian/linux(Debian:12) = 6.1.129-1 No fix listed
debian/linux(Debian:12) = 6.1.133-1 No fix listed
debian/linux(Debian:12) = 6.1.135-1 No fix listed
debian/linux(Debian:12) = 6.1.137-1 No fix listed
debian/linux(Debian:12) = 6.1.139-1 No fix listed
debian/linux(Debian:12) = 6.1.140-1 No fix listed
debian/linux(Debian:12) = 6.1.147-1 No fix listed
debian/linux(Debian:12) = 6.1.148-1 No fix listed
debian/linux(Debian:12) = 6.1.153-1 No fix listed
debian/linux(Debian:12) = 6.1.158-1 No fix listed
debian/linux(Debian:12) = 6.1.159-1 No fix listed
debian/linux(Debian:12) = 6.1.162-1 No fix listed
debian/linux(Debian:12) = 6.1.164-1 No fix listed
debian/linux(Debian:12) = 6.1.170-1 No fix listed
debian/linux(Debian:12) = 6.1.170-2 No fix listed
debian/linux(Debian:12) = 6.1.170-3 No fix listed
debian/linux(Debian:12) = 6.1.172-1 No fix listed
debian/linux(Debian:12) = 6.1.174-1 No fix listed
debian/linux(Debian:12) = 6.1.176-1 No fix listed
debian/linux(Debian:12) = 6.1.177-1 No fix listed
debian/linux(Debian:12) = 6.1.180-1 No fix listed
debian/linux(Debian:12) = 6.1.187-1 No fix listed
debian/linux(Debian:12) = 6.1.190-1 No fix listed
debian/linux(Debian:12) = 6.1.27-1 No fix listed
debian/linux(Debian:12) = 6.1.37-1 No fix listed
debian/linux(Debian:12) = 6.1.38-1 No fix listed
debian/linux(Debian:12) = 6.1.38-2 No fix listed
debian/linux(Debian:12) = 6.1.38-2~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.38-3 No fix listed
debian/linux(Debian:12) = 6.1.38-4 No fix listed
debian/linux(Debian:12) = 6.1.38-4~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.52-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.64-1 No fix listed
debian/linux(Debian:12) = 6.1.66-1 No fix listed
debian/linux(Debian:12) = 6.1.67-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.76-1 No fix listed
debian/linux(Debian:12) = 6.1.76-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.82-1 No fix listed
debian/linux(Debian:12) = 6.1.85-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.94-1 No fix listed
debian/linux(Debian:12) = 6.1.94-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.98-1 No fix listed
debian/linux(Debian:12) = 6.1.99-1 No fix listed
debian/linux(Debian:13) < 6.12.25-1 6.12.25-1
debian/linux(Debian:14) < 6.12.25-1 6.12.25-1

References