From patchwork Thu Aug 10 07:28:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9892951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 728C8603B4 for ; Thu, 10 Aug 2017 07:30:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63F97289EF for ; Thu, 10 Aug 2017 07:30:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5861A28A56; Thu, 10 Aug 2017 07:30:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 809C628A9A for ; Thu, 10 Aug 2017 07:30:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfht2-0006eC-6U; Thu, 10 Aug 2017 07:28:08 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfht0-0006e0-Nz for xen-devel@lists.xenproject.org; Thu, 10 Aug 2017 07:28:06 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id 04/7F-03612-60B0C895; Thu, 10 Aug 2017 07:28:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRWlGSWpSXmKPExsXS6fjDS5eVuyf S4NIFZYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNeN4z1v2gs1sFbMfnGBrYHzE0sXIySEkkCcx 9/I/NhCbV8BOYt2UnUwgtoSAocTphTfBalgEVCU2tN1nBLHZBNQl2p5tZ+1i5OAQETCQOHc0C STMLBAl0bf8KlirsICvxMRPq1ghxttJTFt5lhmknFdAUOLvDmGIci2Jh79usUDY2hLLFr4GK2 EWkJZY/o9jAiPvLISGWUgaZiFpmIXQsICRZRWjRnFqUVlqka6RoV5SUWZ6RkluYmaOrqGBmV5 uanFxYnpqTmJSsV5yfu4mRmCIMQDBDsY/ywIOMUpyMCmJ8hZ/6o4U4kvKT6nMSCzOiC8qzUkt PsQow8GhJMF7krMnUkiwKDU9tSItMwcY7DBpCQ4eJRHeSyBp3uKCxNzizHSI1ClGY46mD1u+M HG8mvD/G5MQS15+XqqUOO8PkFIBkNKM0jy4QbAovMQoKyXMywh0mhBPQWpRbmYJqvwrRnEORi Vh3mUgU3gy80rg9r0COoUJ6JQI306QU0oSEVJSDYz7zgh5TMrb/81+4cXutbcmfPTsEOmsyH9 is3aB/dcu/jeJ31sVemqL1VWrwjfPPHdJu0j94WTvi49UZ/O1fZDokH+1wCjUS+z8tdkzLz7o muAj7GXh71prX/r0xK5Nswzkm/6pLTkqPO3HZ3mx5TyXX/+vU5EzvyK+tS3IzfN6Y/nWdUzhE 3OVWIozEg21mIuKEwGCzdeLvQIAAA== X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1502350083!70608260!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11205 invoked from network); 10 Aug 2017 07:28:05 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-14.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 10 Aug 2017 07:28:05 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 10 Aug 2017 01:28:03 -0600 Message-Id: <598C2722020000780016E67B@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.2 Date: Thu, 10 Aug 2017 01:28:02 -0600 From: "Jan Beulich" To: "xen-devel" References: <598C2722020000780016E67B@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Cc: Andrew Cooper , Paul Durrant Subject: [Xen-devel] [PATCH] x86/HVM: fix boundary check in hvmemul_insn_fetch() (again) X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit 5a992b670b ("x86/hvm: Fix boundary check in hvmemul_insn_fetch()") went a little too far in its correction to commit 0943a03037 ("x86/hvm: Fixes to hvmemul_insn_fetch()"): Keep the start offset check, but restore the original end offset one. Signed-off-by: Jan Beulich Reviewed-by: Paul Durrant --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -959,7 +959,7 @@ int hvmemul_insn_fetch( * which means something went wrong with instruction decoding... */ if ( insn_off >= sizeof(hvmemul_ctxt->insn_buf) || - (insn_off + bytes) >= sizeof(hvmemul_ctxt->insn_buf) ) + insn_off + bytes > sizeof(hvmemul_ctxt->insn_buf) ) { ASSERT_UNREACHABLE(); return X86EMUL_UNHANDLEABLE;