Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
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
Container Registry
Model registry
Operate
Environments
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
Zipr Toolchain
Commits
c41ff9b9
Commit
c41ff9b9
authored
10 years ago
by
an7s
Browse files
Options
Downloads
Patches
Plain Diff
updated
Former-commit-id: a6f0c8a6ee7fc529575dac4cd3fbaf0ee4154b86
parent
b61f5c1b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/do_cinderella.sh
+36
-3
36 additions, 3 deletions
tools/do_cinderella.sh
with
36 additions
and
3 deletions
tools/do_cinderella.sh
+
36
−
3
View file @
c41ff9b9
...
...
@@ -64,6 +64,22 @@ echo "CINDERELLA TODO: rename all libc functions detected: prepend to cinderella
# for the true malloc()
#
TMP
=
tmp.
$$
echo
"CINDERELLA PASS1: simply intersects static + dynamic"
$SECURITY_TRANSFORMS_HOME
/tools/cgclibc/cgclibc.exe
$ORIG_VARIANT_ID
--positive-inferences
cinderella.inferences.positive
--negative-inferences
cinderella.inferences.negative
>
cinderella.static.pass1
count_malloc
=
`
grep
"^static positive malloc"
cinderella.static.pass1 |
wc
-l
`
if
[
"
$count_malloc
"
=
"0"
]
;
then
echo
"No dynamic memory allocation in this program"
exit
0
elif
[
"
$count_malloc
"
=
"1"
]
;
then
grep
-i
"positive malloc"
cinderella.static.pass1 |
cut
-d
' '
-f4
>
$TRUE_MALLOC
echo
"CINDERELLA: pass 1: detected true malloc"
cat
$TRUE_MALLOC
echo
"CINDERELLA TODO: rename detected malloc fn to cinderella::malloc"
exit
0
fi
#
# Use dominator heuristic to find malloc
# potential mallocs (dynamic): D = {A, B, C}
...
...
@@ -79,7 +95,8 @@ echo "CINDERELLA TODO: rename all libc functions detected: prepend to cinderella
# with the static analysis pass
#
echo
"CINDERELLA PASS2: intersect dynamic and static analyses for malloc / turn on --dominator"
$SECURITY_TRANSFORMS_HOME
/tools/cgclibc/cgclibc.exe
$ORIG_VARIANT_ID
--positive-inferences
cinderella.inferences.positive
--dominator
>
cinderella.static.pass2
grep
-i
"positive malloc"
cinderella.static.pass1
>
$TMP
$SECURITY_TRANSFORMS_HOME
/tools/cgclibc/cgclibc.exe
$ORIG_VARIANT_ID
--positive-inferences
$TMP
--negative-inferences
cinderella.inferences.negative
--dominator
>
cinderella.static.pass2
count_malloc
=
`
grep
"^static positive malloc"
cinderella.static.pass2 |
wc
-l
`
count_free
=
`
grep
"^static positive free"
cinderella.static.pass2 |
wc
-l
`
...
...
@@ -96,8 +113,9 @@ fi
# Use simple clustering heuristic
#
if
[
"
$count_malloc
"
!=
"1"
]
||
[
"
$count_free
"
!=
"1"
]
;
then
echo
"CINDERELLA PASS3: with restrictions on malloc / turn on --dominator and --cluster"
$SECURITY_TRANSFORMS_HOME
/tools/cgclibc/cgclibc.exe
$ORIG_VARIANT_ID
--positive-inferences
cinderella.inferences.positive
--dominator
--cluster
>
cinderella.static.pass3
echo
"CINDERELLA PASS3: with restrictions on malloc / turn on --dominator"
grep
-i
"positive malloc"
cinderella.static.pass2
>
$TMP
$SECURITY_TRANSFORMS_HOME
/tools/cgclibc/cgclibc.exe
$ORIG_VARIANT_ID
--positive-inferences
$TMP
--negative-inferences
cinderella.inferences.negative
--dominator
>
cinderella.static.pass3
count_malloc
=
`
grep
"^static positive malloc"
cinderella.static.pass3 |
wc
-l
`
count_free
=
`
grep
"^static positive free"
cinderella.static.pass3 |
wc
-l
`
fi
...
...
@@ -112,6 +130,21 @@ if [ "$count_malloc" = "1" ]; then
exit
0
fi
echo
"CINDERELLA PASS3: with restrictions on malloc / turn on --dominator and --cluster"
grep
-i
"positive malloc"
cinderella.static.pass3
>
$TMP
$SECURITY_TRANSFORMS_HOME
/tools/cgclibc/cgclibc.exe
$ORIG_VARIANT_ID
--positive-inferences
$TMP
--negative-inferences
cinderella.inferences.negative
--dominator
--cluster
>
cinderella.static.pass4
count_malloc
=
`
grep
"^static positive malloc"
cinderella.static.pass4 |
wc
-l
`
count_free
=
`
grep
"^static positive free"
cinderella.static.pass4 |
wc
-l
`
echo
"CINDERELLA: PASS4: #mallocs:
$count_malloc
#frees:
$count_free
"
if
[
"
$count_malloc
"
=
"1"
]
;
then
grep
-i
"positive malloc"
cinderella.static.pass4 |
cut
-d
' '
-f4
>
$TRUE_MALLOC
echo
"CINDERELLA: pass 4: detected true malloc"
cat
$TRUE_MALLOC
echo
"CINDERELLA TODO: rename detected malloc fn to cinderella::malloc"
exit
0
fi
echo
"CINDERELLA: TODO: handle realloc() and calloc()"
exit
0
...
...
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