Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CFI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
CFI
Commits
d7e9701f
Commit
d7e9701f
authored
9 years ago
by
jdh8d
Browse files
Options
Downloads
Patches
Plain Diff
Added options to protect returns and/or jumps separately.
parent
d88766ef
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scfi_driver.cpp
+11
-1
11 additions, 1 deletion
scfi_driver.cpp
scfi_instr.cpp
+5
-0
5 additions, 0 deletions
scfi_instr.cpp
scfi_instr.hpp
+11
-2
11 additions, 2 deletions
scfi_instr.hpp
with
27 additions
and
3 deletions
scfi_driver.cpp
+
11
−
1
View file @
d7e9701f
...
...
@@ -53,12 +53,22 @@ int main(int argc, char **argv)
}
bool
do_coloring
=
false
;
bool
do_jumps
=
true
;
bool
do_rets
=
true
;
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
string
(
argv
[
i
])
==
"--color"
)
do_coloring
=
true
;
else
if
(
string
(
argv
[
i
])
==
"--no-color"
)
do_coloring
=
false
;
else
if
(
string
(
argv
[
i
])
==
"--protect-jumps"
)
do_jumps
=
true
;
else
if
(
string
(
argv
[
i
])
==
"--no-protect-jumps"
)
do_jumps
=
false
;
else
if
(
string
(
argv
[
i
])
==
"--protect-rets"
)
do_rets
=
true
;
else
if
(
string
(
argv
[
i
])
==
"--no-protect-rets"
)
do_rets
=
false
;
}
string
programName
(
argv
[
0
]);
...
...
@@ -89,7 +99,7 @@ int main(int argc, char **argv)
try
{
SCFI_Instrument
scfii
(
firp
,
do_coloring
);
SCFI_Instrument
scfii
(
firp
,
do_coloring
,
do_jumps
,
do_rets
);
int
success
=
scfii
.
execute
();
...
...
This diff is collapsed.
Click to expand it.
scfi_instr.cpp
+
5
−
0
View file @
d7e9701f
...
...
@@ -398,6 +398,9 @@ void mov_reloc(Instruction_t* from, Instruction_t* to, string type )
void
SCFI_Instrument
::
AddJumpCFI
(
Instruction_t
*
insn
)
{
if
(
!
do_jumps
)
return
;
assert
(
do_rets
);
ColoredSlotValue_t
v2
;
if
(
insn
->
GetIBTargets
()
&&
color_map
)
v2
=
color_map
->
GetColorOfIB
(
insn
);
...
...
@@ -440,6 +443,8 @@ void SCFI_Instrument::AddJumpCFI(Instruction_t* insn)
void
SCFI_Instrument
::
AddReturnCFI
(
Instruction_t
*
insn
,
ColoredSlotValue_t
*
v
)
{
if
(
!
do_rets
)
return
;
ColoredSlotValue_t
v2
;
if
(
v
==
NULL
&&
color_map
)
{
...
...
This diff is collapsed.
Click to expand it.
scfi_instr.hpp
+
11
−
2
View file @
d7e9701f
...
...
@@ -29,8 +29,15 @@
class
SCFI_Instrument
{
public:
SCFI_Instrument
(
libIRDB
::
FileIR_t
*
the_firp
,
bool
p_do_coloring
=
true
)
:
firp
(
the_firp
),
do_coloring
(
p_do_coloring
),
color_map
(
NULL
)
{}
SCFI_Instrument
(
libIRDB
::
FileIR_t
*
the_firp
,
bool
p_do_coloring
=
true
,
bool
p_do_jumps
=
true
,
bool
p_do_rets
=
true
)
:
firp
(
the_firp
),
do_coloring
(
p_do_coloring
),
do_jumps
(
p_do_jumps
),
do_rets
(
p_do_rets
),
color_map
(
NULL
)
{}
bool
execute
();
private
:
...
...
@@ -64,6 +71,8 @@ class SCFI_Instrument
libIRDB
::
FileIR_t
*
firp
;
bool
do_coloring
;
bool
do_jumps
;
bool
do_rets
;
ColoredInstructionNonces_t
*
color_map
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment