]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Support initializing stack variables on function entry
authorbrooks <brooks@FreeBSD.org>
Tue, 10 Nov 2020 19:15:13 +0000 (19:15 +0000)
committerbrooks <brooks@FreeBSD.org>
Tue, 10 Nov 2020 19:15:13 +0000 (19:15 +0000)
commit142137080c57d96bbc715c7d3f062b6650685eb2
tree46ba7bf0f2d8c42e2827359200519c2ac2474af2
parente85e8ebb306db7b22172a1d09e1385f8d21ad39d
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
share/mk/bsd.compiler.mk
share/mk/bsd.lib.mk
share/mk/bsd.opts.mk
share/mk/bsd.prog.mk
sys/conf/kern.mk
tools/build/options/WITH_INIT_ALL_PATTERN [new file with mode: 0644]
tools/build/options/WITH_INIT_ALL_ZERO [new file with mode: 0644]