From patchwork Wed Jan 27 19:42:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 8139721 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D6037BEEE5 for ; Wed, 27 Jan 2016 19:45:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E5A920173 for ; Wed, 27 Jan 2016 19:45:05 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3043E20155 for ; Wed, 27 Jan 2016 19:45:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aOVyy-0006Hp-Uj; Wed, 27 Jan 2016 19:42:24 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aOVyx-0006Hi-Ff for xen-devel@lists.xen.org; Wed, 27 Jan 2016 19:42:23 +0000 Received: from [193.109.254.147] by server-2.bemta-14.messagelabs.com id B4/9F-12889-E9D19A65; Wed, 27 Jan 2016 19:42:22 +0000 X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1453923741!19606051!1 X-Originating-IP: [81.196.12.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60965 invoked from network); 27 Jan 2016 19:42:22 -0000 Received: from smtp1.rdslink.ro (HELO smtp.rdslink.ro) (81.196.12.70) by server-13.tower-27.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 27 Jan 2016 19:42:22 -0000 Received: (qmail 30631 invoked from network); 27 Jan 2016 19:42:20 -0000 X-Mail-Scanner: Scanned by qSheff-II-2.1-r3 (http://www.enderunix.org/qsheff/) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 Received: from unknown (HELO dell.localdomain) (188.25.222.83) by smtp1.rdslink.ro with SMTP; 27 Jan 2016 19:42:19 -0000 From: Razvan Cojocaru To: xen-devel@lists.xen.org Date: Wed, 27 Jan 2016 21:42:18 +0200 Message-Id: <1453923738-4919-1-git-send-email-rcojocaru@bitdefender.com> X-Mailer: git-send-email 2.7.0 Cc: andrew.cooper3@citrix.com, tamas@tklengyel.com, keir@xen.org, Razvan Cojocaru , jbeulich@suse.com Subject: [Xen-devel] [PATCH] x86 vm_event: reset monitor in vm_event_cleanup_domain() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Virus-Scanned: ClamAV using ClamSMTP It is currently possible to leave a monitor flag enabled even after vm_event_cleanup_domain() has been called, potentially leading to a crash in hvm_msr_write_intercept() and hvm_set_crX() (when v->arch.vm_event has become NULL, but the corresponding corresponding v->domain->arch.monitor flag is non-zero). This patch zeroes out arch.monitor in vm_event_cleanup_domain(). Signed-off-by: Razvan Cojocaru Reviewed-by: Andrew Cooper Acked-by: Tamas K Lengyel --- xen/arch/x86/vm_event.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c index 9677ecc..08d678a 100644 --- a/xen/arch/x86/vm_event.c +++ b/xen/arch/x86/vm_event.c @@ -56,6 +56,7 @@ void vm_event_cleanup_domain(struct domain *d) } d->arch.mem_access_emulate_each_rep = 0; + memset(&d->arch.monitor, 0, sizeof(d->arch.monitor)); } void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v)