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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 8CABFC433DB for ; Tue, 16 Feb 2021 10:00:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CA64F64DA1 for ; Tue, 16 Feb 2021 10:00:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA64F64DA1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2B4848D0168; Tue, 16 Feb 2021 05:00:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 264628D0140; Tue, 16 Feb 2021 05:00:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 154678D0168; Tue, 16 Feb 2021 05:00:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 006548D0140 for ; Tue, 16 Feb 2021 05:00:49 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B3D1F1801D3D7 for ; Tue, 16 Feb 2021 10:00:49 +0000 (UTC) X-FDA: 77823687018.30.4D10A28 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf05.hostedemail.com (Postfix) with ESMTP id 27419E0011E3 for ; Tue, 16 Feb 2021 10:00:48 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D3B17ACBF; Tue, 16 Feb 2021 10:00:47 +0000 (UTC) Date: Tue, 16 Feb 2021 11:00:45 +0100 From: Joerg Roedel To: Peter Zijlstra Cc: David Rientjes , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , "Kirill A. Shutemov" , Andi Kleen , 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: <20210216100045.GE28884@suse.de> References: <7515a81a-19e-b063-2081-3f5e79f0f7a8@google.com> <20210212131907.GI5453@suse.de> <20210212145318.GK5453@suse.de> <20210212152813.GA28884@suse.de> <20210212161849.GB28884@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: offpkcbbktx1o1pcstsquchm4pkeujbe X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 27419E0011E3 Received-SPF: none (suse.de>: No applicable sender policy available) receiver=imf05; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1613469648-580849 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 05:45:11PM +0100, Peter Zijlstra wrote: > I really don't want #VE to be IST. I really *really* detests ISTs, > they're an unmitigated trainwreck. > > But you're right, if a HV injects #VE in the syscall gap and gets a > concurrent CPU to 'fix' the exception frame (which then lives on the > user stack) the handler might never know it went ga-ga. > > Is this something the TDX thread model covers? A malicous HV and a TDX > guest co-operating to bring down the guest kernel. If the guest is not malicous, and you have a valid user-stack in the SYSCALL gap, then it depends on whether SMAP is active. I guess it usually is, in which case the #VE would be promoted to a #DF to kill the machine. But since we don't trust user-space either in a TDX guest, it must be expected that user RSP points to something clever within the kernel. And in this case making #VE an IST handler will be the only help. Note that a TDX guest doesn't need to be kept alive in this situation, but we must make sure it can reliably crash. Otherwise a naughty HV has a chance to take control of the code-flow in the guest to make it reveal its secrets. Regards, Joerg