From patchwork Mon Nov 20 10:55:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 167050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp2114337vqn; Mon, 20 Nov 2023 02:57:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUkBfLYVMecuGBt4PfMWUc4lj7l7FtJfmUGRK6w19YN1R4MqsUSMOmd4uL+iTUy5Gj05H/ X-Received: by 2002:a17:903:50d:b0:1ca:dee1:4d1a with SMTP id jn13-20020a170903050d00b001cadee14d1amr5110928plb.25.1700477821746; Mon, 20 Nov 2023 02:57:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700477821; cv=none; d=google.com; s=arc-20160816; b=fBF+IF9rj6q6IB7+puYYTucDv9ihLllCpjKeFVbv0TS2HCBbgptjDJkHcm1UeZzJEA VzdF3+sTe+7VaqoN//nuk/YVYay747nsoad6a3/ZAWuyG7KE2Bx0zLOgoaZAsbbQFXzy i9ZCeSdysjDu8OK7xSc5A8AtwCoESTUWPpQUVZZzlpUaUFtQ9FPiarGur9H3wEy4gFuS k8gVSZj+1IwmHrbPNZotslxvDllD+KDsYhgTo4ABVfKSlxFccAkyw5f67TfFCcXXBWF1 nnt+7fOvo5ktvEhWRcn9LvUIgyjNkwTIqmgVgb4NC+EXAUeQEDIZKwVsrQ4yJ8cuIddM OJIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qtn+6JJtdQbGCK4bL8AZ/8s8qyj6h0vNojls/57mTy0=; fh=bEaXtmS8lzRItYrE/RfaVyKNdc9i8y6GHBEJVBz/DUE=; b=zXtq6P/4cwPBzi9XyI5DwszqhWgwJmDW2+tf00FIn4gFgcZ7p3/QIcZPG2nCpfbnc9 8Z/o3xOpmNDwc+2v2UY8oRbc9jH4fBC60DS0zGqfoNFifgbl65LL5QzcW1NxnKX6Z5Y1 dV3Jzj70IAkAm5Rli2q+Je95lYtQQHFnUYEEDvkbP8ar8frR3NCVEc4dkHbH3HG6JlJC f6u9b757WfLHjaD3DZSuNeMa9jsHJtdD7N8XCEsxj8NMwSItNCj0vuq5wcnH45TirNUm pFgbLIW3r68GXVXJVk0LNhDpUaV9m0EtbPCDHbK9UyJtQp6y6XFLEHZVH08BXcOt+xP0 dpkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EedCQgO9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id n10-20020a170902d2ca00b001cc407388a8si3901930plc.337.2023.11.20.02.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:57:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EedCQgO9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A5C708043ECC; Mon, 20 Nov 2023 02:56:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233144AbjKTK4v (ORCPT + 27 others); Mon, 20 Nov 2023 05:56:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233152AbjKTK43 (ORCPT ); Mon, 20 Nov 2023 05:56:29 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75B42D5E for ; Mon, 20 Nov 2023 02:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700477776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qtn+6JJtdQbGCK4bL8AZ/8s8qyj6h0vNojls/57mTy0=; b=EedCQgO9sbv9zInDZaG1JMZO4B+aJ4uwLxYxmmy3xwJ7thzAsjQLcc2tOAR7k6As1/deiT H55UiLxJ2DW04uYvj+zlzlU6vqEo6ZmjaTf7akt+FQDa0BQWWB0H7yS+VvcBSUPComvWbB Mh01kE3rjKU8moj/D8hz5A4bTRsCHmw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-VLYCU4uwP9KHCgOT1Uc4aw-1; Mon, 20 Nov 2023 05:56:07 -0500 X-MC-Unique: VLYCU4uwP9KHCgOT1Uc4aw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DBF5811E91; Mon, 20 Nov 2023 10:56:06 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.39.195.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A89A2026D4C; Mon, 20 Nov 2023 10:56:02 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Pawan Gupta , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Arnd Bergmann , Jason Baron , Steven Rostedt , Ard Biesheuvel , Frederic Weisbecker , "Paul E. McKenney" , Feng Tang , Andrew Morton , "Mike Rapoport (IBM)" , Vlastimil Babka , David Hildenbrand , "ndesaulniers@google.com" , Michael Kelley , "Masami Hiramatsu (Google)" Subject: [PATCH 4/5] x86/speculation: Make mds_user_clear __ro_after_init Date: Mon, 20 Nov 2023 11:55:27 +0100 Message-ID: <20231120105528.760306-5-vschneid@redhat.com> In-Reply-To: <20231120105528.760306-1-vschneid@redhat.com> References: <20231120105528.760306-1-vschneid@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 02:56:59 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783080232536363104 X-GMAIL-MSGID: 1783080232536363104 mds_user_clear is only ever enabled in: o __init mds_select_mitigation() o __init taa_select_mitigation() o __init mmio_select_mitigation() mark it as __ro_after_init. Signed-off-by: Valentin Schneider --- arch/x86/kernel/cpu/bugs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index bb0ab8466b919..bab36096015d8 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -112,7 +112,7 @@ DEFINE_STATIC_KEY_FALSE(switch_mm_cond_ibpb); DEFINE_STATIC_KEY_FALSE(switch_mm_always_ibpb); /* Control MDS CPU buffer clear before returning to user space */ -DEFINE_STATIC_KEY_FALSE(mds_user_clear); +DEFINE_STATIC_KEY_FALSE_RO(mds_user_clear); EXPORT_SYMBOL_GPL(mds_user_clear); /* Control MDS CPU buffer clear before idling (halt, mwait) */ DEFINE_STATIC_KEY_FALSE(mds_idle_clear);