Skip to content

Commit

Permalink
Merge pull request #6410 from trailofbits/file-cavities
Browse files Browse the repository at this point in the history
Detect "cavities" in a file
  • Loading branch information
ESultanik authored Nov 9, 2021
2 parents c0ca9b7 + 18ae154 commit b5520ba
Show file tree
Hide file tree
Showing 43 changed files with 574 additions and 34,660 deletions.
2 changes: 1 addition & 1 deletion build_in_docker/Dockerfile-mutool
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:bionic AS sources
FROM ubuntu:focal AS sources

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
4 changes: 4 additions & 0 deletions build_in_docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ bin/mutool_track: $(POLYTRACKER_FILES)
./build.sh
./build_mutool.sh

bin/mutool_track_no_control_flow: $(POLYTRACKER_FILES)
./build.sh
./build_mutool.sh mutool_track_no_control_flow --no-control-flow-tracking

.PHONY: run_remote_debug_container
run_remote_debug_container: bin/mutool_track
echo "Running the remote dev Docker container; ^C this process to end it."
Expand Down
6 changes: 4 additions & 2 deletions build_in_docker/build_mutool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ else
DOCKER_FLAGS=""
fi

OUTPUT_FILE="${1:mutool_track}"

docker run ${DOCKER_FLAGS} --rm --mount type=bind,source="${SCRIPTPATH}/..",target=/polytracker \
--mount type=bind,source="${SCRIPTPATH}/bin",target=/sources/bin \
--mount type=bind,source="${SCRIPTPATH}/scripts",target=/sources/mupdf/mupdf_scripts \
trailofbits/polytrackerbuilder-mupdf /sources/mupdf/mupdf_scripts/compile_mupdf.sh
echo "Built ${SCRIPTPATH}/bin/mutool_track"
trailofbits/polytrackerbuilder-mupdf /sources/mupdf/mupdf_scripts/compile_mupdf.sh "${OUTPUT_FILE}" "${@:2}"
echo "Built ${SCRIPTPATH}/bin/${OUTPUT_FILE}"
14 changes: 11 additions & 3 deletions build_in_docker/run_mutool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ set -e

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

make -C "${SCRIPTPATH}" bin/mutool_track

if [ -t 1 ] ; then
DOCKER_FLAGS="-ti"
else
DOCKER_FLAGS=""
fi

if [ "$1" = "--no-control-flow-tracking" ]; then
ARGS=${*:2}
BINARY="mutool_track_no_control_flow"
else
ARGS=$*
BINARY="mutool_track"
fi

make -C "${SCRIPTPATH}" "bin/${BINARY}"

docker run ${DOCKER_FLAGS} --rm --mount type=bind,source="${SCRIPTPATH}/..",target=/polytracker \
--mount type=bind,source="${SCRIPTPATH}/bin",target=/sources/bin \
--mount type=bind,source="${SCRIPTPATH}/scripts",target=/sources/mupdf/mupdf_scripts \
--mount type=bind,source="$(pwd)",target=/workdir \
trailofbits/polytrackerbuilder-mupdf /sources/bin/mutool_track $*
trailofbits/polytrackerbuilder-mupdf "/sources/bin/${BINARY}" $ARGS
6 changes: 4 additions & 2 deletions build_in_docker/scripts/compile_mupdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
set -e
mkdir -p /sources/bin
cd /sources/mupdf/build/debug
${CC} --lower-bitcode -i mutool.bc -o mutool_track --libs libmupdf.a m pthread
cp mutool_track* /sources/bin/
${CC} --lower-bitcode -i mutool.bc -o mutool_track "${@:2}" --libs libmupdf.a m pthread
cp "mutool_track" "/sources/bin/$1"
cp "mutool_track.bc" "/sources/bin/$1.bc"
cp "mutool_track.o" "/sources/bin/$1.o"
4 changes: 3 additions & 1 deletion polytracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ set(POLYTRACK_TESTS_DIR "${CMAKE_INSTALL_PREFIX}/share/polytracker/tests")
set(POLYTRACK_PASS_DIR "${CMAKE_INSTALL_PREFIX}/share/polytracker/pass")

add_subdirectory(src)
install(DIRECTORY "./abi_lists" DESTINATION ${POLYTRACK_CXX_DIR})
install(DIRECTORY "./custom_abi/" DESTINATION ${POLYTRACK_RULE_DIR}
FILES_MATCHING PATTERN "*"
PATTERN "CMakeLists.txt" EXCLUDE PATTERN "Makefile" EXCLUDE PATTERN "*.cmake" EXCLUDE)
add_subdirectory(custom_abi)

install(PROGRAMS "scripts/polybuild.py" DESTINATION ${POLYTRACK_BIN_DIR})
Expand Down
418 changes: 0 additions & 418 deletions polytracker/abi_lists/ignore_lists/abi_ignore_list.txt

This file was deleted.

2,776 changes: 0 additions & 2,776 deletions polytracker/abi_lists/ignore_lists/helpme.txt

This file was deleted.

Loading

0 comments on commit b5520ba

Please sign in to comment.