public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, X86 ML <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86,bpf: Avoid IBT objtool warning
Date: Wed, 6 Apr 2022 12:46:43 +0200	[thread overview]
Message-ID: <20220406104643.GB2731@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <CAADnVQJ1_9sBqRngG_J+84whx9j7d7qOSzMaJvhc0evDBQfE3w@mail.gmail.com>

On Tue, Apr 05, 2022 at 09:58:28AM -0700, Alexei Starovoitov wrote:
> On Tue, Apr 5, 2022 at 12:55 AM Peter Zijlstra <peterz@infradead.org> 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) <peterz@infradead.org>
> > ---
> >  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.

  reply	other threads:[~2022-04-06 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05  7:55 [PATCH] x86,bpf: Avoid IBT objtool warning Peter Zijlstra
2022-04-05 16:58 ` Alexei Starovoitov
2022-04-06 10:46   ` Peter Zijlstra [this message]
2022-04-06 17:01     ` Alexei Starovoitov
2022-04-07  9:46 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220406104643.GB2731@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox