From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D3ABC433EF for ; Tue, 7 Jun 2022 18:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348810AbiFGSW4 (ORCPT ); Tue, 7 Jun 2022 14:22:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352654AbiFGSRZ (ORCPT ); Tue, 7 Jun 2022 14:17:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA82E13AF2F; Tue, 7 Jun 2022 10:52:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3240AB8236F; Tue, 7 Jun 2022 17:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 190E0C341C5; Tue, 7 Jun 2022 17:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654624344; bh=4YAS2hxdgSWEjTSJ+tXksYA0mkYVnKdZ8x4YsHB7YBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CXVBr1EX8u5F6xqeYyZEc38IDm7Nz+TvxSCQJ7bYrOyTIpgT44zswDrblnbJ4EnoD YbzXi54h5UPT+33UDpusmD7zK9Y1hvg/ZZs5ykzmFg8h4ZyYNHdo+ZwZkIaGw6C8uF W6BVuWHsuHzFeYFR0CAQNxGkuzFZct45ZOwUeuG79bjbMPDryZiUSIyBSUjouRTj8r yEbunTuPjwDhVpH5tQGX45V4oj5+yfAqcyeh74HnffExZF1dWRjF5WB1zlagQ4dxbB CnMdrNIffmydMQkEMzM6Zcko3yCEAZPz5zjTfVOuU6aaoEw21mxJqoqZa17ejgWwtE oE+zRxHt6DZGg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Zijlstra , kernel test robot , Sasha Levin , jpoimboe@kernel.org, jbaron@akamai.com Subject: [PATCH AUTOSEL 5.18 55/68] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds Date: Tue, 7 Jun 2022 13:48:21 -0400 Message-Id: <20220607174846.477972-55-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220607174846.477972-1-sashal@kernel.org> References: <20220607174846.477972-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Peter Zijlstra [ Upstream commit 656d054e0a15ec327bd82801ccd58201e59f6896 ] When building x86_64 with JUMP_LABEL=n it's possible for instrumentation to sneak into noinstr: vmlinux.o: warning: objtool: exit_to_user_mode+0x14: call to static_key_count.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_exit_to_user_mode+0x2d: call to static_key_count.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: irqentry_exit_to_user_mode+0x1b: call to static_key_count.constprop.0() leaves .noinstr.text section Switch to arch_ prefixed atomic to avoid the explicit instrumentation. Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Sasha Levin --- include/linux/jump_label.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 107751cc047b..bf1eef337a07 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -256,9 +256,9 @@ extern void static_key_disable_cpuslocked(struct static_key *key); #include #include -static inline int static_key_count(struct static_key *key) +static __always_inline int static_key_count(struct static_key *key) { - return atomic_read(&key->enabled); + return arch_atomic_read(&key->enabled); } static __always_inline void jump_label_init(void) -- 2.35.1