Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2817886pxb; Tue, 13 Apr 2021 10:51:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqg6jjhGmjJiTPEMHUxk6ObGZJeqZ1TMJKUJHoDe8o/ad1qz48RAGI0j25y9URJQA5PMT9 X-Received: by 2002:a05:6402:27ce:: with SMTP id c14mr36065938ede.263.1618336307893; Tue, 13 Apr 2021 10:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618336307; cv=none; d=google.com; s=arc-20160816; b=ZUUDZwYzCNCkZEmccXepxtjgd02J8jfXEhuiSxIIdQ20mDW1CQRsq0raJElB0+fj0k NtBc0VTefj7pHgduLpD1ZJm0a+1scccJVFWrgmeaTMtExNTXv6bORB3V8DWeKtls1mzR G1fDLtQFM3meXjOPI17EOX3C8flQ0LCCK4Ly9Sqmlx4nE8T5NXO1pJfKF3z5HCDAqPDZ ZgJ0JKc4M2DknLyiRhEOjhNrIJWODvUjLh4hRqWjDYN3FIjohKMOcUQ25ykdog4cpJuu YrbIsAb0SFNxwSBxoyO7SE3QNuZJWBdj/f7yD16aEyz/GBzDtbLdmJYtAzN8eE1fWY9/ ACeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=h8Pc6sjKzyL/ywQSK9iQAj3O9qrUD0TkuhHTS3lVgIo=; b=j3i8Enz84QZDVvxyJdew/EkLYnJ1O/hEbgni2+o7DT+zdqSQET+JiJtviGvD9eB0J0 m8RhRgIUNHYBzV30kF1+kPhkdskE8IBVW88bDyaKmgV+ldFdCRU+pqmLrddhAIhD7UEY z7uxybY3MtnCoXIUwc15jns8T66sD7D6Lf6ROYN2LMCi4ManwmUGUEgqrwXWgcFbFGsA vYyJuOoQEvTfTTqF9uCyHX+9/QJ/Ds5UJLDUzSNBgMs6v1I/lDISBx/u4XL7ckHJH6kc XyUdd8iqzuFZH20Q72mPtJpt2vXE8XUD82O7SHw8rimdGJ2cvJEeGZmvr/5uHzWsndch cZYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XafcObQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si11829981edj.156.2021.04.13.10.51.24; Tue, 13 Apr 2021 10:51:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XafcObQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345909AbhDMM3E (ORCPT + 99 others); Tue, 13 Apr 2021 08:29:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36622 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345627AbhDMM2C (ORCPT ); Tue, 13 Apr 2021 08:28:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618316862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h8Pc6sjKzyL/ywQSK9iQAj3O9qrUD0TkuhHTS3lVgIo=; b=XafcObQtlAN/13cyUsGtO+1cWs7WBeT+8qrJXVsMUSW6ZApTaMaigpZ/ly2S1P9SLujdcK rQsFY3kAfjX9H+u/zrrTmVFh7jc/5WpRlVrMnVuxaAWyyZuuqkQnSeOWcCExAP6+CtuuKr qaRwWnDAYiZuFQgWkhY8WkQ9BN76hbQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-85-2GCwpfY2OMODe7607fW5RA-1; Tue, 13 Apr 2021 08:27:41 -0400 X-MC-Unique: 2GCwpfY2OMODe7607fW5RA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7903483DD21; Tue, 13 Apr 2021 12:27:39 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.40.195.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A75460C04; Tue, 13 Apr 2021 12:27:37 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Siddharth Chandrasekaran , linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [PATCH RFC 18/22] KVM: x86: hyper-v: Honor HV_SIGNAL_EVENTS privilege bit Date: Tue, 13 Apr 2021 14:26:26 +0200 Message-Id: <20210413122630.975617-19-vkuznets@redhat.com> In-Reply-To: <20210413122630.975617-1-vkuznets@redhat.com> References: <20210413122630.975617-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hyper-V partition must possess 'HV_SIGNAL_EVENTS' privilege to issue HVCALL_SIGNAL_EVENT hypercalls. Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/hyperv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 6e4bf1da9dcf..b661f92d90c8 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -2120,6 +2120,12 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) kvm_vcpu_on_spin(vcpu, true); break; case HVCALL_SIGNAL_EVENT: + if (unlikely(!(hv_vcpu->cpuid_cache.features_ebx & + HV_SIGNAL_EVENTS))) { + ret = HV_STATUS_ACCESS_DENIED; + break; + } + if (unlikely(rep)) { ret = HV_STATUS_INVALID_HYPERCALL_INPUT; break; -- 2.30.2