#1010685 dpkg-buildflags: Please enable -ftrivial-auto-var-init=zero

Package:
dpkg-dev
Source:
dpkg
Submitter:
Kees Cook
Date:
2022-05-27 08:12:04 UTC
Severity:
normal
Tags:
#1010685#5
Date:
2022-05-07 03:50:08 UTC
From:
To:
Please add "-ftrivial-auto-var-init=zero" for GCC 12 (which is the first
release of GCC to provide this flag).

It goes well with the other important security flaw mitigation flags
already enabled in Debian:
https://wiki.debian.org/Hardening#dpkg-buildflags

While many variables are initialized (due to -Wuninitialized), there is
a blind spot for variables passed by reference, padding, and cases where
-Wuninitialized just fails to track it. Universally wiping the variables
eliminates nearly the entire class of uninitialized stack variable use
(https://cwe.mitre.org/data/definitions/457.html) with nearly no overhead
(e.g. any duplicate assignments will already be squashed during dead
store elimination, etc).