From: jjenista Date: Thu, 24 Jun 2010 20:51:44 +0000 (+0000) Subject: taints tested, propagate interprocedurally X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0eb7c59b31dc23f54c4c9288ecb721603b67d952;p=IRC.git taints tested, propagate interprocedurally --- diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index cfe73e39..7bcf7391 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -1799,8 +1799,9 @@ public class ReachGraph { ExistPredSet preds = ExistPredSet.factory( pred ); - TaintSet taints = - TaintSet.factory(); + TaintSet taints = TaintSet.factory( reArg.getTaints(), + preds + ); RefEdge reCallee = new RefEdge( vnCallee, @@ -2183,6 +2184,8 @@ public class ReachGraph { // since the node is coming over, find out which reach // states on it should come over, too + assert calleeNode2calleeStatesSatisfied.get( hrnCallee ) == null; + Iterator stateItr = hrnCallee.getAlpha().iterator(); while( stateItr.hasNext() ) { ReachState stateCallee = stateItr.next(); @@ -2192,13 +2195,18 @@ public class ReachGraph { callerNodeIDsCopiedToCallee ); if( predsIfSatis != null ) { - assert calleeNode2calleeStatesSatisfied.get( hrnCallee ) == null; - + Hashtable calleeStatesSatisfied = - new Hashtable(); - calleeStatesSatisfied.put( stateCallee, predsIfSatis ); + calleeNode2calleeStatesSatisfied.get( hrnCallee ); + + if( calleeStatesSatisfied == null ) { + calleeStatesSatisfied = + new Hashtable(); - calleeNode2calleeStatesSatisfied.put( hrnCallee, calleeStatesSatisfied ); + calleeNode2calleeStatesSatisfied.put( hrnCallee, calleeStatesSatisfied ); + } + + calleeStatesSatisfied.put( stateCallee, predsIfSatis ); } } @@ -2335,6 +2343,8 @@ public class ReachGraph { // since the edge is coming over, find out which reach // states on it should come over, too + assert calleeEdge2calleeStatesSatisfied.get( reCallee ) == null; + stateItr = reCallee.getBeta().iterator(); while( stateItr.hasNext() ) { ReachState stateCallee = stateItr.next(); @@ -2344,18 +2354,25 @@ public class ReachGraph { callerNodeIDsCopiedToCallee ); if( predsIfSatis != null ) { - assert calleeEdge2calleeStatesSatisfied.get( reCallee ) == null; Hashtable calleeStatesSatisfied = - new Hashtable(); - calleeStatesSatisfied.put( stateCallee, predsIfSatis ); - - calleeEdge2calleeStatesSatisfied.put( reCallee, calleeStatesSatisfied ); + calleeEdge2calleeStatesSatisfied.get( reCallee ); + + if( calleeStatesSatisfied == null ) { + calleeStatesSatisfied = + new Hashtable(); + + calleeEdge2calleeStatesSatisfied.put( reCallee, calleeStatesSatisfied ); + } + + calleeStatesSatisfied.put( stateCallee, predsIfSatis ); } } // since the edge is coming over, find out which taints // on it should come over, too + assert calleeEdge2calleeTaintsSatisfied.get( reCallee ) == null; + Iterator tItr = reCallee.getTaints().iterator(); while( tItr.hasNext() ) { Taint tCallee = tItr.next(); @@ -2365,13 +2382,18 @@ public class ReachGraph { callerNodeIDsCopiedToCallee ); if( predsIfSatis != null ) { - assert calleeEdge2calleeTaintsSatisfied.get( reCallee ) == null; Hashtable calleeTaintsSatisfied = - new Hashtable(); - calleeTaintsSatisfied.put( tCallee, predsIfSatis ); - - calleeEdge2calleeTaintsSatisfied.put( reCallee, calleeTaintsSatisfied ); + calleeEdge2calleeTaintsSatisfied.get( reCallee ); + + if( calleeTaintsSatisfied == null ) { + calleeTaintsSatisfied = + new Hashtable(); + + calleeEdge2calleeTaintsSatisfied.put( reCallee, calleeTaintsSatisfied ); + } + + calleeTaintsSatisfied.put( tCallee, predsIfSatis ); } } } diff --git a/Robust/src/Analysis/Disjoint/Taint.java b/Robust/src/Analysis/Disjoint/Taint.java index cf275c97..e5ab027b 100644 --- a/Robust/src/Analysis/Disjoint/Taint.java +++ b/Robust/src/Analysis/Disjoint/Taint.java @@ -59,20 +59,20 @@ public class Taint extends Canonical { } public static Taint factory( FlatNode stallSite, - TempDescriptor liveVar, + TempDescriptor var, AllocSite as, ExistPredSet eps ) { - Taint out = new Taint( null, stallSite, liveVar, as, eps ); + Taint out = new Taint( null, stallSite, var, as, eps ); out = (Taint) Canonical.makeCanonical( out ); return out; } public static Taint factory( FlatSESEEnterNode sese, FlatNode stallSite, - TempDescriptor liveVar, + TempDescriptor var, AllocSite as, ExistPredSet eps ) { - Taint out = new Taint( sese, stallSite, liveVar, as, eps ); + Taint out = new Taint( sese, stallSite, var, as, eps ); out = (Taint) Canonical.makeCanonical( out ); return out; } diff --git a/Robust/src/Analysis/Disjoint/TaintSet.java b/Robust/src/Analysis/Disjoint/TaintSet.java index 6631de37..b0005b3b 100644 --- a/Robust/src/Analysis/Disjoint/TaintSet.java +++ b/Robust/src/Analysis/Disjoint/TaintSet.java @@ -47,6 +47,28 @@ public class TaintSet extends Canonical { return out; } + public static TaintSet factory( TaintSet ts, + ExistPredSet preds ) { + assert ts != null; + assert ts.isCanonical(); + + TaintSet out = new TaintSet(); + + Iterator tItr = ts.iterator(); + while( tItr.hasNext() ) { + Taint t = tItr.next(); + Taint tOut = Taint.factory( t.sese, + t.stallSite, + t.var, + t.allocSite, + preds ); + out.taints.add( tOut ); + } + + out = (TaintSet) Canonical.makeCanonical( out ); + return out; + } + protected TaintSet() { taints = new HashSet(); } diff --git a/Robust/src/Tests/disjoint/taintTest1/makefile b/Robust/src/Tests/disjoint/taintTest1/makefile index 56dcc005..fa76629b 100644 --- a/Robust/src/Tests/disjoint/taintTest1/makefile +++ b/Robust/src/Tests/disjoint/taintTest1/makefile @@ -5,7 +5,7 @@ SOURCE_FILES=$(PROGRAM).java BUILDSCRIPT=~/research/Robust/src/buildscript BSFLAGS= -mainclass Test -justanalyze -ooojava -disjoint -disjoint-k 1 -enable-assertions -DEBUGFLAGS= -disjoint-write-dots final -disjoint-debug-snap-method main 0 10 true +DEBUGFLAGS= -disjoint-write-dots final -disjoint-write-initial-contexts -disjoint-write-ihms -disjoint-debug-snap-method main 0 10 true all: $(PROGRAM).bin diff --git a/Robust/src/Tests/disjoint/taintTest1/test.java b/Robust/src/Tests/disjoint/taintTest1/test.java index 748edf40..c079e86d 100644 --- a/Robust/src/Tests/disjoint/taintTest1/test.java +++ b/Robust/src/Tests/disjoint/taintTest1/test.java @@ -9,38 +9,28 @@ public class Test { static public void main( String[] args ) { Foo a = new Foo(); - Foo b = new Foo(); if( false ) { a = new Foo(); } - rblock p1 { + rblock r1 { a.f = new Foo(); - a.g = new Foo(); - - Foo x = a.f; + doSomething( a ); } + + } - rblock p2 { - a.f = new Foo(); - b.f = new Foo(); + static void doSomething( Foo a ) { - rblock c1 { - Foo d = a; - d.g = new Foo(); - Foo e = d.g; - } + a.g = new Foo(); - Foo y = a.f; - } + a.f.f = a.g; + //Foo x = a.g; - - //doSomething( a ); - } - - static void doSomething( Foo a ) { + // Foo y = new Foo(); + // y.f = x; //Foo f = doStuff( a, c ); }