// For flags

CVE-2024-31076

genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline

Severity Score

5.1
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

Track
*SSVC
Descriptions

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

genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline

The absence of IRQD_MOVE_PCNTXT prevents immediate effectiveness of
interrupt affinity reconfiguration via procfs. Instead, the change is
deferred until the next instance of the interrupt being triggered on the
original CPU.

When the interrupt next triggers on the original CPU, the new affinity is
enforced within __irq_move_irq(). A vector is allocated from the new CPU,
but the old vector on the original CPU remains and is not immediately
reclaimed. Instead, apicd->move_in_progress is flagged, and the reclaiming
process is delayed until the next trigger of the interrupt on the new CPU.

Upon the subsequent triggering of the interrupt on the new CPU,
irq_complete_move() adds a task to the old CPU's vector_cleanup list if it
remains online. Subsequently, the timer on the old CPU iterates over its
vector_cleanup list, reclaiming old vectors.

However, a rare scenario arises if the old CPU is outgoing before the
interrupt triggers again on the new CPU.

In that case irq_force_complete_move() is not invoked on the outgoing CPU
to reclaim the old apicd->prev_vector because the interrupt isn't currently
affine to the outgoing CPU, and irq_needs_fixup() returns false. Even
though __vector_schedule_cleanup() is later called on the new CPU, it
doesn't reclaim apicd->prev_vector; instead, it simply resets both
apicd->move_in_progress and apicd->prev_vector to 0.

As a result, the vector remains unreclaimed in vector_matrix, leading to a
CPU vector leak.

To address this issue, move the invocation of irq_force_complete_move()
before the irq_needs_fixup() call to reclaim apicd->prev_vector, if the
interrupt is currently or used to be affine to the outgoing CPU.

Additionally, reclaim the vector in __vector_schedule_cleanup() as well,
following a warning message, although theoretically it should never see
apicd->move_in_progress with apicd->prev_cpu pointing to an offline CPU.

En el kernel de Linux, se resolvió la siguiente vulnerabilidad: genirq/cpuhotplug, x86/vector: evita la fuga de vectores durante la CPU fuera de línea. La ausencia de IRQD_MOVE_PCNTXT impide la efectividad inmediata de la reconfiguración de la afinidad de interrupción a través de procfs. En cambio, el cambio se difiere hasta la siguiente instancia de interrupción que se activa en la CPU original. La siguiente vez que se activa la interrupción en la CPU original, la nueva afinidad se aplica dentro de __irq_move_irq(). Se asigna un vector desde la nueva CPU, pero el vector antiguo en la CPU original permanece y no se recupera inmediatamente. En su lugar, se marca apicd->move_in_progress y el proceso de recuperación se retrasa hasta el siguiente desencadenante de la interrupción en la nueva CPU. Tras la activación posterior de la interrupción en la nueva CPU, irq_complete_move() agrega una tarea a la lista vector_cleanup de la CPU anterior si permanece en línea. Posteriormente, el temporizador de la CPU antigua itera sobre su lista vector_cleanup, recuperando vectores antiguos. Sin embargo, surge un escenario poco común si la CPU antigua sale antes de que la interrupción se active nuevamente en la nueva CPU. En ese caso, irq_force_complete_move() no se invoca en la CPU saliente para recuperar el antiguo apicd->prev_vector porque la interrupción no es actualmente afín a la CPU saliente, e irq_needs_fixup() devuelve false. Aunque más tarde se llama a __vector_schedule_cleanup() en la nueva CPU, no reclama apicd->prev_vector; en su lugar, simplemente restablece apicd->move_in_progress y apicd->prev_vector a 0. Como resultado, el vector permanece sin reclamar en vector_matrix, lo que provoca una fuga de vector de CPU. Para solucionar este problema, mueva la invocación de irq_force_complete_move() antes de la llamada irq_needs_fixup() para recuperar apicd->prev_vector, si la interrupción es actualmente o solía ser afín a la CPU saliente. Además, recupere también el vector en __vector_schedule_cleanup(), después de un mensaje de advertencia, aunque en teoría nunca debería ver apicd->move_in_progress con apicd->prev_cpu apuntando a una CPU fuera de línea.

*Credits: N/A
CVSS Scores
Attack Vector
Local
Attack Complexity
Low
Privileges Required
High
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
Low
* Common Vulnerability Scoring System
SSVC
  • Decision:Track
Exploitation
None
Automatable
No
Tech. Impact
Partial
* Organization's Worst-case Scenario
Timeline
  • 2024-06-21 CVE Reserved
  • 2024-06-21 CVE Published
  • 2024-06-22 EPSS Updated
  • 2024-09-11 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-402: Transmission of Private Resources into a New Sphere ('Resource Leak')
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 4.19.316
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 4.19.316"
en
Affected
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 5.4.278
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 5.4.278"
en
Affected
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 5.10.219
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 5.10.219"
en
Affected
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 5.15.161
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 5.15.161"
en
Affected
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 6.1.93
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 6.1.93"
en
Affected
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 6.6.33
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 6.6.33"
en
Affected
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 6.9.4
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 6.9.4"
en
Affected
Linux
Search vendor "Linux"
Linux Kernel
Search vendor "Linux" for product "Linux Kernel"
>= 4.13 < 6.10
Search vendor "Linux" for product "Linux Kernel" and version " >= 4.13 < 6.10"
en
Affected