# CVE-2021-47230: KVM: x86: Immediately reset the MMU context when the SMM flag is cleared

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.6
- **CVSS:** 6.6 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: Required; Scope: Unchanged; Confidentiality impact: None; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.32% (percentile 18, 2026-11-28)
- **CWE:** CWE-476
- **Published:** 2024-05-21T14:19:33.759Z
- **Modified:** 2026-06-17T04:16:57.617Z

## Who should check

- Anyone running Linux \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< cbb425f62df9df7abee4b3f068f7ed6ffc3561e2; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< 669a8866e468fd020d34eb00e08cb41d3774b71b; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< df9a40cfb3be2cbeb1c17bb67c59251ba16630f3; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< 78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6
- Anyone running Linux 5.1

## Description

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

KVM: x86: Immediately reset the MMU context when the SMM flag is cleared

Immediately reset the MMU context when the vCPU's SMM flag is cleared so
that the SMM flag in the MMU role is always synchronized with the vCPU's
flag.  If RSM fails (which isn't correctly emulated), KVM will bail
without calling post\_leave\_smm() and leave the MMU in a bad state.

The bad MMU role can lead to a NULL pointer dereference when grabbing a
shadow page's rmap for a page fault as the initial lookups for the gfn
will happen with the vCPU's SMM flag (=0), whereas the rmap lookup will
use the shadow page's SMM flag, which comes from the MMU (=1).  SMM has
an entirely different set of memslots, and so the initial lookup can find
a memslot (SMM=0) and then explode on the rmap memslot lookup (SMM=1).

  general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 \[\#1\] PREEMPT SMP KASAN
  KASAN: null-ptr-deref in range \[0x0000000000000000-0x0000000000000007\]
  CPU: 1 PID: 8410 Comm: syz-executor382 Not tainted 5.13.0-rc5-syzkaller \#0
  Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
  RIP: 0010:\_\_gfn\_to\_rmap arch/x86/kvm/mmu/mmu.c:935 \[inline\]
  RIP: 0010:gfn\_to\_rmap+0x2b0/0x4d0 arch/x86/kvm/mmu/mmu.c:947
  Code: \<42\> 80 3c 20 00 74 08 4c 89 ff e8 f1 79 a9 00 4c 89 fb 4d 8b 37 44
  RSP: 0018:ffffc90000ffef98 EFLAGS: 00010246
  RAX: 0000000000000000 RBX: ffff888015b9f414 RCX: ffff888019669c40
  RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
  RBP: 0000000000000001 R08: ffffffff811d9cdb R09: ffffed10065a6002
  R10: ffffed10065a6002 R11: 0000000000000000 R12: dffffc0000000000
  R13: 0000000000000003 R14: 0000000000000001 R15: 0000000000000000
  FS:  000000000124b300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 0000000028e31000 CR4: 00000000001526e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   rmap\_add arch/x86/kvm/mmu/mmu.c:965 \[inline\]
   mmu\_set\_spte+0x862/0xe60 arch/x86/kvm/mmu/mmu.c:2604
   \_\_direct\_map arch/x86/kvm/mmu/mmu.c:2862 \[inline\]
   direct\_page\_fault+0x1f74/0x2b70 arch/x86/kvm/mmu/mmu.c:3769
   kvm\_mmu\_do\_page\_fault arch/x86/kvm/mmu.h:124 \[inline\]
   kvm\_mmu\_page\_fault+0x199/0x1440 arch/x86/kvm/mmu/mmu.c:5065
   vmx\_handle\_exit+0x26/0x160 arch/x86/kvm/vmx/vmx.c:6122
   vcpu\_enter\_guest+0x3bdd/0x9630 arch/x86/kvm/x86.c:9428
   vcpu\_run+0x416/0xc20 arch/x86/kvm/x86.c:9494
   kvm\_arch\_vcpu\_ioctl\_run+0x4e8/0xa40 arch/x86/kvm/x86.c:9722
   kvm\_vcpu\_ioctl+0x70f/0xbb0 arch/x86/kvm/../../../virt/kvm/kvm\_main.c:3460
   vfs\_ioctl fs/ioctl.c:51 \[inline\]
   \_\_do\_sys\_ioctl fs/ioctl.c:1069 \[inline\]
   \_\_se\_sys\_ioctl+0xfb/0x170 fs/ioctl.c:1055
   do\_syscall\_64+0x3f/0xb0 arch/x86/entry/common.c:47
   entry\_SYSCALL\_64\_after\_hwframe+0x44/0xae
  RIP: 0033:0x440ce9

## Affected and fixed versions

- Linux: \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< cbb425f62df9df7abee4b3f068f7ed6ffc3561e2; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< 669a8866e468fd020d34eb00e08cb41d3774b71b; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< df9a40cfb3be2cbeb1c17bb67c59251ba16630f3; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< 78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6 (cvelist)
- Linux: 5.1 (cvelist)

## Mitigation

- Upgrade Linux to 78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47230. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47230.md
Affected: Linux >= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, < cbb425f62df9df7abee4b3f068f7ed6ffc3561e2; >= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, < 669a8866e468fd020d34eb00e08cb41d3774b71b; >= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, < df9a40cfb3be2cbeb1c17bb67c59251ba16630f3; >= 9ec19493fb86d6d5fbf9286…
Fixed in: Linux 669a8866e468fd020d34eb00e08cb41d3774b71b, Linux 78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47230 being exploited?

There is no confirmed exploitation: CVE-2021-47230 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.32% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2021-47230?

Medium: CVSS 6.6 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.

### Which versions are affected by CVE-2021-47230?

Linux \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< cbb425f62df9df7abee4b3f068f7ed6ffc3561e2; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< 669a8866e468fd020d34eb00e08cb41d3774b71b; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< df9a40cfb3be2cbeb1c17bb67c59251ba16630f3; \>= 9ec19493fb86d6d5fbf9286b94ff21e56ef66376, \< 78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6; Linux 5.1.

### Is there a fix for CVE-2021-47230?

Yes. Fixed in Linux 669a8866e468fd020d34eb00e08cb41d3774b71b, Linux 78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6. Upgrade Linux to 78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6 or later.

### How do I check if I'm affected by CVE-2021-47230?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/cbb425f62df9df7abee4b3f068f7ed6ffc3561e2>
- patch: <https://git.kernel.org/stable/c/669a8866e468fd020d34eb00e08cb41d3774b71b>
- patch: <https://git.kernel.org/stable/c/df9a40cfb3be2cbeb1c17bb67c59251ba16630f3>
- patch: <https://git.kernel.org/stable/c/78fcb2c91adfec8ce3a2ba6b4d0dda89f2f4a7c6>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47230>

HTML: <https://flawdb.com/CVE-2021-47230> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47230>
