diff options
author | Sean Christopherson <[email protected]> | 2024-02-16 17:34:30 -0800 |
---|---|---|
committer | Paolo Bonzini <[email protected]> | 2024-02-23 03:55:59 -0500 |
commit | 5ef1d8c1ddbf696e47b226e11888eaf8d9e8e807 (patch) | |
tree | c03285677558ea35d4617496cb260bb0388407bb /scripts/gdb/linux/utils.py | |
parent | c48617fbbe831d4c80fe84056033f17b70a31136 (diff) |
KVM: SVM: Flush pages under kvm->lock to fix UAF in svm_register_enc_region()
Do the cache flush of converted pages in svm_register_enc_region() before
dropping kvm->lock to fix use-after-free issues where region and/or its
array of pages could be freed by a different task, e.g. if userspace has
__unregister_enc_region_locked() already queued up for the region.
Note, the "obvious" alternative of using local variables doesn't fully
resolve the bug, as region->pages is also dynamically allocated. I.e. the
region structure itself would be fine, but region->pages could be freed.
Flushing multiple pages under kvm->lock is unfortunate, but the entire
flow is a rare slow path, and the manual flush is only needed on CPUs that
lack coherency for encrypted memory.
Fixes: 19a23da53932 ("Fix unsynchronized access to sev members through svm_register_enc_region")
Reported-by: Gabe Kirkpatrick <[email protected]>
Cc: Josh Eads <[email protected]>
Cc: Peter Gonda <[email protected]>
Cc: [email protected]
Signed-off-by: Sean Christopherson <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/utils.py')
0 files changed, 0 insertions, 0 deletions