From patchwork Tue Sep 5 13:56:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9939105 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 2B51D6038C for ; Tue, 5 Sep 2017 13:58:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CA84289A7 for ; Tue, 5 Sep 2017 13:58:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11E09289C9; Tue, 5 Sep 2017 13:58:08 +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 89A60289A7 for ; Tue, 5 Sep 2017 13:58:07 +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 1dpEKm-0004cK-0Y; Tue, 05 Sep 2017 13:56:08 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpEKk-0004c8-Nw for xen-devel@lists.xenproject.org; Tue, 05 Sep 2017 13:56:06 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 55/78-01782-5FCAEA95; Tue, 05 Sep 2017 13:56:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRWlGSWpSXmKPExsXS6fjDS/frmnW RBq1XpSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxjJ9+zFyzgrrh49zx7A+Mfti5GTg4hgTyJ 1yd+MIPYvAJ2Ei9nd4PFJQQMJU4vvMkCYrMIqEqsaZ8JZrMJqEu0PdvO2sXIwSEiYCBx7mgSi MksoC+xbR1YhbCAkcTOYxuZIabbSZx7/ZwJpIRXQFDi7w5hkDCzgJbEw1+3WCBsbYllC18zQ0 yRllj+j2MCI+8shIZZSBpmIWmYhdCwgJFlFaNGcWpRWWqRrpGRXlJRZnpGSW5iZo6uoYGpXm5 qcXFiempOYlKxXnJ+7iZGYIDVMzAw7mDc0+53iFGSg0lJlDc0cV2kEF9SfkplRmJxRnxRaU5q 8SFGGQ4OJQneiNVAOcGi1PTUirTMHGCow6QlOHiURHhTQdK8xQWJucWZ6RCpU4yKUuK8fSAJA ZBERmkeXBssvi4xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEubtB5nCk5lXAjf9FdBiJqDFVS /XgCwuSURISTUwqrLOWRUT8fyqUFJbtu1C+dNMvdcTr7KumTClpHtV49Ut10rmCod2VCcIXPt uIyK966hC0ZUzyVOOF7o3ZU2XLrR48jZeVLo6O2Wq1NPmhANl4fWFx2MemG3Xnqy6o3vhgc03 xFaceS81Y1tI+P6P/Wu2M3kd2J+9uqM/8dOKRJ3bt1bYxTZtVWIpzkg01GIuKk4EABRB/hWqA gAA X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1504619763!96157200!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 2811 invoked from network); 5 Sep 2017 13:56:05 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-15.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Sep 2017 13:56:05 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 05 Sep 2017 07:56:02 -0600 Message-Id: <59AEC91002000078001778DE@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.2 Date: Tue, 05 Sep 2017 07:56:00 -0600 From: "Jan Beulich" To: "xen-devel" References: <59AEC91002000078001778DE@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Cc: Andrew Cooper Subject: [Xen-devel] [PATCH v2] x86emul: correct EVEX decoding 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 While these are latent issues only for now, correct them right away: - unnamed (in the SDM) EVEX bits need to be set/clear respectively - EVEX.V' (called RX in our code) needs to uniformly be 1 in non-64-bit modes, - EXEX.R' (called R in our code) is uniformly being ignored in non-64-bit modes. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- v2: Add missing checks also affecting 64-bit mode. --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -495,13 +495,13 @@ union evex { uint8_t raw[3]; struct { uint8_t opcx:2; - uint8_t :2; + uint8_t mbz:2; uint8_t R:1; uint8_t b:1; uint8_t x:1; uint8_t r:1; uint8_t pfx:2; - uint8_t evex:1; + uint8_t mbs:1; uint8_t reg:4; uint8_t w:1; uint8_t opmsk:3; @@ -2544,6 +2544,14 @@ x86_decode( evex.raw[1] = vex.raw[1]; evex.raw[2] = insn_fetch_type(uint8_t); + generate_exception_if(evex.mbs || !evex.mbz, EXC_UD); + + if ( !mode_64bit() ) + { + generate_exception_if(!evex.RX, EXC_UD); + evex.R = 1; + } + vex.opcx = evex.opcx; break; case 0xc4: