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
8676455f
Commit
8676455f
authored
8 years ago
by
an7s
Browse files
Options
Downloads
Patches
Plain Diff
made coloring cfi work for cgc, and added clamp-mask option
parent
795de7f4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nonce_relocs.cpp
+1
-18
1 addition, 18 deletions
nonce_relocs.cpp
with
1 addition
and
18 deletions
nonce_relocs.cpp
+
1
−
18
View file @
8676455f
...
...
@@ -271,32 +271,15 @@ void NonceRelocs_t::AddSlowPathInstructions()
// cmp ecx/r11, end_segment_addr
// jgt out_of_range_handler
#ifdef CGC
// CGC needs to keep from faulting, so we have to check to make sure the IB is an intra-module IB.
// if not, we terminate immediately.
// we aren't doing the pop/cmp before jumping to the slow path, so we have to do it here.
Instruction_t
*
after
=
insertAssemblyBefore
(
&
m_firp
,
slow_path
,
"pop "
+
reg
);
// pop ecx (get ret addr)
tmp
=
insertAssemblyAfter
(
&
m_firp
,
slow_path
,
"cmp "
+
reg
+
", 0x12345678"
);
out_of_range_handler
=
exit_node
;
// cgc is statically linked, so we can just go to the exit node.
#else
Instruction_t
*
after
=
insertAssemblyBefore
(
&
m_firp
,
slow_path
,
"cmp "
+
reg
+
", 0x12345678"
);
tmp
=
slow_path
;
#endif
min_addr_update
.
insert
(
tmp
);
tmp
=
insertAssemblyAfter
(
&
m_firp
,
tmp
,
"jl 0"
,
out_of_range_handler
);
// cross library jump detected
tmp
=
insertAssemblyAfter
(
&
m_firp
,
tmp
,
"cmp "
+
reg
+
", 0x87654321"
);
max_addr_update
.
insert
(
tmp
);
tmp
=
insertAssemblyAfter
(
&
m_firp
,
tmp
,
"jg 0"
,
out_of_range_handler
);
// cross library jump detected
#ifdef CGC
// After we're sure it's in this segment, we can
// go ahead and check for a nonce that we layed down previously.
// cmp byte [ecx/r11-1], 0xf4
// jeq slow_path
tmp
=
insertAssemblyAfter
(
&
m_firp
,
tmp
,
"cmp byte ["
+
reg
+
"-1], 0xf4"
);
tmp
=
insertAssemblyAfter
(
&
m_firp
,
tmp
,
"jne 0"
,
after
);
// finally, go to the slow path checks when a nonce didn't work.
tmp
=
insertAssemblyAfter
(
&
m_firp
,
tmp
,
"jmp "
+
reg
);
#endif // CGC
m_firp
.
AssembleRegistry
();
// resolve all assembly into actual bits.
...
...
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