Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4236178pxb; Mon, 8 Feb 2021 11:06:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKfeFGg4GjntyrpW1jrD5dqh832Hq/Yc++NkW46+OYqEYt7dS2CEj04XPDUTKTd0abxgbH X-Received: by 2002:a17:907:2088:: with SMTP id pv8mr17981654ejb.131.1612811165182; Mon, 08 Feb 2021 11:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612811165; cv=none; d=google.com; s=arc-20160816; b=aSwLDuzvn9YqMFgPsvyuM8+Kr12jyeNCkY7/zqR+nuHQ0by/6GUFdBbT/rqShvxiEj mq9dWzggxklKNRBQn17hhSuoKlNPPjRJDTLr3Oo6KKmFC9/JMifMkDvofaf3aAC9zBi7 kPqpJ+4aEMQ/7WGa0cESDLYPqjZPCH4lqAmPkNIiLJHXbRpcsaU/V89U5snKDY5a955B z5S4geH0FQG3Xk0ROb/Wsn+8he+3CjXHGs/pO3YJ6XJDX4WZvCUBIyTbI0AcTu8b70ke dUxclZQroAgTdQiht07fEbC+fb3Qj4P3LeiI3a4xuzhCENXSKogZQ4RnlIBPF/1kOz0D HbPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=rk8hBnqzSk8IKdehPpMR21St3g94W00HJk2pGpZRlUM=; b=HuAvbXYLKuGVqXxG/bpEk4zayUx+t949ZyqpCG6Ydp/GFcQ+dk3X9LYVPXe7oB84hO SX3sLqktlIgf0U/P1DIE9/0x6JnK9eafccimGSBHAQFkvKvVltTMJ28FpkSs8tkDLcrZ VoT4+XYlujr+njEewF/yWRc1cHJx9b56U46OOwVlN8Swbqya6YNqXZLetW0Af0JNPLQH Iv6EGO2J7I4lKM/3g1mH57zWwWM4/z8+uaJSg2hEGTbEqMYHV/b11vZxjIxeUJSL2Pyb lM+B7pdJFC5Crbs1iDzc73qXs3NrY+5bB3V/C9jAMc27gPN5/noa4ymwM69GXsuEy3l0 Qzdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=QhTtHeK4; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu24si11192506ejb.42.2021.02.08.11.05.39; Mon, 08 Feb 2021 11:06:05 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=QhTtHeK4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236170AbhBHTDT (ORCPT + 99 others); Mon, 8 Feb 2021 14:03:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233156AbhBHRf5 (ORCPT ); Mon, 8 Feb 2021 12:35:57 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCAF8C06178C for ; Mon, 8 Feb 2021 09:35:16 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id w1so26169710ejf.11 for ; Mon, 08 Feb 2021 09:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rk8hBnqzSk8IKdehPpMR21St3g94W00HJk2pGpZRlUM=; b=QhTtHeK4ZKTuLys3oD1ge2sDBy25LyBIlEb6rq0+qySZxVVbbXsJAxCtEVCdDmMTl4 xJGa8G4tHKClDCp26tjcgxYm16FeSmIpK+4i7WHnI+XE2uRBwY0lYjXSuIas/15OJt6j tIaPvQ+/kTOaDd6ZYQOevDvu8PIBU5OsbEXiL+XEEoZlk0H5Km4oZlZ51d3LwmbPqOAi fewTdelXJC8xS93sqoBs4f0d5De8Hp3x5fJ3xy3+1KeEA1XlNY3DWze+W2pUDB/pqWKj kEl1d/WXeDsRXO5mwXmwG6lR+EQfdrduR1Jfe6cw09ilje/B1akvhfFbAB6ZXDVhcgaT HS3w== 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=rk8hBnqzSk8IKdehPpMR21St3g94W00HJk2pGpZRlUM=; b=O9hD+/gIlUJbQc+d7yk09WIWZ/u4hYagwsRwI2fEFJ7/W1hRTRk1qiYVLRI7rGRYL+ 3SDvh3WHYKxjK9svL5nV1WVNcJsJuIg+VOUQC5EkrmxIcPtSgBSSWM4UtZcgXr6+lki8 UPpasB1yWQpsJaJWJYp+ZrhTVf6iKsc+0rJnjGNSoTMGns88qHiuYlXdguxTdWyKWlxc n1xlEGPKMiVsjHrwNr+1pNWA3TkqJo9JkT4+d7sX5Ybd6HuRs9M4hvdt1yWok7U3Z8hC lhllKVcT+naU3SwXls9WAfRsatP0YPyHRQ8HWaCgohzLrJY2BAVwOkFPh6mmVVD5/j/G hvpA== X-Gm-Message-State: AOAM530FU1kLysSq/CFyka5ghKhq83GZ8SltkAYTvbkDtALHQV7fR4tU MoHQYg82Pb6j1VXpYX+1STUA+ReK/kpmQBC0VwAttA== X-Received: by 2002:a17:906:24d1:: with SMTP id f17mr17887566ejb.503.1612805715256; Mon, 08 Feb 2021 09:35:15 -0800 (PST) MIME-Version: 1.0 References: <0A886D87-1979-419C-86DE-EA2FABDFF3EB@amacapital.net> In-Reply-To: From: Andy Lutomirski Date: Mon, 8 Feb 2021 09:35:03 -0800 Message-ID: Subject: Re: [RFC v1 09/26] x86/tdx: Handle CPUID via #VE To: Sean Christopherson Cc: Dave Hansen , "Kirill A. Shutemov" , Andy Lutomirski , Kuppuswamy Sathyanarayanan , Peter Zijlstra , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Dan Williams , Raj Ashok , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 8, 2021 at 9:11 AM Sean Christopherson wrote: > > On Sun, Feb 07, 2021, Andy Lutomirski wrote: > > > > How much of the register state is revealed to the VMM when we do a TDVMCALL? > > Presumably we should fully sanitize all register state that shows up in > > cleartext on the other end, and we should treat all regs that can be modified > > by the VMM as clobbered. > > The guest gets to choose, with a few restrictions. RSP cannot be exposed to the > host. RAX, RCX, R10, and R11 are always exposed as they hold mandatory info > about the TDVMCALL (TDCALL fn, GPR mask, GHCI vs. vendor, and TDVMCALL fn). All > other GPRs are exposed and clobbered if their bit in RCX is set, otherwise they > are saved/restored by the TDX-Module. > > I agree with Dave, pass everything required by the GHCI in the main routine, and > sanitize and save/restore all such GPRs. Sounds okay to me.