Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1257561ioo; Fri, 27 May 2022 05:09:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvHJNkxtoyBW4sQIV1sdIzbW2Owu4t1+EDEUEANUSHtt114SqqoZSS5u7k0B1AAvFiOa0b X-Received: by 2002:a17:903:240c:b0:153:c8df:7207 with SMTP id e12-20020a170903240c00b00153c8df7207mr42451343plo.44.1653653365964; Fri, 27 May 2022 05:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653653365; cv=none; d=google.com; s=arc-20160816; b=PYiUqEUNoKnklv7xzmY3ZFE1hDqXpnyp4sgoJLEMuv9EecOGSotGRShnWmtA64fnji l3T/v2jqcH6qlCIQr978gFz5Eefrs+iOMzCsq6JigldVhQ2csjBHKqkW3F4C/h+aRYdw Ku/v3vhJpi3vklzZglawmrl4kEzPuVB6ZtBTntXkNnrZOC5EEVupHInN2i+4+4FJxhJ5 jNtNgUVycLRfGOUo8qRj36SaaUfrRieiqqRJvLiIJ5W6MV8fC3L/FVmzfs0tX9UWOqwc xKV8fF0LcCQ43ueXM7kwPO+GOU18RKqDNHh/AvbjmZvpuQcz7m32DVus3VxMX+9fbjfR 8T5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=wvAvvbNo0hvEaZFKbTa+ygMbbyVcho85Qv3DLuAb9qY=; b=DG+tYTq9J1yF3PrfCn7j0lZfwajdzI2hXgCfhyhlAh2H/ehPr14Xm+AgjXR6UK+tPv MuWkcoTTSVatKWYFQfN3cmIaI4ez3vJmLghTEwgpSCpCIush0dv2ZTUqSIIEyNEX2CCn VrowT5AVp6PVB4FzVsifydBcBW/OxuztriFJnKcCSo0Gx4Jp/ygeXKB8x4pS9yeFqjWW 4Ude45ctLVBTumKF07nRYM5ggB8pVm6047aNqlb2DkV0UQ5Xkg7LcEkgotCh1XPRMiKC 4ewKgqPjMlHNTvAfALHnkjNiEj20NtnxmpBW6+r2K5gi6XO42N6uIPuLp7issZzf+ZL0 FjDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Aiv+eZWJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s20-20020a635254000000b003fa387b9ac8si5105067pgl.513.2022.05.27.05.09.11; Fri, 27 May 2022 05:09:25 -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=@infradead.org header.s=desiato.20200630 header.b=Aiv+eZWJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238009AbiEZLFR (ORCPT + 99 others); Thu, 26 May 2022 07:05:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347107AbiEZLDq (ORCPT ); Thu, 26 May 2022 07:03:46 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69DCCCEBB7 for ; Thu, 26 May 2022 04:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=wvAvvbNo0hvEaZFKbTa+ygMbbyVcho85Qv3DLuAb9qY=; b=Aiv+eZWJXCR+Oh1l2J65HSodgM kjBrssVNXSJNT0pVn1nRP+qCAaEKSdXfQ3KCQ7kZJ1MioBXVZPfLqjA8KX/R6cJjruvgExPItSk4r s7EH1DnlhuvM4M3LnGW+ek6Ziog8nnU6jsRSqgbRQ26/5cyvUnH2/NGMWcw9L7JDHxf91WjZrduYe JhhQkRUeLvTfEQ5bZpMYBCRbzuTFF4/0IUXBF9suSIcf03eiCyFOf+emBe+IjHFnfPPj5DnciaJLm yXK87a6Y2U6/JALtdxpyR7S6Gbu+LVZbp9XuJM1cWM/00lt0cRP8MLIsIxRWutxb0nW3NTKtDc2hW a8CKUr/A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nuBGX-001sVf-K3; Thu, 26 May 2022 11:02:54 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9B32930047E; Thu, 26 May 2022 13:02:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 7659C202226B8; Thu, 26 May 2022 13:02:50 +0200 (CEST) Message-ID: <20220526105957.944756116@infradead.org> User-Agent: quilt/0.66 Date: Thu, 26 May 2022 12:52:56 +0200 From: Peter Zijlstra To: x86@kernel.org, jpoimboe@redhat.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, elver@google.com, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, mark.rutland@arm.com, kernel test robot Subject: [PATCH 4/7] x86/cpu: Elide KCSAN for cpu_has() and friends References: <20220526105252.440440893@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 As x86 uses the headers, the regular forms of all bitops are instrumented with explicit calls to KASAN and KCSAN checks. As these are explicit calls, these are not suppressed by the noinstr function attribute. This can result in calls to those check functions in noinstr code, which objtool warns about: vmlinux.o: warning: objtool: enter_from_user_mode+0x24: call to __kcsan_check_access() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0x28: call to __kcsan_check_access() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare+0x24: call to __kcsan_check_access() leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_enter_from_user_mode+0x24: call to __kcsan_check_access() leaves .noinstr.text section Prevent this by using the arch_*() bitops, which are the underlying bitops without explciit instrumentation. Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220502111216.290518605@infradead.org --- arch/x86/include/asm/cpufeature.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -51,7 +51,7 @@ extern const char * const x86_power_flag extern const char * const x86_bug_flags[NBUGINTS*32]; #define test_cpu_cap(c, bit) \ - test_bit(bit, (unsigned long *)((c)->x86_capability)) + arch_test_bit(bit, (unsigned long *)((c)->x86_capability)) /* * There are 32 bits/features in each mask word. The high bits