From patchwork Tue Nov 14 15:11:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Pop X-Patchwork-Id: 10057839 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 49D4560231 for ; Tue, 14 Nov 2017 15:14:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40F2F2973A for ; Tue, 14 Nov 2017 15:14:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 356C62984D; Tue, 14 Nov 2017 15:14:30 +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 F17402973A for ; Tue, 14 Nov 2017 15:14:28 +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 1eEcsO-0006IQ-4G; Tue, 14 Nov 2017 15:11:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEcsN-0006IK-1J for xen-devel@lists.xen.org; Tue, 14 Nov 2017 15:11:47 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id C6/74-10664-2B70B0A5; Tue, 14 Nov 2017 15:11:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsUSfTxjoe5Gdu4 og0X9ahZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8abn02sBU2cFa83zWNvYHzE1sXIySEk4CHx 8EQ/UxcjF5C9llFiScM+ZojEVUaJtw9tYYqu7Z3BClG0G6jo0kdGkASbgLrE5r1bWEFsEQFpi WufL4PFmQWKJU797GECsYUFrCUe7Z3MDmKzCKhKnF2/DMzmFbCU+DqhnwXElhCQl1j8fScbhJ 0jcbSpA+gIDiBbSuJ/qxLIXgmBfhaJW81fmCFqZCQeTbzJNoFRYAEjwypGjeLUorLUIl0jS72 kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjMDAYgCCHYwHFgUeYpTkYFIS5VX5zB4l xJeUn1KZkVicEV9UmpNafIhRhoNDSYK3m407SkiwKDU9tSItMwcY4jBpCQ4eJRHeepA0b3FBY m5xZjpE6hSjMcezma8bmDmmXW1tYhZiycvPS5US540EKRUAKc0ozYMbBIu9S4yyUsK8jECnCf EUpBblZpagyr9iFOdgVBLm3QwyhSczrwRu3yugU5iATpEC+YK3uCQRISXVwHi8XcNHcEtU7Dr ve4JSqrYHDHl2214qK1Js7b+oVP6/WW7Z/7klH/iSr3DUnD+Xk16xT+Nyn0W0bkP70eNsJaFa vMEPYn6UP5qdtP6eTveyd0W+zg4lqYzljv01e6r1S4RiGHtc5DtqTZ+433hZ+U/f/I20lkiXb PyNM2YpdUJcd4IEXx9UYinOSDTUYi4qTgQAzKd7C7gCAAA= X-Env-Sender: apop@bitdefender.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1510672304!81996233!1 X-Originating-IP: [91.199.104.161] 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 44778 invoked from network); 14 Nov 2017 15:11:45 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-7.tower-21.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 14 Nov 2017 15:11:45 -0000 Received: (qmail 24948 invoked from network); 14 Nov 2017 17:11:44 +0200 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 14 Nov 2017 17:11:44 +0200 Received: from smtp02.buh.bitdefender.net (smtp.bitdefender.biz [10.17.80.76]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id 0EA977FBF5 for ; Tue, 14 Nov 2017 17:11:44 +0200 (EET) Received: (qmail 12237 invoked from network); 14 Nov 2017 17:11:44 +0200 Received: from unknown (HELO hel.clj.bitdefender.biz) (apop@bitdefender.com@10.220.12.75) by smtp02.buh.bitdefender.net with AES128-GCM-SHA256 encrypted SMTP; 14 Nov 2017 17:11:43 +0200 From: Adrian Pop To: xen-devel@lists.xen.org Date: Tue, 14 Nov 2017 17:11:33 +0200 Message-Id: <20171114151133.31478-1-apop@bitdefender.com> X-Mailer: git-send-email 2.15.0 X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp02.buh.bitdefender.net, sigver: 7.73805 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.8.1074, Dats: 466742, Stamp: 3], Multi: [Enabled, t: (0.000008, 0.003545)], BW: [Enabled, t: (0.000007)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.002144), Flags: 85D2ED72; NN_NO_CONTENT_TYPE; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.007237,0.000059)], URL: [Enabled, t: (0.000005)], RTDA: [Enabled, t: (0.098763), Hit: No, Details: v2.6.15; Id: 15.5f4foa.1btosv3rt.ebni6], total: 0(775) X-BitDefender-CF-Stamp: none Cc: Andrew Cooper , Jan Beulich , Adrian Pop Subject: [Xen-devel] [PATCH] x86/hvm: Fix rcu_unlock_domain call bypass 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP rcu_lock_current_domain is called at the beginning of do_altp2m_op, but the altp2m_vcpu_enable_notify subop handler might skip calling rcu_unlock_domain, possibly hanging the domain altogether. Signed-off-by: Adrian Pop Reviewed-by: Andrew Cooper --- xen/arch/x86/hvm/hvm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 205b4cb685..0af498a312 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4534,12 +4534,18 @@ static int do_altp2m_op( if ( a.u.enable_notify.pad || a.domain != DOMID_SELF || a.u.enable_notify.vcpu_id != curr->vcpu_id ) + { rc = -EINVAL; + break; + } if ( !gfn_eq(vcpu_altp2m(curr).veinfo_gfn, INVALID_GFN) || mfn_eq(get_gfn_query_unlocked(curr->domain, a.u.enable_notify.gfn, &p2mt), INVALID_MFN) ) - return -EINVAL; + { + rc = -EINVAL; + break; + } vcpu_altp2m(curr).veinfo_gfn = _gfn(a.u.enable_notify.gfn); altp2m_vcpu_update_vmfunc_ve(curr);