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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBC86C433EF for ; Wed, 10 Nov 2021 18:44:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 92D3161269 for ; Wed, 10 Nov 2021 18:44:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 92D3161269 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DACB66B006C; Wed, 10 Nov 2021 13:44:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D5C136B0072; Wed, 10 Nov 2021 13:44:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD6686B0073; Wed, 10 Nov 2021 13:44:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id AAD4D6B006C for ; Wed, 10 Nov 2021 13:44:12 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 58FBA81602DD for ; Wed, 10 Nov 2021 18:44:12 +0000 (UTC) X-FDA: 78793895544.22.7F0F94E Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf15.hostedemail.com (Postfix) with ESMTP id 80DE5D0000AB for ; Wed, 10 Nov 2021 18:43:55 +0000 (UTC) Received: from zn.tnic (p200300ec2f111e00f6c7178ba52ca674.dip0.t-ipconnect.de [IPv6:2003:ec:2f11:1e00:f6c7:178b:a52c:a674]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C01551EC0529; Wed, 10 Nov 2021 19:44:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1636569846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=C2VOLfmvL9L0orajbDbFzDBlQB82yHKAfIoIPQsHwAc=; b=VDuO+2n5Q4g0soTuNocoR45e46tiy9TDeRzGik3lHMNjnRD9uQhO4dlPkWbAtwc4lkoPeS vFCQpLvnUi5kmukfhsnFhL/G0/zNJhgBHrg8TlSWs59ed8ytsQFLhbJ687F/hUcYodJw4Z zAOdxjE5tQGFJkJMn8ubDa5uRWi+Ptw= Date: Wed, 10 Nov 2021 19:43:59 +0100 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v6 19/42] x86/mm: Add support to validate memory when changing C-bit Message-ID: References: <20211008180453.462291-1-brijesh.singh@amd.com> <20211008180453.462291-20-brijesh.singh@amd.com> <4ea63467-3869-b6f5-e154-d70d1033135b@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4ea63467-3869-b6f5-e154-d70d1033135b@amd.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 80DE5D0000AB X-Stat-Signature: r3m8mj9qwz7nxux1wzgjpxw1tqttcpnc Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=alien8.de header.s=dkim header.b=VDuO+2n5; dmarc=pass (policy=none) header.from=alien8.de; spf=pass (imf15.hostedemail.com: domain of bp@alien8.de designates 5.9.137.197 as permitted sender) smtp.mailfrom=bp@alien8.de X-HE-Tag: 1636569835-803408 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 Wed, Nov 10, 2021 at 08:21:21AM -0600, Brijesh Singh wrote: > I am assuming you mean add some compile time check to ensure that desc will > fit in the shared buffer ? No: struct ghcb { ... u8 shared_buffer[2032]; so that memcpy needs to do: memcpy(ghcb->shared_buffer, desc, min_t(int, 2032, sizeof(*desc))); with that 2032 behind a proper define, ofc. > I can drop the overlap comment to avoid the confusion, as you pointed it > more of the future thing. Basically overlap is the below condition > > set_memory_private(gfn=0, page_size=2m) > set_memory_private(gfn=10, page_size=4k) > > The RMPUPDATE instruction will detect overlap on the second call and return > an error to the guest. After we add the support to track the page validation > state (either in bitmap or page flag), the second call will not be issued > and thus avoid an overlap errors. For now, we use the page_size=4k for all > the page state changes from the kernel. Yah, sounds like the comment is not needed now. You could put this in the commit message, though. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette