{"id":72504,"date":"2025-10-28T13:45:42","date_gmt":"2025-10-28T10:15:42","guid":{"rendered":"https:\/\/afaghhosting.net\/blog\/cve-2025-40026-kvm-x86-dont-recheck-l1-intercepts-when-completing-userspace-i-o\/"},"modified":"2025-10-28T13:45:42","modified_gmt":"2025-10-28T10:15:42","slug":"cve-2025-40026-kvm-x86-dont-recheck-l1-intercepts-when-completing-userspace-i-o","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cve-2025-40026-kvm-x86-dont-recheck-l1-intercepts-when-completing-userspace-i-o\/","title":{"rendered":"CVE-2025-40026 &#8211; KVM: x86: Don&#8217;t (re)check L1 intercepts when completing userspace I\/O"},"content":{"rendered":"<p>CVE ID : CVE-2025-40026<\/p>\n<p>Published :  28. Oktober 2025 10:15 | 29\u00a0Minuten ago<\/p>\n<p>Description : In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>KVM: x86: Don&#8217;t (re)check L1 intercepts when completing userspace I\/O<\/p>\n<p>When completing emulation of instruction that generated a userspace exit<br \/>\nfor I\/O, don&#8217;t recheck L1 intercepts as KVM has already finished that<br \/>\nphase of instruction execution, i.e. has already committed to allowing L2<br \/>\nto perform I\/O.  If L1 (or host userspace) modifies the I\/O permission<br \/>\nbitmaps during the exit to userspace,  KVM will treat the access as being<br \/>\nintercepted despite already having emulated the I\/O access.<\/p>\n<p>Pivot on EMULTYPE_NO_DECODE to detect that KVM is completing emulation.<br \/>\nOf the three users of EMULTYPE_NO_DECODE, only complete_emulated_io() (the<br \/>\nintended &#8220;recipient&#8221;) can reach the code in question.  gp_interception()&#8217;s<br \/>\nuse is mutually exclusive with is_guest_mode(), and<br \/>\ncomplete_emulated_insn_gp() unconditionally pairs EMULTYPE_NO_DECODE with<br \/>\nEMULTYPE_SKIP.<\/p>\n<p>The bad behavior was detected by a syzkaller program that toggles port I\/O<br \/>\ninterception during the userspace I\/O exit, ultimately resulting in a WARN<br \/>\non vcpu-&gt;arch.pio.count being non-zero due to KVM no completing emulation<br \/>\nof the I\/O instruction.<\/p>\n<p>  WARNING: CPU: 23 PID: 1083 at arch\/x86\/kvm\/x86.c:8039 emulator_pio_in_out+0x154\/0x170 [kvm]\n  Modules linked in: kvm_intel kvm irqbypass<br \/>\n  CPU: 23 UID: 1000 PID: 1083 Comm: repro Not tainted 6.16.0-rc5-c1610d2d66b1-next-vm #74 NONE<br \/>\n  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02\/06\/2015<br \/>\n  RIP: 0010:emulator_pio_in_out+0x154\/0x170 [kvm]\n  PKRU: 55555554<br \/>\n  Call Trace:<\/p>\n<p>   kvm_fast_pio+0xd6\/0x1d0 [kvm]\n   vmx_handle_exit+0x149\/0x610 [kvm_intel]\n   kvm_arch_vcpu_ioctl_run+0xda8\/0x1ac0 [kvm]\n   kvm_vcpu_ioctl+0x244\/0x8c0 [kvm]\n   __x64_sys_ioctl+0x8a\/0xd0<br \/>\n   do_syscall_64+0x5d\/0xc60<br \/>\n   entry_SYSCALL_64_after_hwframe+0x4b\/0x53<\/p>\n<p>Severity: 0.0 | NA<\/p>\n<p>Visit the link for more details, such as CVSS details, affected products, timeline, and more&#8230;\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CVE ID : CVE-2025-40026 Published : 28. Oktober 2025 10:15 | 29\u00a0Minuten ago Description : In the Linux kernel, the following vulnerability has been resolved: KVM: x86: Don&#8217;t (re)check L1 intercepts when completing userspace I\/O When completing emulation of instruction that generated a userspace exit for I\/O, don&#8217;t recheck L1 intercepts as KVM has already &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-72504","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/72504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=72504"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/72504\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=72504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=72504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=72504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}