Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install/setup for hacking process cleanup #6578

Merged
merged 6 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions: read-all

jobs:
lint:
uses: trailofbits/.github/.github/workflows/lint.yml@v0.1.3
uses: trailofbits/.github/.github/workflows/lint.yml@main
permissions:
contents: read
pull-requests: read
Expand Down
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ Docker image:
pip3 install -e ".[dev]" && polytracker docker rebuild
```

or pull the latest prebuilt version from DockerHub:
or just pull the latest prebuilt version from DockerHub:

```shell-script
docker pull trailofbits/polytracker:latest
Expand Down Expand Up @@ -287,34 +287,41 @@ cd /polytracker/the_klondike/poppler-0.84.0/build/utils
./pdfinfo_track some_pdf.pdf
```

## Building PolyTracker from Source
## Hacking on PolyTracker Using the Docker Environment

The compilation process for both PolyTracker LLVM and PolyTracker is rather
fickle, since it involves juggling both instrumented and non-instrumented
versions of standard library bitcode. We highly recommend using our pre-built
and tested Docker container if at all possible. Installing the PolyTracker
Python package on your host system will allow you to seamlessly interact with
the prebuilt Docker container. Otherwise, to install PolyTracker natively, we
recommend replicating the install process from the
[PolyTracker Dockerfile](Dockerfile).
Suppose you want to get a little more in-depth in extending the PolyTracker
codebase or in analysing TDAG traces, and you don't want to mess with your
local environment by installing an LLVM version that is heavily customized.

If you're working in Ubuntu and starting from a relatively clean 22.04 or 24.04
base, the [linked Gist](https://gist.github.com/kaoudis/cf412abafea5ca4054c852f9e5905aab)
details steps to get a working passthrough version of the PolyTracker base container.
The base container provides a development environment with all dependencies
that you can directly work in, or can extend (as we've done in the example
Dockerfiles).

## Running Tests
Running both the Python and C++ unit tests should be done inside the PolyTracker

Running both the Python and C++ unit tests should be done inside the PolyTracker
Docker container.

The Catch2 unit tests in `unittests/` live in
`/polytracker-build/unittests/src/taintdag/` within the container. Run the test binary
The Catch2 unit tests in `unittests/` live in
`/polytracker-build/unittests/src/taintdag/` within the container. Run the test binary
within the Docker container with

```shell-script
cd /polytracker-build/unittests/src/taintdag/ && ./tests-taintdag
```

The Python unit tests in `tests/` require local test C++ programs that the test
The Python unit tests in `tests/` require local test C++ programs that the test
fixtures will instrument. Run them using Pytest in the working

```shell-script
pytest tests
```

Or use pytest to run a single test file with

```shell-script
pytest tests/test_foo.py
```
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def polytracker_version_string() -> str:
"Pillow>=7.2.0",
"prompt_toolkit~=3.0.8",
"pygments~=2.15.0",
"setuptools>=75.8.0",
"tqdm>=4.59.0", # We need at least this version to get the `delay` option
"typing_extensions>=3.7.4.2",
"types-setuptools~=57.4.9",
Expand Down
Loading