Implement stack protection support

this adds kernel & libroot stack protector hooks. it uses /dev/random in userspace.
A configure option --enable-stack-protector is added to activate -fstack-protector
on selected system components (ATM apps, kits, servers).

Change-Id: If3a2920ba9aa0a85eaff4ba6778947f8c76ade31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3895
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Jérôme Duval
2021-05-03 17:52:31 +00:00
parent 409d65c0d6
commit 04be20a75a
12 changed files with 153 additions and 0 deletions
+16
View File
@@ -600,6 +600,16 @@ rule ArchitectureSetupWarnings architecture
}
}
rule EnableStackProtector dirTokens : scope {
# enable stack protector, if requested
if $(HAIKU_USE_STACK_PROTECTOR) = 1 {
AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) :
-fstack-protector : $(scope) ;
AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) :
-fstack-protector : $(scope) ;
}
}
# Work-around for GCC 2 problem -- despite -Wno-multichar it reports
# multichar warnings in headers/private/kernel/debugger_keymaps.h included
# by src/system/kernel/arch/x86/arch_debug_console.cpp.
@@ -746,6 +756,12 @@ rule ArchitectureSetupWarnings architecture
EnableWerror src system libroot posix locale ;
EnableWerror src system libroot posix wchar ;
EnableWerror src system runtime_loader ;
EnableStackProtector src apps ;
EnableStackProtector src kits ;
EnableStackProtector src preferences ;
EnableStackProtector src servers ;
EnableStackProtector src system kernel ;
}