From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7767047A7D for ; Wed, 17 Apr 2024 20:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713387078; cv=none; b=UGJSN4V+xYIfH4uiwSqVmYhJLJKcxo7EesL+qzYQV5OjazBN/RZmTtkpF9/9frXD1OK+6vTMhwjJ02zy7sJLPrOXkLuD1rzykwuUqPC2tfBQICTH3cCN45Tloinz8R+ZAyCXhHLxW+UDLZy3HZC8annR9eLkmzLAyCKuOC8PXX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713387078; c=relaxed/simple; bh=25na2u5dqSMwdfKH+InG17crUdYa9TxiMOwoUCyo2Zg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MHa+5eFU/jggYPw8xMiuMaXhzXavldVOq67lqX8fmYvJfVM6kPyUBGspF7slkWhxVDVRrDJDy7hFAE6rQ0MkPAgSLBVfkFvyPaBlNDQFnUf+/Y/v+pJlw6UUVttoWp3+eWZ+I4Yk4B/UQfExytBPZj6swHm0rSgNvDnh1ycwAOY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id E478040E0177; Wed, 17 Apr 2024 20:51:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WjHW1JqznPJz; Wed, 17 Apr 2024 20:51:09 +0000 (UTC) Received: from zn.tnic (pd953020b.dip0.t-ipconnect.de [217.83.2.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 21AF640E00B2; Wed, 17 Apr 2024 20:50:54 +0000 (UTC) Date: Wed, 17 Apr 2024 22:50:48 +0200 From: Borislav Petkov To: Tom Lendacky Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, svsm-devel@coconut-svsm.dev, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Dan Williams , Michael Roth , Ashish Kalra Subject: Re: [PATCH v3 02/14] x86/sev: Make the VMPL0 checking function more generic Message-ID: <20240417205048.GHZiA2KGbFFTQFyTAM@fat_crate.local> References: <1b0d8ec8e671ad957a2ad888725ce24edeedf74a.1711405593.git.thomas.lendacky@amd.com> <20240417114658.GHZh-2sk47TZgCp4Mb@fat_crate.local> <505dcf34-93ff-643c-b149-8ef9ce90c023@amd.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <505dcf34-93ff-643c-b149-8ef9ce90c023@amd.com> On Wed, Apr 17, 2024 at 03:35:53PM -0500, Tom Lendacky wrote: > Well, it doesn't really modify any permissions that matter. It tries to > change the permission of a lesser privileged VMPL level. Potato potato. :-P > Since the kernel only runs at a single VMPL it would never be > effected. The operation performed here is to update VMPL1 permission > levels (which can only be done successfully at VMPL0) and return the > result of the operation. A success implies running at VMPL0 and > failure implies not running at VMPL0. Yap. The point is, it is calling RMPADJUST. And it does modify RMP permissions of a guest page. Thus, if you prefer, you can go all out and call the helper rmp_adjust_permissions(unsigned int tgt_vmpl, void *pa) and make it generic from the get-go. And then have the macro wrap around it in order to explain that particular use with the macro name. If it is still not clear what I mean, lemme know and I'll do a diff ontop. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette