Commit 3e6e7b6
KVM: SVM: Force flush caches before reboot CSV guest
hygon inclusion
category: feature
CVE: NA
---------------------------
For memory encrypted guest, its pages' encrypt status will changed at
runtime. When user reboot the guest, the pages' encrypt status during
last boot were ignored. So during the boot flow of reboot, there may
be 2 versions of memory data lies in cache as follows:
+--------+ | |
| | +--------------+ --+
| | | | \
|________| | | \
cacheline for -> |________| <-+ | | \
pa1(c=0) | | \ |______________| \
| | \_ 64 bytes aligned <- pa1 \
| | _ |______________| 4K
| | / | | page
cacheline for |________| / | | /
pa1(c=1) -> |________| <-+ | | /
| | | | /
| | | | /
| | | | /
| | +--------------+ --+
| | | |
If the older version cache was flushed after that of newer version, and
guest read the memory again, then it will get corrupted data and may
lead to crash.
In this change, for any memory encrypted guest, the cache is forcibly
flushed to memory before the next boot flow, which ensures that memory
access is up-to-date.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
Link: #354
(cherry picked from commit aeab587)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>1 parent 39173bc commit 3e6e7b6
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
1031 | | - | |
| 1031 | + | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | | - | |
| 1034 | + | |
1035 | 1035 | | |
1036 | 1036 | | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
1037 | 1040 | | |
1038 | 1041 | | |
1039 | 1042 | | |
| |||
0 commit comments