mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 3/6] lib: stackprot: omit HAVE_STACKPROTECTOR for powerpc
Date: Mon,  9 Feb 2026 10:10:28 +0100	[thread overview]
Message-ID: <20260209091513.3563412-4-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260209091513.3563412-1-a.fatoum@barebox.org>

gcc for PowerPC generates references to __stack_chk_guard_local and
aliasing it to __stack_chk_guard doesn't lead to a bootable barebox, so
let's disable stack protector on that architecture.

The other architectures are assumed to work, but this should be verified
per CI test in future.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 arch/Kconfig          | 6 ++++++
 arch/arm/Kconfig      | 1 +
 arch/kvx/Kconfig      | 1 +
 arch/mips/Kconfig     | 1 +
 arch/openrisc/Kconfig | 1 +
 arch/riscv/Kconfig    | 1 +
 arch/sandbox/Kconfig  | 1 +
 arch/x86/Kconfig      | 1 +
 lib/Kconfig.hardening | 2 ++
 9 files changed, 15 insertions(+)

diff --git a/arch/Kconfig b/arch/Kconfig
index ca9aa25a9c4b..ba9dd0e6f4df 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -131,6 +131,12 @@ config HAVE_ARCH_KASAN
 config ARCH_HAS_UBSAN_SANITIZE_ALL
 	bool
 
+config HAVE_STACKPROTECTOR
+	bool
+	help
+	  An arch should select this symbol if:
+	  - it has implemented a stack canary (e.g. __stack_chk_guard)
+
 config ARCH_HAS_FORTIFY_SOURCE
 	bool
 	help
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 65856977ab41..c7514acb775f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -3,6 +3,7 @@
 config ARM
 	bool
 	select HAS_KALLSYMS
+	select HAVE_STACKPROTECTOR
 	select HAVE_IMAGE_COMPRESSION
 	select HAVE_ARCH_KASAN
 	select ARCH_HAS_SJLJ
diff --git a/arch/kvx/Kconfig b/arch/kvx/Kconfig
index 987fdb2e1e89..bbbec6471f06 100644
--- a/arch/kvx/Kconfig
+++ b/arch/kvx/Kconfig
@@ -3,6 +3,7 @@
 config KVX
 	bool
 	select 64BIT
+	select HAVE_STACKPROTECTOR
 	select BOOTM
 	select HAVE_ARCH_BOOTM_OFTREE
 	select BOOTM_OFTREE
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 44c4fc82ae5b..d34377a33d47 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3,6 +3,7 @@
 config MIPS
 	bool
 	select GENERIC_LIB_ASHLDI3
+	select HAVE_STACKPROTECTOR
 	select GENERIC_LIB_ASHRDI3
 	select GENERIC_LIB_LSHRDI3
 	select HAS_KALLSYMS
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 10cbfa1ffbce..f82d160a3a15 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -3,6 +3,7 @@
 config OPENRISC
 	bool
 	select OFTREE
+	select HAVE_STACKPROTECTOR
 	select HAVE_CONFIGURABLE_MEMORY_LAYOUT
 	select GENERIC_FIND_NEXT_BIT
 	select ARCH_HAS_SJLJ
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index cc9b15ce6409..f1d98d1b33a5 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -3,6 +3,7 @@
 config RISCV
 	def_bool y
 	select GENERIC_FIND_NEXT_BIT
+	select HAVE_STACKPROTECTOR
 	select GPIOLIB
 	select OFTREE
 	select OFDEVICE
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 5c7948b215cf..504171809193 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -5,6 +5,7 @@ source "scripts/Kconfig.include"
 config SANDBOX
 	bool
 	select OFTREE
+	select HAVE_STACKPROTECTOR
 	select GPIOLIB
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
 	select ARCH_HAS_FORTIFY_SOURCE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b453890f022b..3426392bc463 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -3,6 +3,7 @@
 config X86
 	bool
 	select HAS_KALLSYMS
+	select HAVE_STACKPROTECTOR
 	select HAS_DMA
 	select GENERIC_FIND_NEXT_BIT
 	select ARCH_DMA_DEFAULT_COHERENT
diff --git a/lib/Kconfig.hardening b/lib/Kconfig.hardening
index 59dd02c9cfae..6374576f489c 100644
--- a/lib/Kconfig.hardening
+++ b/lib/Kconfig.hardening
@@ -162,6 +162,7 @@ config STACKPROTECTOR
 
 choice
 	prompt "Stack Protector buffer overflow detection"
+	depends on HAVE_STACKPROTECTOR
 
 config STACKPROTECTOR_NONE
 	bool "None"
@@ -211,6 +212,7 @@ endchoice
 
 choice
 	prompt "Stack Protector buffer overflow detection for PBL" if PBL_IMAGE
+	depends on HAVE_STACKPROTECTOR
 
 config PBL_STACKPROTECTOR_NONE
 	bool "None"
-- 
2.47.3




  parent reply	other threads:[~2026-02-09  9:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09  9:10 [PATCH 0/6] ppc: add QEMU ppce500 test in CI Ahmad Fatoum
2026-02-09  9:10 ` [PATCH 1/6] include: array_size.h: make header self-contained Ahmad Fatoum
2026-02-09  9:10 ` [PATCH 2/6] serial: ns16550: add "ns16550" compatible string Ahmad Fatoum
2026-02-09  9:10 ` Ahmad Fatoum [this message]
2026-02-09  9:10 ` [PATCH 4/6] gpio: mpc8xxx: allow build on MPC85xx platforms Ahmad Fatoum
2026-02-09  9:10 ` [PATCH 5/6] mach-mpc85xx: speed: add fsl_set_timebase_clock() override Ahmad Fatoum
2026-02-09  9:10 ` [PATCH 6/6] powerpc: add QEMU ppce500 board support with CI test infrastructure Ahmad Fatoum
2026-02-11  9:34 ` [PATCH 0/6] ppc: add QEMU ppce500 test in CI Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260209091513.3563412-4-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox