5.7.1.1 Stack-protector Options

The -fstack-protector option enables stack protection for vulnerable functions that contain:
  • A character array larger than 8 bytes
  • An 8-bit integer array larger than 8 bytes
  • A call to alloca() with either a variable size or a constant size bigger than 8 bytes
The -fstack-protector-strong form of this option enables stack protection for vulnerable functions that contain:
  • An array of any size and type
  • A call to alloca()
  • An automatic local variable that has its address taken

The -fstack-protector-all form of this option adds stack protection to all functions regardless of their vulnerability.

The -fno-stack-protector form of this option disables stack protection and is the default action if no option is specified.

Note: If you specify more than one of these options, the last option that is specified takes effect.