From owner-svn-src-all@FreeBSD.ORG Wed Jul 3 23:05:17 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CA9974F7; Wed, 3 Jul 2013 23:05:17 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BD3AC1D3A; Wed, 3 Jul 2013 23:05:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r63N5HGQ053605; Wed, 3 Jul 2013 23:05:17 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r63N5Hc0053604; Wed, 3 Jul 2013 23:05:17 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201307032305.r63N5Hc0053604@svn.freebsd.org> From: Neel Natu Date: Wed, 3 Jul 2013 23:05:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252641 - head/sys/amd64/vmm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jul 2013 23:05:17 -0000 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);