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

Implement deterministic shuffle #47

Open connorkuehl opened 5 years ago

connorkuehl commented 5 years ago

std::shuffle is insufficient for the same implementation-defined reasons as why std::default_random_engine is insufficient.

Per comment: https://reviews.llvm.org/D59254#1428656

connorkuehl commented 5 years ago

On the revision, Module::createRNG was mentioned which may be applicable here, but not code complete as they suggest some of its patches are still floating around on Phabricator.

connorkuehl commented 5 years ago

I think it's only the overloaded version of std::shuffle which does not receive a PRNG is implementation-defined.

See https://en.cppreference.com/w/cpp/algorithm/random_shuffle

I could be wrong though...