[go: up one dir, main page]

|
|
Log in / Subscribe / Register

Randomizing structure layout

Randomizing structure layout

Posted May 14, 2017 17:49 UTC (Sun) by johan (guest, #112044)
In reply to: Randomizing structure layout by k8to
Parent article: Randomizing structure layout

"The randstruct plugin is a new GCC add-on that lets the compiler randomize the layout of C structures."

Since it's a plugin I'm hoping that it has sane defaults so the randstruct plugin is disabled when specifying -g


to post comments

Randomizing structure layout

Posted May 17, 2017 12:44 UTC (Wed) by nix (subscriber, #2304) [Link]

Well, if it were built in to GCC and not a plugin this would actually be considered unacceptable: specifying -g should not change the generated code in any way (including disabling, say, structure randomization). What should happen, instead (and what I think does in fact happen) is that the generated debugging info correctly represents the structures' randomized field offsets in the DWARF. (DWARF does not require structure members to be represented in ascending order: indeed, they can be entirely overlapping -- this is how unions are represented -- or even partially overlapping, reversed, or, as here, in random order.)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds