mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] Kbuild: disable ARM64 pointer authentication
@ 2022-10-19 12:43 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2022-10-19 12:43 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The aarch64 cross-compiler built with Yocto's kirkstone release
configures -mbranch-protection=standard as default.

The resulting PACIASP/AUTIASP instructions are interpreted as NOPs by
existing CPUs, but they increase image size and misalign the barebox
header in ENTRY_FUNCTION(). Also on ARMv8.3+, where they serve a
purpose, we wouldn't benefit from them as we don't setup any pointer
authentication keys. Thus disable it.

This fixes a breakage to the extended firmware mechanism when
building my i.MX8M barebox with the Kirkstone toolchain.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
This is a workaround. ENTRY_FUNCTION() should be rewritten for ARM64,
so we don't expect function prologue to be exactly two bytes long.
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index 98da09f18523..3737265316e9 100644
--- a/Makefile
+++ b/Makefile
@@ -659,6 +659,11 @@ KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check)
 # Platforms that have their setjmp appropriately implemented may override this
 KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
 
+# We don't have the necessary infrastructure to benefit from ARMv8.3+ pointer
+# authentication. On older CPUs, they are interpreted as NOPs and blot the
+# code and break less portable code that expects a very specific code layout
+KBUILD_CFLAGS += $(call cc-option,-mbranch-protection=none)
+
 KBUILD_CFLAGS   += $(call cc-disable-warning, address-of-packed-member)
 
 # Align the bit size of userspace programs with the kernel
-- 
2.30.2




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-19 12:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 12:43 [PATCH master] Kbuild: disable ARM64 pointer authentication Ahmad Fatoum

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