В ядре Linux устранена следующая уязвимость:
KVM: SVM: Принудительно выйти из режима SMM при перехвате SHUTDOWN
Ранее зафиксировали ed129ec9057f («KVM: x86: принудительно покинуть вложенный режим
при сбросе виртуального ЦП") устранена проблема, из-за которой тройная ошибка возникала в
вложенный режим может привести к сценариям использования после освобождения. Тем не менее, фиксация
не обработал аналогичную ситуацию для режима управления системой (SMM). Это упущение приводит к срабатыванию WARN, когда KVM принудительно выполняет инициализацию виртуального ЦП.
после перехвата SHUTDOWN, когда виртуальный ЦП находится в режиме SMM.
Эта ситуация была
воспроизведено с помощью Syzkaller:
1) Создание виртуальной машины KVM и виртуального процессора
2) Отправка ioctl KVM_SMI для явного входа в SMM.
3) Выполнение недопустимых инструкций, вызывающее последовательные исключения и
в итоге тройная ошибка
Проблема проявляется следующим образом:
ВНИМАНИЕ: ЦП: 0 PID: 25506 в файле Arch/x86/kvm/x86.c:12112.
kvm_vcpu_reset+0x1d2/0x1530 Arch/x86/kvm/x86.c:12112
Модули, связанные с:
ЦП: 0 PID: 25506 Связь: syz-executor.0 Не испорчено
6.1.130-syzkaller-00157-g164fe5dde9b6 #0
Имя оборудования: Стандартный ПК QEMU (i440FX + PIIX, 1996 г.),
БИОС 1.12.0-1 01.04.2014
RIP: 0010:kvm_vcpu_reset+0x1d2/0x1530 Arch/x86/kvm/x86.c:12112
Отслеживание вызова:
<ЗАДАЧА>
Shutdown_interception+0x66/0xb0 Arch/x86/kvm/svm/svm.c:2136
svm_invoke_exit_handler+0x110/0x530 Arch/x86/kvm/svm/svm.c:3395
svm_handle_exit+0x424/0x920 Arch/x86/kvm/svm/svm.c:3457
vcpu_enter_guest Arch/x86/kvm/x86.c:10959 [встроенный]
vcpu_run+0x2c43/0x5a90 Arch/x86/kvm/x86.c:11062
kvm_arch_vcpu_ioctl_run+0x50f/0x1cf0 Arch/x86/kvm/x86.c:11283
kvm_vcpu_ioctl+0x570/0xf00 Arch/x86/kvm/../../../virt/kvm/kvm_main.c:4122
vfs_ioctl fs/ioctl.c:51 [встроенный]
__do_sys_ioctl fs/ioctl.c:870 [встроенный]
__se_sys_ioctl fs/ioctl.c:856 [встроенный]
__x64_sys_ioctl+0x19a/0x210 fs/ioctl.c:856
do_syscall_x64 Arch/x86/entry/common.c:51 [встроенный]
do_syscall_64+0x35/0x80 Arch/x86/entry/common.c:81
запись_SYSCALL_64_after_hwframe+0x6e/0xd8
Архитектурно INIT блокируется, когда ЦП находится в режиме SMM, следовательно, WARN() KVM.
в kvm_vcpu_reset() для защиты от ошибок KVM, например. обнаружить ненадлежащее
эмуляция INIT. SHUTDOWN на SVM — это странный крайний случай, когда KVM необходимо
сделать что-нибудь разумное с VMCB, поскольку технически оно не определено, и
INIT — наименее ужасный выбор, учитывая ABI KVM. Итак, удвойте нагрузку на INIT при SHUTDOWN и выведите виртуальный ЦП из режима
SMM, чтобы избежать каких-либо странностей (и ПРЕДУПРЕЖДЕНИЯ). Найден Центром проверки Linux (linuxtesting.org) с помощью Syzkaller.
[Шон: просмотрите список изменений, дайте понять, что это не архитектурное поведение]
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: KVM: SVM: Forcibly leave SMM mode on SHUTDOWN interception Previously, commit ed129ec9057f ("KVM: x86: forcibly leave nested mode on vCPU reset") addressed an issue where a triple fault occurring in nested mode could lead to use-after-free scenarios. However, the commit did not handle the analogous situation for System Management Mode (SMM). This omission results in triggering a WARN when KVM forces a vCPU INIT after SHUTDOWN interception while the vCPU is in SMM. This situation was reprodused using Syzkaller by: 1) Creating a KVM VM and vCPU 2) Sending a KVM_SMI ioctl to explicitly enter SMM 3) Executing invalid instructions causing consecutive exceptions and eventually a triple fault The issue manifests as follows: WARNING: CPU: 0 PID: 25506 at arch/x86/kvm/x86.c:12112 kvm_vcpu_reset+0x1d2/0x1530 arch/x86/kvm/x86.c:12112 Modules linked in: CPU: 0 PID: 25506 Comm: syz-executor.0 Not tainted 6.1.130-syzkaller-00157-g164fe5dde9b6 #0 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:kvm_vcpu_reset+0x1d2/0x1530 arch/x86/kvm/x86.c:12112 Call Trace: <TASK> shutdown_interception+0x66/0xb0 arch/x86/kvm/svm/svm.c:2136 svm_invoke_exit_handler+0x110/0x530 arch/x86/kvm/svm/svm.c:3395 svm_handle_exit+0x424/0x920 arch/x86/kvm/svm/svm.c:3457 vcpu_enter_guest arch/x86/kvm/x86.c:10959 [inline] vcpu_run+0x2c43/0x5a90 arch/x86/kvm/x86.c:11062 kvm_arch_vcpu_ioctl_run+0x50f/0x1cf0 arch/x86/kvm/x86.c:11283 kvm_vcpu_ioctl+0x570/0xf00 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4122 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x19a/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 Architecturally, INIT is blocked when the CPU is in SMM, hence KVM's WARN() in kvm_vcpu_reset() to guard against KVM bugs, e.g. to detect improper emulation of INIT. SHUTDOWN on SVM is a weird edge case where KVM needs to do _something_ sane with the VMCB, since it's technically undefined, and INIT is the least awful choice given KVM's ABI. So, double down on stuffing INIT on SHUTDOWN, and force the vCPU out of SMM to avoid any weirdness (and the WARN). Found by Linux Verification Center (linuxtesting.org) with Syzkaller. [sean: massage changelog, make it clear this isn't architectural behavior]
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 13
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.15.81
|
5.16
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.0.11
|
6.1
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.1.1
|
6.6.92
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.29
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.14.7
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:-:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:rc7:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:rc8:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.15:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.15:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.15:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.15:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.15:rc5:*:*:*:*:*:*
|
— | — |