Setting a default value for OPT_INIT_ALL (stable=zero, current=pattern)
Alexander Leidinger <[email protected]>
| Newsgroups | gmane.os.freebsd.architechture |
|---|---|
| Organization | No organization, this is a private message. |
| Message-ID | <[email protected]> |
Hi,
we have support to set a default initialization value for uninitialized
variables (OPT_INIT_ALL in src.conf). Possible values are (copy&paste
from
https://gcc.gnu.org/pipermail/gcc-patches/2021-February/565514.html):
'-ftrivial-auto-var-init=CHOICE'
Initialize automatic variables with either a pattern or with zeroes
to increase program security by preventing uninitialized memory
disclosure and use.
The three values of CHOICE are:
* 'uninitialized' doesn't initialize any automatic variables.
This is C and C++'s default.
* 'pattern' Initialize automatic variables with values which
will likely transform logic bugs into crashes down the line,
are easily recognized in a crash dump and without being values
that programmers can rely on for useful program semantics.
The values used for pattern initialization might be changed in
the future.
* 'zero' Initialize automatic variables with zeroes.
The default is 'uninitialized'.
The main point of this option is to prevent leaking random data by
accident.
What I propose is to have OPT_INIT_ALL set to "zero" in stable branches.
We could maybe also set it to "pattern" in -current. In my opinion this
a similar thing like the malloc production setting, or witness, and so
on.
Any thoughts about this?
In case of a generic consensus of this, I would expect the release
engineering team to take this into their procedure for branching a new
stable branch. The locations where a OPT_INIT_ALL?=zero would need to be
added are share/mk/bsd.lib.mk, share/mk/bsd.prog.mk and
sys/conf/kern.mk.
Bye,
Alexander.
--
http://www.Leidinger.net [email protected]: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org [email protected] : PGP 0x8F31830F9F2772BF
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmeCyeEACgkQEg2wmwP4 2IYpPQ//QBeEIbUlqlLcG4RqFo9oB3TX+Db5bT6NH6V9raxRPdJf8uHzFkkKtabm Oy4muDwhxSQYZlvpERvuLN1stUIVD61Pv5tPAIIDNIyyQknZ1hYVG2EtYOXFsSO9 p0KpIaPf6F3p5r9XvPjBScYi8hIwe2ZCacXLpeXE11QhJnekxAeRt2cVej2aVFV1 tNTpZHh1zClpFDr8N6IIPWN0c8GakE0JBshowCgcpXZ0mRuHC5b+IrACsuFf/CQX Iv/skVP+5eDko9tiEA2osxAaXmob4G5983Coktzstet2f9RDEFMJCwssSex7+0rX ebu0fQ+nFiLEjjqoO2dN96G7ZaN9jsOyKPZVkc+JNASiB/N2QJywwIot09K3DllA FV8BqqIHn+gzQJP/DzfX1tsGUE+qCrNmTeO2w5Uw0knijUahbI1z+FV+Iqz/NBoR VzOR9YoH1OiInSt498BTfRNKdh03PzpuQffjOAGuo6l0CJX6Sp8+1KKgVmioZ4Ak WVjV1JB7SiZeoV3JcKOZ8Ux5LjkDYJSVn2V+m+1zqTdttWxKy/+adFgYHidhAbd/ vM/HtlPRRHQiqm5KCtmHqT3QD5eSmgVo8tqMDmG4+PrFP8jWSOBaKgVxZ7gzwre1 FRFIJA8DKkzQbTjWaYZAKBGEN0QF8sREESOKxyC64sKn55ADP+I= =YNmk -----END PGP SIGNATURE-----