Exemplo n.º 1
0
ContextVector ContextUtils::getAllContexts(SandboxVector& sandboxes) {
    ContextVector Cs;
    Cs.push_back(PRIV_CONTEXT);
    Cs.push_back(NO_CONTEXT);
    Cs.insert(Cs.end(), sandboxes.begin(), sandboxes.end());
    return Cs;
}
Exemplo n.º 2
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;
    }
}
Exemplo n.º 3
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;
    }
}