Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1482907rwd; Wed, 31 May 2023 14:49:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WZFcbU7I2W33eaeSM0VMTFhXfxUebBoM16kb8SpkSd6Y5yr92cLJZKJ8h25d8ogXz2yXq X-Received: by 2002:a25:c7d3:0:b0:ba8:3bbe:c37b with SMTP id w202-20020a25c7d3000000b00ba83bbec37bmr7990171ybe.6.1685569743818; Wed, 31 May 2023 14:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685569743; cv=none; d=google.com; s=arc-20160816; b=xgrX16pHeyzOfnA64kr16PxuBu53PpFLpzRrDf5GHco6gJY5oULNqphsBznNBFQXhY LEmN5gE05edKu6u0MfOLzxwGjs3zz8Fh1CtrimquCbyUety2kqStGeEYZW3ko2gnANAl M0tEGXXhjCpPbHVQAUq80X9icIIsM2irz55yhCTWPHhoX4wimN+WpFP5nCBvdwDFApac 73d2HldbYcy5aGM3WwxEokkEGUZxwRGuX/mZeLuEvGEJfe1toshoAuU/s7jwBItQ1FhR 62N2v2W+NcxnGqqaz4zCWiMKZOl+pCKTaw9k99+0aKhcSzGZK85ily9Sf2Kv/IPyDsFX tsNw== 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=cCSCvMUJ37RrG4sztF6QhyhQ1BDqg4ZKC/u3DdWe32g=; b=DtlbhQlqZfDJzTq6BH8yLvFivjS0vmGT5C5kPIv7INuXEcgplWbhzJZxNDruTQ7rwC aubUIx/cDvJVyF9bsvifQeXtlANQ47g/B63jiAtP0KovrDYcm7uX9QAXU6h2VzbyGeGv scqlLtp2QnjwtP+kicJDPxUcevBquRhPY97+Quor4zfEXZYwfF83Tyu2R8DfeJLN83Ge lS8npIkU1WwvRyVXmCtA/S2aTJS3Tl36Z5mwqcUNy/fRXzq95z3Wmxv7W0eqLFVMOFF6 3i7JeZY1NyDWUKPMvUguMmA/uZzaFirlm1ts93RoTtR7J8rjilACnS8f11ARO+PsDyrc izXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@alien8.de header.s=dkim header.b=mjuLMaR1; 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=fail (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 ik8-20020a170902ab0800b001ac84f87b0fsi1603236plb.339.2023.05.31.14.48.49; Wed, 31 May 2023 14:49:03 -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=temperror (no key for signature) header.i=@alien8.de header.s=dkim header.b=mjuLMaR1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjEaV3S (ORCPT + 99 others); Wed, 31 May 2023 17:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjEaV3P (ORCPT ); Wed, 31 May 2023 17:29:15 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2034612F; Wed, 31 May 2023 14:29:13 -0700 (PDT) Received: from zn.tnic (pd9530d32.dip0.t-ipconnect.de [217.83.13.50]) (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 728F51EC0373; Wed, 31 May 2023 23:29:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1685568551; 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=cCSCvMUJ37RrG4sztF6QhyhQ1BDqg4ZKC/u3DdWe32g=; b=mjuLMaR1e2IadpeC2YMylI51M24PqVdK3GsLZ+Pt63S54EcehZhUV81YAX21UFa2K5gzH6 xUJ2Wju/+Ag8CXRKqWqYLjbFEv0WifotziO9DUOQUthCiE0oCkYbA+RyqqmVjDbqPEcAYe glM3L0dpYBFYcz8JvvABhrVP7YOposI= Date: Wed, 31 May 2023 23:29:07 +0200 From: Borislav Petkov To: Sean Christopherson Cc: Jon Kohler , Dave Hansen , Thomas Gleixner , Ingo Molnar , Dave Hansen , "x86@kernel.org" , "H. Peter Anvin" , "Chang S. Bae" , Kyle Huey , "neelnatu@google.com" , Andrew Cooper , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , Paolo Bonzini Subject: Re: [PATCH] x86/fpu/xstate: clear XSAVE features if DISABLED_MASK set Message-ID: <20230531212907.GHZHe8I/DZUyzIXI2Q@fat_crate.local> References: <20230530200152.18961-1-jon@nutanix.com> <2a6502e3-ba87-0355-af09-825e8467b81f@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 Wed, May 31, 2023 at 08:18:34PM +0000, Sean Christopherson wrote: > Assert that the to-be-checked bit passed to cpu_feature_enabled() is a > compile-time constant instead of applying the DISABLED_MASK_BIT_SET() > logic if and only if the bit is a constant. Conditioning the check on > the bit being constant instead of requiring the bit to be constant could > result in compiler specific kernel behavior, e.g. running on hardware that > supports a disabled feature would return %false if the compiler resolved > the bit to a constant, but %true if not. Uff, more mirroring CPUID inconsistencies. So *actually*, we should clear all those build-time disabled bits from x86_capability so that this doesn't happen. > All current usage of cpu_feature_enabled() specifies a hardcoded > X86_FEATURE_* flag, so this *should* be a glorified nop. Also, pls add here the exact example which prompted this as I'm sure we will forget why this was done. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette