Exemple #1
0
def remake_trace(trace):
    trace = list(enumerate(t for i, t in trace))
    tbs = make_tbs(trace)
    tbdict = make_tbdict(tbs)
    cfg = make_slice_cfg(tbs)
    return trace, tbs, tbdict, cfg
Exemple #2
0
def remake_trace(trace):
    trace = list(enumerate(t for i,t in trace))
    tbs = make_tbs(trace)
    tbdict = make_tbdict(tbs)
    cfg = make_slice_cfg(tbs)
    return trace, tbs, tbdict, cfg
Exemple #3
0
        # the derivation of the address of a buffer.
        if is_memop(insn):
            uses_set -= set(["A0"])

        if defs_set & work:
            work = (work - defs_set) | uses_set
            if debug: print i, repr(insn)

    if debug: print "Working set at end:", work
    return source in work


if __name__ == "__main__":
    trace, inbufs, outbufs = load_trace(file(sys.argv[1]))
    tbs = make_tbs(trace)
    tbdict = make_tbdict(tbs)
    cfg = make_slice_cfg(tbs)

    alloc_ctr = counter()
    alloc_calls = defaultdict(list)
    alloc_rets = []
    for m, argbytes, name in mallocs:
        for idx in range(len(
                tbdict[m])):  # This allows us to change the tbdict during
            tb = tbdict[m][idx]  # iteration without getting stale data.

            i = tbs.index(tb)
            callsite = tbs[i - 1]

            # Find the return address and get its TB object
            # Note: this might fail if we have nested calls, but worry
Exemple #4
0
        # For this one special case we DON'T want to track
        # the derivation of the address of a buffer.
        if is_memop(insn):
            uses_set -= set(["A0"])

        if defs_set & work:
            work = (work - defs_set) | uses_set
            if debug: print i,repr(insn)

    if debug: print "Working set at end:", work
    return source in work

if __name__ == "__main__":
    trace, inbufs, outbufs = load_trace(file(sys.argv[1]))
    tbs = make_tbs(trace)
    tbdict = make_tbdict(tbs)
    cfg = make_slice_cfg(tbs)
    
    alloc_ctr = counter()
    alloc_calls = defaultdict(list)
    alloc_rets = []
    for m,argbytes,name in mallocs:
        for idx in range(len(tbdict[m])):  # This allows us to change the tbdict during
            tb = tbdict[m][idx]       # iteration without getting stale data.

            i = tbs.index(tb)
            callsite = tbs[i-1]
            
            # Find the return address and get its TB object
            # Note: this might fail if we have nested calls, but worry
            # about that later. The "right" solution is a shadow stack