Skip to content

Instantly share code, notes, and snippets.

@hxy9243
Created December 5, 2014 01:31
Show Gist options
  • Save hxy9243/9c9a45360d01bb239b82 to your computer and use it in GitHub Desktop.
Save hxy9243/9c9a45360d01bb239b82 to your computer and use it in GitHub Desktop.
Test case for global privilege analysis
getting analysis usage
Running Split BB Pass
split on priv_raise in foo
split on priv_raise in foo
split on priv_raise in foo
split on priv_raise in bar
split on priv_raise in nothing
split on priv_lower in foo
split on priv_lower in foo
split on priv_lower in foo
split on priv_lower in bar
split on priv_lower in nothing
split on nothing in foo
split on nothing in foo
split on nothing in foo
split on nothing in foo
split on nothing in bar
split on nothing in bar
split on foobar in main
split on foobar in main
bar is the start of a block in foobar I'm not splitting you
split on bar in foobar
split on bar in foobar
split on bar in foobar
printf is empty!
foo is the start of a block in foobar I'm not splitting you
split on foo in foobar
Sizeof privBB is 5
Sizeof CallSiteBB is 7
Sizeof BBFuncTable is 7
Running Local Analysis Pass
bar Privileges:
3 4
foo Privileges:
5 6 7 10 12 23 24 25 26
nothing Privileges:
7 17 29
Running CallGraph propagation pass
Dump table before propagation
bar Privileges:
3 4
foo Privileges:
5 6 7 10 12 23 24 25 26
nothing Privileges:
7 17 29
Dump table after propagation
printf Privileges:
foobar Privileges:
3 4 5 6 7 10 12 17 23 24 25 26 29
bar Privileges:
3 4 7 17 29
foo Privileges:
5 6 7 10 12 17 23 24 25 26 29
main Privileges:
3 4 5 6 7 10 12 17 23 24 25 26 29
priv_raise Privileges:
priv_lower Privileges:
nothing Privileges:
7 17 29
Running Global Live Analysis pass
converged with 320 iterations
BBCAPTable_in size 32
BBCAPTable size 32
BB1 in priv_raise:
BB1 out priv_raise:
BB2 in priv_lower:
BB2 out priv_lower:
BB3 in foobar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB3 out foobar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB4 in foobar: 3 4 7 17 29
BB4 out foobar:
BB5 in foobar: 5 6 7 10 12 17 23 24 25 26 29
BB5 out foobar:
BB6 in foobar:
BB6 out foobar:
BB7 in bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB7 out bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB8 in foo: 5 6 7 10 12 17 23 24 25 26 29
BB8 out foo: 5 6 7 10 12 17 23 24 25 26 29
BB9 in main: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB9 out main: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB10 in bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB10 out bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB11 in foo: 5 6 7 17 29
BB11 out foo: 7 17 29
BB12 in foo: 5 6 7 12 17 24 26 29
BB12 out foo: 5 6 7 17 29
BB13 in nothing: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB13 out nothing: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB14 in nothing: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB14 out nothing: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB15 in foo: 5 6 7 10 12 17 23 24 25 26 29
BB15 out foo: 5 6 7 12 17 24 26 29
BB16 in foo: 7 17 29
BB16 out foo: 7 17 29
BB17 in foo: 5 6 7 17 29
BB17 out foo: 5 6 7 17 29
BB18 in foo: 5 6 7 12 17 24 26 29
BB18 out foo: 5 6 7 12 17 24 26 29
BB19 in bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB19 out bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB20 in nothing: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB20 out nothing: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB21 in foo: 7 17 29
BB21 out foo:
BB22 in foo:
BB22 out foo:
BB23 in foo: 5 6 7 12 17 24 26 29
BB23 out foo: 5 6 7 12 17 24 26 29
BB24 in foo: 5 6 7 12 17 24 26 29
BB24 out foo: 5 6 7 12 17 24 26 29
BB25 in bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB25 out bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB26 in bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB26 out bar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB27 in main: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB27 out main:
BB28 in main:
BB28 out main:
BB29 in foobar:
BB29 out foobar:
BB30 in foobar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB30 out foobar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB31 in foobar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB31 out foobar: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB32 in foobar:
BB32 out foobar:
BB33 drop priv_raise:
BB34 drop priv_lower:
BB35 drop foobar:
BB36 drop foobar: 3 4 7 17 29
BB37 drop foobar: 5 6 7 10 12 17 23 24 25 26 29
BB38 drop foobar:
BB39 drop bar:
BB40 drop foo:
BB41 drop main:
BB42 drop bar:
BB43 drop foo: 5 6
BB44 drop foo: 12 24 26
BB45 drop nothing:
BB46 drop nothing:
BB47 drop foo: 10 23 25
BB48 drop foo:
BB49 drop foo:
BB50 drop foo:
BB51 drop bar:
BB52 drop nothing:
BB53 drop foo: 7 17 29
BB54 drop foo:
BB55 drop foo:
BB56 drop foo:
BB57 drop bar:
BB58 drop bar:
BB59 drop main: 3 4 5 6 7 10 12 17 23 24 25 26 29
BB60 drop main:
BB61 drop foobar:
BB62 drop foobar:
BB63 drop foobar:
BB64 drop foobar:
#include <stdio.h>
void bar ();
void foo ();
void nothing(int i);
void foobar();
int priv_raise (int, ...);
int priv_lower (int, ...);
void nothing(int i){
priv_raise(3, 7, 17, 29);
printf("something\n");
priv_lower(3, 7, 17, 29);
return;
}
void foobar(int i){
bar();
if (i){
bar();
}
else{
foo ();
}
}
void bar (){
int k = 10;
int i = 30;
int j = 30;
priv_raise(2, 3, 4);
printf ("something\n");
priv_lower(2, 3, 4);
k = i + j;
nothing(k);
j = k + i;
i = k * i;
}
void foo (){
int k = 30;
int i = 34;
int j = 34;
priv_raise (3, 10, 23, 25);
printf("something\n");
priv_lower (3, 10, 23, 25);
k = j + 100;
nothing(10);
k = j + 100;
priv_raise (3, 12, 24, 26);
printf("something\n");
priv_lower (3, 12, 24, 26);
k = j + 100;
priv_raise (3, 5, 6, 7);
printf("something\n");
priv_lower (3, 5, 6, 7);
k = j + 100;
nothing(10);
j = k + i;
i = k * i;
}
int priv_raise (int i, ...){
printf("raising priv\n");
return i;
}
int priv_lower (int i, ...){
printf("lowering priv\n");
return i;
}
int main (int argc, char **argv){
// foobar(argc);
foobar(argc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment