documentation_complete: true


title: 'Stack Protector buffer overflow detection'

description: |-
    This feature puts, at the beginning of functions, a canary value on the stack just before the
    return address, and validates the value just before actually returning.
    This configuration is available from kernel 4.18.

    {{{ describe_kernel_build_config("CONFIG_STACKPROTECTOR", "y") | indent(4) }}}

rationale: |-
    This halts the program when a stack overflow is detected, potentially reducing the impact of
    exploits.

warnings:
    {{{ warning_kernel_build_config() | indent(4) }}}

severity: medium

identifiers:
    cce@rhel8: CCE-88055-9
    cce@rhel9: CCE-89055-8
    cce@rhel10: CCE-88537-6

ocil_clause: 'the kernel was not built with the required value'

ocil: |-
    {{{ ocil_kernel_build_config("CONFIG_STACKPROTECTOR", "y") | indent(4) }}}

template:
    name: kernel_build_config
    vars:
        config: CONFIG_STACKPROTECTOR
        value: 'y'

