Re: [PATCH v7 8/8] [DO NOT MERGE] x86/kexec: Add CFI type information to relocate_kernel()

From: David Woodhouse
Date: Fri Mar 14 2025 - 14:29:34 EST


On Fri, 2025-03-14 at 10:52 -0700, Josh Poimboeuf wrote:
> On Fri, Mar 14, 2025 at 05:23:15PM +0000, David Woodhouse wrote:
> > ISTR this version is OK with Clang and CONFIG_CFI_CLANG but with GCC I
> > get this:
> >
> > vmlinux.o: warning: objtool: relocate_kernel+0x69: unsupported stack register modification
> >
> >         /* setup a new stack at the end of the physical control page */
> >         lea     PAGE_SIZE(%rsi), %rsp
> >   79:   48 8d a6 00 10 00 00    lea    0x1000(%rsi),%rsp
> >
> >
> > Maybe the answer is to put the UNWIND_HINT_FUNC into #ifdef
> > CONFIG_CFI_CLANG but that seems wrong.
>
> The UNWIND_HINT_FUNC definitely looks wrong, why would Clang need it?

I think it's when CONFIG_CFI_CLANG makes the SYM_TYPED_FUNC_START()
macro actually emit the CFI prologue?

> > I'll have another look at putting it in the data section, and see if I
> > can remember why I didn't want to do that before (and if that's still
> > relevant now).
>
> IIRC, the reasons were the patched alternative, and also you wanted to
> disassemble (but note that's still possible with gdb).
>
> Here was a patch to make it work:
>
>   https://lore.kernel.org/20241218212326.44qff3i5n6cxuu5d@jpoimboe

Yeah, that does seem reasonable. Sorry, I think I missed that before
Christmas. I'll look at rolling it in. This part is kind of orthogonal
to the actual debug support so it's fine to keep it separate.

Thanks.

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