Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

From: Josh Poimboeuf
Date: Fri Sep 13 2024 - 19:09:33 EST


On Fri, Sep 13, 2024 at 10:39:18AM -0400, Joe Lawrence wrote:
> and now a happy kernel build and boot.

Thanks!

> A klp-build of the usual cmdline.patch succeeds, however it generates
> some strange relocations:
>
> Relocation section '.rela.text' at offset 0x238 contains 6 entries:
> Offset Info Type Symbol's Value Symbol's Name + Addend
> 0000000000000016 0000004600000004 R_X86_64_PLT32 0000000000000000 __kmalloc_noprof - 4
> 0000000000000035 0000004e00000004 R_X86_64_PLT32 0000000000000000 __fentry__ - 4
> 000000000000003c 0000000000000000 R_X86_64_NONE -4
>
> Relocation section '.rela.klp.relocs' at offset 0x1168 contains 2 entries:
> Offset Info Type Symbol's Value Symbol's Name + Addend
> 0000000000000000 0000000700000001 R_X86_64_64 0000000000000000 .text + 3c
> 0000000000000008 0000000000000001 R_X86_64_64 -4
>
> Relocation section '.klp.rela.h..text' at offset 0x53f18 contains 1 entry:
> Offset Info Type Symbol's Value Symbol's Name + Addend
> 000000000000003c 0000000000000002 R_X86_64_PC32 -4
>
> No bueno. FWIW, Song's 0001-test-klp.patch does seem to build w/o odd
> relocations and it loads fine.

Grr, I'm guessing more toolchain issues. A lot of tools don't seem to
like klp relocs.

Do you happen to have BTF enabled? I saw something similar with BTF and
had a fix in mind but I haven't had a chance to do it.

--
Josh