В ядре Linux устранена следующая уязвимость:
Arm64/entry: маска DAIF в cpu_switch_to(), call_on_irq_stack()
`cpu_switch_to()` и `call_on_irq_stack()` манипулируют SP для изменения
в разные стеки вместе со стеком теневых вызовов, если он включен. Эти два изменения стека не могут быть выполнены атомарно, и обе функции
может быть прервано ошибками SError или исключениями отладки, которые, хотя и маловероятны,
очень сильно сломан: если его прервать, мы можем получить несовпадающие стопки
и Shadow Call Stack, приводящий к засорению стеков. В `cpu_switch_to()` это может произойти, когда SP_EL0 указывает на новую задачу.
но кадры x18 указывают на SCS старой задачи.
Когда обработчик прерывания
пытается сохранить указатель SCS задачи, она сохранит старую задачу
Указатель SCS (x18) в новую структуру задачи (на которую указывает SP_EL0),
забивая его. В `call_on_irq_stack()` это может произойти при переключении из стека задач.
в стек IRQ и при переключении обратно. В обоих случаях мы можем быть
прерывается, когда указатель SCS указывает на IRQ SCS, а SP указывает на
стек задач.
Вложенный обработчик прерываний передает свои адреса возврата
по IRQ SCS. Затем он обнаруживает, что SP указывает на стек задач.
вызывает `call_on_irq_stack()` и уничтожает указатель SCS задачи с помощью
указатель IRQ SCS, который он также будет использовать!
Это приводит к тому, что задачи возвращаются по адресам не на тех СКС,
или даже на IRQ SCS, вызывая панику ядра через CONFIG_VMAP_STACK
или FPAC, если включено. Это возможно в конфигурации по умолчанию, но маловероятно.
Однако при включении CONFIG_ARM64_PSEUDO_NMI DAIF демаскируется и
вместо этого GIC отвечает за фильтрацию того, что прерывает работу ЦП.
должны получать в соответствии с приоритетом. Учитывая цель эмуляции NMI, псевдо-NMI могут быть получены ЦП.
даже в `cpu_switch_to()` и `call_on_irq_stack()`, возможно *очень*
часто в зависимости от конфигурации системы и рабочей нагрузки, что приводит к
к непредсказуемым паникам ядра. Полностью замаскируйте DAIF в `cpu_switch_to()` и восстановите его при возврате.
Сделайте то же самое в `call_on_irq_stack()`, но восстановите и замаскируйте его.
ветка. Маскируйте DAIF, даже если CONFIG_SHADOW_CALL_STACK не включен для обеспечения согласованности.
поведения между всеми конфигурациями. Ввести и использовать макрос сборки для сохранения и маскировки DAIF,
так как существующий сохраняет, но маскирует только ЕСЛИ.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: arm64/entry: Mask DAIF in cpu_switch_to(), call_on_irq_stack() `cpu_switch_to()` and `call_on_irq_stack()` manipulate SP to change to different stacks along with the Shadow Call Stack if it is enabled. Those two stack changes cannot be done atomically and both functions can be interrupted by SErrors or Debug Exceptions which, though unlikely, is very much broken : if interrupted, we can end up with mismatched stacks and Shadow Call Stack leading to clobbered stacks. In `cpu_switch_to()`, it can happen when SP_EL0 points to the new task, but x18 stills points to the old task's SCS. When the interrupt handler tries to save the task's SCS pointer, it will save the old task SCS pointer (x18) into the new task struct (pointed to by SP_EL0), clobbering it. In `call_on_irq_stack()`, it can happen when switching from the task stack to the IRQ stack and when switching back. In both cases, we can be interrupted when the SCS pointer points to the IRQ SCS, but SP points to the task stack. The nested interrupt handler pushes its return addresses on the IRQ SCS. It then detects that SP points to the task stack, calls `call_on_irq_stack()` and clobbers the task SCS pointer with the IRQ SCS pointer, which it will also use ! This leads to tasks returning to addresses on the wrong SCS, or even on the IRQ SCS, triggering kernel panics via CONFIG_VMAP_STACK or FPAC if enabled. This is possible on a default config, but unlikely. However, when enabling CONFIG_ARM64_PSEUDO_NMI, DAIF is unmasked and instead the GIC is responsible for filtering what interrupts the CPU should receive based on priority. Given the goal of emulating NMIs, pseudo-NMIs can be received by the CPU even in `cpu_switch_to()` and `call_on_irq_stack()`, possibly *very* frequently depending on the system configuration and workload, leading to unpredictable kernel panics. Completely mask DAIF in `cpu_switch_to()` and restore it when returning. Do the same in `call_on_irq_stack()`, but restore and mask around the branch. Mask DAIF even if CONFIG_SHADOW_CALL_STACK is not enabled for consistency of behaviour between all configurations. Introduce and use an assembly macro for saving and masking DAIF, as the existing one saves but only masks IF.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 14
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.10.180
|
5.10.210
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.15.111
|
5.15.190
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.1.28
|
6.1.149
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2.15
|
6.6.101
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.41
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.15.9
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.16:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.16:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.16:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.16:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.16:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.16:rc6:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.16:rc7:*:*:*:*:*:*
|
— | — |
|
Debian Debian_Linux
cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*
|
— | — |