clang-randstruct / llvm-project

Randomize the order of fields in a structure layout as a compile-time hardening feature
3 stars 1 forks source link

Add support for __no_randomize_layout #6

Closed connorkuehl closed 5 years ago

connorkuehl commented 5 years ago

Is your feature request related to a problem? Please describe. One of our stretch goals requires this feature to allow application programmers to opt out of automatic structure selection.

Describe the solution you'd like When Clang hands control to our plugin for a structure layout, we will immediately check to see if the structure has a __no_randomize_layout attribute attached to it. If so, we will not randomize this structure's layout. We will return false; and have Clang lay it out for us normally.

connorkuehl commented 5 years ago

Acceptance criteria:

Nixoncole commented 5 years ago

Might be useful: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/writing_clang_plugins.md#emitting-errors

Connor sent this: https://clang.llvm.org/docs/InternalsManual.html#the-diagnostics-subsystem

connorkuehl commented 5 years ago

I suspect we will also want to include this in the regression test suite.

See #20 for an example of this.

Nixoncole commented 5 years ago

Looks like Jeff and I finished this, just waiting for code push on his end.

connorkuehl commented 5 years ago

This code got reverted at some point; we need it back.

connorkuehl commented 5 years ago

Closed in #39