Пример #1
0
ContextVector ContextUtils::getContextsForMethod(Function* F, bool contextInsensitive, SandboxVector& sandboxes, Module& M) {
    if (contextInsensitive) {
        return ContextVector(1, SINGLE_CONTEXT);
    }
    else {
        ContextVector Cs;
        if (SandboxUtils::isPrivilegedMethod(F, M)) {
            Cs.push_back(PRIV_CONTEXT);
        }
        SandboxVector containers = SandboxUtils::getSandboxesContainingMethod(F, sandboxes);
        Cs.insert(Cs.begin(), containers.begin(), containers.end());
        return Cs;
    }
}
Пример #2
0
ContextVector ContextUtils::getContextsForInstruction(Instruction* I, bool contextInsensitive, SandboxVector& sandboxes, Module& M) {
    SDEBUG("soaap.util.context", 5, dbgs() << "getContextsForInstruction\n");
    if (contextInsensitive) {
        SDEBUG("soaap.util.context", 5, dbgs() << "context insensitive\n");
        return ContextVector(1, SINGLE_CONTEXT);
    }
    else {
        ContextVector Cs;
        if (SandboxUtils::isPrivilegedInstruction(I, sandboxes, M)) {
            Cs.push_back(PRIV_CONTEXT);
        }
        SDEBUG("soaap.util.context", 5, dbgs() << "looking for sandboxes containing instruction\n");
        SandboxVector containers = SandboxUtils::getSandboxesContainingInstruction(I, sandboxes);
        Cs.insert(Cs.begin(), containers.begin(), containers.end());
        return Cs;
    }
}
Пример #3
0
bool ContextUtils::isInContext(Instruction* I, Context* C, bool contextInsensitive, SandboxVector& sandboxes, Module& M) {
    ContextVector Cs = getContextsForInstruction(I, contextInsensitive, sandboxes, M);
    SDEBUG("soaap.util.context", 5, dbgs() << "Looking for " << stringifyContext(C) << " amongst " << Cs.size() << " contexts\n");
    SDEBUG("soaap.util.context", 5, dbgs() << "sandboxes.size(): " << sandboxes.size() << "\n");
    return find(Cs.begin(), Cs.end(), C) != Cs.end();
}