[RFC PATCH 2/2] x86/kexec: Add data section to relocate_kernel

David Woodhouse dwmw2 at infradead.org
Tue Nov 12 00:44:33 PST 2024


On Fri, 2024-11-08 at 12:26 +0100, H. Peter Anvin wrote:
> 
> > --- a/arch/x86/kernel/vmlinux.lds.S
> > +++ b/arch/x86/kernel/vmlinux.lds.S
> > @@ -100,7 +100,7 @@ const_pcpu_hot = pcpu_hot;
> >         . = ALIGN(PAGE_SIZE);                                   \
> >         __relocate_kernel_start = .;                            \
> >         *(.text.relocate_kernel);                               \
> > -       *(.rodata.relocate_kernel);                             \
> > +       *(.data.relocate_kernel);                               \
> >         __relocate_kernel_end = .;
> > #else
> > #define KEXEC_RELOCATE_KERNEL_TEXT
> 
> Looks good at first glance. I'm currently traveling so I haven't
> fully reviewed it though.

Turns out it doesn't help much. It's neater, obviously, but objtool
still wants to disassemble the .data.relocate_kernel section after it
gets included in the overall kernel text section.

So once I rebase the debugging support on top and add the GDT¹ into the
data section, it gets very unhappy:

arch/x86/tools/insn_decoder_test: warning: Found an x86 instruction decoder bug, please report this.
arch/x86/tools/insn_decoder_test: warning: ffffffff8219250a:	eb fd                1f 00 00 00 00 00 00 00 ff ff 00 00 00 9a cf 00     ................ff ff 00 00 00 9a af 00 ff ff 00 00 00 92 cf 00     ................cc cc cc cc cc cc cc cc cc cc cc cc                 ............	jmp    ffffffffarch/x86/tools/insn_decoder_test: warning: objdump says 23 bytes, but insn_get_length() says 2
arch/x86/tools/insn_decoder_test: error: malformed line 5236442:
82192509 <exc_handler+0x18e>

It's also still complaining that pr_nybble() and pr_qword() are
unreachable, although it doesn't say that of the exc_handler() function
which blatantly calls them. Although I can look at that harder if I do
factor it out to C code.

¹ https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/kexec-debug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5965 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/kexec/attachments/20241112/9806cb2c/attachment.p7s>


More information about the kexec mailing list