linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] arm32/boot/compressed: Force hidden visibility for all symbol references
@ 2025-01-24  8:20 Yuntao Liu
  2025-01-24 14:00 ` Ard Biesheuvel
  2025-01-24 15:25 ` Russell King (Oracle)
  0 siblings, 2 replies; 4+ messages in thread
From: Yuntao Liu @ 2025-01-24  8:20 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: linux, ruanjinjie, kees, masahiroy, ardb, liuyuntao12

Eliminate all GOT entries in the decompressor binary, by forcing hidden
visibility for all symbol references, which informs the compiler that
such references will be resolved at link time without the need for
allocating GOT entries.

Include linux/hidden.h in Makefile, like x86, for the
hidden visibility attribute.

Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
---
 arch/arm/boot/compressed/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 945b5975fce2..d8a17760ad29 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -93,6 +93,9 @@ targets       := vmlinux vmlinux.lds piggy_data piggy.o \
 		 head.o $(OBJS)
 
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
+ifneq ($(CONFIG_LD_IS_LLD),y)
+KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
+endif
 
 ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
 	     -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] arm32/boot/compressed: Force hidden visibility for all symbol references
  2025-01-24  8:20 [PATCH -next] arm32/boot/compressed: Force hidden visibility for all symbol references Yuntao Liu
@ 2025-01-24 14:00 ` Ard Biesheuvel
  2025-01-24 15:32   ` Russell King (Oracle)
  2025-01-24 15:25 ` Russell King (Oracle)
  1 sibling, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2025-01-24 14:00 UTC (permalink / raw)
  To: Yuntao Liu, Linus Walleij
  Cc: linux-arm-kernel, linux-kernel, linux, ruanjinjie, kees,
	masahiroy

On Fri, 24 Jan 2025 at 09:31, Yuntao Liu <liuyuntao12@huawei.com> wrote:
>
> Eliminate all GOT entries in the decompressor binary, by forcing hidden
> visibility for all symbol references, which informs the compiler that
> such references will be resolved at link time without the need for
> allocating GOT entries.
>
> Include linux/hidden.h in Makefile, like x86, for the
> hidden visibility attribute.
>
> Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>

Doesn't this break appended DTB?

> ---
>  arch/arm/boot/compressed/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
> index 945b5975fce2..d8a17760ad29 100644
> --- a/arch/arm/boot/compressed/Makefile
> +++ b/arch/arm/boot/compressed/Makefile
> @@ -93,6 +93,9 @@ targets       := vmlinux vmlinux.lds piggy_data piggy.o \
>                  head.o $(OBJS)
>
>  KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
> +ifneq ($(CONFIG_LD_IS_LLD),y)
> +KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
> +endif
>

Why not for LLD?


>  ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
>              -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
> --
> 2.34.1
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] arm32/boot/compressed: Force hidden visibility for all symbol references
  2025-01-24  8:20 [PATCH -next] arm32/boot/compressed: Force hidden visibility for all symbol references Yuntao Liu
  2025-01-24 14:00 ` Ard Biesheuvel
@ 2025-01-24 15:25 ` Russell King (Oracle)
  1 sibling, 0 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2025-01-24 15:25 UTC (permalink / raw)
  To: Yuntao Liu
  Cc: linux-arm-kernel, linux-kernel, ruanjinjie, kees, masahiroy, ardb

On Fri, Jan 24, 2025 at 08:20:30AM +0000, Yuntao Liu wrote:
> Eliminate all GOT entries in the decompressor binary, by forcing hidden
> visibility for all symbol references, which informs the compiler that
> such references will be resolved at link time without the need for
> allocating GOT entries.

One question. Why.

I don't think this is desirable. We don't want the linker to fully
resolve references at link time - we specifically want a GOT so that
at run time the decompressor can resolve the references irrespective
of where the decompressor is loaded - in other words, allowing the
decompressor to be loaded anywhere in memory.

We do not link the decompressor for any specific address, and thus
the only way the decompressor can work is by fixing up the GOT.

Unless you can demonstrate that the GOT is no longer required, then
based on your commit description... hard NAK.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] arm32/boot/compressed: Force hidden visibility for all symbol references
  2025-01-24 14:00 ` Ard Biesheuvel
@ 2025-01-24 15:32   ` Russell King (Oracle)
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2025-01-24 15:32 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Yuntao Liu, Linus Walleij, linux-arm-kernel, linux-kernel,
	ruanjinjie, kees, masahiroy

On Fri, Jan 24, 2025 at 03:00:10PM +0100, Ard Biesheuvel wrote:
> On Fri, 24 Jan 2025 at 09:31, Yuntao Liu <liuyuntao12@huawei.com> wrote:
> >
> > Eliminate all GOT entries in the decompressor binary, by forcing hidden
> > visibility for all symbol references, which informs the compiler that
> > such references will be resolved at link time without the need for
> > allocating GOT entries.
> >
> > Include linux/hidden.h in Makefile, like x86, for the
> > hidden visibility attribute.
> >
> > Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
> 
> Doesn't this break appended DTB?

Yes. It also breaks ZBOOT_ROM=y as well.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-24 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24  8:20 [PATCH -next] arm32/boot/compressed: Force hidden visibility for all symbol references Yuntao Liu
2025-01-24 14:00 ` Ard Biesheuvel
2025-01-24 15:32   ` Russell King (Oracle)
2025-01-24 15:25 ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).