Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] boot/arm-trusted-firmware: fix SSP disable in v2.2
@ 2022-11-13 19:09 Baruch Siach via buildroot
  2022-11-13 20:55 ` Thomas Petazzoni via buildroot
  2022-11-15 13:10 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Baruch Siach via buildroot @ 2022-11-13 19:09 UTC (permalink / raw)
  To: buildroot; +Cc: Sergey Matyukevich

ATF version 2.2 and older does not disable SSP when
ENABLE_STACK_PROTECTOR is not set. This is because the compiler enables
SSP by default, and ATF does not pass -fno-stack-protector to the
compiler. Upstream commit 7af195e29a42 ("Disable stack protection
explicitly") fixed the issue for v2.3 and newer.

Add -fno-stack-protector in CFLAGS when
BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP is not set to fix older ATF
versions.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/3301821171

Cc: Dick Olsson <hi@senzilla.io>
Cc: Sergey Matyukevich <geomatsi@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 34d7d80243d4..1164c8141061 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -67,11 +67,17 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP),y)
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
 	ENABLE_STACK_PROTECTOR=$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP_LEVEL))
+else
+ARM_TRUSTED_FIRMWARE_CFLAGS += -fno-stack-protector
+endif
+
+ifeq ($(BR2_PIC_PIE),y)
+ARM_TRUSTED_FIRMWARE_CFLAGS += -fno-PIE
 endif
 
 ARM_TRUSTED_FIRMWARE_MAKE_ENV += \
 	$(TARGET_MAKE_ENV) \
-	$(if $(BR2_PIC_PIE),CFLAGS="-fno-PIE")
+	CFLAGS="$(ARM_TRUSTED_FIRMWARE_CFLAGS)"
 
 ifeq ($(BR2_ARM_CPU_ARMV7A),y)
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=7
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] boot/arm-trusted-firmware: fix SSP disable in v2.2
  2022-11-13 19:09 [Buildroot] [PATCH] boot/arm-trusted-firmware: fix SSP disable in v2.2 Baruch Siach via buildroot
@ 2022-11-13 20:55 ` Thomas Petazzoni via buildroot
  2022-11-15 13:10 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-11-13 20:55 UTC (permalink / raw)
  To: Baruch Siach via buildroot; +Cc: buildroot, Sergey Matyukevich

On Sun, 13 Nov 2022 21:09:54 +0200
Baruch Siach via buildroot <buildroot@buildroot.org> wrote:

> ATF version 2.2 and older does not disable SSP when
> ENABLE_STACK_PROTECTOR is not set. This is because the compiler enables
> SSP by default, and ATF does not pass -fno-stack-protector to the
> compiler. Upstream commit 7af195e29a42 ("Disable stack protection
> explicitly") fixed the issue for v2.3 and newer.
> 
> Add -fno-stack-protector in CFLAGS when
> BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP is not set to fix older ATF
> versions.
> 
> Fixes:
> https://gitlab.com/buildroot.org/buildroot/-/jobs/3301821171
> 
> Cc: Dick Olsson <hi@senzilla.io>
> Cc: Sergey Matyukevich <geomatsi@gmail.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  boot/arm-trusted-firmware/arm-trusted-firmware.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Applied to master, thanks for having looked so quickly at this issue!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] boot/arm-trusted-firmware: fix SSP disable in v2.2
  2022-11-13 19:09 [Buildroot] [PATCH] boot/arm-trusted-firmware: fix SSP disable in v2.2 Baruch Siach via buildroot
  2022-11-13 20:55 ` Thomas Petazzoni via buildroot
@ 2022-11-15 13:10 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-11-15 13:10 UTC (permalink / raw)
  To: Baruch Siach via buildroot; +Cc: buildroot, Sergey Matyukevich

>>>>> "Baruch" == Baruch Siach via buildroot <buildroot@buildroot.org> writes:

 > ATF version 2.2 and older does not disable SSP when
 > ENABLE_STACK_PROTECTOR is not set. This is because the compiler enables
 > SSP by default, and ATF does not pass -fno-stack-protector to the
 > compiler. Upstream commit 7af195e29a42 ("Disable stack protection
 > explicitly") fixed the issue for v2.3 and newer.

 > Add -fno-stack-protector in CFLAGS when
 > BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP is not set to fix older ATF
 > versions.

 > Fixes:
 > https://gitlab.com/buildroot.org/buildroot/-/jobs/3301821171

 > Cc: Dick Olsson <hi@senzilla.io>
 > Cc: Sergey Matyukevich <geomatsi@gmail.com>
 > Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Committed to 2022.08.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-11-15 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-13 19:09 [Buildroot] [PATCH] boot/arm-trusted-firmware: fix SSP disable in v2.2 Baruch Siach via buildroot
2022-11-13 20:55 ` Thomas Petazzoni via buildroot
2022-11-15 13:10 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox