Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1115259pxb; Wed, 6 Apr 2022 09:04:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaGoQ7d+zuE61pxTXaU3R+ERcEQ2DbPaarQgImXs9315ov2SdwYDft4HVNPyuALaayr6jI X-Received: by 2002:a05:6638:2642:b0:323:756f:42a7 with SMTP id n2-20020a056638264200b00323756f42a7mr5172819jat.145.1649261078467; Wed, 06 Apr 2022 09:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649261078; cv=none; d=google.com; s=arc-20160816; b=QvVJvhoypB3702f+ELFUJOOY5iOxOBJMyaBwbROb/BXrwDziqdHymRuI2SegTvxZgx 7BHnfFegY0KPMdo7a+JcX1r8ha2u+Q956t3vktLkH+RRoXcCE4r+0lYckofcYb0PGGQy 31F7sQp0ZJvvSQ9rmj3/GFJa3lg1oz1Yg0+jUx5flTdNnF3BEod6LgKOz4q3Mw3knqKN AjjG9X7AC9veHmyJvJqeJacOY8C9yV0G+rojz6/nC6z+ExxSkh0mLNRDs3t9khMW5Dyt M357WPo9KwMjMTmfl+uHFqxWGGFe+fLXXpqb+kLYVqbNfboABNq1DqYUxigRI16quTcu 3T0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6OzT4OmHz+L2j/EDCMxP9gXB/ot5T8KVaZBqTZv1Ez0=; b=ACWFi6l3qu/Mfo/T2ot7D6V//YeyWGEKhuNUklnW7CWHrKphWi10Z4CVwFzes2pXWB 4tXZSBmqOQVC4+BeYT8tvb82kVwLnNFABjJnVLiOKxpvNUtpF95sgqvw0OtRwpfsDywu 2vUq77+KBuKRXXmJIAiawtRY1GKgvOlqFCN/L6bR+Znxc8/2IBscuAoFrPJGmKQLsBqq HDcKYd0mMrGEiRnwZMDPvCYqgc+1Dpr+KPZalfYIXJwqDJKkabF1wILR2H7M3XIwMDev X5U+NaJMuHxJyo65c41GsXz7OlcZs3/nuGv9vQFoJCaAjcrCqaP3jL0M8mREd9D7K3FH Srfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=n5X36hvd; 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 w4-20020a056638378400b00323a2346986si8365386jal.75.2022.04.06.09.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 09:04:38 -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=n5X36hvd; 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 71ADB2F7111; Wed, 6 Apr 2022 07:29:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234937AbiDFObA (ORCPT + 99 others); Wed, 6 Apr 2022 10:31:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234901AbiDFOaZ (ORCPT ); Wed, 6 Apr 2022 10:30:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 440C9501B45; Wed, 6 Apr 2022 03:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6OzT4OmHz+L2j/EDCMxP9gXB/ot5T8KVaZBqTZv1Ez0=; b=n5X36hvd6MbjoxFRIpTKDcjiFW Jz5Y3vAxfgH8fP8YEKASBAXzQhZqeUQ9oYG/ytpO4hyasBMRkKI34KV9R6PH7ixw1miNLhmtXgI3G WLNABrkOzKfcnx6wXifQs0cm1VXdAxaco7bfUJwUzPdkdHHU+GWIb7Aza6qcu7hslbEO8u8UTwnsN 2TBCrnJjmWAka8mmR660bNHsozgMIcf28LvZVNDPJICZ/kC4i5E6cLaOafRyejMFpfgT3vzRsgE+F FtC3qZY71RdKBijIqKT3OUsYX/lN0ZsiIuEtah9q3DLQT8nSTV0ktdfCH0aIACHwMLqUqIX1nXd9s 6eDa4PoQ==; 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 1nc3BV-007iGk-KW; Wed, 06 Apr 2022 10:46:45 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 967C6986199; Wed, 6 Apr 2022 12:46:43 +0200 (CEST) Date: Wed, 6 Apr 2022 12:46:43 +0200 From: Peter Zijlstra To: Alexei Starovoitov Cc: bpf , Daniel Borkmann , Andrii Nakryiko , X86 ML , LKML Subject: Re: [PATCH] x86,bpf: Avoid IBT objtool warning Message-ID: <20220406104643.GB2731@worktop.programming.kicks-ass.net> References: <20220405075531.GB30877@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Tue, Apr 05, 2022 at 09:58:28AM -0700, Alexei Starovoitov wrote: > On Tue, Apr 5, 2022 at 12:55 AM Peter Zijlstra wrote: > > > > > > 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 > > Looks good. Please cc bpf@vger and all bpf maintainers in the future. Oh right, I'll go add an alias for that. > We can take it through the bpf tree if you prefer. I'll take it through the x86/urgent tree if you don't mind.