From patchwork Mon Apr 11 09:03:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 8798921 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 801E09F36E for ; Mon, 11 Apr 2016 09:06:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96AC0202BE for ; Mon, 11 Apr 2016 09:06:37 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id CAA392021A for ; Mon, 11 Apr 2016 09:06:36 +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 1apXlJ-0003RJ-RD; Mon, 11 Apr 2016 09:04:01 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apXlH-0003RD-N8 for xen-devel@lists.xen.org; Mon, 11 Apr 2016 09:03:59 +0000 Received: from [193.109.254.147] by server-16.bemta-14.messagelabs.com id EE/A4-02846-E786B075; Mon, 11 Apr 2016 09:03:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRWlGSWpSXmKPExsXitHRDpG5dBne 4wdFbkhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8ahlhvMBYs4K2Y1rWBsYDzN3sXIySEh4C/x YcZDVhCbTUBfYveLT0wgtoiAusTpjotgcWaBPInOjx/B6oUFgiRmz1vHDGKzCKhKLOm8BFbDK +ApsXvaK0aImXIS54//BKsRElCTuNZ/iR2iRlDi5MwnLBAzJSQOvnjBDFHPLXH79FTmCYw8s5 CUzUJStoCRaRWjenFqUVlqka6xXlJRZnpGSW5iZo6uoaGJXm5qcXFiempOYlKxXnJ+7iZGYIg wAMEOxrt9zocYJTmYlER5rV5yhAvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4H2czh0uJFiUmp5a kZaZAwxWmLQEB4+SCO8zkDRvcUFibnFmOkTqFKOilDjvXZCEAEgiozQPrg0WIZcYZaWEeRmBD hHiKUgtys0sQZV/xSjOwagkzPsGZApPZl4J3PRXQIuZQBb/4wRZXJKIkJJqYLzrrXbzRFSwTb DDniaLfp4V7BvmSfNYF7Jozaw3dk+cfvu6rnPJwqqrc3d5pFjFzQ7Kqy+wXfbKbJF6zoqU8kz RN2Wq7Punt+6TDFuR28LNwVK+6ubyUF973s5Gv/UJ3yKvNSidCOV/bN8UusXw1AGdgokMLuyV Qaf3vvpYWnWeXSCRYbKmEktxRqKhFnNRcSIA+SmccYsCAAA= X-Env-Sender: prvs=902c09e3c=Andrew.Cooper3@citrix.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1460365437!22606459!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60164 invoked from network); 11 Apr 2016 09:03:58 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-14.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 11 Apr 2016 09:03:58 -0000 X-IronPort-AV: E=Sophos;i="5.24,462,1454976000"; d="scan'208";a="346138583" From: Andrew Cooper To: Xen-devel Date: Mon, 11 Apr 2016 10:03:55 +0100 Message-ID: <1460365435-12325-1-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-DLP: MIA2 Cc: Andrew Cooper , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH for-4.7] x86/pv: Correctly fold vIOPL back into vcpu_guest_context 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP c/s f71ecb6 "x86: introduce a new VMASSIST for architectural behaviour of iopl" shifted the vcpu iopl field by 12, but didn't update the logic which reconstructs the guests eflags for migration. Existing guest kernels set a vIOPL of 1, to prevent them from faulting when accessing IO ports. This bug manifests as a crash after migrate, as the vIOPL reverts back to the default of 0, and the guest suffers an unexpected #GP fault. Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu Tested-by: Boris Ostrovsky --- CC: Jan Beulich CC: Wei Liu --- xen/arch/x86/domctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index cba1e37..6e709cb 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1512,7 +1512,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c) /* IOPL privileges are virtualised: merge back into returned eflags. */ BUG_ON((c(user_regs.eflags) & X86_EFLAGS_IOPL) != 0); - c(user_regs.eflags |= v->arch.pv_vcpu.iopl << 12); + c(user_regs.eflags |= v->arch.pv_vcpu.iopl); if ( !compat ) {