Skip to contentSkip to conversation

board/qemu/s390x: disable SSP when needed

PATCH New Fabrice Fontaine 4 participants 7 messages May 9, 2021 – May 15, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 board/qemu/s390x: disable SSP when needed

Fix build failure raised since commit 810ba387bec3c5b6904e8893fb4cb6f9d3717466 by disabling SSP when needed

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043361

---
Changes v1 -> v2 (after review of Romain Naour):
- Move patch from linux to board/qemu/s390x

 ...01-arch-s390-disable-SSP-when-needed.patch | 47 +++++++++++++++++++
 configs/qemu_s390x_defconfig                  |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch
board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch new file +47 -0
new file mode 100644
index 0000000000..c8199d4fd6
@@ -0,0 +1,47 @@
+From 8a054081678ed0b0e56f829bac0a4656e3a198b9 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sat, 8 May 2021 22:03:11 +0200
+Subject: [PATCH] arch/s390: disable SSP when needed
+
+Though -nostdlib is passed in PURGATORY_LDFLAGS and -ffreestanding in
+KBUILD_CFLAGS_DECOMPRESSOR, -fno-stack-protector must also be passed to
+avoid linking errors related to undefined references to
+'__stack_chk_guard' and '__stack_chk_fail' if toolchain enforces
+-fstack-protector.
+
+Fixes:
+ - https://gitlab.com/kubu93/buildroot/-/jobs/1247043361
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ arch/s390/Makefile           | 1 +
+ arch/s390/purgatory/Makefile | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/arch/s390/Makefile b/arch/s390/Makefile
+index e443ed9947bd..098abe3a56f3 100644
+--- a/arch/s390/Makefile
++++ b/arch/s390/Makefile
+@@ -28,6 +28,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
+ KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding
++KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector
+ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
+diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
+index c57f8c40e992..21c4ebe29b9a 100644
+--- a/arch/s390/purgatory/Makefile
++++ b/arch/s390/purgatory/Makefile
+@@ -24,6 +24,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
+ KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
+ KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
+ KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
++KBUILD_CFLAGS += -fno-stack-protector
+ KBUILD_CFLAGS += $(CLANG_FLAGS)
+ KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
+ KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
+-- 
+2.30.2
+
configs/qemu_s390x_defconfig +1 -0
index 9b3821f043..4aed9d9ae5 100644
@@ -20,6 +20,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.7"
 BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
 BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_GLOBAL_PATCH_DIR="board/qemu/s390x/patches"
 
 # host-qemu for gitlab testing
 BR2_PACKAGE_HOST_QEMU=y
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/1 board/qemu/s390x: disable SSP when needed

Hello Fabrice,

Le 09/05/2021 ? 15:06, Fabrice Fontaine a ?crit?:

Quoted 7 lines

Fix build failure raised since commit 810ba387bec3c5b6904e8893fb4cb6f9d3717466 by disabling SSP when needed

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043361

Best regards,
Romain

Quoted 75 lines

---
Changes v1 -> v2 (after review of Romain Naour):
- Move patch from linux to board/qemu/s390x

 ...01-arch-s390-disable-SSP-when-needed.patch | 47 +++++++++++++++++++
 configs/qemu_s390x_defconfig                  |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch
board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch new file +47 -0
new file mode 100644
index 0000000000..c8199d4fd6
@@ -0,0 +1,47 @@
+From 8a054081678ed0b0e56f829bac0a4656e3a198b9 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sat, 8 May 2021 22:03:11 +0200
+Subject: [PATCH] arch/s390: disable SSP when needed
+
+Though -nostdlib is passed in PURGATORY_LDFLAGS and -ffreestanding in
+KBUILD_CFLAGS_DECOMPRESSOR, -fno-stack-protector must also be passed to
+avoid linking errors related to undefined references to
+'__stack_chk_guard' and '__stack_chk_fail' if toolchain enforces
+-fstack-protector.
+
+Fixes:
+ - https://gitlab.com/kubu93/buildroot/-/jobs/1247043361
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ arch/s390/Makefile           | 1 +
+ arch/s390/purgatory/Makefile | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/arch/s390/Makefile b/arch/s390/Makefile
+index e443ed9947bd..098abe3a56f3 100644
+--- a/arch/s390/Makefile
++++ b/arch/s390/Makefile
+@@ -28,6 +28,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
+ KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding
++KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector
+ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
+diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
+index c57f8c40e992..21c4ebe29b9a 100644
+--- a/arch/s390/purgatory/Makefile
++++ b/arch/s390/purgatory/Makefile
+@@ -24,6 +24,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
+ KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
+ KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
+ KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
++KBUILD_CFLAGS += -fno-stack-protector
+ KBUILD_CFLAGS += $(CLANG_FLAGS)
+ KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
+ KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
+-- 
+2.30.2
+
configs/qemu_s390x_defconfig +1 -0
index 9b3821f043..4aed9d9ae5 100644
@@ -20,6 +20,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.7"
 BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
 BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_GLOBAL_PATCH_DIR="board/qemu/s390x/patches"
 
 # host-qemu for gitlab testing
 BR2_PACKAGE_HOST_QEMU=y
