Skip to contentSkip to conversation

ARM: atags_to_fdt: don't warn about stack size

PATCH In review David Heidelberg 4 participants 5 messages Aug 9, 2021 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: atags_to_fdt: don't warn about stack size

The merge_fdt_bootargs() function by definition consumes more than 1024 bytes of stack because it has a 1024 byte command line on the stack, meaning that we always get a warning when building this file:

arch/arm/boot/compressed/atags_to_fdt.c: In function 'merge_fdt_bootargs':
arch/arm/boot/compressed/atags_to_fdt.c:98:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

However, as this is the decompressor and we know that it has a very shallow call chain, and we do not actually risk overflowing the kernel stack at runtime here.

This just shuts up the warning by disabling the warning flag for this file.

Tested on Nexus 7 2012 builds.

Original Author: Arnd Bergmann <[email protected]>
Reference: https://lore.kernel.org/lkml/8232115.18ykgQ6J5T@wuerfel/

Cc Arnd Bergmann <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Russell King <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Marc Zyngier <[email protected]>
---
 arch/arm/boot/compressed/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/compressed/Makefile +2 -0
index 9d91ae1091b0..91265e7ff672 100644
@@ -85,6 +85,8 @@ compress-$(CONFIG_KERNEL_LZ4)  = lz4
 libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o
 
 ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
+CFLAGS_REMOVE_atags_to_fdt.o += -Wframe-larger-than=${CONFIG_FRAME_WARN}
+CFLAGS_atags_to_fdt.o += -Wframe-larger-than=1280
 OBJS	+= $(libfdt_objs) atags_to_fdt.o
 endif
 ifeq ($(CONFIG_USE_OF),y)
Signature · 1 line
2.30.2
#1 lore raw
Quoted 27 lines · David Heidelberg

The merge_fdt_bootargs() function by definition consumes more than 1024 bytes of stack because it has a 1024 byte command line on the stack, meaning that we always get a warning when building this file:

arch/arm/boot/compressed/atags_to_fdt.c: In function 'merge_fdt_bootargs':
arch/arm/boot/compressed/atags_to_fdt.c:98:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

However, as this is the decompressor and we know that it has a very shallow call chain, and we do not actually risk overflowing the kernel stack at runtime here.

This just shuts up the warning by disabling the warning flag for this file.

Tested on Nexus 7 2012 builds.

Original Author: Arnd Bergmann <[email protected]>
Reference: https://lore.kernel.org/lkml/8232115.18ykgQ6J5T@wuerfel/

Cc Arnd Bergmann <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Russell King <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Marc Zyngier <[email protected]>
Quoted 1 line

I assume Arnd never sent his v3 from what I see in the thread you link to above.

This needs to go to the patch system to be applied. Details in my signature below. Thanks.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Acked-by
#2 lore raw
Quoted 2 lines · Russell King (Oracle)
Quoted 1 line · David Heidelberg

(or keep my original Signed-off-by if you like)

Quoted 2 lines

I assume Arnd never sent his v3 from what I see in the thread you link to above.

Yes, it's in my ever-growing backlog of things I plan to eventually resubmit.

In this case, I actually have a different patch in my tree, but that in turn depends on other stuff I have to submit first (reorganizing the way that warning options get handled based on compiler version etc), and the version here is what works on current mainline kernels.

Arnd

author Acked-by Arnd Bergmann
#3 lore raw

Thank you, in next iteration I'll keep you as author and keep your S-off-by

-------- Původní zpráva --------
Odesílatel: Arnd Bergmann <[email protected]>
Odesláno: 9. srpna 2021 16:02:36 UTC
Komu: "Russell King (Oracle)" <[email protected]>
Kopie: David Heidelberg <[email protected]>, Arnd Bergmann <[email protected]>, Jon Medhurst <[email protected]>, Ard Biesheuvel <[email protected]>, Marc Zyngier <[email protected]>, Nicolas Pitre <[email protected]>, Linux Kernel Mailing List <[email protected]>, Linux ARM <[email protected]> Předmět: Re: [PATCH] ARM: atags_to_fdt: don't warn about stack size

Quoted 2 lines · Russell King (Oracle)
Quoted 1 line · David Heidelberg

(or keep my original Signed-off-by if you like)

Quoted 2 lines

I assume Arnd never sent his v3 from what I see in the thread you link to above.

Yes, it's in my ever-growing backlog of things I plan to eventually resubmit.

In this case, I actually have a different patch in my tree, but that in turn depends on other stuff I have to submit first (reorganizing the way that warning options get handled based on compiler version etc), and the version here is what works on current mainline kernels.

Arnd

S pozdravem a přáním krásného dne
David Heidelberg

Acked-by on v1 1/1
#4 lore raw
In reply to David Heidelberg
Quoted 27 lines · David Heidelberg

The merge_fdt_bootargs() function by definition consumes more than 1024 bytes of stack because it has a 1024 byte command line on the stack, meaning that we always get a warning when building this file:

arch/arm/boot/compressed/atags_to_fdt.c: In function 'merge_fdt_bootargs':
arch/arm/boot/compressed/atags_to_fdt.c:98:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

However, as this is the decompressor and we know that it has a very shallow call chain, and we do not actually risk overflowing the kernel stack at runtime here.

This just shuts up the warning by disabling the warning flag for this file.

Tested on Nexus 7 2012 builds.

Original Author: Arnd Bergmann <[email protected]>
Reference: https://lore.kernel.org/lkml/8232115.18ykgQ6J5T@wuerfel/

Cc Arnd Bergmann <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Russell King <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Marc Zyngier <[email protected]>
Quoted 1 line
Quoted 21 lines
---
 arch/arm/boot/compressed/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/compressed/Makefile +2 -0
index 9d91ae1091b0..91265e7ff672 100644
@@ -85,6 +85,8 @@ compress-$(CONFIG_KERNEL_LZ4)  = lz4
 libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o
 
 ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
+CFLAGS_REMOVE_atags_to_fdt.o += -Wframe-larger-than=${CONFIG_FRAME_WARN}
+CFLAGS_atags_to_fdt.o += -Wframe-larger-than=1280
 OBJS	+= $(libfdt_objs) atags_to_fdt.o
 endif
 ifeq ($(CONFIG_USE_OF),y)
Signature · 1 line
2.30.2