Commit 61f9447
KVM: x86/mmu: Set disallowed_nx_huge_page in TDP MMU before setting SPTE
Set nx_huge_page_disallowed in TDP MMU shadow pages before making the SP visible to other readers, i.e. before setting its SPTE. This will allow KVM to query the flag when determining if a shadow page can be replaced by a NX huge page without violating the rules of the mitigation. Note, the shadow/legacy MMU holds mmu_lock for write, so it's impossible for another CPU to see a shadow page without an up-to-date nx_huge_page_disallowed, i.e. only the TDP MMU needs the complicated dance. Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Yan Zhao <yan.y.zhao@intel.com> Message-Id: <20221019165618.927057-5-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent b5b0977 commit 61f9447
3 files changed
+39
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
806 | | - | |
807 | | - | |
| 806 | + | |
808 | 807 | | |
809 | | - | |
810 | | - | |
811 | 808 | | |
812 | 809 | | |
813 | 810 | | |
| |||
816 | 813 | | |
817 | 814 | | |
818 | 815 | | |
819 | | - | |
820 | | - | |
| 816 | + | |
821 | 817 | | |
822 | 818 | | |
823 | 819 | | |
824 | 820 | | |
825 | 821 | | |
826 | 822 | | |
827 | 823 | | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
828 | 833 | | |
829 | 834 | | |
830 | 835 | | |
| |||
842 | 847 | | |
843 | 848 | | |
844 | 849 | | |
845 | | - | |
| 850 | + | |
846 | 851 | | |
847 | | - | |
848 | | - | |
849 | 852 | | |
850 | 853 | | |
851 | 854 | | |
852 | 855 | | |
853 | 856 | | |
854 | 857 | | |
855 | 858 | | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
856 | 866 | | |
857 | 867 | | |
858 | 868 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
332 | | - | |
333 | | - | |
| 331 | + | |
| 332 | + | |
334 | 333 | | |
335 | 334 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
407 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
| |||
1118 | 1121 | | |
1119 | 1122 | | |
1120 | 1123 | | |
1121 | | - | |
1122 | | - | |
1123 | 1124 | | |
1124 | 1125 | | |
1125 | 1126 | | |
1126 | 1127 | | |
1127 | 1128 | | |
1128 | 1129 | | |
1129 | | - | |
1130 | | - | |
| 1130 | + | |
1131 | 1131 | | |
1132 | 1132 | | |
1133 | 1133 | | |
| |||
1142 | 1142 | | |
1143 | 1143 | | |
1144 | 1144 | | |
1145 | | - | |
1146 | | - | |
1147 | 1145 | | |
1148 | 1146 | | |
1149 | 1147 | | |
| |||
1157 | 1155 | | |
1158 | 1156 | | |
1159 | 1157 | | |
| 1158 | + | |
1160 | 1159 | | |
1161 | 1160 | | |
1162 | 1161 | | |
| |||
1193 | 1192 | | |
1194 | 1193 | | |
1195 | 1194 | | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | 1195 | | |
1200 | 1196 | | |
1201 | 1197 | | |
| |||
1207 | 1203 | | |
1208 | 1204 | | |
1209 | 1205 | | |
1210 | | - | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
1211 | 1209 | | |
1212 | 1210 | | |
1213 | 1211 | | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1214 | 1219 | | |
1215 | 1220 | | |
1216 | 1221 | | |
| |||
1498 | 1503 | | |
1499 | 1504 | | |
1500 | 1505 | | |
1501 | | - | |
| 1506 | + | |
1502 | 1507 | | |
1503 | 1508 | | |
1504 | 1509 | | |
| |||
0 commit comments