linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: socfpga: Fix crash with CONFIG_FORTIRY_SOURCE
@ 2021-11-17 19:32 Takashi Iwai
  2021-11-17 22:01 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2021-11-17 19:32 UTC (permalink / raw)
  To: Dinh Nguyen; +Cc: Kees Cook, Ivan T . Ivanov, linux-arm-kernel, linux-kernel

When CONFIG_FORTIFY_SOURCE is set, memcpy() checks the potential
buffer overflow and panics.  The code in sofcpga bootstrapping
contains the memcpy() calls are mistakenly translated as the shorter
size, hence it triggers a panic as if it were overflowing.

This patch adds the __NO_FORTIFY define for avoiding the
false-positive crash.

Buglink: https://bugzilla.suse.com/show_bug.cgi?id=1192473
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

I took an easier path for now, as the attempt with a foced cast
failed.  If there is a better way to handle, let me know, I'd happily
resubmit.  Thanks!

 arch/arm/mach-socfpga/platsmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index fbb80b883e5d..d46b1af96a8a 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -5,6 +5,9 @@
  * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
  * Copyright (C) 2012 Altera Corporation
  */
+
+#define __NO_FORTIFY /* need to avoid the crash with memcpy() calls */
+
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/smp.h>
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-11-18 14:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 19:32 [PATCH] ARM: socfpga: Fix crash with CONFIG_FORTIRY_SOURCE Takashi Iwai
2021-11-17 22:01 ` Kees Cook
2021-11-18  7:27   ` Takashi Iwai
2021-11-18 14:23     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).