From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-1709334-1516800240-2-16076158710901741096 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no ("Email failed DMARC policy for domain") X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, HEADER_FROM_DIFFERENT_DOMAINS 0.25, RCVD_IN_DNSWL_MED -2.3, SPF_PASS -0.001, LANGUAGES en, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='140.211.166.137', Host='smtp4.osuosl.org', Country='US', FromHeader='com', MailFrom='org' X-Spam-charsets: cc='UTF-8', plain='us-ascii' X-IgnoreVacation: yes ("Email failed DMARC policy for domain") X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: driverdev-devel-bounces@linuxdriverproject.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1516800239; b=r2frn5OowH5U2OUFt5dK7oMVOZRUJGtNHWiNK6iMzEaXhC8 peRKi6gE2EEvQczBQVK4yI7VX1+dIiwruz9zSMp1IwZz/DriGjprS+8YB0zBn+UE 4gcG7jY5jPBa2EzYdxOXSY7qOh2PbQiKgishZi2rfWAJj9rXRAZYTz3+uXnE4dw5 vEsMDlYgnX59iZXlTirUshCSnVYs6hqs3BtIv2EFVvoidf5GryhDXURQ+9hFN+lv Fk9o08Hzj4+PpHcN5gsRl6+wEKT9wZawd2ixVE+k25owHjLTaguWIxvurQeVoKdb AXL8hW4eGK7hyz5sZ3IFpRSmb7QzdAWPpcQBU/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :in-reply-to:references:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:cc:mime-version:content-type :content-transfer-encoding:sender; s=arctest; t=1516800239; bh=e 3fzCZwrGiFNblFOLxUIqZuyiCPampAD8sq4q/Ru2Xw=; b=GSeDACEdOoM192/d4 eHZVAgS//94BoHuTpac21bNjTBuTcrvK0MeaeaObJWeAAsPRmVnEX0Hn8QqzwdPK W40NxX6IyctqmPlGmcNo26dbYmmIoIUP+vdbUVegkMNgGkgcRRFxhmqo5VYCMU76 4jXqh7SeFqgSsueapnFz1oBDWITtkPWEfa7Jf2NcUMzWkAvn4ymrh8Qo+6eYJL9O bYVwcKBNmSkuV8GSRAWCjgfFc1sHHca0rXdX65L0BxVClXw0N8kAFTLBLbjMKxqS EgMfrtvV5IBVysaZBgO1haQCpypSWd8cb7RZfLaJWYxkepHDhXvg2k5euSkLt9al 7ESGg== ARC-Authentication-Results: i=1; mx4.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=fail (p=none,has-list-id=yes,d=none) header.from=redhat.com; iprev=pass policy.iprev=140.211.166.137 (smtp4.osuosl.org); spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org smtp.helo=fraxinus.osuosl.org; x-aligned-from=fail; x-ptr=fail x-ptr-helo=fraxinus.osuosl.org x-ptr-lookup=smtp4.osuosl.org; x-return-mx=pass smtp.domain=linuxdriverproject.org smtp.result=pass smtp_is_org_domain=yes header.domain=redhat.com header.result=pass header_is_org_domain=yes; x-tls=pass version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128 Authentication-Results: mx4.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=fail (p=none,has-list-id=yes,d=none) header.from=redhat.com; iprev=pass policy.iprev=140.211.166.137 (smtp4.osuosl.org); spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org smtp.helo=fraxinus.osuosl.org; x-aligned-from=fail; x-ptr=fail x-ptr-helo=fraxinus.osuosl.org x-ptr-lookup=smtp4.osuosl.org; x-return-mx=pass smtp.domain=linuxdriverproject.org smtp.result=pass smtp_is_org_domain=yes header.domain=redhat.com header.result=pass header_is_org_domain=yes; x-tls=pass version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128 X-Remote-Delivered-To: driverdev-devel@osuosl.org From: Vitaly Kuznetsov To: kvm@vger.kernel.org, x86@kernel.org Subject: [PATCH v4 1/7] x86/hyper-v: check for required priviliges in hyperv_init() Date: Wed, 24 Jan 2018 14:23:31 +0100 Message-Id: <20180124132337.30138-2-vkuznets@redhat.com> In-Reply-To: <20180124132337.30138-1-vkuznets@redhat.com> References: <20180124132337.30138-1-vkuznets@redhat.com> X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.24 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephen Hemminger , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Haiyang Zhang , linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, "Michael Kelley \(EOSG\)" , Ingo Molnar , Roman Kagan , Andy Lutomirski , "H. Peter Anvin" , Paolo Bonzini , Thomas Gleixner , Mohammed Gamal MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: In hyperv_init() we presume we always have access to VP index and hypercall MSRs while according to the specification we should check if we're allowed to access the corresponding MSRs before accessing them. Signed-off-by: Vitaly Kuznetsov Reviewed-by: Thomas Gleixner --- arch/x86/hyperv/hv_init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 189a398290db..21f9d53d9f00 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -110,12 +110,19 @@ static int hv_cpu_init(unsigned int cpu) */ void hyperv_init(void) { - u64 guest_id; + u64 guest_id, required_msrs; union hv_x64_msr_hypercall_contents hypercall_msr; if (x86_hyper_type != X86_HYPER_MS_HYPERV) return; + /* Absolutely required MSRs */ + required_msrs = HV_X64_MSR_HYPERCALL_AVAILABLE | + HV_X64_MSR_VP_INDEX_AVAILABLE; + + if ((ms_hyperv.features & required_msrs) != required_msrs) + return; + /* Allocate percpu VP index */ hv_vp_index = kmalloc_array(num_possible_cpus(), sizeof(*hv_vp_index), GFP_KERNEL); -- 2.14.3 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel