-fstack-check : If the two macro values STACK_CHECK_BUILTIN and STACK_CHECK_STATIC_BUILTIN remain at default 0, it simply inserts NULL bytes every 4kb (page) when the stack grows. By default, only one, but when the stack can grow more than one page, which is the most dangerous case, every 4 KB. linux> 2.6 has only one small page gap between the stack and the heap, which can lead to stack attacks known since 2005. See What exception has been added to C for the GCC -fstack-check option for assembly. It has been included in gcc since at least 2.95.3, in clang since 3.6.
__stack_chk_fail is the inserted code -fstack-protector , which checks the inserted stock value of the channel, which can be overwritten by a simple stack overflow, for example. recursion.
rurban
source share