News for hackers. Stuff that matters.
Re:GCC Preparing to Introduce “-Fhardened” Security Hardenin... by woodruffw on Tuesday September 19, 2023 @05:18AM (#37567365)
On top of your reasons (which are good ones!), there’s another good reason to avoid default zero initialization in languages like C: zero is a special value for all kinds of sensitive operations (like UID 0 for root).

In other words: a mitigation that initializes all values to 0 may make some uses of uninitialized variables worse than they were before.

Re:GCC Preparing to Introduce “-Fhardened” Security Hardenin... by google234123 on Tuesday September 19, 2023 @05:46AM (#37567521)
0 is also the most common variable value probably :p hard to tell a valid state from an invalid one
Re:GCC Preparing to Introduce “-Fhardened” Security Hardenin... by woodruffw on Tuesday September 19, 2023 @05:53AM (#37567571)
Yes, that's why the "uninitialized" part is important; we're talking about a mitigation that would make UB potentially easier rather than harder to exploit.

Having 0 as a default initialization value in a language where doing so is well defined makes perfect sense; this is primarily an issue for C and C++ (to a lesser extent).