Received: by 2002:ac0:cd04:0:0:0:0:0 with SMTP id w4csp78584imn; Fri, 1 Jul 2022 10:17:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vGah8nx+ewE18G8JhVtuhx270rcv5O/xkpUQ0S34VCu1FfmyHN4n+szD0n31AKTVmWm1fp X-Received: by 2002:a17:902:a613:b0:168:a216:f3ff with SMTP id u19-20020a170902a61300b00168a216f3ffmr20686551plq.21.1656695833900; Fri, 01 Jul 2022 10:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656695833; cv=none; d=google.com; s=arc-20160816; b=xlq/ev/CJqaNyofxTM7A2ERkZ2rvkYAyE92J9cgS0iEk34lPTpqXTOpmQLsofcbaC7 XJJGzLNTN2U4oWOi6jkTInUgSI3WYX+fd+OO3hIEfn3wlEX5R+0yfbRoHGIJm1LGTAh2 z7roM1WuJvgNyhMuxHWmTOwxNLP6nLiI19kqXK92fg/KB5VZWcs7BGirxJZlCoQjw/05 dwS5wtKJZmAyEs9XrbExLdsWQqv8cctuUEvutp1wz3Gb8WCrXLuZkoCvyKxld9bm5mI0 7djT0XcaMekPhwenAXdpvCA5Y+VOUK4MWSQxLn90cRpTYJAISHQ3kVxD/n6H5mG1XSUg 4vZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LsRagpxJ0d6m6LED7HHfWRzzrUzw8aGp7k8R8oF5VaQ=; b=lw0+DP251J+K4yZ9cZE5aftYKz8FEMd01S326E5HQoBKeiW6GdCWx+D/NijK/Zwxlk XQGkURzpRHf91PNVfy9kpqkoIGY8GT1C8HxGgPFPPQQvIFwLbf2PO1vCurjWvJQ5Z1MP h1nmZur4N8qZ3iiZVa+rnRPe5vAwSoBv7nQLEvc/dxKWAV3Q1sv5FzZYDE1QOa5uc4yY BcrmKCKfyy1Qg1WqmsrX53ee1ldSyJ1D8qstJ5guONQRwpzUSjAeYFvZ10tgjZUcoBXL zaF2/q7SeSellK3mdW/n6nXhSJgFctimwEycWFt0Ng7CIyBwTTdSeSfvUlEjy+LP0GKZ /dyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=kVgbaLHT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a6555cb000000b00411ef13f705si1702539pgs.296.2022.07.01.10.17.02; Fri, 01 Jul 2022 10:17:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=kVgbaLHT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232439AbiGAQv0 (ORCPT + 99 others); Fri, 1 Jul 2022 12:51:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiGAQvY (ORCPT ); Fri, 1 Jul 2022 12:51:24 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A5D44A0A; Fri, 1 Jul 2022 09:51:23 -0700 (PDT) Received: from zn.tnic (p200300ea970ff648329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:970f:f648:329c:23ff:fea6:a903]) (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 43EFA1EC064A; Fri, 1 Jul 2022 18:51:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1656694277; 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=LsRagpxJ0d6m6LED7HHfWRzzrUzw8aGp7k8R8oF5VaQ=; b=kVgbaLHTIsuv3Te5Rsh4ZkmUq+hTiJvlWYa0pGnkSJ1yBJNazGmA2MlsU8d0LXoBgXZDOs BK/Mwzu4AfZefSG/tFTr/kXyg/+2uZlvmUlaGKGG9Ycsc+noYabQkfcWzq5iRgMug9P5/h w9QwkfALpCmGSrcjBNsjLmOwQ/3hJ1w= Date: Fri, 1 Jul 2022 18:51:13 +0200 From: Borislav Petkov To: Sean Christopherson Cc: Tom Lendacky , Michael Roth , 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 , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , brijesh.ksingh@gmail.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v12 19/46] x86/kernel: Make the .bss..decrypted section shared in RMP table Message-ID: References: <20220307213356.2797205-1-brijesh.singh@amd.com> <20220307213356.2797205-20-brijesh.singh@amd.com> <6db51d45-e17a-38dd-131d-e43132c55dfb@amd.com> <9abe9a71-242d-91d5-444a-b56c8b9b6d90@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 16, 2022 at 04:41:05PM +0000, Sean Christopherson wrote: > > I worry that another use of cc_platform_has() could creep in at some point > > and cause the same issue. Not sure how bad it would be, performance-wise, to > > remove the jump table optimization for arch/x86/coco/core.c. Is there a gcc switch for that? > One thought would be to initialize "vendor" to a bogus value, disallow calls to > cc_set_vendor() until after the kernel as gotten to a safe point, and then WARN > (or panic?) if cc_platform_has() is called before "vendor" is explicitly set. > New calls can still get in, but they'll be much easier to detect and less likely > to escape initial testing. The invalid vendor thing makes sense but I don't think it'll help in this case. We set vendor in sme_enable() which comes before the __startup_64 -> sme_postprocess_startup path you're hitting. We could do only the aspect of checking whether it hasn't been set yet and warn then, in order to make the usage more robust... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette