Re: [PATCH V2] x86/boot: explicitly place .eh_frame after .rodata

From: Nick Desaulniers
Date: Mon Nov 18 2019 - 12:46:39 EST


On Mon, Nov 18, 2019 at 6:36 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Wed, Nov 06, 2019 at 02:06:28PM +0200, Ilie Halip wrote:
> > diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld
> > index 0149e41d42c2..30ce52635cd0 100644
> > --- a/arch/x86/boot/setup.ld
> > +++ b/arch/x86/boot/setup.ld
> > @@ -25,6 +25,7 @@ SECTIONS
> >
> > . = ALIGN(16);
> > .rodata : { *(.rodata*) }
> > + .eh_frame : { *(.eh_frame) }
>
> The kernel proper linker script does
>
> /DISCARD/ : {
> *(.eh_frame)
> }
>
> with the .eh_frame section.
>
> Wouldn't that solve your issue too, if you add it to the /DISCARD/
> section in that linker script too?

Yep. Looks like:
- arch/x86/kernel/vmlinux.lds.S
- arch/x86/realmode/rm/realmode.lds.S

discard .eh_frame, while
- arch/x86/entry/vdso/vdso-layout.lds.S
- arch/x86/um/vdso/vdso-layout.lds.S

keep it. I assume then that just vdso code that get linked into
userspace needs to preserve this. This suggestion would be a
functional change, which is why we pursued the conservative change
preserving it.
https://github.com/ClangBuiltLinux/linux/issues/760#issuecomment-549192213

Ilie, would you mind sending a v3 with Boris' recommendation?

--
Thanks,
~Nick Desaulniers