From patchwork Fri Jan 6 20:11:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9501723 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 7DA3B6021C for ; Fri, 6 Jan 2017 20:13:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E95E2074F for ; Fri, 6 Jan 2017 20:13:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 632162851E; Fri, 6 Jan 2017 20:13:53 +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 DA1B92074F for ; Fri, 6 Jan 2017 20:13:52 +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 1cParP-00055N-Mg; Fri, 06 Jan 2017 20:11:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cParO-00055F-4h for xen-devel@lists.xen.org; Fri, 06 Jan 2017 20:11:34 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 34/B2-29113-4F9FF685; Fri, 06 Jan 2017 20:11:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42JxWrrBXvfTz/w Ig/nHBS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1owfJ1axFixjr/i9zLSBsZmti5GTQ0LAX6Lj wHR2EJtNQF9i94tPTCC2iIC6xOmOi6xdjBwczAJ+Eoce+IKEhQUCJC7/mMkKYrMIqEjc3z0Xr JVXwFPi7Z8j7BAj5STOH//JDGJzCnhJPD8yG2ykEFDNqgVLoGw1iWv9l6B6BSVOznzCAmIzC0 hIHHzxgnkCI+8sJKlZSFILGJlWMaoXpxaVpRbpGuklFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQ mFesl5+duYgSGDQMQ7GD8/sfpEKMkB5OSKO//F/kRQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4 5/4AygkWpaanVqRl5gADGCYtwcGjJMLLC5LmLS5IzC3OTIdInWLU5TjwfsVTJiGWvPy8VClx3 uUgRQIgRRmleXAjYNF0iVFWSpiXEegoIZ6C1KLczBJU+VeM4hyMSsK820Gm8GTmlcBtegV0BB PQEYKeYEeUJCKkpBoYlxiny2Wyla7/Z6ygqvexQ6diWobaP6EbBRfrVl04cPIxR9oZ109qBpM 0/R9pRry6bhGjJyFvez7jycoHce/en/NescDngOXHayu4JJknvf25vE16i5kt65KO65MvRDZc qfUOi66fz9Kz//jHU6pf77ep+ulrlFzdKLf5RcO//c/Ov/9tcbHnrhJLcUaioRZzUXEiAGViW F+hAgAA X-Env-Sender: prvs=1720a4d25=Andrew.Cooper3@citrix.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1483733488!63172412!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52297 invoked from network); 6 Jan 2017 20:11:29 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 6 Jan 2017 20:11:29 -0000 X-IronPort-AV: E=Sophos;i="5.33,326,1477958400"; d="scan'208";a="407237994" From: Andrew Cooper To: Xen-devel Date: Fri, 6 Jan 2017 20:11:26 +0000 Message-ID: <1483733486-25193-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1483733486-25193-1-git-send-email-andrew.cooper3@citrix.com> References: <1483733486-25193-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH 2/2] x86/pv: Check that emulate_privileged_op() didn't change TF 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 As the comment says, the guest shouldn't be able to change X86_EFLAGS_TF, although we don't care which value it currently has. Signed-off-by: Andrew Cooper --- CC: Jan Beulich --- xen/arch/x86/traps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index e45ff71..6dbdaa0 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -3395,7 +3395,8 @@ static int emulate_privileged_op(struct cpu_user_regs *regs) * Un-mirror virtualized state from EFLAGS. * Nothing we allow to be emulated can change TF, IF, or IOPL. */ - ASSERT(!((regs->_eflags ^ eflags) & (X86_EFLAGS_IF | X86_EFLAGS_IOPL))); + ASSERT(!((regs->_eflags ^ eflags) & + (X86_EFLAGS_TF | X86_EFLAGS_IF | X86_EFLAGS_IOPL))); regs->_eflags |= X86_EFLAGS_IF; regs->_eflags &= ~X86_EFLAGS_IOPL;