Conversation

Replying to and
wiki.sei.cmu.edu/confluence/dis is also a serious issue and the portable ways of working around it are impractical / unrealistic. Linux kernel relies on the incorrect assumption that padding bytes will always be copied by the compiler. It depends on a non-existent language extension...
Automatic initialization with a pattern is not necessarily enough. An assignment like `struct foo bar = baz` will not necessarily fully initialize `bar` and may leave padding bytes. Later on, copying the struct across a trust boundary will likely copy padding bytes, leaking data.
1
3
Proposal to declare padding via fields is very error prone and not portable. Structs would need to be correctly declared for each architecture. Struct packing isn't portable either and changes the ABI, along with impacting performance. Only valid option there is serialization.
1
Show replies