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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3FB9C433FE for ; Tue, 23 Nov 2021 08:55:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 234FC6B0074; Tue, 23 Nov 2021 03:55:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BECA6B0075; Tue, 23 Nov 2021 03:55:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 037A66B0078; Tue, 23 Nov 2021 03:55:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id E677D6B0074 for ; Tue, 23 Nov 2021 03:55:20 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A20A8182AD9DE for ; Tue, 23 Nov 2021 08:55:10 +0000 (UTC) X-FDA: 78839585538.11.40A4052 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf24.hostedemail.com (Postfix) with ESMTP id 0B367B0000B8 for ; Tue, 23 Nov 2021 08:55:06 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AB37E21709; Tue, 23 Nov 2021 08:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1637657708; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZLZuQ6koNaswA+CFy6l66aMDFMx1Xmt74WFtd9eJ/c0=; b=NZNB751fkQLisImTSn25U7tN26nqjh3/ICTqluWuMyK5oS5sqVIqIsjmwUAVw3NgKu78UV ELDic3N1var7dh+IvywCYg/Hm06/eN1ZCrjsXZxaaEV1ALPBn000An1xxVhWTyXdjqyDAI Nynx+GjM0dVOGH/yRwwTLspKGe1WQX0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1637657708; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZLZuQ6koNaswA+CFy6l66aMDFMx1Xmt74WFtd9eJ/c0=; b=GMq9ZhLzZfzykiNQfmW00d7KVJ9pBZnEpvpBjb//lcfh6djgw70wiuzCQPWeKA3ZYmUNIm wbTVDYxI/6fILgDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3C50613B58; Tue, 23 Nov 2021 08:55:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8ZEGDmysnGEsBgAAMHmgww (envelope-from ); Tue, 23 Nov 2021 08:55:08 +0000 Message-ID: <303c4bb7-ad0f-7686-d4e6-b0640823cbc9@suse.cz> Date: Tue, 23 Nov 2021 09:55:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH Part2 v5 00/45] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support Content-Language: en-US To: Dave Hansen , Brijesh Singh , Peter Gonda Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Michael Roth , "Kirill A . Shutemov" , Andi Kleen , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com References: <20210820155918.7518-1-brijesh.singh@amd.com> <5f3b3aab-9ec2-c489-eefd-9136874762ee@intel.com> <38282b0c-7eb5-6a91-df19-2f4cfa8549ce@intel.com> From: Vlastimil Babka In-Reply-To: <38282b0c-7eb5-6a91-df19-2f4cfa8549ce@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0B367B0000B8 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=NZNB751f; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=GMq9ZhLz; dmarc=none; spf=pass (imf24.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Stat-Signature: s69zth7ha4ycd7d9mfymiap5ys96wyk4 X-HE-Tag: 1637657706-814722 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 11/22/21 23:51, Dave Hansen wrote: > On 11/22/21 12:33 PM, Brijesh Singh wrote: >>> How do we, for example, prevent ptrace() from inducing a panic()? >> >> In the current approach, this access will induce a panic(). > > That needs to get fixed before SEV-SNP is merged, IMNHO. This behavior > would effectively mean that any userspace given access to create SNP > guests would panic the kernel. > >> In general, supporting the ptrace() for the encrypted VM region is >> going to be difficult. > > By "supporting", do you mean doing something functional? I don't really > care if ptrace() to guest private memory returns -EINVAL or whatever. > The most important thing is not crashing the host. > > Also, as Sean mentioned, this isn't really about ptrace() itself. It's > really about ensuring that no kernel or devices accesses to guest > private memory can induce bad behavior. Then we need gup to block any changes from shared to guest private? I assume there will be the usual issues of recognizing temporary elevated refcount vs long-term gup, etc. >> The upcoming TDX work to unmap the guest memory region from the >> current process page table can easily extend for the SNP to cover the >> current limitations. By "current process page table" you mean userspace page tables? > My preference would be that we never have SEV-SNP code in the kernel > that can panic() the host from guest userspace. If that means waiting > until there's common guest unmapping infrastructure around, then I think > we should wait. >