Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp246837pxb; Wed, 3 Feb 2021 04:43:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjp7Yd7mtiHGHsi7NPEUedyAv2Rt5mTbjGYzDdSAUA1ZZ5wGqxghxsAVq7SkEr6By1rW+3 X-Received: by 2002:a17:906:c448:: with SMTP id ck8mr3019465ejb.55.1612356208090; Wed, 03 Feb 2021 04:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612356208; cv=none; d=google.com; s=arc-20160816; b=Vh/nuGEoEwmufjLVtx18+T8Rmr7pYy8u3P7Ji8qJbDgTj6Ixvb40fE+zo8OVLRabwm gu0pkxsIO6Bq9B1l5ZfC6lnH4U650d1F/TXd5HEkkPm/iC+Ej29VBnZF1WHY6u3jDPWd VZvy6OOx9LAeohQsYMEwfmedUHHtZoWpJM3Nw/RRM7r1G9g44bS6ecPtHyOjDUAwHBIO JoQRNBLFbtAJtOQZIXVFJLLQKt61LBEckg6Imh8+JA38Ps55sO84CA2EmDnbOY3KKMje QgH2qRZ3/R/16TjxiqFDdYblXYU5gp7InmZz0On0EyXWlc181vZE9BHG3ZTF3pCdThkL 48LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ShpPYTvXC1QZW794cxDqP5Ce8luBrirDryFdaZVPazQ=; b=RekPwW68XPiKg24bpQzHMI53btVxcWvXPnr7LplVu6ik7Pvd4z0fBy5KgJlLG/3F/G L/dUjAcagP9U5sLbZm6uQV4Hi1aMzEeV7MomQqrTplFLpJxbyFrNpoChHni2uF8dDnQz z0eLoaSAaLRsxLzuhznchTKnCQU/defdwOnfkpEDVhIj1KRwR0jgRorivT0V54wgcUV9 oFi3Etmgow26KcbpoEIgEQl7maJzeBgWq2yzdQR4zERqzvSFKb8ln7Y+06fRy0Js2+4r m2R9doJdUHJFcboDpd9X5Tf0gfnpjr9GEUOtOZ3Rs6MdRQeeliypkUZvLDWqc2TtjXJo 8AeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ez8fAf0G; 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 e6si1375375edz.98.2021.02.03.04.43.01; Wed, 03 Feb 2021 04:43:28 -0800 (PST) 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=ez8fAf0G; 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 S230191AbhBCMln (ORCPT + 99 others); Wed, 3 Feb 2021 07:41:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41284 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231153AbhBCMli (ORCPT ); Wed, 3 Feb 2021 07:41:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612356010; 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=ShpPYTvXC1QZW794cxDqP5Ce8luBrirDryFdaZVPazQ=; b=ez8fAf0GNCPtj69mASG/uNzGbtjpk+b7jvwiDv+SNAnznYlmxoWep9djlmZbU+NKvj7vXJ X9pYSDt0QdY2AAYXJvFpJ4h1sEM27IX063hUJvUzXNABvZjq/T/rOz9Z6gqO7/fr9QDloJ HiMWBwuuDSFcyuL6pZk7rtkmS63KT+Q= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-311-wlv0rgPWOLOtBZkO4HkrbA-1; Wed, 03 Feb 2021 07:40:05 -0500 X-MC-Unique: wlv0rgPWOLOtBZkO4HkrbA-1 Received: by mail-ed1-f72.google.com with SMTP id bo11so4898398edb.0 for ; Wed, 03 Feb 2021 04:40:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ShpPYTvXC1QZW794cxDqP5Ce8luBrirDryFdaZVPazQ=; b=P17gNWr2tMXd27YVz5MHQd25zFECvWNk5PPdn2xOqF1psv3+5OlYujvIax6WdkElBZ E6dZc6A20VSzA4Ji19dljTzDrXQ7IScOsIsYVH+qWXewP9+bZSbZLCEpj6PJkBLxvGPM D7w66eWUDaXM9k7Jby0N8AyrY1flimmXtRbRzqRAWPsYy0MVzsovOq9h86fIIxjotFNI LH+xtgWnR5Xt5opgMZOov86pHV565KvR3KAgZiv4nR6f5TRhplv5b60DfogtFfZkt0BH L1r2gltG4Uk58zVsQgPd5YxEM7PF0jDccLtl3UFfe9q2mSG94vL3gHBdFSvYSeTxbkQS eyKw== X-Gm-Message-State: AOAM533XPcIrm8IloFCTilZaBwa0AIVPmOSkHUXJ8JLXkEhOJMpxwErD 2FZJltQKj7PVLfTJUmaGaVz4Vm3TmUtJWUwNBIK53SaWtE05vLG1aHiBRIGYj+LLncRXxrv1E1E zxdKBIGsqYky2unb3QlrnqZIy X-Received: by 2002:a17:906:1241:: with SMTP id u1mr2393976eja.196.1612356003814; Wed, 03 Feb 2021 04:40:03 -0800 (PST) X-Received: by 2002:a17:906:1241:: with SMTP id u1mr2393878eja.196.1612356002595; Wed, 03 Feb 2021 04:40:02 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x42sm830572ede.64.2021.02.03.04.40.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Feb 2021 04:40:01 -0800 (PST) Subject: Re: [PATCH v15 00/14] Introduce support for guest CET feature To: Yang Weijiang , seanjc@google.com, jmattson@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yu.c.zhang@linux.intel.com References: <20210203113421.5759-1-weijiang.yang@intel.com> From: Paolo Bonzini Message-ID: Date: Wed, 3 Feb 2021 13:40:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210203113421.5759-1-weijiang.yang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/02/21 12:34, Yang Weijiang wrote: > Control-flow Enforcement Technology (CET) provides protection against > Return/Jump-Oriented Programming (ROP/JOP) attack. There're two CET > subfeatures: Shadow Stack (SHSTK) and Indirect Branch Tracking (IBT). > SHSTK is to prevent ROP and IBT is to prevent JOP. > > Several parts in KVM have been updated to provide guest CET support, including: > CPUID/XSAVES settings, MSR passthrough, user-space MSR access interface, > vmentry/vmexit config, nested VM etc. These patches are dependent on CET > kernel patches for XSAVES support and CET definitions, e.g., MSR and related > feature flags. > > CET kernel patches: refer to [1], [2]. > > Previous CET KVM patches: refer to [3]. > > CET QEMU patches: refer to [4]. > > CET KVM unit-test patch: refer to [5]. > > [1]: CET Shadow Stack patches v18: > https://lkml.kernel.org/linux-api/20210127212524.10188-1-yu-cheng.yu@intel.com/ > > [2]: Indirect Branch Tracking patches v18: > https://lkml.kernel.org/linux-api/20210127213028.11362-1-yu-cheng.yu@intel.com/ > > [3]: CET KVM patches v14: > https://lkml.kernel.org/kvm/20201106011637.14289-1-weijiang.yang@intel.com/ > > [4]: CET QEMU patches: > https://patchwork.ozlabs.org/project/qemu-devel/patch/20201013051935.6052-2-weijiang.yang@intel.com/ > > [5]: CET KVM unit-test patch: > https://patchwork.kernel.org/project/kvm/patch/20200506082110.25441-12-weijiang.yang@intel.com/ > > Changes in v15: > - Changed patches per Paolo's review feedback on v14. > - Added a new patch for GUEST_SSP save/restore in guest SMM case. > - Fixed guest call-trace issue due to CET MSR interception. > - Removed unnecessary guest CET state cleanup in VMCS. > - Rebased patches to 5.11-rc6. > > > Sean Christopherson (2): > KVM: x86: Report XSS as an MSR to be saved if there are supported > features > KVM: x86: Load guest fpu state when accessing MSRs managed by XSAVES > > Yang Weijiang (12): > KVM: x86: Refresh CPUID on writes to MSR_IA32_XSS > KVM: x86: Add #CP support in guest exception dispatch > KVM: VMX: Introduce CET VMCS fields and flags > KVM: x86: Add fault checks for CR4.CET > KVM: VMX: Emulate reads and writes to CET MSRs > KVM: VMX: Add a synthetic MSR to allow userspace VMM to access > GUEST_SSP > KVM: x86: Report CET MSRs as to-be-saved if CET is supported > KVM: x86: Enable CET virtualization for VMX and advertise CET to > userspace > KVM: VMX: Pass through CET MSRs to the guest when supported > KVM: nVMX: Add helper to check the vmcs01 MSR bitmap for MSR > pass-through > KVM: nVMX: Enable CET support for nested VMX > KVM: x86: Save/Restore GUEST_SSP to/from SMRAM > > arch/x86/include/asm/kvm_host.h | 4 +- > arch/x86/include/asm/vmx.h | 8 ++ > arch/x86/include/uapi/asm/kvm.h | 1 + > arch/x86/include/uapi/asm/kvm_para.h | 1 + > arch/x86/kvm/cpuid.c | 26 +++- > arch/x86/kvm/emulate.c | 11 ++ > arch/x86/kvm/vmx/capabilities.h | 5 + > arch/x86/kvm/vmx/nested.c | 57 ++++++-- > arch/x86/kvm/vmx/vmcs12.c | 6 + > arch/x86/kvm/vmx/vmcs12.h | 14 +- > arch/x86/kvm/vmx/vmx.c | 202 ++++++++++++++++++++++++++- > arch/x86/kvm/x86.c | 67 ++++++++- > arch/x86/kvm/x86.h | 10 +- > 13 files changed, 387 insertions(+), 25 deletions(-) > Queued, though not for 5.12 unless the bare metal support is there too. Paolo