-qstackprotect

Pragma equivalent

None.

Purpose

Provides protection against malicious input data or programming errors that overwrite or corrupt the stack.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-nostackprotect----------------------.   
>>- -q--+-stackprotect----=----+-all--------+-+----------------><
                               '-size--=--N-'     

Defaults

-qnostackprotect

Parameters

all
Protects all functions whether or not functions have vulnerable objects. This option is not set by default.
size=N
Protects all functions containing automatic objects with size greater than or equal to N bytes. The default size is 8 byteswhen -qstackprotect is enabled.

Usage

-qstackprotect generates extra code to protect functions with vulnerable objects against stack corruption. The option is disabled by default because it can degrade runtime performance.

To generate code to protect all functions with vulnerable objects, enter the following command:

xlc myprogram.c -qstackprotect=all

To generate code to protect functions with objects of certain size, enter the following command with the size= parameter set to the object size indicated in bytes:

xlc myprogram.c -qstackprotect=size=8
Notes:
  • Because of the dependency on libc.a in AIX®, this option requires AIX 6.1/TL4 or higher.
  • If the link step fails with a message that indicates __ssp_canary_word is undefined, you have probably used an unsupported level of AIX.

Predefined macros

None.

Related information



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us