From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3657EC433DB for ; Fri, 12 Feb 2021 21:59:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 02E2B64E36 for ; Fri, 12 Feb 2021 21:59:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02E2B64E36 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7427F8D009F; Fri, 12 Feb 2021 16:59:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F3198D0060; Fri, 12 Feb 2021 16:59:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 606FB8D009F; Fri, 12 Feb 2021 16:59:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 49CD58D0060 for ; Fri, 12 Feb 2021 16:59:07 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1A9A318264E5D for ; Fri, 12 Feb 2021 21:59:07 +0000 (UTC) X-FDA: 77810981934.24.force41_4b0fa4827624 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id ECEFB1A4A0 for ; Fri, 12 Feb 2021 21:59:06 +0000 (UTC) X-HE-Tag: force41_4b0fa4827624 X-Filterd-Recvd-Size: 4036 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 12 Feb 2021 21:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jcxVJHE5KLCeiI5FWvac2Y2Ys9ABkVH6v5IRoXfb+DY=; b=FlfqIFuC9c+M97MCsDw4+tczb7 7SJe3ox4rdJW6Bv9bSQMKAcrow37w6TwagXE5+7zfbMN3JwimOF2kzt6DdlQ9qDSIkX58W8TMBzju QBVt+tHqARyKBuW81exLh5K0ohh1D67vsLTigAk75g8lFm88s0jaYCQndBHiDSnrgxyG6qb5hS9LJ 60kMXqqZLD6Ag/wboF2Kq4xoFXeos0TKvi3JkRe4/rkUQuBHSZl3O68i7EndoawD91DHw2i61jZBU AR0ayW9xWqinHZmS/+a+QV1FJgv7OVXCDxIAlT+S/QUrlwq7UOCWVUSiSclQ8yXpgcwIrKMU6wqCC VHluxC3Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAgSl-0006zH-U9; Fri, 12 Feb 2021 21:58:56 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id D90E5983406; Fri, 12 Feb 2021 22:58:52 +0100 (CET) Date: Fri, 12 Feb 2021 22:58:52 +0100 From: Peter Zijlstra To: Andi Kleen Cc: Joerg Roedel , David Rientjes , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , "Kirill A. Shutemov" , Brijesh Singh , Tom Lendacky , Jon Grimm , Thomas Gleixner , Christoph Hellwig , Paolo Bonzini , Ingo Molnar , x86@kernel.org, linux-mm@kvack.org Subject: Re: AMD SEV-SNP/Intel TDX: validation of memory pages Message-ID: <20210212215852.GL8912@worktop.programming.kicks-ass.net> References: <7515a81a-19e-b063-2081-3f5e79f0f7a8@google.com> <20210212131907.GI5453@suse.de> <20210212145318.GK5453@suse.de> <20210212152813.GA28884@suse.de> <20210212214205.GF365765@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210212214205.GF365765@tassilo.jf.intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Feb 12, 2021 at 01:42:05PM -0800, Andi Kleen wrote: > > > I don't know the details about TDX and #VE, but could a malicious HV not > > > trigger a #VE basically everywhere by mapping around pages? So 'fail' > > > means panic() in this case, right? > > > > Right. > > Well we might not be able to reliably panic if we don't run on a IST > if it hits the syscall gap. Otherwise you might end up with panic > running on the ring 3 stack. > > Given it's a bit muddled threat model - would need both a > malicious process in the hypervisor and inside the secure guest, > but I presume that's possible. > > That seems to argue that an IST for #VE is actually required. But AFAI recursive #VE is entirely possible. The moment #VE reads that ve_info thing, NMIs can happen, which can trigger another #VE which then clobbers your stack and we're irrecoverably screwed again. (also, inhibiting NMI is a seriously dodgy hack, the very last thing x86 needs is is more ductape on the recursion rules) Repeat after me: ISTs aren't a solution but part of the problem. If TDX requires IST, it's architecturally bankrupt. There is much talk elsewhere in this thread about validated pages; have the TDX module hard guarantee certain pages are available and will not *ever* generate #VE. TDX module can kill the guest, but must not #VE. Without something like that it's a complete and utter non-starter.