Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp627625pxb; Tue, 5 Apr 2022 16:28:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4kUMJkYWtjDgNWBh8rEee19WcHRl7BAYOVabciY/NZnDWnC8knkbzG2uz0VGuHQxQIjRD X-Received: by 2002:a63:6dcc:0:b0:398:a0c9:7a77 with SMTP id i195-20020a636dcc000000b00398a0c97a77mr4677863pgc.117.1649201308669; Tue, 05 Apr 2022 16:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649201308; cv=none; d=google.com; s=arc-20160816; b=O1/kbh1LRWLag3bljrAbJKPzK9MoOzEXUtHbzLVxvavnQT1tLAYvCqOad/5Vu1lb+3 qopEYuWyvUOZmZvclsSCYH/9y3Mpe7j75mSvw4+Y+niLz3gbRImjhEqZBiwJn/nd06Oo y+LB0jXG+SHK9P4Yd7fmXPguUNUw/BMSyGjNssBKfnnRN2hC1tFCCYVDzCbPoT0xcW3h cAt5rnNkU5sqexVrfgSsrWvZCz0Vn8dDilgn08BSjy7bv1EE3macreYiimspetPI0jQd DEZH87mkzz68bIFeWDWWiplXc/awk4HQu1pmueqHGrmktjVM+ZbzO52hkdiVkjpGiXXT /uHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=v0lvCJ1nOTjsWpQFBErf0tqfOG0A5lcVLb6Qg+sSzpw=; b=x1UArONWmXFRA4/lzHAVMOZP72iWwLwTdRdprsEp45295/SPkCJnDZCtKocd/jUfwf 7ReFNKuz9RAmF30Eh7Brbvttqiq9Wd7HO3VM7JLBqLtN5s5yz3T1f7iEoRjvj0ZQymSn VLIsiosXDZ4Ye7yU/Gd0qG3COwZrnMPvFxdvnrCIk3A7r5zhpMEDt9IBAPGjwCxzPUEO 315LwL1zYFiIwcFkKjMVEasawdPTjPpRXomAGbsRzPZn4iuTT99xRho1XfkWYNyXrRtI m5IbJ3Tk2PeQLNGeNO3oaO5ySLlfnLtXnUeL94L4wr1Uuf/l8z9zQrp7MThH1+AhDka3 /Hsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uDrnUQwK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d32-20020a631d20000000b003990b9576f5si9134982pgd.425.2022.04.05.16.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:28:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uDrnUQwK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8CE3011BE5D; Tue, 5 Apr 2022 16:12:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242391AbiDEIhn (ORCPT + 99 others); Tue, 5 Apr 2022 04:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235565AbiDEH7v (ORCPT ); Tue, 5 Apr 2022 03:59:51 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE3D840A14 for ; Tue, 5 Apr 2022 00:55:35 -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:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=v0lvCJ1nOTjsWpQFBErf0tqfOG0A5lcVLb6Qg+sSzpw=; b=uDrnUQwKSZFbIlBPBLGif1YYuh xI8QFY8k5HSb8rAJBirSb6+4PbVdsnnyfUBEsUg+qMuSC3j+z5tP8QVEs3yEASlqQR1gtGSLUZkmw 3IPLSUofE/GhmD1ZAqDHunqWMDP5AzKiqO/lj0iQLR52oLOUlEtpUcbNz3A3r1HCNqa56iLC62K0c 2B/XlGafViOp0d9Kq9JQDJnCD04/3LMDm/4RHn7bFXr6RgLsaO48EzKE2ElDPRbnjXa3oDztEdZ96 ov7dodKqoVqNjU/U9ZxHyqzupw6+zEgpW59qKdZk7SUJUaVIb9luBrAG4bjyP/Jh1rTvcNx+ybK4F j5+fytiw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbe2G-006Tew-7z; Tue, 05 Apr 2022 07:55:32 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 9ADC2986B5B; Tue, 5 Apr 2022 09:55:31 +0200 (CEST) Date: Tue, 5 Apr 2022 09:55:31 +0200 From: Peter Zijlstra To: x86@kernel.org, alexei.starovoitov@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] x86,bpf: Avoid IBT objtool warning Message-ID: <20220405075531.GB30877@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Clang can inline emit_indirect_jump() and then folds constants, which results in: | vmlinux.o: warning: objtool: emit_bpf_dispatcher()+0x6a4: relocation to !ENDBR: .text.__x86.indirect_thunk+0x40 | vmlinux.o: warning: objtool: emit_bpf_dispatcher()+0x67d: relocation to !ENDBR: .text.__x86.indirect_thunk+0x40 | vmlinux.o: warning: objtool: emit_bpf_tail_call_indirect()+0x386: relocation to !ENDBR: .text.__x86.indirect_thunk+0x20 | vmlinux.o: warning: objtool: emit_bpf_tail_call_indirect()+0x35d: relocation to !ENDBR: .text.__x86.indirect_thunk+0x20 Suppress the optimization such that it must emit a code reference to the __x86_indirect_thunk_array[] base. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/net/bpf_jit_comp.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -412,6 +412,7 @@ static void emit_indirect_jump(u8 **ppro EMIT_LFENCE(); EMIT2(0xFF, 0xE0 + reg); } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) { + OPTIMIZER_HIDE_VAR(reg); emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip); } else #endif