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.8 required=3.0 tests=BAYES_00, 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 5D2F0C433E0 for ; Tue, 16 Feb 2021 14:27:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B19FE64DF5 for ; Tue, 16 Feb 2021 14:27:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B19FE64DF5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C05066B0005; Tue, 16 Feb 2021 09:27:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB6626B0006; Tue, 16 Feb 2021 09:27:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF3526B006C; Tue, 16 Feb 2021 09:27:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9A7CC6B0005 for ; Tue, 16 Feb 2021 09:27:47 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5D19B18260C82 for ; Tue, 16 Feb 2021 14:27:47 +0000 (UTC) X-FDA: 77824359774.25.idea34_5309a3427644 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 37F3D18244EF7 for ; Tue, 16 Feb 2021 14:27:47 +0000 (UTC) X-HE-Tag: idea34_5309a3427644 X-Filterd-Recvd-Size: 3679 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Tue, 16 Feb 2021 14:27:46 +0000 (UTC) IronPort-SDR: Jx13rpqPLz0flw8rKcpY1umdHC+8b1034AkmlImgCC7M0qXkjEt1XgpBTwCfhEkWBmW3z2AMJX ie+s3qUoxaKw== X-IronPort-AV: E=McAfee;i="6000,8403,9896"; a="182970713" X-IronPort-AV: E=Sophos;i="5.81,183,1610438400"; d="scan'208";a="182970713" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 06:27:43 -0800 IronPort-SDR: ThwpGTtQSrKj2L5J++R7kRAaYrsFAGgNMPzszjt/nfS590J9RyvezIZQwrRDiOLD5rA4re238n U4UgUV7B7iRQ== X-IronPort-AV: E=Sophos;i="5.81,183,1610438400"; d="scan'208";a="493307642" Received: from tassilo.jf.intel.com ([10.54.74.11]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 06:27:43 -0800 Date: Tue, 16 Feb 2021 06:27:41 -0800 From: Andi Kleen To: Joerg Roedel Cc: Peter Zijlstra , 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: <20210216142741.GI365765@tassilo.jf.intel.com> References: <7515a81a-19e-b063-2081-3f5e79f0f7a8@google.com> <20210212131907.GI5453@suse.de> <20210212145318.GK5453@suse.de> <20210212152813.GA28884@suse.de> <20210212161849.GB28884@suse.de> <20210216100045.GE28884@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210216100045.GE28884@suse.de> 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: > > 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. An malicious user process in the guest could set user RSP to a kernel address. But yes without that it's probably not a problem due to SMAP. It really boils down if we consider this combination of "malicious hypervisor and malicious user process together" to be a threat. At least in the classical TDX model malicious guest process was out of scope. So considering it would be a new requirement. For the kernel exit we could handle it by checking if the RSP address is in the kernel, and killing the process before switching the stack. It's just a problem for the entry, which probably would really need an IST. For the IST we would need to handle two level nesting, but I presume that would be possible. It should be much simpler than the NMI nesting with just a single stack switch. I think the IST solution should at least be explored before dismissing it. It might be simpler than anything else (like using new APIs) -Andi