Эх сурвалжийг харах

Merge branch 'kvm-insert-lfence' into kvm-master

Topic branch for CVE-2017-5753, avoiding conflicts in the next merge window.
Paolo Bonzini 7 жил өмнө
parent
commit
2aad9b3e07
1 өөрчлөгдсөн 10 нэмэгдсэн , 2 устгасан
  1. 10 2
      arch/x86/kvm/vmx.c

+ 10 - 2
arch/x86/kvm/vmx.c

@@ -899,8 +899,16 @@ static inline short vmcs_field_to_offset(unsigned long field)
 {
 	BUILD_BUG_ON(ARRAY_SIZE(vmcs_field_to_offset_table) > SHRT_MAX);
 
-	if (field >= ARRAY_SIZE(vmcs_field_to_offset_table) ||
-	    vmcs_field_to_offset_table[field] == 0)
+	if (field >= ARRAY_SIZE(vmcs_field_to_offset_table))
+		return -ENOENT;
+
+	/*
+	 * FIXME: Mitigation for CVE-2017-5753.  To be replaced with a
+	 * generic mechanism.
+	 */
+	asm("lfence");
+
+	if (vmcs_field_to_offset_table[field] == 0)
 		return -ENOENT;
 
 	return vmcs_field_to_offset_table[field];