CVE-2021-4440

See a problem?
Source
https://nvd.nist.gov/vuln/detail/CVE-2021-4440
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-4440.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-4440
Related
Published
2024-06-25T15:15:11Z
Modified
2024-09-18T03:16:49.544295Z
Summary
[none]
Details

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

x86/xen: Drop USERGS_SYSRET64 paravirt call

commit afd30525a659ac0ae0904f0cb4a2ca75522c3123 upstream.

USERGS_SYSRET64 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/entry_64: Add VERW just before userspace transition").

   When CONFIG_PARAVIRT_XXL=y, CLEAR_CPU_BUFFERS is not executed in
   syscall_return_via_sysret path as USERGS_SYSRET64 is runtime
   patched to:

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

   which is missing CLEAR_CPU_BUFFERS. It turns out dropping
   USERGS_SYSRET64 simplifies the code, allowing CLEAR_CPU_BUFFERS
   to be explicitly added to syscall_return_via_sysret path. Below
   is with CONFIG_PARAVIRT_XXL=y and this patch applied:

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

]

References

Affected packages

Debian:11 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.218-1

Affected versions

5.*

5.10.46-4
5.10.46-5
5.10.70-1~bpo10+1
5.10.70-1
5.10.84-1
5.10.92-1~bpo10+1
5.10.92-1
5.10.92-2
5.10.103-1~bpo10+1
5.10.103-1
5.10.106-1
5.10.113-1
5.10.120-1~bpo10+1
5.10.120-1
5.10.127-1
5.10.127-2~bpo10+1
5.10.127-2
5.10.136-1
5.10.140-1
5.10.148-1
5.10.149-1
5.10.149-2
5.10.158-1
5.10.158-2
5.10.162-1
5.10.178-1
5.10.178-2
5.10.178-3
5.10.179-1
5.10.179-2
5.10.179-3
5.10.179-4
5.10.179-5
5.10.191-1
5.10.197-1
5.10.205-1
5.10.205-2
5.10.209-1
5.10.209-2
5.10.216-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}