]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blobdiff - Config.in
security hardening: add RELFO, FORTIFY options
[coffee/buildroot.git] / Config.in
index e7e5c2d077e8d9b0e6aff18c74444df1321aefd7..0002df51767f52d8b9aef3a295fefcde5ade080e 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -734,6 +734,76 @@ endchoice
 comment "Stack Smashing Protection needs a toolchain w/ SSP"
        depends on !BR2_TOOLCHAIN_HAS_SSP
 
+choice
+       bool "RELRO Protection"
+       depends on BR2_SHARED_LIBS
+       help
+         Enable a link-time protection know as RELRO (RELocation Read Only)
+         which helps to protect from certain type of exploitation techniques
+         altering the content of some ELF sections.
+
+config BR2_RELRO_NONE
+       bool "None"
+       help
+         Disables Relocation link-time protections.
+
+config BR2_RELRO_PARTIAL
+       bool "Partial"
+       help
+         This option makes the dynamic section not writeable after
+         initialization (with almost no performance penalty).
+
+config BR2_RELRO_FULL
+       bool "Full"
+       help
+         This option includes the partial configuration, but also
+         marks the GOT as read-only at the cost of initialization time
+         during program loading, i.e every time an executable is started.
+
+endchoice
+
+comment "RELocation Read Only (RELRO) needs shared libraries"
+       depends on !BR2_SHARED_LIBS
+
+choice
+       bool "Buffer-overflow Detection (FORTIFY_SOURCE)"
+       depends on BR2_TOOLCHAIN_USES_GLIBC
+       depends on !BR2_OPTIMIZE_0
+       help
+         Enable the _FORTIFY_SOURCE macro which introduces additional
+         checks to detect buffer-overflows in the following standard library
+         functions: memcpy, mempcpy, memmove, memset, strcpy, stpcpy,
+         strncpy, strcat, strncat, sprintf, vsprintf, snprintf, vsnprintf,
+         gets.
+
+         NOTE: This feature requires an optimization level of s/1/2/3/g
+
+         Support for this feature has been present since GCC 4.x.
+
+config BR2_FORTIFY_SOURCE_NONE
+       bool "None"
+       help
+         Disables additional checks to detect buffer-overflows.
+
+config BR2_FORTIFY_SOURCE_1
+       bool "Conservative"
+       help
+         This option sets _FORTIFY_SOURCE to 1 and only introduces
+         checks that shouldn't change the behavior of conforming
+         programs.  Adds checks at compile-time only.
+
+config BR2_FORTIFY_SOURCE_2
+       bool "Aggressive"
+       help
+         This option sets _FORTIFY_SOURCES to 2 and some more
+         checking is added, but some conforming programs might fail.
+         Also adds checks at run-time (detected buffer overflow
+         terminates the program)
+
+endchoice
+
+comment "Fortify Source needs a glibc toolchain and optimization"
+       depends on (!BR2_TOOLCHAIN_USES_GLIBC || BR2_OPTIMIZE_0)
 endmenu
 
 source "toolchain/Config.in"