Skip to content

Commit b5520ba

Browse files
authored
Merge pull request #6410 from trailofbits/file-cavities
Detect "cavities" in a file
2 parents c0ca9b7 + 18ae154 commit b5520ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+574
-34660
lines changed

build_in_docker/Dockerfile-mutool

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:bionic AS sources
1+
FROM ubuntu:focal AS sources
22

33
ENV DEBIAN_FRONTEND=noninteractive
44

build_in_docker/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ bin/mutool_track: $(POLYTRACKER_FILES)
1616
./build.sh
1717
./build_mutool.sh
1818

19+
bin/mutool_track_no_control_flow: $(POLYTRACKER_FILES)
20+
./build.sh
21+
./build_mutool.sh mutool_track_no_control_flow --no-control-flow-tracking
22+
1923
.PHONY: run_remote_debug_container
2024
run_remote_debug_container: bin/mutool_track
2125
echo "Running the remote dev Docker container; ^C this process to end it."

build_in_docker/build_mutool.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ else
1818
DOCKER_FLAGS=""
1919
fi
2020

21+
OUTPUT_FILE="${1:mutool_track}"
22+
2123
docker run ${DOCKER_FLAGS} --rm --mount type=bind,source="${SCRIPTPATH}/..",target=/polytracker \
2224
--mount type=bind,source="${SCRIPTPATH}/bin",target=/sources/bin \
2325
--mount type=bind,source="${SCRIPTPATH}/scripts",target=/sources/mupdf/mupdf_scripts \
24-
trailofbits/polytrackerbuilder-mupdf /sources/mupdf/mupdf_scripts/compile_mupdf.sh
25-
echo "Built ${SCRIPTPATH}/bin/mutool_track"
26+
trailofbits/polytrackerbuilder-mupdf /sources/mupdf/mupdf_scripts/compile_mupdf.sh "${OUTPUT_FILE}" "${@:2}"
27+
echo "Built ${SCRIPTPATH}/bin/${OUTPUT_FILE}"

build_in_docker/run_mutool.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@ set -e
44

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

7-
make -C "${SCRIPTPATH}" bin/mutool_track
8-
97
if [ -t 1 ] ; then
108
DOCKER_FLAGS="-ti"
119
else
1210
DOCKER_FLAGS=""
1311
fi
1412

13+
if [ "$1" = "--no-control-flow-tracking" ]; then
14+
ARGS=${*:2}
15+
BINARY="mutool_track_no_control_flow"
16+
else
17+
ARGS=$*
18+
BINARY="mutool_track"
19+
fi
20+
21+
make -C "${SCRIPTPATH}" "bin/${BINARY}"
22+
1523
docker run ${DOCKER_FLAGS} --rm --mount type=bind,source="${SCRIPTPATH}/..",target=/polytracker \
1624
--mount type=bind,source="${SCRIPTPATH}/bin",target=/sources/bin \
1725
--mount type=bind,source="${SCRIPTPATH}/scripts",target=/sources/mupdf/mupdf_scripts \
1826
--mount type=bind,source="$(pwd)",target=/workdir \
19-
trailofbits/polytrackerbuilder-mupdf /sources/bin/mutool_track $*
27+
trailofbits/polytrackerbuilder-mupdf "/sources/bin/${BINARY}" $ARGS

build_in_docker/scripts/compile_mupdf.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
set -e
33
mkdir -p /sources/bin
44
cd /sources/mupdf/build/debug
5-
${CC} --lower-bitcode -i mutool.bc -o mutool_track --libs libmupdf.a m pthread
6-
cp mutool_track* /sources/bin/
5+
${CC} --lower-bitcode -i mutool.bc -o mutool_track "${@:2}" --libs libmupdf.a m pthread
6+
cp "mutool_track" "/sources/bin/$1"
7+
cp "mutool_track.bc" "/sources/bin/$1.bc"
8+
cp "mutool_track.o" "/sources/bin/$1.o"

polytracker/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ set(POLYTRACK_TESTS_DIR "${CMAKE_INSTALL_PREFIX}/share/polytracker/tests")
99
set(POLYTRACK_PASS_DIR "${CMAKE_INSTALL_PREFIX}/share/polytracker/pass")
1010

1111
add_subdirectory(src)
12-
install(DIRECTORY "./abi_lists" DESTINATION ${POLYTRACK_CXX_DIR})
12+
install(DIRECTORY "./custom_abi/" DESTINATION ${POLYTRACK_RULE_DIR}
13+
FILES_MATCHING PATTERN "*"
14+
PATTERN "CMakeLists.txt" EXCLUDE PATTERN "Makefile" EXCLUDE PATTERN "*.cmake" EXCLUDE)
1315
add_subdirectory(custom_abi)
1416

1517
install(PROGRAMS "scripts/polybuild.py" DESTINATION ${POLYTRACK_BIN_DIR})

polytracker/abi_lists/ignore_lists/abi_ignore_list.txt

Lines changed: 0 additions & 418 deletions
This file was deleted.

polytracker/abi_lists/ignore_lists/helpme.txt

Lines changed: 0 additions & 2776 deletions
This file was deleted.

0 commit comments

Comments
 (0)