#2 lore raw

PATCH v2 1/1 board/qemu/s390x: disable SSP when needed

In reply to Fabrice Fontaine
Quoted 83 lines · Fabrice Fontaine

Fix build failure raised since commit 810ba387bec3c5b6904e8893fb4cb6f9d3717466 by disabling SSP when needed

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043361

---
Changes v1 -> v2 (after review of Romain Naour):
- Move patch from linux to board/qemu/s390x

 ...01-arch-s390-disable-SSP-when-needed.patch | 47 +++++++++++++++++++
 configs/qemu_s390x_defconfig                  |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch
board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch new file +47 -0
new file mode 100644
index 0000000000..c8199d4fd6
@@ -0,0 +1,47 @@
+From 8a054081678ed0b0e56f829bac0a4656e3a198b9 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sat, 8 May 2021 22:03:11 +0200
+Subject: [PATCH] arch/s390: disable SSP when needed
+
+Though -nostdlib is passed in PURGATORY_LDFLAGS and -ffreestanding in
+KBUILD_CFLAGS_DECOMPRESSOR, -fno-stack-protector must also be passed to
+avoid linking errors related to undefined references to
+'__stack_chk_guard' and '__stack_chk_fail' if toolchain enforces
+-fstack-protector.
+
+Fixes:
+ - https://gitlab.com/kubu93/buildroot/-/jobs/1247043361
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ arch/s390/Makefile           | 1 +
+ arch/s390/purgatory/Makefile | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/arch/s390/Makefile b/arch/s390/Makefile
+index e443ed9947bd..098abe3a56f3 100644
+--- a/arch/s390/Makefile
++++ b/arch/s390/Makefile
+@@ -28,6 +28,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
+ KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding
++KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector
+ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
+diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
+index c57f8c40e992..21c4ebe29b9a 100644
+--- a/arch/s390/purgatory/Makefile
++++ b/arch/s390/purgatory/Makefile
+@@ -24,6 +24,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
+ KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
+ KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
+ KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
++KBUILD_CFLAGS += -fno-stack-protector
+ KBUILD_CFLAGS += $(CLANG_FLAGS)
+ KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
+ KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
+-- 
+2.30.2
+
configs/qemu_s390x_defconfig +1 -0
index 9b3821f043..4aed9d9ae5 100644
@@ -20,6 +20,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.7"
 BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
 BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_GLOBAL_PATCH_DIR="board/qemu/s390x/patches"
 
 # host-qemu for gitlab testing
 BR2_PACKAGE_HOST_QEMU=y
Signature · 1 line
2.30.2

Thank you for the fix. Looks good to me.

Regards
Alex

#3 lore raw

PATCH v2 1/1 board/qemu/s390x: disable SSP when needed

In reply to Fabrice Fontaine

Fabrice, All,

On 2021-05-09 15:06 +0200, Fabrice Fontaine spake thusly:

Quoted 7 lines

Fix build failure raised since commit 810ba387bec3c5b6904e8893fb4cb6f9d3717466 by disabling SSP when needed

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043361

Applied to master, thanks.

Alexander, is this something we can expect to land in mainline?

Regards,
Yann E. MORIN.

Quoted 81 lines

---
Changes v1 -> v2 (after review of Romain Naour):
- Move patch from linux to board/qemu/s390x

 ...01-arch-s390-disable-SSP-when-needed.patch | 47 +++++++++++++++++++
 configs/qemu_s390x_defconfig                  |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch
