Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1216551pxb; Wed, 6 Apr 2022 11:34:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzKcQHdcYxos0X255uren4jLITCgc3Jap1eMfop8qdXJ7J+6XVTHJN/fEHAG/6u6MdzNx7 X-Received: by 2002:a63:214e:0:b0:399:1123:a388 with SMTP id s14-20020a63214e000000b003991123a388mr8304220pgm.66.1649270080749; Wed, 06 Apr 2022 11:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649270080; cv=none; d=google.com; s=arc-20160816; b=bwb778a8i0wqP3dQcvvjV/N4xOlHzL5zH+RcVy1FahBTnGqyFc/VgqffZXRzvCLPAL oz/yl2q6swbozMJvkJIIGCC6q3A4dur7vnDUvMyeOJG6iLutwkjX28KNi/JXrMfFsj3p xt5Ub9adfh2vAKQHoHNHDd/Ec1R6/M/CBmSRH+DBMMV0Z4/rljLHvat3UXKD4HKlySWg PW43cbPJEKmVA/pNYa1HvRcyoh83B7KguV669yP6pZEB6aNk9Nx1GgjmpdY+uzwkRxOv dKd7fvTE+N6ojbrcZfhQOEZUGLdrOCFc1EqnW/D9m70nZDxmc8Nnap9wlwLnbmcdQ+h9 ANVQ== 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=tji3uryA80ryL0v5i/4cJLB5FmNIif56xmTcuZ+KJ1E=; b=qGFolgdkYFnmpsMgjAdpPqxHsGLpaGsTvINqMY9kv1TIWOJTf6y4XZLhHHQBOwA9/d 6h4oHejBYvx2UCbavusz1vVWKqe9VkwxgKURq5Trff2/NRkLAkJyfdQOb6vOoAk0YQcA 74FvH0W2zNESQjZWNByDvZAna68A4JQN2ktObbZ6MsHVBY2JnMzKV2apgNBT7iTnJ3qD iGRjKDx2JoCeoOxhE5YDfIwx6KByBws0Om3k46nKPXW+5vJFdCCJ5yZUfat3g1qhtxZc +NHAHe1MFrCSPdaVIxfpS1k6TKkLHUhXImL+qKgYCWOucXNd18pwTp6j3ymR5UziItJX bgVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VKGbuIMC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x185-20020a6331c2000000b00398b3711547si16394100pgx.580.2022.04.06.11.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 11:34:40 -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=@gmail.com header.s=20210112 header.b=VKGbuIMC; 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; 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 C5AB411A56B; Wed, 6 Apr 2022 11:18:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240575AbiDFSUE (ORCPT + 99 others); Wed, 6 Apr 2022 14:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241494AbiDFSTT (ORCPT ); Wed, 6 Apr 2022 14:19:19 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDB9810781D; Wed, 6 Apr 2022 10:01:50 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id bx5so3117507pjb.3; Wed, 06 Apr 2022 10:01:50 -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=tji3uryA80ryL0v5i/4cJLB5FmNIif56xmTcuZ+KJ1E=; b=VKGbuIMCQkgcPN2TDBgIhQ0kOQ5fkECxM375spzc9MjKK3AH4Ss+8I8/w0TwxzGZbr yjEIW1kMpL5UwR1ByOoQuTEmwmZ5ihewS3bXAPBrTmZkNtFo/Exj6Z4QOoPDVpOXqEa+ X6FPILUSP6D3YB7DWDU7Jdw37z5u1JX1ojLmwZ30eY/6ono4+TJeSEqks+f77pJx0VNb P38COxMVPO4tGwAxAg43DcCXd9MVWqpad9quPgVZEwgn1qtOLFcsnQjMln6foAhj/yzm uiJHXRrTqlM5gty/vGc5IrBp7CctkWXdH8jJIGMgwp35/mg7Zn/xYnraYhXVa0RUc0rg fV0g== 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=tji3uryA80ryL0v5i/4cJLB5FmNIif56xmTcuZ+KJ1E=; b=VR42+s8nWqdxOLTmFXzomEQuyirTtRfFL132GEXsRNHflgozZkblSlNRlZH+7Ggvg+ 0/KfFem5XGSzX+4qA3y9FGo9zHpKzAeiZDWc3n/W7DXyCakHpPmedrOkej07m0QzQpDR RIgviZjdva5CGrum1DVYVJaWdNNLBCaFPo7EiEjaiNnw5PQvfNDOkKVm3IVrF4oCV8jd kJ+r/GVNoBpet6sTVgtrmQu/k+hGfIu/udDWRAnmQLaZQRSWjBaK3NMHkfyP5v23YDLD BDKUJtD1zfi+vq67GHDsCslmMU61kk+hEuOSoImhubDkvPzYo7T9BCaqT94TSvFS04H0 bslg== X-Gm-Message-State: AOAM533c/jtMy6uoLjK8TiGdGDFgoI4RxW4ysIjt6IiBXx3ul67Y7OUq 5Es7JOwP2EZZw3SaPxPHzdAQVFrhw+UUJvT5e1mngQul X-Received: by 2002:a17:903:32c5:b0:156:b466:c8ed with SMTP id i5-20020a17090332c500b00156b466c8edmr9561560plr.34.1649264510205; Wed, 06 Apr 2022 10:01:50 -0700 (PDT) MIME-Version: 1.0 References: <20220405075531.GB30877@worktop.programming.kicks-ass.net> <20220406104643.GB2731@worktop.programming.kicks-ass.net> In-Reply-To: <20220406104643.GB2731@worktop.programming.kicks-ass.net> From: Alexei Starovoitov Date: Wed, 6 Apr 2022 10:01:39 -0700 Message-ID: Subject: Re: [PATCH] x86,bpf: Avoid IBT objtool warning To: Peter Zijlstra Cc: bpf , Daniel Borkmann , Andrii Nakryiko , 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 Wed, Apr 6, 2022 at 3:46 AM Peter Zijlstra wrote: > > 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. Sure. Then pls add: Acked-by: Alexei Starovoitov