Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp926580pxb; Wed, 6 Apr 2022 04:30:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGzwZICLvz4DAEITDgiPwKstZolkYzk9oCuW10WBh96XJmKOxVU8GCMeYF858EuXQTySQu X-Received: by 2002:a17:902:ec8c:b0:154:7cee:774e with SMTP id x12-20020a170902ec8c00b001547cee774emr8093270plg.61.1649244629787; Wed, 06 Apr 2022 04:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649244629; cv=none; d=google.com; s=arc-20160816; b=hvd0HJnBx9pv5S7rfrwf+4D7SZCu8nWJzEzQvtNrdjBwY8VCPkVjFHzMg5vKTF/Ne6 rx3jb5gkQG12wT0tw5j9cyR7vsfkCTTNzQ8CtqsKm2HiMwwTcwyVn0FuUrA38BM2gVyQ A42riOSF5eMLG9F15AdGMZV0bhsOgvKospfyWyHifoeKT889pZyDn7h7di9Brc3eAGkm 3UHQWCpUecZ+RY353CSrj7PdfkcMVWQSJyYaq2zmgvwyke6l9wzCYauplO/WA9YeMnxb Xppl1j4eH2OTrR9qlRX8QdUCfwjfX6nPEyaghdV42DjHkx1IpvPNadt9qoF1HZDkwqVZ h1Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZAVOxKCn1rSRBeHkGZiJCt2gkjQ/XAx8tCfYXVtiNfE=; b=q6oseBS8N9eLH15nGzNn/4Qjzw8gGbwHGxyaW6y0u2ejUTY+hVgN1/AwXR3UlQ+Sxq cHxVp2Yi98WAFDp5+DpZrwCgXsazR8EXQJSkvN/e6xATrUw5JMd92ZxPu/UNR3oHrmfx AiLeNUIo15/Wpr3DWLWLZQwFGYX/Ikl22dy2n7nvLPQDxsEbut5LyUxch8fOs4181VgL So+XV6ERyP74FEDpQ3G4Z5vkqyvS5nop0udQB+knC0GWYDQcYTy+xa/0qt2I5GPJ4dk1 KbzqSoIQwsM8KK/TTRDwoHXBxcsL7UGk2ov2l0clgcBDE0P9u4ed3czPlko25CNgxukR enow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BCmXM1EP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id cn3-20020a056a00340300b004fe52f14401si1227437pfb.372.2022.04.06.04.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:30:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BCmXM1EP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E9012602D80; Wed, 6 Apr 2022 02:52:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381069AbiDEUyo (ORCPT + 99 others); Tue, 5 Apr 2022 16:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457938AbiDERAj (ORCPT ); Tue, 5 Apr 2022 13:00:39 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E1DEBC0B; Tue, 5 Apr 2022 09:58:40 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id x16so7269171pfa.10; Tue, 05 Apr 2022 09:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZAVOxKCn1rSRBeHkGZiJCt2gkjQ/XAx8tCfYXVtiNfE=; b=BCmXM1EPbsht9Le2RBBahOAvfdS8skESRKaGokKX4zH1mid2b3gkPH+7yeaMUotIkX NbGdGgZUpeiJ3gcEyuIX9YmL6aKRHI0Ro2BaiZ6XjqRP2m7CKlHSuUHTMLX2NSIG2dm5 HsJwWqgby3b4336TPjsBa5UN9sDUtcgVUND+DX6y7CTnOXnjiuvnfz0xyouIucQQx+EI nXE6toJv/NMiDw3WCfZ71mrl7R7Bvu+SZDhsJUQUr2Zwo+xGSeq99721WuG2hKNGZbNe wmZS8BuxXvE1kG9ToDalW5HUMb0OuCMOkXO0tPwEiirJb0Sipb6N3gnGMjvO1qWAdbK8 GaQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZAVOxKCn1rSRBeHkGZiJCt2gkjQ/XAx8tCfYXVtiNfE=; b=TX6DxWo/6bmRXGnKmJ/u8tK9QHEfnhjVJO5PNn5VogMbLjcTyDntaKwu8/caN7Qnw7 fUNkb9SWRwiACWr+99Ranss199s8VtRfTYwxJNCuEbb/M/wMd85KL15Tz/x408goKWKM 6FRiasGcT+UIVAGsFhFSghTH/i9TEmbcDsfDuBUP2tPRz+Nd1J7oIAs67pIwlvzVKfR/ 8UaoRe8ahSoKnOFWRe4aXj/7BeSLhra53pnEP82jbJMCHjnOoFuc7uCkmYYU6nQOXBWN QMItESM4oaAfKMsHwoHIyHvDAKJW94zQqTT+R8fzeNxqWF240BG7710y7NF8Y2F2F0YG yUHQ== X-Gm-Message-State: AOAM530fJhgg7s6Zl5HjUu7cKXtMISkAMDqJ0FaZZ/AdZ9LaoUfbc79T 0p4zBQ+lcxFrk+SMJ77Lb1dopikzFK9HWB4TskK52FJ2 X-Received: by 2002:a05:6a00:1c9e:b0:4fa:d946:378b with SMTP id y30-20020a056a001c9e00b004fad946378bmr4548697pfw.46.1649177919721; Tue, 05 Apr 2022 09:58:39 -0700 (PDT) MIME-Version: 1.0 References: <20220405075531.GB30877@worktop.programming.kicks-ass.net> In-Reply-To: <20220405075531.GB30877@worktop.programming.kicks-ass.net> From: Alexei Starovoitov Date: Tue, 5 Apr 2022 09:58:28 -0700 Message-ID: Subject: Re: [PATCH] x86,bpf: Avoid IBT objtool warning To: Peter Zijlstra , bpf , Daniel Borkmann , Andrii Nakryiko Cc: X86 ML , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 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. We can take it through the bpf tree if you prefer.