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

Structures are randomized in the same way #43

Open connorkuehl opened 5 years ago

connorkuehl commented 5 years ago

This is because the Randstruct object is created and destroyed with each structure.

Kees suggested we use the structure name as part of the seed.

jcantrell commented 5 years ago

Just to clarify, does this mean that, say, structures with three members will be shuffled into the same order as all other structures with three members?

connorkuehl commented 5 years ago

Just to clarify, does this mean that, say, structures with three members will be shuffled into the same order as all other structures with three members?

I think so, yes

tim-pugh commented 5 years ago

+1 on using the struct name. This will ensure the same named structs are randomized in a predictable fashion, but structs with the same count of fields will differ.

tim-pugh commented 5 years ago

We also have another issue brought up by the clang devs whom are reviewing our code where the default random engine may, from my understanding, use different engines, so we would need to choose a specific random algorithm.

I believe this should take care of randomness issues against platforms. View #44 which this issue depends upon.