From 5468f737e1eb021f8a69fe3ba559c43aa22d1455 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Tue, 19 Nov 2024 11:41:45 +0900 Subject: Polish a tad --- fix.m4 | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'fix.m4') diff --git a/fix.m4 b/fix.m4 index cbf3725..4647d00 100644 --- a/fix.m4 +++ b/fix.m4 @@ -1,6 +1,6 @@ #!/bin/sh # Patcher -# Copyright (C) 2024 Nguy?n Gia Phong +# Copyright (C) 2024 Nguyễn Gia Phong # # This file is part of taosc. # @@ -17,30 +17,32 @@ # You should have received a copy of the GNU Affero General Public License # along with taosc. If not, see . -set -e +set -ex if test $# -ne 3 then - echo Usage: taosc-fix binary instruction-address working-directory + echo Usage: taosc-fix binary address workdir exit 1 fi binary="$(realpath $1)" address="$2" wd="$(realpath $3)" +bin="$wd/$(basename $binary)" +afl-dyninst -x "$binary" "$bin.fuzzee" pushd DATA_DIR > /dev/null trap 'popd > /dev/null' EXIT -collect="$wd/$(basename $binary).collect" -e9tool -M addr=$address -P 'log(state)@collect' -o "$collect.orig" "$binary" -afl-dyninst -i "$collect.orig" -o "$collect" -patched="$wd/$(basename $binary).patched" -e9tool -M addr=$address -P 'if dest(state)@patch goto' -o "$patched" "$binary" +e9tool -M addr=$address -P 'log(state)@collect'\ + -o "$bin.collect" "$binary" +e9tool -M addr=$address -P 'if dest(state)@patch goto'\ + -o "$bin.patched" "$binary" +# TODO: augment number of executions +afl-dyninst-env afl-fuzz -i "$wd/fuzz/exploits" -o "$wd/fuzz/crashes"\ + -CE 10000 -- "$bin.fuzzee" -d @@ +find "$wd/fuzz/crashes/default/crashes" -name id:* | + parallel TAOSC_OUTPUT="$wd/vars/neg/"'$(basename {})' "$bin.collect" -d {} +time taosc-synth "$wd/vars" > "$wd/predicates" taosc-scout "$binary" "$address" > "$wd/destinations" -#for dest in $(taosc-slice "$binary" "$address") -#do -# for dest in $(taosc-slice "$binary" "$address") -# do -# TAOSC_PREDICATE="