From nobody Sun May 10 14:12:37 2026 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 76B1BC433FE for ; Mon, 2 May 2022 11:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384674AbiEBLQk (ORCPT ); Mon, 2 May 2022 07:16:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231792AbiEBLQY (ORCPT ); Mon, 2 May 2022 07:16:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7AC22ADA for ; Mon, 2 May 2022 04:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=JMBIhZTFw3f6Qw/Ll9Y2VAw8jWaSrVdBmw9EHMTt0fA=; b=E+eV5eP8pWlvBb2CCfKjPDkL1g esoNcAxFN7yClEkSSOCiK6MTgdrnKyG8HhlILnR9PFVnIBjJXZO1TlB7D2ZEw8yLEd09WLSY71/6i S4tDan+hzYxELUFd1YcRObGjGibWEvsAMQaM+I6JwGcDWIwsh1eYvMBMQEPSjrdO5CgsGsDzttc0N rzSKUZ2xXBuU0eImIxamFMrNPDeOXEM4fCGEjdaghbdwNh9hJebYeGOMOGJkQewtscKcIIo/AsTj+ amg1PFbb1NeuVNsTgiiOAiq3QyYDRyZ53cQXiWW0/8Lr6taTMezCdOYqmN8TIGDuk9+PDSiHJcdTW IL1qKo2w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlTyn-00ElGR-Nv; Mon, 02 May 2022 11:12:38 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3644E300367; Mon, 2 May 2022 13:12:34 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id DD66420288CF3; Mon, 2 May 2022 13:12:34 +0200 (CEST) Message-ID: <20220502111216.229292763@infradead.org> User-Agent: quilt/0.66 Date: Mon, 02 May 2022 13:07:42 +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, kernel test robot Subject: [PATCH 1/3] objtool: Mark __ubsan_handle_builtin_unreachable() as noreturn References: <20220502110741.951055904@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" fs/ntfs3/ntfs3.prelink.o: warning: objtool: ni_read_frame() falls through= to next function ni_readpage_cmpr.cold() That is in fact: 000000000000124a : 124a: 44 89 e0 mov %r12d,%eax 124d: 0f b6 55 98 movzbl -0x68(%rbp),%edx 1251: 48 c7 c7 00 00 00 00 mov $0x0,%rdi 1254: R_X86= _64_32S .data+0x1380 1258: 48 89 c6 mov %rax,%rsi 125b: e8 00 00 00 00 call 1260 125c: R_X86_64_PLT32 __ubsan_handle_shift_out_of_bounds-0x4 1260: 48 8d 7d cc lea -0x34(%rbp),%rdi 1264: e8 00 00 00 00 call 1269 1265: R_X86_64_PLT32 __tsan_read4-0x4 1269: 8b 45 cc mov -0x34(%rbp),%eax 126c: e9 00 00 00 00 jmp 1271 126d: R_X86_64_PC32 .text+0x19109 1271: 48 8b 75 a0 mov -0x60(%rbp),%rsi 1275: 48 63 d0 movslq %eax,%rdx 1278: 48 c7 c7 00 00 00 00 mov $0x0,%rdi 127b: R_X86= _64_32S .data+0x13a0 127f: 89 45 88 mov %eax,-0x78(%rbp) 1282: e8 00 00 00 00 call 1287 1283: R_X86_64_PLT32 __ubsan_handle_shift_out_of_bounds-0x4 1287: 8b 45 88 mov -0x78(%rbp),%eax 128a: e9 00 00 00 00 jmp 128f 128b: R_X86_64_PC32 .text+0x19098 128f: 48 c7 c7 00 00 00 00 mov $0x0,%rdi 1292: R_X86= _64_32S .data+0x11f0 1296: e8 00 00 00 00 call 129b = 1297: R_X86_64_PLT32 __ubsan_handle_builtin_unreachable-0x4 000000000000129b : Tell objtool that __ubsan_handle_builtin_unreachable() is a noreturn. Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220502091514.GB479834@worktop.programming= .kicks-ass.net --- tools/objtool/check.c | 1 + 1 file changed, 1 insertion(+) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -184,6 +184,7 @@ static bool __dead_end_function(struct o "do_group_exit", "stop_this_cpu", "__invalid_creds", + "__ubsan_handle_builtin_unreachable", }; =20 if (!func) From nobody Sun May 10 14:12:37 2026 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 AFDB4C433EF for ; Mon, 2 May 2022 11:13:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233926AbiEBLQ3 (ORCPT ); Mon, 2 May 2022 07:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232127AbiEBLQV (ORCPT ); Mon, 2 May 2022 07:16:21 -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 857755FFA for ; Mon, 2 May 2022 04:12:53 -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=9HmtpnMy2TgReU4YIb75qrQVXcE+pFVlRmoqNCAWKJk=; b=Pp9iFkHJznwCUWPc1IoxBkJ0sQ YgXkBDD+AlFX/WN9vrgRWofwabPVgdWtUBzvNmNcOxqiKhQZFTLciuX3THbHKmPn9/yeymD0uDlTK 7MQorIHjc834/sj0eMV53L2Nu/OGu+kSaA157AwrSTLwmx06G7SemRB+rpvH2ChuLK3XOGAUU3jMp 1In2sjbETeG4QzYR3/a9A4yAQwtSKi4bOMRnzksuZT4UM55bp644zo2ru8oX3UiE/PV38aAATFvl2 tTh7WsGrtdeXgvwaStpe2yFBxltF/OjTXeH2xNcYk+65iwq8mxNUMIeSUttiCN/oneQp211jZkras q2TWjGmw==; 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 1nlTyn-00ARA8-Ln; Mon, 02 May 2022 11:12:39 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3A9423004B5; Mon, 2 May 2022 13:12:34 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id E014420288D08; Mon, 2 May 2022 13:12:34 +0200 (CEST) Message-ID: <20220502111216.290518605@infradead.org> User-Agent: quilt/0.66 Date: Mon, 02 May 2022 13:07:43 +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, kernel test robot Subject: [PATCH 2/3] x86/cpu: Elide KCSAN for cpu_has() and friends References: <20220502110741.951055904@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" vmlinux.o: warning: objtool: enter_from_user_mode+0x24: call to __kcsan_che= ck_access() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0x28: call to __k= csan_check_access() leaves .noinstr.text section vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare+0x24: cal= l 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 Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Marco Elver --- 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]; =20 #define test_cpu_cap(c, bit) \ - test_bit(bit, (unsigned long *)((c)->x86_capability)) + arch_test_bit(bit, (unsigned long *)((c)->x86_capability)) =20 /* * There are 32 bits/features in each mask word. The high bits From nobody Sun May 10 14:12:37 2026 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 80E2AC433EF for ; Mon, 2 May 2022 11:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350637AbiEBLQf (ORCPT ); Mon, 2 May 2022 07:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231997AbiEBLQY (ORCPT ); Mon, 2 May 2022 07:16:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A8626D1 for ; Mon, 2 May 2022 04:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=IboLsRTGfsW5mAOfgWVbq8NTNwIsQlJU0nFRW/NtXfE=; b=U5qiIMSOIeVcTRivs/9mkXqVeO EorD5rMULKDErza5ssoI6BlhhuZrIs2tyXBh2ClHsEqYyhRDrTxFPz6h+zVW+wIaKk6cqoffQ2HOZ 3iMy/z8Yu9RzcSmAPXDz+gjDJcKH8nwhUbFUj/u5bz2gNmMDs5Jk71Gsi0rWkMZ3lPFZq7oMNquek XG8qVSFuwWwR2So/JF2x+qx1aL8+mw8Ld6g8MXI0gr/5xKz6gfYsc6ZkOZV0dem5xjD3kQi0bp94L PcJ1gnUy/28e44sVh4v1DraANswz1A1X7DH5/i5bHLNDstPfI7cQtpyGYqiFKTcvDqqScZK0saRhH HPuuKfyA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlTyn-00ElGQ-O4; Mon, 02 May 2022 11:12:38 +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 3876030047E; Mon, 2 May 2022 13:12:35 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id E2ECF20288D0D; Mon, 2 May 2022 13:12:34 +0200 (CEST) Message-ID: <20220502111216.350926848@infradead.org> User-Agent: quilt/0.66 Date: Mon, 02 May 2022 13:07:44 +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, kernel test robot Subject: [PATCH 3/3] jump_label,noinstr: Avoid instrumentation for JUMP_LABEL=n builds References: <20220502110741.951055904@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When building x86_64 with JUMP_LABEL=3Dn it's possible for instrumentation to sneak into noinstr: vmlinux.o: warning: objtool: exit_to_user_mode+0x14: call to static_key_cou= nt.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 stati= c_key_count.constprop.0() leaves .noinstr.text section Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) --- include/linux/jump_label.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -256,9 +256,9 @@ extern void static_key_disable_cpuslocke #include #include =20 -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 READ_ONCE_NOCHECK(&key->enabled.count); } =20 static __always_inline void jump_label_init(void)