board/qemu/s390x/patches/linux/0001-arch-s390-disable-SSP-when-needed.patch new file +47 -0
new file mode 100644
index 0000000000..c8199d4fd6
@@ -0,0 +1,47 @@
+From 8a054081678ed0b0e56f829bac0a4656e3a198b9 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sat, 8 May 2021 22:03:11 +0200
+Subject: [PATCH] arch/s390: disable SSP when needed
+
+Though -nostdlib is passed in PURGATORY_LDFLAGS and -ffreestanding in
+KBUILD_CFLAGS_DECOMPRESSOR, -fno-stack-protector must also be passed to
+avoid linking errors related to undefined references to
+'__stack_chk_guard' and '__stack_chk_fail' if toolchain enforces
+-fstack-protector.
+
+Fixes:
+ - https://gitlab.com/kubu93/buildroot/-/jobs/1247043361
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ arch/s390/Makefile           | 1 +
+ arch/s390/purgatory/Makefile | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/arch/s390/Makefile b/arch/s390/Makefile
+index e443ed9947bd..098abe3a56f3 100644
+--- a/arch/s390/Makefile
++++ b/arch/s390/Makefile
+@@ -28,6 +28,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
+ KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
+ KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding
++KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector
+ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
+ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
+diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
+index c57f8c40e992..21c4ebe29b9a 100644
+--- a/arch/s390/purgatory/Makefile
++++ b/arch/s390/purgatory/Makefile
+@@ -24,6 +24,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
+ KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
+ KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
+ KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
++KBUILD_CFLAGS += -fno-stack-protector
+ KBUILD_CFLAGS += $(CLANG_FLAGS)
+ KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
+ KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
+-- 
+2.30.2
+
configs/qemu_s390x_defconfig +1 -0
index 9b3821f043..4aed9d9ae5 100644
@@ -20,6 +20,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.7"
 BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
 BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_GLOBAL_PATCH_DIR="board/qemu/s390x/patches"
 
 # host-qemu for gitlab testing
 BR2_PACKAGE_HOST_QEMU=y
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v2 1/1 board/qemu/s390x: disable SSP when needed

Quoted 9 lines · Yann E. MORIN

Fabrice, All,

On 2021-05-09 15:06 +0200, Fabrice Fontaine spake thusly:

Quoted 6 lines

Fix build failure raised since commit 810ba387bec3c5b6904e8893fb4cb6f9d3717466 by disabling SSP when needed

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043361

Quoted 9 lines
Quoted 1 line

Applied to master, thanks.

Alexander, is this something we can expect to land in mainline?

Regards,
Yann E. MORIN.

Hi Yann,

yes, i'm already looking into it.

Regards
Alex

#5 lore raw

PATCH v2 1/1 board/qemu/s390x: disable SSP when needed

Hi Alex,

Le sam. 15 mai 2021 ? 17:03, Alexander Egorenkov
<[email protected]> a ?crit :

Quoted 18 lines
Quoted 15 lines · Yann E. MORIN

Fabrice, All,

On 2021-05-09 15:06 +0200, Fabrice Fontaine spake thusly:

Quoted 7 lines

Fix build failure raised since commit 810ba387bec3c5b6904e8893fb4cb6f9d3717466 by disabling SSP when needed

Fixes:
- https://gitlab.com/kubu93/buildroot/-/jobs/1247043361

Applied to master, thanks.

Alexander, is this something we can expect to land in mainline?

Quoted 7 lines
Quoted 3 lines

Regards,
Yann E. MORIN.

Hi Yann,

yes, i'm already looking into it.

If it can helps, I sent the patch on the mailing list as suggested by
Romain: https://marc.info/?l=linux-s390&m=162062472219221&w=2

Quoted 3 lines

Regards
Alex

Best Regards,

Fabrice

#6 lore raw

PATCH v2 1/1 board/qemu/s390x: disable SSP when needed

Alexander, Fabrice, All,

On 2021-05-15 17:09 +0200, Fabrice Fontaine spake thusly:

Quoted 8 lines

Le sam. 15 mai 2021 ? 17:03, Alexander Egorenkov
<[email protected]> a ?crit :

Quoted 6 lines
Quoted 4 lines · Yann E. MORIN

On 2021-05-09 15:06 +0200, Fabrice Fontaine spake thusly:

Quoted 2 lines

Fix build failure raised since commit 810ba387bec3c5b6904e8893fb4cb6f9d3717466 by disabling SSP when needed

Alexander, is this something we can expect to land in mainline?

yes, i'm already looking into it.

Awesome; thanks! :-)

Quoted 2 lines

If it can helps, I sent the patch on the mailing list as suggested by
Romain: https://marc.info/?l=linux-s390&m=162062472219221&w=2

Awesome too; thanks too! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'