Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp214002ybp; Thu, 10 Oct 2019 16:48:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOGdcHBRXGrsJnaIM3SlQzoUsVuoKp5GFF4zQQNq9WQfBoFqqhM5JdBS8Va/OFC27gzGuv X-Received: by 2002:aa7:d908:: with SMTP id a8mr10727403edr.49.1570751301213; Thu, 10 Oct 2019 16:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570751301; cv=none; d=google.com; s=arc-20160816; b=G23F58I/y83hBTc9PLpyd6zT/1a8MJHvHrLaRMEq2SAsvEMYkNibV+uHaqV3nNrRC4 sWm++HOUgGzCskpRdC/dsS6Pb5cV2wqClZCl278HukyxMFERN9Z3hf+/pR9YJLt9x7oh 5xcjVhzz0k0UWCi8TCJoerjKyBkOW7c0/CiltOcN9P8URKh8bIH8FkoanjPmrSQ+jzHm rYNIJxOi63NU5eURiLMvQ77Ph0SkEJeSxmvPXv4UwQX5EDUuiyzfRxC9nMK1mYKqtf9V PtAFWvpFxEnk+65xKlz4bWJjV1N3BQmiUMQyDzai1IBOLWlYpgT1LZFOyJSKRf6ihNCn pgYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0Tn2P8fhQIwWSUcG8Ny4e4ny/sLUaj89L7ixuEf482Q=; b=aZPWGLDEziuheItTLZed8uMgSpg8O4M7MP92DnjImQEHqXgyapPcexqY0L7SE5tcmp 0gsSCZmrJ9oU0/VphmOjyTWbbg6/XEK5lJGxAgfWp7C7efqL+sBWb9Z0tuCtAUitn49/ sQMMgifje56AYCOSzHSF8dadeKgUjgBOX2jyxLlqtv6mDi46U2j/lXL8JINvn3Kkg/E1 HmLQyjFep5651Z7qEm3EAi9N1LCXJDQu18VQ5vtHzE7RZGG+IJ630m3Yj9e7U5BmjtKK G4p+v8HRjqXS/DUereyiCpP01iypTQ70mpdp/H7fboryJp769aGsOiPo2yBE5I5cCl6J uT5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SQSqMQwO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k6si4027981ejc.399.2019.10.10.16.47.55; Thu, 10 Oct 2019 16:48:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SQSqMQwO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbfJJXoa (ORCPT + 99 others); Thu, 10 Oct 2019 19:44:30 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:45759 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725845AbfJJXoa (ORCPT ); Thu, 10 Oct 2019 19:44:30 -0400 Received: by mail-io1-f67.google.com with SMTP id c25so17563650iot.12 for ; Thu, 10 Oct 2019 16:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0Tn2P8fhQIwWSUcG8Ny4e4ny/sLUaj89L7ixuEf482Q=; b=SQSqMQwOhvRWiFoM/d8fnha7YNV8lyIvctWJ7jkN5lsCe2eRcYoIjFYEY3PXVXbD0P EECgrtNOeQ3b2Bnb8HMiD+zFD5Ge/laomPtOWcPoT55NsodLXiCL+OAV1bnguJPvy7au lmV5NJH3l+5KzRSLpe4oG11fnx8/xaL5cO25g6Ew72qGMPFjCMCM72B0PnHvN1ESxQj1 1gWpAyp59kEr3hHzPdOjCcXt5f6MLTp5xOk4LG6ACFd1y/IcErqwx4LKv7KxzvTbLHmT qgVtxinc8NleD/3OCtbZJYrxFVy4MI2IwDQTdDE2USgwFYO+qc9Hd8MJrZAAT+k/TCsF Ctsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0Tn2P8fhQIwWSUcG8Ny4e4ny/sLUaj89L7ixuEf482Q=; b=jhfkeYDfDAoV5LIg/3sIeVNLN5zwrgGrrA/jd5xEEtkCfGAS5KywyzzMKeeYZQHaz2 4xYZLQbFChD6n9MKRXfs8ENSMTN0BoEPZ4X9/znE3akQqUNrjj0VH53EK9f/l/aV/wBq UMsmEo3vK98TlTXdr1QQ8NcqA7q0eEEPJfglAk63P9U5llbmS75RN0hjnGEQE6SQLnUk mwFV4ykXxhdQmTEMzwvFhYmEibSbe7TMPm+jyAzw6w2fmKF2bve8f2zPnancxIFfBPhi CcouFJb7A5NsS/iKsKn7BEL0W9uPy1jjCFD+uXgs8J8i60nEzfRa+IuHYtvwtF7NsTvv TOOQ== X-Gm-Message-State: APjAAAX323Oha7eJntpt1220JUoJU8pUEzmEECGaUf0hxZVTLZXVIRKY jvt4F2mjAPiECOS5UxgYjLIkWuxzj7uwUt1DXoUW1g== X-Received: by 2002:a6b:6f0a:: with SMTP id k10mr4331789ioc.118.1570751069096; Thu, 10 Oct 2019 16:44:29 -0700 (PDT) MIME-Version: 1.0 References: <20190927021927.23057-1-weijiang.yang@intel.com> <20190927021927.23057-5-weijiang.yang@intel.com> <20191009064339.GC27851@local-michael-cet-test> <20191010013027.GA1196@local-michael-cet-test.sh.intel.com> In-Reply-To: <20191010013027.GA1196@local-michael-cet-test.sh.intel.com> From: Jim Mattson Date: Thu, 10 Oct 2019 16:44:17 -0700 Message-ID: Subject: Re: [PATCH v7 4/7] KVM: VMX: Load Guest CET via VMCS when CET is enabled in Guest To: Yang Weijiang Cc: kvm list , LKML , Paolo Bonzini , Sean Christopherson , "Michael S. Tsirkin" , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 9, 2019 at 6:28 PM Yang Weijiang wrote: > > On Wed, Oct 09, 2019 at 04:08:50PM -0700, Jim Mattson wrote: > > On Tue, Oct 8, 2019 at 11:41 PM Yang Weijiang wrote: > > > > > > On Wed, Oct 02, 2019 at 11:54:26AM -0700, Jim Mattson wrote: > > > > On Thu, Sep 26, 2019 at 7:17 PM Yang Weijiang wrote: > > > > > + if (cet_on) > > > > > + vmcs_set_bits(VM_ENTRY_CONTROLS, > > > > > + VM_ENTRY_LOAD_GUEST_CET_STATE); > > > > > > > > Have we ensured that this VM-entry control is supported on the platform? > > > > > > > If all the checks pass, is it enought to ensure the control bit supported? > > > > I don't think so. The only way to check to see if a VM-entry control > > is supported is to check the relevant VMX capability MSR. > > > It's a bit odd, there's no relevant CET bit in VMX cap. MSR, so I have > to check like this. Bit 52 of the IA32_VMX_ENTRY_CTLS MSR (index 484H) [and bit 52 of the IA32_VMX_TRUE_ENTRY_CTLS MSR (index 490H), on hardware that supports the "true" VMX capability MSRs] will be 1 if it is legal to set bit 20 of the VM-entry controls field to 1. > > BTW, what about the corresponding VM-exit control? > The kernel supervisor mode CET is not implemented yet, so I don't load host CET > states on VM-exit, in future, I'll add it. If you don't clear the supervisor mode CET state on VM-exit and the guest has set IA32_S_CET.SH_STK_EN, doesn't that mean that supervisor-mode shadow stacks will then be enabled on the host after VM-exit?