Toggle navigation
Toggle navigation
This project
Loading...
Sign in
공재호
/
JJS_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박우진
2020-06-01 14:46:39 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7aa79fdbf052417fa0ad364ad36aae74941b2c45
7aa79fdb
1 parent
e270e5d6
make return obfuscation pass
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
src/llvm/lib/Transforms/Obfuscation/ReturnObfuscation.cpp
src/llvm/lib/Transforms/Obfuscation/ReturnObfuscation.cpp
View file @
7aa79fd
...
...
@@ -13,10 +13,6 @@ namespace {
ReturnObfuscation
()
:
FunctionPass
(
ID
)
{}
bool
runOnFunction
(
Function
&
F
)
override
{
Module
*
mod
=
F
.
getParent
();
/*
if (!F.getName().contains("setup") && !F.getName().contains("test")) {
return false;
}*/
ArrayType
*
return_array
=
ArrayType
::
get
(
IntegerType
::
get
(
mod
->
getContext
(),
8
),
12
);
PointerType
*
return_array_ptr
=
PointerType
::
get
(
return_array
,
0
);
PointerType
*
ret_func_ptr
=
PointerType
::
get
(
IntegerType
::
get
(
mod
->
getContext
(),
8
),
0
);
...
...
@@ -66,7 +62,18 @@ namespace {
for
(
auto
&
BB
:
RetBlocks
)
{
Constant
*
retBlockAddress
=
BlockAddress
::
get
(
BB
);
Module
*
M
=
F
.
getParent
();
for
(
auto
curFref
=
M
->
getFunctionList
().
begin
(),
endFref
=
M
->
getFunctionList
().
end
();
curFref
!=
endFref
;
++
curFref
)
{
for
(
auto
&
B
:
curFref
->
getBasicBlockList
())
{
StoreInst
*
asdf
=
new
StoreInst
(
retBlockAddress
,
ptr_this_ret
,
false
,
&
B
);
asdf
->
setAlignment
(
MaybeAlign
(
4
));
break
;
}
}
BasicBlock
*
decrypt_start
=
BasicBlock
::
Create
(
mod
->
getContext
(),
"dec_start"
,
&
F
,
BB
);
for
(
BasicBlock
*
preds
:
predecessors
(
BB
))
{
preds
->
getTerminator
()
->
eraseFromParent
();
...
...
Please
register
or
login
to post a comment