Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp495948rwb; Fri, 4 Aug 2023 16:58:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZVsw5Oql/43hTXQg2oqNPbP8t434Z84c1oZ6njs8i1NHu4b68YNdv1mukfQyTPvwjCeLn X-Received: by 2002:a05:620a:1909:b0:76c:df5d:13a9 with SMTP id bj9-20020a05620a190900b0076cdf5d13a9mr3608603qkb.58.1691193495047; Fri, 04 Aug 2023 16:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691193494; cv=none; d=google.com; s=arc-20160816; b=OWoE0rrh19rUIpjYcn8On6U6ka43qcja0xt1V4DBQhD50fppvao2HR3Quvovk6WgEa oHBuE9HxudUKFbok2Lnn9vu0s6hdNloJgAJSpJsDiYOjD1cAEKKm0/x8OJWG57954Iy4 10FWpjSSnDNw6kw3fYhZMmmh3EldlJqA3r9oT+aONsAdFXrZgVmZlo/0C6SZ/8OdY3VA nyZ5y25jaZVvvkcc+rTx2ujSBpiH7MD4VUcHapwljTbgtT8KImFt9oEZ4Xy4uZ9GVpkY EpTjwPXzVewtIwicJWdMHmggyyLTjpoIscDjzVDHmEpmOpngfP350oFo74W7funOTfjT tipQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=weedpLZSxXWVJh6Mq8AZeRZyHNVXA0yXoLLHsvv4P0Q=; fh=zqpqB8pV2nBNgZtvnwx+ZO2aTLltffpWxBLXeLzvEXU=; b=AgqeUrGTSDuGw4XespqODZBqgki4U82ihv2cx5ZxArszK2cib7dZ4NL3/24vtxSNtM AKQFSMQyk0K/asiP+2KB/RBbPMg9oj4l5en5FDAuxr2pV9lNpPLP5Ed6w1oonMcduEpM zUrc0rczkWkb1UWZqrfhIdvy9U9yr078IFExua6SFnYT8BkIEgKrClLkez2/ohPLqRGg nacgeUOcop7v/RLBT+dG8jyPA+DRHafsAOyyuetKFmUBuCzUMUdUUFl9lbM4rnKkR1R9 7U0vjQaZemNSnN+zHtT4INAftv7B4lSkg3ohtcokj/WE0Ke/F8vrI0kVrQXWi3VXak4s UE5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H3lD0voR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jw11-20020a170903278b00b001b8419bd0f5si2402017plb.254.2023.08.04.16.58.03; Fri, 04 Aug 2023 16:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H3lD0voR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230095AbjHDVqJ (ORCPT + 99 others); Fri, 4 Aug 2023 17:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbjHDVqI (ORCPT ); Fri, 4 Aug 2023 17:46:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A68CF7 for ; Fri, 4 Aug 2023 14:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691185521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=weedpLZSxXWVJh6Mq8AZeRZyHNVXA0yXoLLHsvv4P0Q=; b=H3lD0voRETVHJIpYCn9GbCJ2Xg70co4T18DPWZ6NVTAA+SvLVgvSLDPa4O/9xQXAxyAH7/ cyEPu8QAIgRYojKkR3IewDCxWE1dSFMgZ5PHKrgk2DIqS5A95Q1GKfyuJb6O3weef6BLts gcsyhYDGFCviU4dgeT/7BvWQ7CElSDA= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-peg0BYo6NZGM_AvL3PLAlw-1; Fri, 04 Aug 2023 17:45:20 -0400 X-MC-Unique: peg0BYo6NZGM_AvL3PLAlw-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-99bcf6ae8e1so158635266b.0 for ; Fri, 04 Aug 2023 14:45:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691185519; x=1691790319; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=weedpLZSxXWVJh6Mq8AZeRZyHNVXA0yXoLLHsvv4P0Q=; b=AYe12BjD9dy0f00zoVqVK/Fv3b5iJxrZckLLFc5by8JRFNtDIYnkHbx4V9I0GObajT 7eH7FmdbKeMuGWsuSz0mjCGa9SiTI/OfFAp1WtqF31EI2j5WNspHr9aSPffeVuwlJ2xu b5+/TkiyWaTEm39iOU2FkvRXhC47MrZ9r5SDPfukXdDbtYgWUZSxeeHO8GN3kPoEmyJE +BLxaSA/DLaxA5pluqQgFtKKtcUGJEEkN2yM8zWyL6NGDDXZIWpRz8AHj69bi/50lQnG Fls5gY5A87WOHShYyymoWMA9f3eq300hxfqiyt0+CRCehqidCsHo6/+0bOpBTNPp9+N6 68fQ== X-Gm-Message-State: AOJu0YymFTEM7n9pupyrqli92vif4IAJEEbGrCNX5U7tqNaUsFFzbLaz 4welBvXb7xxCXuJ53Tb/JZfRhclbvviHpx5ECTzjRT3IAjDLV9UJk0zfGo7EmojzoDcz2Fz0p80 pQHJHSiUEzD0yfj2QS55/gpVpDwH9bAM0 X-Received: by 2002:a17:906:2d9:b0:99c:b65b:54eb with SMTP id 25-20020a17090602d900b0099cb65b54ebmr298066ejk.59.1691185518916; Fri, 04 Aug 2023 14:45:18 -0700 (PDT) X-Received: by 2002:a17:906:2d9:b0:99c:b65b:54eb with SMTP id 25-20020a17090602d900b0099cb65b54ebmr298057ejk.59.1691185518541; Fri, 04 Aug 2023 14:45:18 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id u26-20020a170906c41a00b0099bcdfff7cbsm1811438ejz.160.2023.08.04.14.45.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Aug 2023 14:45:17 -0700 (PDT) Message-ID: Date: Fri, 4 Aug 2023 23:45:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v5 11/19] KVM:VMX: Emulate read and write to CET MSRs Content-Language: en-US To: Sean Christopherson , Chao Gao Cc: Yang Weijiang , peterz@infradead.org, john.allen@amd.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, rick.p.edgecombe@intel.com, binbin.wu@linux.intel.com References: <20230803042732.88515-1-weijiang.yang@intel.com> <20230803042732.88515-12-weijiang.yang@intel.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/4/23 23:27, Sean Christopherson wrote: >>> + >>> + if (!kvm_cpu_cap_has(X86_FEATURE_SHSTK) && >>> + !kvm_cpu_cap_has(X86_FEATURE_IBT)) >>> + return false; >>> + >>> + return msr->host_initiated || >>> + guest_cpuid_has(vcpu, X86_FEATURE_IBT) || >>> + guest_cpuid_has(vcpu, X86_FEATURE_SHSTK); > > Similar to my suggestsion for XSS, I think we drop the waiver for host_initiated > accesses, i.e. require the feature to be enabled and exposed to the guest, even > for the host. No, please don't. Allowing host-initiated accesses is what makes it possible to take the list of MSR indices and pass it blindly to KVM_GET_MSR and KVM_SET_MSR. This should be documented, will send a patch. Paolo