Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp854876ybz; Sat, 25 Apr 2020 05:51:09 -0700 (PDT) X-Google-Smtp-Source: APiQypI4wcUnpw+EE0gQDs4gWdxG6gGo+2NPPlsLNeMOOm2oYUmx5nYuy8FZR0tkk3hdz1ov9nwR X-Received: by 2002:a05:6402:2293:: with SMTP id cw19mr6089094edb.351.1587819069523; Sat, 25 Apr 2020 05:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587819069; cv=none; d=google.com; s=arc-20160816; b=seA/KgwVUtVGeGk93KHHP4KZvL0acPqhbOnC6Eyz5ZSRkjnBuIEA+Z2A0kAmPQ779J vmfK5wrXzZ8UiopEunOzgu8qHMNJBRtL/JTeY/12YV6jYICHaVC2WSd8mFw9+DLK+3iD wNjuDUwb/Vi+/9q6DXS7w6Wr9WC4n6BUw/lh0YiOzdTG6Iq+H4PTj0D4CeaQkekews3e 45QVx2tSOxkyR/Rsk6qxqDULK1PoqWfRC4hLbeM+knAaqE1EAoK7qLrlsoBp9xzeNLbt MltdBCparRmMda6I9UMcCdLseRtBi3fPiChez0d4BXA97YvW1qO1EpJ/DPUZABNGY5ep CwWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=h9QG0UkaOhiANdnnkDMwADm36DVqvvO3pcviWa3yfrI=; b=esz6X0tbaRRQc7/158V60tmMo8aJt9ewqrREsSHlbQIuwp16M2ma8yBHkEMbLuvsgY F7W+yroy+1GmlpEAajmdqfyf4G1AdwuCXZbLX0ZPKmyqudp0lXCo12uUJSzV/XtsOsg3 THRBjv4CQk+AqaexcES5iYqifutUuzjbwavCI5z6mGSpKOov8f+2rmvI1xkvfcFtK4iz an5yfbgPawYvIfo07vCZaWJfgvj1clg8yqC0Aa2EO+haAvG+bmhwnaKtidi7p7LNeAOg H28691foEd1YRxfwN1uwGpQPMoG+wdn234kfRA2V8ynady7i3BZyR0QyzMI68GjzEblT vBxg== ARC-Authentication-Results: i=1; mx.google.com; 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 ba9si4895414edb.114.2020.04.25.05.50.45; Sat, 25 Apr 2020 05:51:09 -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; 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 S1726112AbgDYMtP (ORCPT + 99 others); Sat, 25 Apr 2020 08:49:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:43690 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbgDYMtP (ORCPT ); Sat, 25 Apr 2020 08:49:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 08E85AD10; Sat, 25 Apr 2020 12:49:12 +0000 (UTC) Date: Sat, 25 Apr 2020 14:49:09 +0200 From: Joerg Roedel To: Dave Hansen Cc: Tom Lendacky , Mike Stunes , joro@8bytes.org, dan.j.williams@intel.com, dave.hansen@linux.intel.com, hpa@zytor.com, jgross@suse.com, jslaby@suse.cz, keescook@chromium.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, luto@kernel.org, peterz@infradead.org, thellstrom@vmware.com, virtualization@lists.linux-foundation.org, x86@kernel.org, Sean Christopherson Subject: Re: [PATCH] Allow RDTSC and RDTSCP from userspace Message-ID: <20200425124909.GO30814@suse.de> References: <20200319091407.1481-56-joro@8bytes.org> <20200424210316.848878-1-mstunes@vmware.com> <2c49061d-eb84-032e-8dcb-dd36a891ce90@intel.com> <4d2ac222-a896-a60e-9b3c-b35aa7e81a97@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d2ac222-a896-a60e-9b3c-b35aa7e81a97@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dave, On Fri, Apr 24, 2020 at 03:53:09PM -0700, Dave Hansen wrote: > Ahh, so any instruction that can have an instruction intercept set > potentially needs to be able to tolerate a #VC? Those instruction > intercepts are under the control of the (untrusted relative to the > guest) hypervisor, right? > > >From the main sev-es series: > > +#ifdef CONFIG_AMD_MEM_ENCRYPT > +idtentry vmm_communication do_vmm_communication has_error_code=1 > +#endif The next version of the patch-set (which I will hopefully have ready next week) will have this changed. The #VC exception handler uses an IST stack and is set to paranoid=1 and shift_ist. The IST stacks for the #VC handler are only allocated when SEV-ES is active. > That's a fun point because it means that the (untrusted) hypervisor can > cause endless faults. I *guess* we have mitigation for this with our > stack guard pages, but it's still a bit nasty that the hypervisor can > arbitrarily land a guest in the double-fault handler. > > It just all seems a bit weak for the hypervisor to be considered > untrusted. But, it's _certainly_ a steep in the right direction from SEV. Yeah, a malicious hypervisor can do bad things to an SEV-ES VM, but it can't easily steal its secrets from memory or registers. The #VC handler does its best to just crash the VM if unexpected hypervisor behavior is detected. Regards, Joerg