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 30EFEC433F5 for ; Wed, 24 Nov 2021 19:36:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8791E6B0074; Wed, 24 Nov 2021 14:35:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 828E96B0075; Wed, 24 Nov 2021 14:35:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A29B6B007B; Wed, 24 Nov 2021 14:35:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 5B6856B0074 for ; Wed, 24 Nov 2021 14:35:50 -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 1F9E318499AB9 for ; Wed, 24 Nov 2021 19:35:40 +0000 (UTC) X-FDA: 78844828356.11.20C4869 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf02.hostedemail.com (Postfix) with ESMTP id 8E8E27001776 for ; Wed, 24 Nov 2021 19:35:37 +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 1236921941; Wed, 24 Nov 2021 19:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1637782538; 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=9aE3EhkO73udWwtqxOb92KxXE9U0rU8t4YmlonhA+V8=; b=miE5FQ0EmpLG7PCHR31uA10N/ZFm2mNsSBywv0kaSPjh7QYid6lV4IojRLs+VlKK81Kcz3 HP/QQoDZuLCY0jea6eF66Twomiem2IgB0bWUCwsD6qaOAyDg31WYutGa3kYCBgatlx0+RL v96Rbmyn4X0VdcSQqUWxHquX7swquLU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1637782538; 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=9aE3EhkO73udWwtqxOb92KxXE9U0rU8t4YmlonhA+V8=; b=v/TlsoC9ZbCs9hGeb1ub5z4ev4ke8hB4iEfUxgP8y1NmHSRRbJHHAWZuaaFi2hxNXnDEfW a6gKhCuWtiHulsDQ== 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 4C44513F3D; Wed, 24 Nov 2021 19:35:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IELGEAmUnmELdwAAMHmgww (envelope-from ); Wed, 24 Nov 2021 19:35:37 +0000 Message-ID: Date: Wed, 24 Nov 2021 20:34:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH Part2 v5 00/45] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support Content-Language: en-US To: Dave Hansen , Joerg Roedel Cc: Brijesh Singh , Peter Gonda , 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 , 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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: 7rejkpwf16frf15kiod9nw9aoz5urihh Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=miE5FQ0E; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="v/TlsoC9"; dmarc=none; spf=pass (imf02.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8E8E27001776 X-HE-Tag: 1637782537-984941 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/24/21 18:48, Dave Hansen wrote: > On 11/24/21 8:03 AM, Joerg Roedel wrote: >> On Mon, Nov 22, 2021 at 02:51:35PM -0800, Dave Hansen wrote: >>> 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. >> Can you elaborate how to crash host kernel from guest user-space? If I >> understood correctly it was about crashing host kernel from _host_ >> user-space. > > Sorry, I misspoke there. > > My concern is about crashing the host kernel. It appears that *host* > userspace can do that quite easily by inducing the host kernel to access > some guest private memory via a kernel mapping. I thought some of the scenarios discussed here also went along "guest (doesn't matter if userspace or kernel) shares a page with host, invokes some host kernel operation and in parallel makes the page private again". >> I think the RMP-fault path in the page-fault handler needs to take the >> uaccess exception tables into account before actually causing a panic. >> This should solve most of the problems discussed here. > > That covers things like copy_from_user(). It does not account for > things where kernel mappings are used, like where a > get_user_pages()/kmap() is in play. >