This is an archive of the discontinued LLVM Phabricator instance.

Adding diversity for security (clang)
AbandonedPublic

Authored by yln on Oct 1 2013, 3:18 PM.

Details

Reviewers
rinon
Summary

This patch was split into multiple, smaller patches (see dependencies).

Old (outdated) summary:
Adds the capability to randomly insert NOPs, permuting the code layout, as well as the option to randomize scheduling decisions. Includes an OpenSSL-linked RNG to provide secure random number generation.

Diff Detail

Event Timeline

Surface review comments.

lib/Frontend/CompilerInvocation.cpp
1457

Please remove this whitespace.

tools/driver/cc1_main.cpp
115 ↗(On Diff #4590)

Please try to follow our coding conventions here.

Pointer should be on the right.
seeddata -> SeedData

llvm::StringRef might make this a bit easier to read.

Something like:

std::string SeedData;
for (const char **i = ArgBegin; i != ArgEnd; ++i) {
  // tmjackso: Skip the -o option because clang (and GCC) generate a
  // random temp file to hold a compiled object if one isn't
  // specified.  This happens if you combine compilation and linking
  // into one step.  There may be a cleaner way of doing this, but
  // this is explicit and obvious.
  if (llvm::StringRef(*i) == "-o")
    ++i;
  else
    // Concatenate options for seeding.
    seeddata.append(*i);
}
rinon updated this revision to Unknown Object (????).Oct 1 2013, 4:56 PM
  • Removed LLVM_ENABLE_RNG.
  • Fixing string handling to be more in line with the LLVM way.
  • Various coding style fixes
rinon updated this revision to Unknown Object (????).Oct 15 2013, 3:26 PM
  • Salt now computed in clang
yln commandeered this revision.Jan 22 2014, 1:48 PM
yln added a reviewer: rinon.

Is there anything stopping this from going forward?

yln updated this revision to Unknown Object (????).Jan 23 2014, 2:56 PM

Moved patch forward to ToT.

yln updated this revision to Unknown Object (????).Jan 23 2014, 3:06 PM

I made a mistake: The previous Diff was the wrong Diff (for llvm).

yln updated this revision to Unknown Object (????).Apr 13 2014, 8:32 PM

Update patch alongside with issue D1802 (http://reviews.llvm.org/D1802).

yln abandoned this revision.Aug 15 2017, 4:07 PM