Esempio n. 1
0
  public static Preset finalize(Preset empty, AnalysisScope scope, IClassHierarchy cha) {
    Preset p = empty;
    p.scfg.cha = cha;

    // The preliminary settings of WALAs AnalysisOptions
    p.options.setReflectionOptions(ReflectionOptions.FULL);
    AndroidEntryPointManager.MANAGER.setInstantiationBehavior(
        new DefaultInstantiationBehavior(cha));
    Util.addDefaultSelectors(p.options, cha);
    Util.addDefaultBypassLogic(p.options, scope, Util.class.getClassLoader(), cha); // ??

    // No changes to the settings of AndroidEntypointManager...
    // p.aem
    // p.entrypointLocatorFlags = EnumSet.of(LocatorFlags.EP_HEURISTIC, LocatorFlags.WITH_SUPER,
    //        LocatorFlags.INCLUDE_CALLBACKS, LocatorFlags.CB_HEURISTIC);
    p.entrypointLocatorFlags =
        EnumSet.of(
            LocatorFlags.EP_HEURISTIC, LocatorFlags.CB_HEURISTIC, LocatorFlags.INCLUDE_CALLBACKS);

    // The following selectors will be injected when Joana generates its new
    // AnalysisOptions
    // TODO: Add ReflectionContext ?
    p.ctxSel = new DefaultContextSelector(p.options, p.scfg.cha);
    p.ctxIpr = new DefaultSSAInterpreter(p.options, p.scfg.cache);
    p.instKeys = new ZeroXInstanceKeys(p.options, p.scfg.cha, p.ctxIpr, ZeroXInstanceKeys.NONE);

    return p;
  }
Esempio n. 2
0
  /**
   * Default settings as described below.
   *
   * <p>These settings contain: * a relatively basic setting for the context-sensitivity * no
   * entrypoints have been set(!)
   *
   * @return a bunch of settings
   */
  public static Preset makeDefault(AnalysisScope scope, IClassHierarchy cha) {
    final Preset p = new Preset(scope);

    // The following settings are used by Joana. Based on them new settings of
    // WALAs AnalysisOptions will be generated by Joana.
    applyPrettyCLIOutput(p);
    p.scfg.cache = new AnalysisCache((IRFactory<IMethod>) new DexIRFactory());
    p.scfg.cha = cha;

    // On external stuff. These settings have little effect on the result.
    p.scfg.ext = makeStandardExternalCallCheck();
    p.scfg.accessPath = false; // Setting this to true overrides other settings

    // On debugging
    p.scfg.showTypeNameInValue = false; // on true: Second type-inference often breaks
    p.scfg.debugManyGraphsDotOutput = false;

    p.scfg.immutableNoOut = Main.IMMUTABLE_NO_OUT;
    p.scfg.immutableStubs = Main.IMMUTABLE_STUBS;
    p.scfg.ignoreStaticFields = Main.IGNORE_STATIC_FIELDS;

    // What to considder
    // p.scfg.exceptions = ExceptionAnalysis.ALL_NO_ANALYSIS;
    p.scfg.exceptions = ExceptionAnalysis.IGNORE_ALL;
    p.scfg.staticInitializers =
        StaticInitializationTreatment.SIMPLE; // Do not use ACCURATE: Is defunct

    // Precision
    p.scfg.pts = PointsToPrecision.INSTANCE_BASED;

    p.scfg.prunecg = Main.DEFAULT_PRUNE_CG;
    // p.scfg.fieldPropagation = FieldPropagation.OBJ_GRAPH;   // Do not use OBJ_TREE: Is outdated
    // p.scfg.fieldPropagation = FieldPropagation.OBJ_GRAPH_SIMPLE_PROPAGATION;
    p.scfg.fieldPropagation = FieldPropagation.OBJ_GRAPH_NO_FIELD_MERGE;
    p.scfg.computeInterference = false;

    // The preliminary settings of WALAs AnalysisOptions
    p.options.setReflectionOptions(ReflectionOptions.FULL);
    AndroidEntryPointManager.MANAGER.setInstantiationBehavior(
        new DefaultInstantiationBehavior(cha));
    Util.addDefaultSelectors(p.options, cha);
    Util.addDefaultBypassLogic(p.options, scope, Util.class.getClassLoader(), cha); // ??

    // No changes to the settings of AndroidEntypointManager...
    // p.aem
    // p.entrypointLocatorFlags = EnumSet.of(LocatorFlags.EP_HEURISTIC, LocatorFlags.WITH_SUPER,
    //        LocatorFlags.INCLUDE_CALLBACKS, LocatorFlags.CB_HEURISTIC);
    p.entrypointLocatorFlags =
        EnumSet.of(
            LocatorFlags.EP_HEURISTIC, LocatorFlags.CB_HEURISTIC, LocatorFlags.INCLUDE_CALLBACKS);

    // The following selectors will be injected when Joana generates its new
    // AnalysisOptions
    // TODO: Add ReflectionContext ?
    p.ctxSel = new DefaultContextSelector(p.options, p.scfg.cha);
    p.ctxIpr = new DefaultSSAInterpreter(p.options, p.scfg.cache);
    p.instKeys = new ZeroXInstanceKeys(p.options, p.scfg.cha, p.ctxIpr, ZeroXInstanceKeys.NONE);

    LogLevels.setLevels();

    Preset.aem.setOverrides(AndroidEntryPointManager.DEFAULT_INTENT_OVERRIDES);
    // XXX TEMP:
    Preset.aem.setDoBootSequence(false);

    return p;
  }
Esempio n. 3
0
 public static void addDefaultJ2EEBypassLogic(
     AnalysisOptions options, AnalysisScope scope, ClassLoader cl, IClassHierarchy cha) {
   com.ibm.wala.ipa.callgraph.impl.Util.addDefaultBypassLogic(options, scope, cl, cha);
   com.ibm.wala.ipa.callgraph.impl.Util.addBypassLogic(options, scope, cl, benignExtSpec, cha);
 }