Skip to content

Commit

Permalink
Merge pull request #17 from defuse/taylor-patches
Browse files Browse the repository at this point in the history
Changes I needed to get Siderophile working
  • Loading branch information
disconnect3d authored Jan 3, 2020
2 parents 9d8e0a1 + f0693a0 commit 81e3461
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion analyze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ echo "trawling source code of dependencies for unsafety"

echo "generating LLVM bitcode for the callgraph"
cargo clean
RUSTFLAGS="-C lto=no -C opt-level=0 -C debuginfo=2 -C inline-threshold=9999 --emit=llvm-bc" \
RUSTFLAGS="-C lto=no -C opt-level=0 -C debuginfo=2 --emit=llvm-bc" \
CARGO_INCREMENTAL="0" \
cargo rustc --lib -- --emit=llvm-bc

Expand Down
2 changes: 1 addition & 1 deletion script/find_unsafe_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def main():
main()
except IndexError:
print("USAGE:")
print(f"{sys.argv[0]} [GRAPH_FILE] [SIDEROPHILE_OUTPUT]")
print("{} [GRAPH_FILE] [SIDEROPHILE_OUTPUT]".format(sys.argv[0]))
8 changes: 4 additions & 4 deletions script/trace_unsafety.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def taint_node(graph, node, name):
# Propagates a taint through a graph breadth-first
def propagate_taint(graph, start_node):
start_label = graph.nodes[start_node].get("label")
log.info(f"taint starting at {start_label}")
log.info("taint starting at {}".format(start_label))

# We mark all the nodes touched in this function call and then increment all their badnesses by
# 1 at the very end. This way we don't double-count nodes in cycles. This function is never
Expand Down Expand Up @@ -115,7 +115,7 @@ def main():
taint_file.read().splitlines(),
))

log.debug(f"node_labels_to_taint == {node_labels_to_taint}")
log.debug("node_labels_to_taint == {}".format(node_labels_to_taint))

node_ids_to_taint = set()
for n in iter(graph):
Expand All @@ -126,7 +126,7 @@ def main():
label = graph.nodes[n]["label"]
# See if this is a node we should taint
if label in node_labels_to_taint:
log.debug(f"found a node we want to taint: {n}")
log.debug("found a node we want to taint: {}".format(n))
node_ids_to_taint.add(n)

for n in node_ids_to_taint:
Expand Down Expand Up @@ -156,4 +156,4 @@ def main():
main()
except IndexError:
print("USAGE:")
print(f"{sys.argv[0]} [GRAPH_FILE] [TAINT_FILE] [FILTER_PREFIX]")
print("{} [GRAPH_FILE] [TAINT_FILE] [FILTER_PREFIX]".format(sys.argv[0]))
6 changes: 5 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ fi
echo "building siderophile"
cargo build --release

if !(hash rustfilt) 2>/dev/null; then
# Where to look for `rustfilt`. If CARGO_HOME is set, use $CARGO_HOME/bin.
# Otherwise, use ~/.cargo/bin
CARGO_BIN=${CARGO_HOME:-~/.cargo}/bin

if !(PATH="$PATH:$CARGO_BIN" hash rustfilt) 2>/dev/null; then
echo "didn't find rustfilt, installing it now"
cargo install rustfilt
fi
Expand Down

0 comments on commit 81e3461

Please sign in to comment.