Skip to content

Commit 32431fb

Browse files
authored
Merge pull request #6346 from trailofbits/carson/debugging
Major Refactor for PolyTracker v3.0.0
2 parents 8cdbf43 + 400b052 commit 32431fb

File tree

2,927 files changed

+10721
-863248
lines changed

Some content is hidden

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

2,927 files changed

+10721
-863248
lines changed

.github/workflows/dockerimage.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Docker Images
1+
name: Tests
22

33
on: push
44

@@ -14,33 +14,33 @@ jobs:
1414
uses: actions/setup-python@v1
1515
with:
1616
python-version: ${{ matrix.python-version }}
17-
- name: Install clang-format-10
17+
- name: Install clang-format
1818
run: |
19-
sudo apt install -y software-properties-common gnupg wget
20-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
21-
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
2219
sudo apt-get update -y
23-
sudo apt-get install -y clang-format-10 libgraphviz-dev
24-
- name: Install black and pytest
20+
sudo apt-get install -y clang-format libgraphviz-dev
21+
- name: Install dependencies
2522
run: |
2623
python -m pip install --upgrade pip
2724
python -m pip install setuptools
28-
python -m pip install mypy
29-
python -m pip install black
30-
- name: Update git submodules
25+
pip install .[dev]
26+
- name: Update git submodules
3127
run: git submodule update --init --recursive
3228
- name: C++ lint
3329
run: |
3430
python third_party/run-clang-format/run-clang-format.py \
35-
polytracker/include/dfsan/*.h polytracker/src/*/*.cpp \
36-
--exclude 'polytracker/src/dfsan_rt/sanitizer_common/*' \
37-
--exclude 'polytracker/src/dfsan_rt/interception/*'
31+
polytracker/include/polytracker/*.h polytracker/src/passes/*.cpp polytracker/src/polytracker/*.cpp \
32+
polytracker/src/taint_sources/*.cpp
3833
- name: Python lint/typecheck
3934
run: |
40-
black --check polytracker tests --exclude '/(polytracker/src|polytracker/scripts)/' --line-length=127
35+
# stop the build if there are Python syntax errors or undefined names
36+
flake8 polytracker tests --count --select=E9,F63,F7,F82 --show-source --statistics
37+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38+
flake8 polytracker tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
# Don't enforce black for now because a bug was causing it to not reach a fixed point when reformatting
40+
# black --check polytracker tests --exclude '/(polytracker/src|polytracker/scripts)/'
4141
mypy --python-version ${{ matrix.python-version }} --ignore-missing-imports polytracker tests
4242
- name: Build the base image
4343
run: docker build . --file Dockerfile --tag trailofbits/polytracker --no-cache
44-
- name: Poly* tests
44+
- name: PolyTracker tests
4545
run: |
46-
docker run --rm trailofbits/polytracker pytest --json=tests/test_data/polytracker_process_set.json --forest=tests/test_data/polytracker_forest.bin
46+
pytest

.github/workflows/pull_req.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,11 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v2
8-
- name: Install dependencies
9-
run: sudo apt update -y && sudo apt install clang-7 llvm-7
10-
- name: Build native
11-
run: mkdir build && cd build && cmake .. && make -j$(nproc)
12-
env:
13-
CC: clang
14-
CXX: clang++
158
- name: Build the base image
169
run: docker build . --file Dockerfile --tag trailofbits/polytracker --no-cache
1710
- name: Build the mupdf demo Docker image
18-
run: docker build . --file examples/Dockerfile-mupdf.demo --tag trailofbits/polytracker-demo-mupdf
11+
run: docker build examples --file examples/Dockerfile-mupdf.demo --tag trailofbits/polytracker-demo-mupdf
1912
- name: Build the poppler demo Docker image
20-
run: docker build . --file examples/Dockerfile-poppler.demo --tag trailofbits/polytracker-demo-poppler
13+
run: docker build examples --file examples/Dockerfile-poppler.demo --tag trailofbits/polytracker-demo-poppler
2114
- name: Build the qpdf demo Docker image
22-
run: docker build . --file examples/Dockerfile-qpdf.demo --tag trailofbits/polytracker-demo-qpdf
23-
15+
run: docker build examples --file examples/Dockerfile-qpdf.demo --tag trailofbits/polytracker-demo-qpdf

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ project(TAPP)
77
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
88
set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "default install path" FORCE)
99
endif()
10+
if (NOT DEFINED CXX_LIB_PATH)
11+
message(FATAL_ERROR "Can't find Polytrackers libcxx, please set -DCXX_LIB_PATH")
12+
endif()
13+
14+
set(POLYTRACK_CXX_INCLUDE "${CXX_LIB_PATH}/poly_build/include/c++/v1")
15+
set(POLYTRACK_CXX_LIB "${CXX_LIB_PATH}/poly_build/lib")
1016

1117
set(POLYTRACK_BIN_DIR "${CMAKE_INSTALL_PREFIX}/share/polytracker/bin")
1218
set(POLYTRACK_LIB_DIR "${CMAKE_INSTALL_PREFIX}/share/polytracker/lib")

Dockerfile

Lines changed: 22 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,34 @@
1-
FROM ubuntu:bionic
2-
MAINTAINER Evan Sultanik <[email protected]>
3-
4-
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update \
5-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
6-
wget \
7-
gnupg
1+
FROM trailofbits/polytracker-llvm:b75b84ed4ce03bc4250c32063d08a1cbd8a05e02
82

9-
# Add the LLVM repo for Ubuntu packages, since the official Ubuntu repo has an
10-
# LLVM that doesn't work right with polytracker for some reason.
11-
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
12-
&& echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" >>/etc/apt/sources.list
3+
MAINTAINER Evan Sultanik <[email protected]>
4+
MAINTAINER Carson Harmon <[email protected]>
135

146
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update \
157
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
16-
clang-7 \
17-
cmake \
18-
git \
19-
lld-7 \
20-
llvm-7 \
21-
libc++abi-dev \
228
ninja-build \
23-
python3-pip \
24-
python3.7-dev \
25-
golang \
26-
libgraphviz-dev \
27-
graphviz
28-
29-
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 10
30-
RUN python3 -m pip install pip
31-
32-
RUN go get github.com/SRI-CSL/gllvm/cmd/...
33-
34-
ENV PATH="$PATH:/root/go/bin"
35-
36-
RUN python3.7 -m pip install pytest
9+
python3-pip \
10+
python3.8-dev \
11+
libgraphviz-dev \
12+
graphviz \
13+
libsqlite3-dev \
14+
vim \
15+
gdb \
16+
sqlite3
17+
18+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 10
19+
RUN python3 -m pip install pip && python3 -m pip install pytest
3720

3821
COPY . /polytracker
39-
4022
WORKDIR /polytracker
41-
42-
RUN pip3 install pytest .
43-
44-
RUN rm -rf build && mkdir -p build
45-
23+
RUN pip3 install .
24+
RUN mkdir /polytracker/build
4625
WORKDIR /polytracker/build
26+
RUN cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_VERBOSE_MAKEFILE=TRUE -DCXX_LIB_PATH=/cxx_libs ..
27+
RUN ninja install
4728

48-
ENV PATH="/usr/lib/llvm-7/bin:${PATH}"
49-
50-
RUN cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_VERBOSE_MAKEFILE=TRUE .. && ninja install
51-
ENV PATH="/polytracker/build/bin/:${PATH}"
52-
ENV CC=polybuild
53-
ENV CXX=polybuild++
54-
ENV LLVM_COMPILER=clang
55-
RUN mkdir -p "/build_artifacts"
56-
57-
# Set the BC store path to the <install_path>/cxx_libs/bitcode/bitcode_store}
58-
ENV WLLVM_BC_STORE="/polytracker/build/share/polytracker/cxx_libs/bitcode/bitcode_store"
59-
ENV WLLVM_ARTIFACT_STORE="/build_artifacts"
6029

30+
# Setting up build enviornment for targets
6131
ENV POLYTRACKER_CAN_RUN_NATIVELY=1
62-
63-
WORKDIR /polytracker
32+
ENV CC=/polytracker/build/bin/polybuild_script
33+
ENV CXX=/polytracker/build/bin/polybuild_script++
34+
ENV PATH=/polytracker/build/bin:$PATH

0 commit comments

Comments
 (0)