CVE-2021-4440: x86/xen: Drop USERGS_SYSRET64 paravirt call

Published Jun 25, 2024
·
Updated

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

x86/xen: Drop USERGSSYSRET64 paravirt call

commit afd30525a659ac0ae0904f0cb4a2ca75522c3123 upstream.

USERGSSYSRET64 is used to return from a syscall via SYSRET, but a Xen PV guest will nevertheless use the IRET hypercall, as there is no sysret PV hypercall defined.

So instead of testing all the prerequisites for doing a sysret and then mangling the stack for Xen PV again for doing an iret just use the iret exit from the beginning.

This can easily be done via an ALTERNATIVE like it is done for the sysenter compat case already.

It should be noted that this drops the optimization in Xen for not restoring a few registers when returning to user mode, but it seems as if the saved instructions in the kernel more than compensate for this drop (a kernel build in a Xen PV guest was slightly faster with this patch applied).

While at it remove the stale sysret32 remnants.

[ pawan: Brad Spengler and Salvatore Bonaccorso <carnil@debian.org> reported a problem with the 5.10 backport commit edc702b4a820 ("x86/entry64: Add VERW just before userspace transition").

When CONFIGPARAVIRTXXL=y, CLEARCPUBUFFERS is not executed in syscallreturnviasysret path as USERGSSYSRET64 is runtime patched to:

.cpuusergssysret64 = { 0x0f, 0x01, 0xf8, 0x48, 0x0f, 0x07 }, // swapgs; sysretq

which is missing CLEARCPUBUFFERS. It turns out dropping USERGSSYSRET64 simplifies the code, allowing CLEARCPUBUFFERS to be explicitly added to syscallreturnviasysret path. Below is with CONFIGPARAVIRTXXL=y and this patch applied:

syscallreturnviasysret: ... <+342>: swapgs <+345>: xchg %ax,%ax <+347>: verw -0x1a2(%rip) <------ <+354>: sysretq ]

Affected Software

71 affected componentsFixes available
Linux Linux kernel>=5.10
Linux Linux kernel>=5.10.215<5.10.218
ubuntu/linux-hwe-edge*
ubuntu/linux-aws-5.0*
ubuntu/linux-aws-5.3*
ubuntu/linux-azure*
ubuntu/linux-azure-5.3*
ubuntu/linux-azure-edge*
ubuntu/linux-gcp*
ubuntu/linux-gcp-5.3*
ubuntu/linux-gke-4.15*
ubuntu/linux-gke-5.4*
ubuntu/linux-gkeop-5.4*
ubuntu/linux-hwe*
ubuntu/linux-hwe-edge*
ubuntu/linux-oem*
ubuntu/linux-oracle-5.0*
ubuntu/linux-oracle-5.3*
ubuntu/linux-aws-5.11*
ubuntu/linux-aws-5.13*
ubuntu/linux-aws-5.8*
ubuntu/linux-azure-5.11*
ubuntu/linux-azure-5.13*
ubuntu/linux-azure-5.8*
ubuntu/linux-azure-fde*
ubuntu/linux-gcp-5.11*
ubuntu/linux-gcp-5.13*
ubuntu/linux-gcp-5.8*
ubuntu/linux-gke*
ubuntu/linux-gke-5.15*
ubuntu/linux-gkeop*
ubuntu/linux-hwe-5.11*
ubuntu/linux-hwe-5.13*
ubuntu/linux-hwe-5.8*
ubuntu/linux-intel-5.13*
ubuntu/linux-oem-5.10*
ubuntu/linux-oem-5.13*
ubuntu/linux-oem-5.6*
ubuntu/linux-oracle-5.11*
ubuntu/linux-oracle-5.13*
ubuntu/linux-oracle-5.8*
ubuntu/linux-raspi2*
ubuntu/linux-riscv*
ubuntu/linux-riscv-5.11*
ubuntu/linux-riscv-5.8*
ubuntu/linux-allwinner-5.19*
ubuntu/linux-aws-5.19*
ubuntu/linux-aws-6.2*
ubuntu/linux-azure-5.19*
ubuntu/linux-azure-6.2*
ubuntu/linux-azure-fde-5.19*
ubuntu/linux-azure-fde-6.2*
ubuntu/linux-gcp-5.19*
ubuntu/linux-gcp-6.2*
ubuntu/linux-hwe-5.19*
ubuntu/linux-hwe-6.2*
ubuntu/linux-intel-iot-realtime*
ubuntu/linux-lowlatency-hwe-5.19*
ubuntu/linux-lowlatency-hwe-6.2*
ubuntu/linux-nvidia-6.2*
ubuntu/linux-oem-5.17*
ubuntu/linux-oem-6.0*
ubuntu/linux-oem-6.1*
ubuntu/linux-realtime*
ubuntu/linux-riscv*
ubuntu/linux-riscv-5.19*
ubuntu/linux-starfive-5.19*
ubuntu/linux-starfive-6.2*
ubuntu/linux-raspi-realtime*
debian/linux<5.10.218-1
5.10.218-1
debian/linux
5.10.218-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 5.10.218-1
  2. Upgrade

    Upgrade Linux kernel to a version that resolves this vulnerability.

    Patch afd30525a659ac0ae0904f0cb4a2ca75522c3123

Event History

Jun 25, 2024
CVE Published
via MITRE·02:20 PM
Data Sourced
via MITRE·02:20 PM
Description
Data Sourced
via OSV·03:15 PM
DescriptionSeverityAffected Software
Event
via OSV·03:15 PM
Data Sourced
via NVD·03:15 PM
Description
Jul 3, 2024
Data Sourced
via NVD·01:38 AM
SeverityWeakness
Mar 24, 2025
Data Sourced
via NVD·05:28 PM
RemedyAffected Software
Nov 12, 2026
Updated
via OSV·05:22 PM
Affected Software
Nov 24, 2026
Withdrawn
via OSV·04:28 AM

Frequently Asked Questions

1

What is the severity of CVE-2021-4440?

CVE-2021-4440 has been classified with a medium severity level due to potential security implications in the Linux kernel.

2

Which versions of the Linux Kernel are affected by CVE-2021-4440?

CVE-2021-4440 affects Linux Kernel versions from 5.10 and continues through later releases.

3

How do I fix CVE-2021-4440?

To fix CVE-2021-4440, update your Linux Kernel to the latest version that has patched this vulnerability.

4

What type of operating system does CVE-2021-4440 affect?

CVE-2021-4440 affects Linux-based operating systems that utilize the Linux Kernel.

5

What does the USERGS_SYSRET64 paravirt call refer to in the context of CVE-2021-4440?

In CVE-2021-4440, the USERGS_SYSRET64 paravirt call is used incorrectly in a Xen PV guest environment when returning from a syscall.

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