Re: linux-next: build warnings after merge of the tip tree

From: Masami Hiramatsu
Date: Tue Mar 22 2022 - 01:31:57 EST


On Mon, 21 Mar 2022 17:48:54 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Mon, Mar 21, 2022 at 02:04:05PM +0100, Peter Zijlstra wrote:
> > On Mon, Mar 21, 2022 at 01:55:49PM +0100, Peter Zijlstra wrote:
> > > On Mon, Mar 21, 2022 at 02:03:27PM +1100, Stephen Rothwell wrote:
> > > > Hi all,
> > > >
> > > > After merging the tip tree, today's linux-next build (x864 allmodconfig)
> > > > produced these new warnings:
> > > >
> > > > vmlinux.o: warning: objtool: arch_rethook_prepare()+0x55: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: arch_rethook_trampoline_callback()+0x3e: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: unwind_next_frame()+0x93e: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: unwind_next_frame()+0x5f2: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: unwind_next_frame()+0x4a7: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: __rethook_find_ret_addr()+0x81: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: __rethook_find_ret_addr()+0x90: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: rethook_trampoline_handler()+0x8c: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > > > vmlinux.o: warning: objtool: rethook_trampoline_handler()+0x9b: relocation to !ENDBR: arch_rethook_trampoline+0x0
> > >
> > > Hurmph, lemme go figure out where that code comes from, I've not seen
> > > those.
> >
> > Ahh, something tracing. I'll go do some patches on top of it.
>
> The below gets rid of the objtool warnings.

Yes, I confirmed that.

>
> But I still think it's fairly terrible to get a (flawed) carbon copy of
> the kretprobe code.

Indeed. I would like to replace the trampoline code of kretprobe with
rethook, eventually. There is no reason why we keep the clone.
(But I need more arch maintainers help for that, there are too many
archs implemented kretprobes)

> Also, I think both should fix regs->ss.

I'm not sure this part. Since the return trampoline should run in the same
context of the called function, isn't ss same there too?

Thank you,

>
> ---
> diff --git a/arch/x86/kernel/rethook.c b/arch/x86/kernel/rethook.c
> index f0f2f0608282..227a1890a984 100644
> --- a/arch/x86/kernel/rethook.c
> +++ b/arch/x86/kernel/rethook.c
> @@ -20,6 +20,7 @@ asm(
> ".type arch_rethook_trampoline, @function\n"
> "arch_rethook_trampoline:\n"
> #ifdef CONFIG_X86_64
> + ANNOTATE_NOENDBR
> /* Push a fake return address to tell the unwinder it's a kretprobe. */
> " pushq $arch_rethook_trampoline\n"
> UNWIND_HINT_FUNC
> @@ -48,7 +49,7 @@ asm(
> " addl $4, %esp\n"
> " popfl\n"
> #endif
> - " ret\n"
> + ASM_RET
> ".size arch_rethook_trampoline, .-arch_rethook_trampoline\n"
> );
> NOKPROBE_SYMBOL(arch_rethook_trampoline);


--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>