Skip to content

Seedarg/member/wip #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 104 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
3b9829e
Add "randomize_layout" attribute
connorkuehl Feb 1, 2019
9b0f3de
testing: Emit message when randomize_layout
connorkuehl Feb 1, 2019
f8da259
Rename Randomized to RandomizeLayout
connorkuehl Feb 1, 2019
7d221cd
fix: Go back to using D's field iterators
connorkuehl Feb 1, 2019
5749304
fix: Oops, actually use correct iterators
connorkuehl Feb 2, 2019
18bcbc0
Add reorder method for RecordDecl
connorkuehl Feb 7, 2019
8a27707
Fix infinite loop by updating tail ptr
connorkuehl Feb 7, 2019
a3fa3dd
Hack: quick and dirty randomization for testing!
connorkuehl Feb 7, 2019
4ff065b
Move Randomization to getASTRecordLayout
connorkuehl Feb 7, 2019
5d6b7c1
Added the 'no_randomize_layout' attr to clang
Nixoncole Feb 12, 2019
1ed67ef
Add performance sensitive randomization
connorkuehl Feb 13, 2019
4ba74e9
Merge pull request #17 from connorkuehl/port-randomization
Feb 15, 2019
73325c9
Delete hacky reorderFields method
connorkuehl Feb 15, 2019
53fec8d
Merge branch 'develop' of https://github.com/connorkuehl/llvm-project…
Nixoncole Feb 18, 2019
456bd5a
WIP, first attempt at emitting compiler warning
Nixoncole Feb 19, 2019
16160e3
Refactor code into tidier classes
connorkuehl Feb 19, 2019
b1f11a3
Added declaration of Diagnostic(), receiving errors.
Nixoncole Feb 19, 2019
dee16c7
builds, but cannot compile. Cant find stdio.h
Nixoncole Feb 20, 2019
bf4b55f
Sync with upstream
connorkuehl Feb 20, 2019
063f1b1
Added the 'no_randomize_layout' attr to clang
Nixoncole Feb 12, 2019
938b5cf
WIP, first attempt at emitting compiler warning
Nixoncole Feb 19, 2019
e1af06f
Added declaration of Diagnostic(), receiving errors.
Nixoncole Feb 19, 2019
a4a855d
builds, but cannot compile. Cant find stdio.h
Nixoncole Feb 20, 2019
11d18d7
putting RandstructSeed in Decl.h
Feb 21, 2019
d76e98b
RandomizeLayout identification for regression test This commit is to
Feb 21, 2019
3deff88
remove RandstructSeed declaration from Decl.h
Feb 21, 2019
753b226
Revert commit so it may be introduced by PR
connorkuehl Feb 21, 2019
69c348e
RandomizeLayout identification for regression test
Feb 21, 2019
5e9c123
RandomizeLayout identification for regression test
Feb 21, 2019
12c5b41
Merge branch 'RandomizeLayout_Regression_Test_Addition' of https://gi…
Feb 22, 2019
162bda5
value not being saved in global
Feb 22, 2019
97bb5ce
removing unused coede
Feb 22, 2019
6ef63eb
removing randstruct constructor call
Feb 22, 2019
e0cfd8a
Added basic implementation of auto selection for strucutres of only f…
Jafosterja Feb 23, 2019
9d3845e
Clean up PR
Feb 23, 2019
287458e
Merge branch 'no_ranomize_layout_attr' of https://github.com/clang-ra…
Feb 23, 2019
f94de06
Add DiagGroup to NoRandomizeLayout attribute
connorkuehl Feb 23, 2019
fadd247
Add NoRandomizeLayout to supported attributes list
connorkuehl Feb 23, 2019
ae1bf92
Add space after semicolon in warning message
connorkuehl Feb 23, 2019
b3a2306
test commit
Feb 23, 2019
a9200c2
printf debugging
Feb 23, 2019
5ceee39
manually adding arg before executing
Feb 24, 2019
5dd2a45
adding include to job.cpp
Feb 24, 2019
7272914
First draft for attribute documentation
Nixoncole Feb 24, 2019
76f2bd1
throwaway commit
Feb 24, 2019
c4863cc
more printf debugging
Feb 24, 2019
1dbbe31
even more printf debugging
Feb 24, 2019
09a54e9
Edit ClangRandstruct entry in AttrDocs.td
Feb 24, 2019
d1d871c
added frandstruct-seed= to CC1Options.td
Feb 24, 2019
efa2157
added frandstruct-seed= to CC1Options.td
Feb 24, 2019
7a329b5
removing =
Feb 24, 2019
495b157
removing =
Feb 24, 2019
651fdc4
error: linker -f may not be used without -shared
Feb 24, 2019
013a77d
error: linker -f may not be used without -shared
Feb 24, 2019
184695d
error: linker -f may not be used without -shared
Feb 24, 2019
0594d7e
gen. commit
Feb 24, 2019
3656e01
wip fixing linker errors
Feb 24, 2019
f07aff2
wip fixing linker errors
Feb 24, 2019
213041f
wip fixing linker errors
Feb 25, 2019
ab0393f
wip fixing linker errors
Feb 25, 2019
d923c6f
wip fixing linker errors
Feb 25, 2019
25246d2
wip fixing linker errors
Feb 25, 2019
1455704
wip fixing linker errors
Feb 25, 2019
3dcf748
wip fixing linker errors
Feb 25, 2019
b47a59e
(#20) Merge RandomizeLayout regression test
connorkuehl Feb 25, 2019
46b491e
generic commit
Feb 25, 2019
d149823
generic commit
Feb 25, 2019
58cfc9b
generic commit
Feb 25, 2019
e0dcc7a
generic commit
Feb 25, 2019
8590e8e
generic commit
Feb 25, 2019
690b679
generic commit
Feb 25, 2019
82bd310
generic commit
Feb 26, 2019
9949798
Docs for the single attribute, 'randomize_layout'.
Nixoncole Feb 26, 2019
f06d4cc
touched up other docs ad ran 'clang-format'
Nixoncole Feb 26, 2019
6fedc9d
Refactored the auto selection code
Jafosterja Feb 26, 2019
6900a62
generic commit
Feb 26, 2019
9cab894
Changed frandstruct to randstruct
Feb 26, 2019
ca2372f
Removed 'header' that is only for when you include docs for multiple …
Nixoncole Feb 26, 2019
63cf353
Added comments
Jafosterja Feb 26, 2019
a9655bd
Merge pull request #27 from clang-randstruct/randomize_layout_docs
jeffreytakahashi Feb 26, 2019
f5e549d
Merge pull request #26 from jcantrell/seedarg/global/wip
Feb 26, 2019
312a0e6
Revert "(#20) Merge RandomizeLayout regression test"
Feb 26, 2019
32fae72
Re-adding regression test fix
Feb 26, 2019
d95e624
Revert "generic commit"
Feb 26, 2019
fe25c0e
Skip Unions when selecting from randomization
connorkuehl Feb 26, 2019
1731e3a
Add warning when union has randomize_layout attr
connorkuehl Feb 26, 2019
e39c922
Removed const qualifier from reorganize() and randomize(), since rng …
Feb 27, 2019
e33d38e
merging changes from develop
Feb 27, 2019
ca6c6d8
Merge pull request #35 from clang-randstruct/seedarg/global/wip
Feb 27, 2019
be0971b
Merge pull request #33 from clang-randstruct/skip-unions
Feb 27, 2019
b4446bd
Removed unnecessary functions
Jafosterja Feb 27, 2019
0a9f695
adding flag
Feb 27, 2019
dd7a572
Merge branch 'develop' into randstruct-auto
connorkuehl Feb 27, 2019
3e53f43
Add -randstruct-auto command line argument
connorkuehl Feb 27, 2019
97166c8
Refactored code for better readability
Jafosterja Feb 27, 2019
a8106ca
Merge branch 'randstruct-auto' into Autoselect
connorkuehl Feb 27, 2019
2a220f2
Delete NoRandomizeLayout check
connorkuehl Feb 27, 2019
46a4a57
merging in develop
Feb 28, 2019
2c5f3eb
Added changes requested by Nixoncole
Jafosterja Feb 28, 2019
3a0479d
Merge pull request #29 from clang-randstruct/Autoselect
Feb 28, 2019
20696c1
merging in changes from develop
Feb 28, 2019
e3be585
generic commit
Feb 28, 2019
dccaff2
generic commit
Feb 28, 2019
4a6549a
ran clang-format on RecordField/Layout files
Feb 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move Randomization to getASTRecordLayout
connorkuehl committed Feb 7, 2019
commit 4ff065bf33a8ac81d32898fe6d636ec92f0eae0c
35 changes: 18 additions & 17 deletions clang/lib/AST/RecordLayoutBuilder.cpp
Original file line number Diff line number Diff line change
@@ -1365,23 +1365,6 @@ void ItaniumRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
bool InsertExtraPadding = D->mayInsertExtraPadding(/*EmitRemark=*/true);
bool HasFlexibleArrayMember = D->hasFlexibleArrayMember();

// A staging area to easily reorder the fields
SmallVector<Decl *, 64> fields;
for (auto f : D->fields()) {
fields.push_back(f);
}

bool ShouldBeRandomized = D->getAttr<RandomizeLayoutAttr>() != nullptr;
if (ShouldBeRandomized) {
// FIXME Should call our Randstruct code once we port it.
auto rng = std::default_random_engine {};
std::shuffle(std::begin(fields), std::end(fields), rng);

// This will rebuild the Decl chain of fields
D->reorderFields(fields);
}


for (auto I = D->field_begin(), End = D->field_end(); I != End; ++I) {
auto Next(I);
++Next;
@@ -3005,6 +2988,24 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const {

const ASTRecordLayout *NewEntry = nullptr;

// FIXME Randstruct code should be called here!
// A staging area to easily reorder the fields
SmallVector<Decl *, 64> fields;
for (auto f : D->fields()) {
fields.push_back(f);
}

bool ShouldBeRandomized = D->getAttr<RandomizeLayoutAttr>() != nullptr;
if (ShouldBeRandomized) {
// FIXME Should call our Randstruct code once we port it.
auto rng = std::default_random_engine {};
std::shuffle(std::begin(fields), std::end(fields), rng);

// This will rebuild the Decl chain of fields
D->reorderFields(fields);
}
// FIXME end Randstruct code

if (isMsLayout(*this)) {
MicrosoftRecordLayoutBuilder Builder(*this);
if (const auto *RD = dyn_cast<CXXRecordDecl>(D)) {