HomeFreeBSD

Support initializing stack variables on function entry

Description

Support initializing stack variables on function entry

There are two options:

  • WITH_INIT_ALL_ZERO: Zero all variables on the stack.
  • WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.

The exact pattern are a compiler implementation detail and vary by type.
They are somewhat documented in the LLVM commit message:
https://reviews.llvm.org/rL349442
I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
than naming them after the LLVM specific compiler flags.

In a range of consumer products, options like these are used in
both debug and production builds with debugs builds using patterns
(intended to provoke crashes on use of uninitialized values) and
production using zeros (deemed more likely to lead to harmless
misbehavior or NULL-pointer dereferences).

Reviewed by: emaste
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27131

Details

Provenance
brooksAuthored on
Reviewer
emaste
Differential Revision
D27131: Add support for initializing stack variables on entry.
Parents
rS367576: Add C startup code tests for PIE binaries.
Branches
Unknown
Tags
Unknown