Change in simtrace2[master]: firmware: disable stack protector by default

osmith gerrit-no-reply at lists.osmocom.org
Thu Apr 8 10:06:30 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/23679 )


Change subject: firmware: disable stack protector by default
......................................................................

firmware: disable stack protector by default

Disable stack protector for all boards/apps by default, not only
qmod-dfu. Use 'make STACK_PROTECTOR=1' to enable.

This was recommened by Eric:
"I'd argue that we do not want this in general, since it adds canaries
to all functions that deal with buffers, and therefore impacts the
overall timing in a non determinstic way depending on inlining and
optimizations, while contributing nothing in non debug builds."

Related: OS#5081
Change-Id: I30ad97f231ea5b401def650bc9adc7e9f2770df0
---
M firmware/Makefile
1 file changed, 8 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/79/23679/1

diff --git a/firmware/Makefile b/firmware/Makefile
index b147b0d..684f223 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -59,11 +59,6 @@
 BIN = bin
 OBJ = obj/$(BOARD)
 
-# Disable stack protector for code in small ROM regions (OS#5081)
-ifeq ($(BOARD)-$(APP), qmod-dfu)
-CFLAGS_EXTRA ?= -fno-stack-protector
-endif
-
 #-------------------------------------------------------------------------------
 #		Tools
 #-------------------------------------------------------------------------------
@@ -183,7 +178,14 @@
 CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
 CFLAGS += -DBOARD=\"$(BOARD)\" -DBOARD_$(BOARD)
 CFLAGS += -DAPPLICATION=\"$(APP)\" -DAPPLICATION_$(APP)
-CFLAGS += $(CFLAGS_EXTRA)
+
+# Disable stack protector by default (OS#5081)
+ifeq ($(STACK_PROTECTOR), 1)
+CFLAGS += -fstack-protector
+else
+CFLAGS += -fno-stack-protector
+endif
+
 ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
 LDFLAGS = -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=ResetException -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--print-memory-usage -Wl,--no-undefined $(LIB)
 #LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats

-- 
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/23679
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I30ad97f231ea5b401def650bc9adc7e9f2770df0
Gerrit-Change-Number: 23679
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210408/f1c0c1e1/attachment.htm>


More information about the gerrit-log mailing list