-qstackprotect

Category

Object code control

Pragma equivalent

None.

Purpose

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

Syntax

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

Defaults

Parameters

all
all protects all procedures whether or not there are vulnerable objects. This option is not set by default.
size=N
size=N protects all procedures containing automatic objects greater or equal to N bytes in size. The default size is 8 when -qstackprotect is enabled.

Usage

-qstackprotect generates extra code to protect procedures with vulnerable objects against stack corruption. This option is disabled by default because it can cause performance degradation.

To generate code to protect all procedures with vulnerable objects:

xlc myprogram.c -qstackprotect=all

To generate code to protect procedures with objects of certain 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