Re: [PATCH v5 07/20] x86/kexec: Invoke copy of relocate_kernel() instead of the original

From: David Woodhouse
Date: Wed Dec 18 2024 - 17:27:50 EST


On Wed, 2024-12-18 at 13:23 -0800, Josh Poimboeuf wrote:
>
> The linker script does place it in .data, but objtool runs on the object
> file before linking, where it's still in an executable section
> (.text..relocate_kernel).
>
> How about something like below?
>
>   - move text to .data..relocate_kernel
>   - remove objtool annotations
>   - replace the alternative with a runtime check

That leaves me unable to use 'objdump -S
arch/x86/kernel/relocate_kernel_64.o' so I hate it :)

At the moment objtool is *mostly* happy with the code in here; is there
no way to make it happy even with the CFI annotation?

In practice I probably don't even need to use SYM_TYPED_FUNC_START()
anyway, as it's doing the wrong thing. It's pointless if it just uses
the external __cfi_typeid_relocate_kernel symbol that the C code emits,
because that's obviously going to match the prototype that the C code
expects.

So I might emit the __cfi_relocate_kernel prologue entirely manually,
and then maybe objtool will thinking it's entitled to opinions :)


Attachment: smime.p7s
Description: S/MIME cryptographic signature