lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Feb 2024 21:18:34 -0800
From: Fangrui Song <maskray@...gle.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: hca@...ux.ibm.com, gor@...ux.ibm.com, agordeev@...ux.ibm.com, 
	borntraeger@...ux.ibm.com, svens@...ux.ibm.com, ndesaulniers@...gle.com, 
	linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org, 
	llvm@...ts.linux.dev, patches@...ts.linux.dev
Subject: Re: [PATCH 06/11] s390/boot: vmlinux.lds.S: Handle '.rela' sections

On Wed, Feb 7, 2024 at 4:15 PM Nathan Chancellor <nathan@...nel.org> wrote:
>
> When building with CONFIG_LD_ORPHAN_WARN after selecting
> CONFIG_ARCH_HAS_LD_ORPHAN_WARN, there are several warnings from
> arch/s390/boot/head.o due to the unhandled presence of '.rela' sections:
>
>   s390-linux-ld: warning: orphan section `.rela.iplt' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.head.text' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.got' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.data' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.data.rel.ro' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.iplt' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.head.text' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.got' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.data' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>   s390-linux-ld: warning: orphan section `.rela.data.rel.ro' from `arch/s390/boot/head.o' being placed in section `.rela.dyn'
>
> These sections are unneeded for the decompressor and they are not
> emitted in the binary currently. In a manner similar to other
> architectures, coalesce the sections into '.rela.dyn' and ensure it is
> zero sized, which is a safe/tested approach versus full discard.
>
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
>  arch/s390/boot/vmlinux.lds.S | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/s390/boot/vmlinux.lds.S b/arch/s390/boot/vmlinux.lds.S
> index 2f0bc05664ed..ff8c62d84f98 100644
> --- a/arch/s390/boot/vmlinux.lds.S
> +++ b/arch/s390/boot/vmlinux.lds.S
> @@ -137,6 +137,10 @@ SECTIONS
>                 *(.igot .igot.plt)
>         }
>         ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
> +       .rela.dyn : {
> +               *(.rela.*) *(.rela_*)
> +       }
> +       ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
>
>         /* Sections to be discarded */
>         /DISCARD/ : {
>
> --
> 2.43.0
>

Commit 5354e84598f264793265cc99b4be2a2295826c86 ("x86/build: Add
asserts for unwanted sections")
specifies `*(.rela.*) *(.rela_*)` but it's not clear why `.rela_*` is
included. We only need .rela.* (see also ld.bfd --verbose)

This patch LGTM with this changed.

-- 
宋方睿

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