[Bug 1972043] Re: Please add -ftrivial-auto-var-init=zero to default build flags

Julian Andres Klode 1972043 at bugs.launchpad.net
Wed May 18 08:16:49 UTC 2022


Oh I have another question: Does this actually turn accessing the
uninitialized variables into defined behavior, or can the optimizer
still treat it as undefined behavior and thus do whatever it want?

Given that this *is* undefined behavior, turning it into defined
behavior with a 0 value would be incredibly useful. It likely also
breaks some code written to exploit legacy gcc behaviour, but oh well,
that is broken anyway.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/1972043

Title:
  Please add -ftrivial-auto-var-init=zero to default build flags

Status in dpkg package in Ubuntu:
  New
Status in gcc-12 package in Ubuntu:
  New
Status in dpkg source package in Kinetic:
  New
Status in gcc-12 source package in Kinetic:
  New

Bug description:
  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 Ubuntu for GCC:
  https://wiki.ubuntu.com/ToolChain/CompilerFlags

  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).

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1972043/+subscriptions




More information about the foundations-bugs mailing list