[PATCH v4 8/9] loongarch: avoid orphan input sections

Ard Biesheuvel ardb at kernel.org
Sat Aug 27 06:27:20 PDT 2022


On Sat, 27 Aug 2022 at 12:16, 陈华才 <chenhuacai at loongson.cn> wrote:
>
> Hi, Ard,
>
> It seems that this patch is a normal bugfix and has no relation with this series. If so, I prefer to take into loongarch-fixes for 6.0-rc4. Thanks.
>

It does have a relation: the signing tool will complain because the
PE/COFF metadata goes out of sync, like so

  SBSIGN  arch/loongarch/boot/vmlinux.efi.signed
warning: data remaining[20754944 vs 20755016]: gaps between PE/COFF sections?

This is because of the *(.rela.dyn) section created by the linker,
which is appended after the .data section, and so the PE/COFF .data
section size does not match the file size.

*However*, you explained to me that vmlinux is not a PIC binary, and
the link should be non-PIE as well. So this looks like another
toolchain issue to me, that you may want to look into.

(The .rela.dyn section typically contains relocations applied by
ld.so, either to PIE executables, or to shared libraries. It is
probably harmless given that the loongarch kernel runs from its link
time address, but it is still odd that this section is being
generated)

Anyway, I will drop this patch from the series - I will leave it up to
you entirely how you prefer to fix this.





>
> > -----原始邮件-----
> > 发件人: "Ard Biesheuvel" <ardb at kernel.org>
> > 发送时间:2022-08-27 16:38:49 (星期六)
> > 收件人: linux-efi at vger.kernel.org
> > 抄送: linux-arm-kernel at lists.infradead.org, "Ard Biesheuvel" <ardb at kernel.org>, "James E.J. Bottomley" <James.Bottomley at HansenPartnership.com>, "Matthew Garrett" <mjg59 at srcf.ucam.org>, "Peter Jones" <pjones at redhat.com>, "Ilias Apalodimas" <ilias.apalodimas at linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt at canonical.com>, "AKASHI Takahiro" <takahiro.akashi at linaro.org>, "Palmer Dabbelt" <palmer at dabbelt.com>, "Atish Patra" <atishp at atishpatra.org>, "Arnd Bergmann" <arnd at arndb.de>, "Huacai Chen" <chenhuacai at loongson.cn>, "Xi Ruoyao" <xry111 at xry111.site>, "Lennart Poettering" <lennart at poettering.net>, "Jeremy Linton" <jeremy.linton at arm.com>
> > 主题: [PATCH v4 8/9] loongarch: avoid orphan input sections
> >
> > Ensure that all input sections are listed explicitly in the linker
> > script, and issue a warning otherwise. This ensures that the binary
> > image matches the PE/COFF and other image metadata exactly, which is
> > important for things like code signing.
> >
> > Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
> > ---
> >  arch/loongarch/Kconfig              | 1 +
> >  arch/loongarch/kernel/vmlinux.lds.S | 2 ++
> >  2 files changed, 3 insertions(+)
> >
> > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> > index fca106a8b8af..407502da4335 100644
> > --- a/arch/loongarch/Kconfig
> > +++ b/arch/loongarch/Kconfig
> > @@ -51,6 +51,7 @@ config LOONGARCH
> >       select ARCH_USE_CMPXCHG_LOCKREF
> >       select ARCH_USE_QUEUED_RWLOCKS
> >       select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
> > +     select ARCH_WANT_LD_ORPHAN_WARN
> >       select ARCH_WANTS_NO_INSTR
> >       select BUILDTIME_TABLE_SORT
> >       select COMMON_CLK
> > diff --git a/arch/loongarch/kernel/vmlinux.lds.S b/arch/loongarch/kernel/vmlinux.lds.S
> > index 36d042739f3c..17d33308dfba 100644
> > --- a/arch/loongarch/kernel/vmlinux.lds.S
> > +++ b/arch/loongarch/kernel/vmlinux.lds.S
> > @@ -74,6 +74,8 @@ SECTIONS
> >               EXIT_DATA
> >       }
> >
> > +     .rela.dyn : { *(.rela.dyn) *(.rela*) }
> > +
> >  #ifdef CONFIG_SMP
> >       PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT)
> >  #endif
> > --
> > 2.35.1
>
>
> 本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
> This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.



More information about the linux-arm-kernel mailing list