KVM: PPC: Book3S HV: Add SRCU protection for virtual-mode HPT hcalls
NIST has received this entry but not started reviewing it.
In the Linux kernel, the following vulnerability has been resolved: KVM: PPC: Book3S HV: Add SRCU protection for virtual-mode HPT hcalls The virtual-mode HPT hcall handlers (H_ENTER, H_REMOVE, H_BULK_REMOVE, H_CLEAR_REF, H_CLEAR_MOD) call into book3s_hv_rm_mmu.c, which accesses memslots via kvm_memslots_raw(). kvm_memslots_raw() uses rcu_dereference_raw_check() to bypass SRCU lockdep annotation checking. This is safe in real mode because the entire guest entry/exit is wrapped in srcu_read_lock/unlock inside kvmppc_run_core() and kvmhv_run_single_vcpu(). However, since commit 6165d5dd99db ("KVM: PPC: Book3S HV: add virtual mode handlers for HPT hcalls and page faults"), these same handlers are also executed in virtual mode via kvmppc_pseries_do_hcall(), which runs after SRCU has already been released on guest exit. A concurrent KVM_SET_USER_MEMORY_REGION deletion or move can therefore call synchronize_srcu_expedited() — which does not wait for this thread — and then kfree(slot) and vfree(slot->arch.rmap) while the hcall handler still holds a raw pointer to the memslot. lock_rmap() then writes to freed vmalloc memory, leading to use-after-free and memory corruption. Because kvm_memslots_raw() suppresses lockdep checks, this race is entirely silent. Fix this by factoring out the 7 HPT hcall handlers (H_REMOVE, H_ENTER, H_READ, H_CLEAR_MOD, H_CLEAR_REF, H_PROTECT, H_BULK_REMOVE) into a helper function, kvmppc_pseries_do_hpt_hcall(), and wrapping its call site in srcu_read_lock(&kvm->srcu) / srcu_read_unlock(&kvm->srcu, idx). Targeting only the HPT hcalls avoids wrapping non-HPT hcalls that sleep (such as H_CONFER, H_REGISTER_VPA, H_PAGE_INIT) or handlers that already acquire SRCU internally (such as H_RTAS).
New to this? Read how to keep your software updated.
The products and versions NIST lists as vulnerable, 2 products in all. If what you run is not listed it is probably not affected, but ask your provider if you are unsure.
| Product | Type | Vulnerable versions | Fixed in |
|---|---|---|---|
| Linux Linux | Software | from 6165d5dd99dbaec7a309491c3951bd81fc89978d, before fbfff331e73f44c25f4edd112eaef3b6865171c6; from 6165d5dd99dbaec7a309491c3951bd81fc89978d, before 294e306dc1c49f1124d0b82eef565778d975420b; from 6165d5dd99dbaec7a309491c3951bd81fc89978d, before 0b456d70fff190abac02795ddb088618ff512a48; from 6165d5dd99dbaec7a309491c3951bd81fc89978d, before 0f86aba67317d65b2dc89995dd5ddefe219411a7; from 6165d5dd99dbaec7a309491c3951bd81fc89978d, before 4ab2c987fd15a4bd28ef46a9ac871359886e6439; from 6165d5dd99dbaec7a309491c3951bd81fc89978d, before c3d0261c4fae2cc36dcf9f4e247552498232caff; and 1 more | fbfff331e73f44c25f4edd112eaef3b6865171c6; 294e306dc1c49f1124d0b82eef565778d975420b; 0b456d70fff190abac02795ddb088618ff512a48; 0f86aba67317d65b2dc89995dd5ddefe219411a7 |
| Linux Linux | Software | 5.14 | not recorded |
The 7.8 severity score (high) from the company that reported it, broken into what it means in practice. Red means it makes the flaw easier or worse.
| How it is reached | On the machine | The attacker needs access to the computer itself, for example a login or a file they can get you to open. |
| How hard it is | Low | Easy to carry out. No special conditions have to line up. |
| Login needed | Low | The attacker needs an ordinary user account. |
| Someone has to act | None | Nobody has to click or open anything. It can happen on its own. |
| Reaches beyond the program | Unchanged | The damage stays inside the vulnerable program. |
| Data exposed | High | Total loss of confidentiality: the attacker can read all the data the program can reach. |
| Data changed | High | The attacker can change or delete anything the program can reach. |
| Service disrupted | High | The attacker can take the service down completely. |
| Ease of attack | 1.8 | A score for how easy it is to use the flaw. Higher is easier. |
| Damage | 5.9 | A score for how bad the harm is if it works. Higher is worse. |
NIST lists 7 sources for this flaw, none tagged as a vendor patch.