svn commit: r252641 - head/sys/amd64/vmm

Neel Natu neel at FreeBSD.org
Wed Jul 3 23:05:17 UTC 2013


Author: neel
Date: Wed Jul  3 23:05:17 2013
New Revision: 252641
URL: http://svnweb.freebsd.org/changeset/base/252641

Log:
  Verify that all bytes in the instruction buffer are consumed during decoding.
  
  Suggested by:	grehan

Modified:
  head/sys/amd64/vmm/vmm_instruction_emul.c

Modified: head/sys/amd64/vmm/vmm_instruction_emul.c
==============================================================================
--- head/sys/amd64/vmm/vmm_instruction_emul.c	Wed Jul  3 23:03:28 2013	(r252640)
+++ head/sys/amd64/vmm/vmm_instruction_emul.c	Wed Jul  3 23:05:17 2013	(r252641)
@@ -780,6 +780,19 @@ decode_immediate(struct vie *vie)
 }
 
 /*
+ * Verify that all the bytes in the instruction buffer were consumed.
+ */
+static int
+verify_inst_length(struct vie *vie)
+{
+
+	if (vie->num_processed == vie->num_valid)
+		return (0);
+	else
+		return (-1);
+}
+
+/*
  * Verify that the 'guest linear address' provided as collateral of the nested
  * page table fault matches with our instruction decoding.
  */
@@ -853,6 +866,9 @@ vmm_decode_instruction(struct vm *vm, in
 	if (decode_immediate(vie))
 		return (-1);
 
+	if (verify_inst_length(vie))
+		return (-1);
+
 	if (verify_gla(vm, cpuid, gla, vie))
 		return (-1);
 


More information about the svn-src-head mailing list