File tree 6 files changed +22
-5
lines changed
6 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,8 @@ if(CONFIG_STACK_CANARIES)
177
177
zephyr_compile_options($<TARGET_PROPERTY:compiler,security_canaries>)
178
178
elseif (CONFIG_STACK_CANARIES_STRONG)
179
179
zephyr_compile_options($<TARGET_PROPERTY:compiler,security_canaries_strong>)
180
+ elseif (CONFIG_STACK_CANARIES_ALL)
181
+ zephyr_compile_options($<TARGET_PROPERTY:compiler,security_canaries_all>)
180
182
elseif (CONFIG_STACK_CANARIES_EXPLICIT)
181
183
zephyr_compile_options($<TARGET_PROPERTY:compiler,security_canaries_explicit>)
182
184
endif ()
Original file line number Diff line number Diff line change @@ -167,8 +167,9 @@ set_compiler_property(PROPERTY imacros -imacros)
167
167
168
168
# Security canaries.
169
169
#no support of -mstack-protector-guard=global"
170
- set_compiler_property(PROPERTY security_canaries -fstack-protector- all )
170
+ set_compiler_property(PROPERTY security_canaries -fstack-protector)
171
171
set_compiler_property(PROPERTY security_canaries_strong -fstack-protector-strong)
172
+ set_compiler_property(PROPERTY security_canaries_all -fstack-protector-all )
172
173
173
174
#no support of _FORTIFY_SOURCE"
174
175
set_compiler_property(PROPERTY security_fortify_compile_time)
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ set_compiler_property(PROPERTY coverage)
93
93
# Security canaries flags.
94
94
set_compiler_property(PROPERTY security_canaries)
95
95
set_compiler_property(PROPERTY security_canaries_strong)
96
+ set_compiler_property(PROPERTY security_canaries_all)
96
97
set_compiler_property(PROPERTY security_canaries_explicit)
97
98
98
99
set_compiler_property(PROPERTY security_fortify_compile_time)
Original file line number Diff line number Diff line change @@ -167,18 +167,21 @@ set_property(TARGET compiler-cpp PROPERTY no_rtti "-fno-rtti")
167
167
set_compiler_property(PROPERTY coverage -fprofile-arcs -ftest-coverage -fno-inline)
168
168
169
169
# Security canaries.
170
- set_compiler_property(PROPERTY security_canaries -fstack-protector- all )
170
+ set_compiler_property(PROPERTY security_canaries -fstack-protector)
171
171
set_compiler_property(PROPERTY security_canaries_strong -fstack-protector-strong)
172
+ set_compiler_property(PROPERTY security_canaries_all -fstack-protector-all )
172
173
set_compiler_property(PROPERTY security_canaries_explicit -fstack-protector-explicit)
173
174
174
175
# Only a valid option with GCC 7.x and above, so let's do check and set.
175
176
if (CONFIG_STACK_CANARIES_TLS)
176
177
check_set_compiler_property(APPEND PROPERTY security_canaries -mstack-protector-guard=tls)
177
178
check_set_compiler_property(APPEND PROPERTY security_canaries_strong -mstack-protector-guard=tls)
179
+ check_set_compiler_property(APPEND PROPERTY security_canaries_all -mstack-protector-guard=tls)
178
180
check_set_compiler_property(APPEND PROPERTY security_canaries_explicit -mstack-protector-guard=tls)
179
181
else ()
180
182
check_set_compiler_property(APPEND PROPERTY security_canaries -mstack-protector-guard=global )
181
183
check_set_compiler_property(APPEND PROPERTY security_canaries_global -mstack-protector-guard=global )
184
+ check_set_compiler_property(APPEND PROPERTY security_canaries_all -mstack-protector-guard=global )
182
185
check_set_compiler_property(APPEND PROPERTY security_canaries_explicit -mstack-protector-guard=global )
183
186
endif ()
184
187
Original file line number Diff line number Diff line change @@ -890,12 +890,14 @@ choice
890
890
will occur at build time.
891
891
892
892
config STACK_CANARIES
893
- bool "Maximum protection available "
893
+ bool "Default protection"
894
894
depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR
895
895
select NEED_LIBC_MEM_PARTITION if !STACK_CANARIES_TLS
896
896
select REQUIRES_STACK_CANARIES
897
897
help
898
- This option enables compiler stack canaries for all functions.
898
+ This option enables compiler stack canaries in functions that have
899
+ vulnerable objects. Generally this means function that call alloca or
900
+ have buffers larger than 8 bytes.
899
901
900
902
config STACK_CANARIES_STRONG
901
903
bool "Strong protection"
@@ -907,6 +909,14 @@ config STACK_CANARIES_STRONG
907
909
functions that have local array definitiion or have references to local
908
910
frame addresses.
909
911
912
+ config STACK_CANARIES_ALL
913
+ bool "Maximum protection available"
914
+ depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR
915
+ select NEED_LIBC_MEM_PARTITION if !STACK_CANARIES_TLS
916
+ select REQUIRES_STACK_CANARIES
917
+ help
918
+ This option enables compiler stack canaries for all functions.
919
+
910
920
config STACK_CANARIES_EXPLICIT
911
921
bool "Explicit protection"
912
922
depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR
Original file line number Diff line number Diff line change 11
11
* This module provides functions to support compiler stack protection
12
12
* using canaries. This feature is enabled with configuration
13
13
* CONFIG_STACK_CANARIES=y or CONFIG_STACK_CANARIES_STRONG=y or
14
- * CONFIG_STACK_CANARIES_EXPLICIT=y.
14
+ * CONFIG_STACK_CANARIES_ALL=y or CONFIG_STACK_CANARIES_EXPLICIT=y.
15
15
*
16
16
* When this feature is enabled, the compiler generated code refers to
17
17
* function __stack_chk_fail and global variable __stack_chk_guard.
You can’t perform that action at this time.
0 commit comments