Skip to content

Commit 1128eb6

Browse files
committed
trunk fmt'd
1 parent 50cfd0e commit 1128eb6

File tree

1 file changed

+45
-38
lines changed

1 file changed

+45
-38
lines changed

examples/analysis/timings.md

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# What did this change break?
2+
23
Hopefully nothing? :D
34

45
# What is this change doing?
6+
57
My goal is for taint tracking to work exactly as before, but to clean up the ftrace/cflog/events side of the house, unifying `--cflog` and `--ftrace` options (cleaning up / simplifying how we are writing to the Functions, Events, Control Flow Log, and String Table sections overall) so we don't add duplicate instrumentation to software or write duplicate data to the TDAG and/or separate files (i.e., functionid.json) anymore.
68

79
Everything that I could build got run on example inputs to make sure it worked as expected. As a part of these changes we don't write to functionid.json anymore and just use the space we were allocating and not filling in in the tdag, since it's a humongous region we don't use all of anyway. TDAG size is fixed, but our usage of it is slightly more efficient currently. A future goal could be to only mmap the space we need so file size can be smaller.
810

911
# Instrumentation Time and Resulting Bitcode Sizes
12+
1013
These experiments reproduce the measurements from the
1114
[PolyTracker paper](https://github.com/trailofbits/publications/blob/master/papers/issta24-polytracker.pdf),
1215
but on different hardware. For uniformity, experiments were all conducted in an Ubuntu 24.04 cloud VM with
@@ -20,57 +23,61 @@ I'm comparing the before-and-after of the TDAG condensation changes on `kaoudis/
2023
All the current example Dockerfiles on `master` that work right now (we/I need to clean up the others a bit; they're a bit bitrotted) are included here for completeness. The following measurements aren't terribly scientific, they are from one run of the Dockerfile each (whereas for the paper I averaged ten runs apiece).
2124

2225
## Bitcode sizes
26+
2327
The "in" .bc file is the whole-program .bc file that gets the first layer of instrumentation applied to it. The CFlog .bc is the "in" .bc with CFlog instrumentation, pre-optimization (if optimization occurs in the PolyTracker build). the final .bc file is the instrumented .bc file ending in `.instrumented.bc` that we lower to an executable. bc size may have changed because what instrumentation we use changed: I removed the separate function name recording / events pass-level code, and added function name recording to the tdag into the cflog pass. I also removed the separate `--ftrace` and `--taint` options: we do `--taint` by default, and `--ftrace` is part of `--cflog` now.
2428

2529
Also note that some dockerfiles did not compile on the `master` branch prior to these changes with the `--cflog` option and I'm not sure why, but because of this I did not record cflog-inclusive bc size for them on `master`.
2630

2731
As measured by `ls -lb` in the container, and normalized into MiB:
2832

29-
| Dockerfile | In .bc size | Final .bc BEFORE (taint, ftrace, events) | Final .bc BEFORE (cflog, taint, ftrace, events) | CFlog-_only_ .bc |Final .bc AFTER (cflog, taint) | Final .bc AFTER (taint only) |
30-
| -- | -- | -- | -- | -- | -- | -- |
31-
| Dockerfile-acropalypse.demo | 1.65 MiB | 1.89 MiB | | 1.89 MiB | 4.4 MiB | 3.94 MiB |
32-
| Dockerfile-daedalus-pdf.demo | 4.15 MiB | 4.76 MiB | 17.83 MiB | 4.95 MiB | 17.62 MiB | 16.39 MiB |
33-
| Dockerfile-ffmpeg.demo | 30.52 MiB | 33.80 MiB | | 33.64 MiB | 84.3 MiB | 84.72 MiB |
34-
| Dockerfile-file.demo | 0.85 MiB | 0.95 MiB | | 0.96 MiB | 1.98 MiB | 1.99 MiB |
35-
| Dockerfile-libjpeg.demo | 1.25 MiB | 1.36 MiB | | 1.36 MiB | 3.33 MiB | 3.62 MiB |
36-
| Dockerfile-mupdf.demo | 14.56 MiB | 18.19 MiB | | 18.19 MiB | 66 MiB | 82.72 MiB |
37-
| Dockerfile-nitro-nitf.demo | 5.79 MiB | 8.23 MiB | 20.64 MiB | 6.57 MiB | 20.62 MiB | 18 MiB |
38-
| Dockerfile-openjpeg.demo | 0.89 MiB | 1.15 MiB | | 1.13 MiB | 4.29 MiB | 3.71 MiB |
39-
| Dockerfile-poppler.demo `pdftops` | 8.82 MiB | 10.25 MiB | 35.58 MiB | 10.17 MiB | 35.77 MiB | 35.99 MiB |
40-
| Dockerfile-poppler.demo `pdftotext` | 8.04 MiB | 9.29 MiB | 31.82 MiB | 9.26 MiB | 32.01 MiB | 32.09 MiB |
41-
| Dockerfile-qpdf.demo | 10.92 MiB | 13.14 MiB | | 13.14 MiB | 49.21 MiB | 47.65 MiB |
42-
| Dockerfile-xpdf.demo `pdfinfo` | 3.78 MiB | 4.56 MiB | 17.14 MiB | 4.37 MiB | 16.88 MiB | 17.80 MiB |
43-
| Dockerfile-xpdf.demo `pdftops` | 4.75 MiB | 5.78 MiB | 22.52 MiB | 5.55 MiB | 22.25 MiB | 23.85 MiB |
44-
| Dockerfile-xpdf.demo `pdftotext` | 3.98 MiB | 4.85 MiB | 18.67 MiB | 4.64 MiB | 18.41 MiB | 19.37 MiB |
33+
| Dockerfile | In .bc size | Final .bc BEFORE (taint, ftrace, events) | Final .bc BEFORE (cflog, taint, ftrace, events) | CFlog-_only_ .bc | Final .bc AFTER (cflog, taint) | Final .bc AFTER (taint only) |
34+
| ----------------------------------- | ----------- | ---------------------------------------- | ----------------------------------------------- | ---------------- | ------------------------------ | ---------------------------- |
35+
| Dockerfile-acropalypse.demo | 1.65 MiB | 1.89 MiB | | 1.89 MiB | 4.4 MiB | 3.94 MiB |
36+
| Dockerfile-daedalus-pdf.demo | 4.15 MiB | 4.76 MiB | 17.83 MiB | 4.95 MiB | 17.62 MiB | 16.39 MiB |
37+
| Dockerfile-ffmpeg.demo | 30.52 MiB | 33.80 MiB | | 33.64 MiB | 84.3 MiB | 84.72 MiB |
38+
| Dockerfile-file.demo | 0.85 MiB | 0.95 MiB | | 0.96 MiB | 1.98 MiB | 1.99 MiB |
39+
| Dockerfile-libjpeg.demo | 1.25 MiB | 1.36 MiB | | 1.36 MiB | 3.33 MiB | 3.62 MiB |
40+
| Dockerfile-mupdf.demo | 14.56 MiB | 18.19 MiB | | 18.19 MiB | 66 MiB | 82.72 MiB |
41+
| Dockerfile-nitro-nitf.demo | 5.79 MiB | 8.23 MiB | 20.64 MiB | 6.57 MiB | 20.62 MiB | 18 MiB |
42+
| Dockerfile-openjpeg.demo | 0.89 MiB | 1.15 MiB | | 1.13 MiB | 4.29 MiB | 3.71 MiB |
43+
| Dockerfile-poppler.demo `pdftops` | 8.82 MiB | 10.25 MiB | 35.58 MiB | 10.17 MiB | 35.77 MiB | 35.99 MiB |
44+
| Dockerfile-poppler.demo `pdftotext` | 8.04 MiB | 9.29 MiB | 31.82 MiB | 9.26 MiB | 32.01 MiB | 32.09 MiB |
45+
| Dockerfile-qpdf.demo | 10.92 MiB | 13.14 MiB | | 13.14 MiB | 49.21 MiB | 47.65 MiB |
46+
| Dockerfile-xpdf.demo `pdfinfo` | 3.78 MiB | 4.56 MiB | 17.14 MiB | 4.37 MiB | 16.88 MiB | 17.80 MiB |
47+
| Dockerfile-xpdf.demo `pdftops` | 4.75 MiB | 5.78 MiB | 22.52 MiB | 5.55 MiB | 22.25 MiB | 23.85 MiB |
48+
| Dockerfile-xpdf.demo `pdftotext` | 3.98 MiB | 4.85 MiB | 18.67 MiB | 4.64 MiB | 18.41 MiB | 19.37 MiB |
4549

4650
## TDAG sizes
51+
4752
TDAG size is fixed because of how we write TDAGs right now; it didn't change.
4853

4954
## Total instrumentation time
50-
"Instrumentation time" here refers either to the time Docker takes to run `polytracker instrument-targets`, which includes how long it takes to do both cflog and taint label instrumentation placement as well as executable creation, or the time to do equivalent steps.
51-
52-
Also note that some dockerfiles did not compile on the `master` branch prior to these changes with the `--cflog` option and I'm not sure why, but because of this I did not record cflog-inclusive instrumentation time for them on `master`.
53-
54-
As measured by Docker:
55-
56-
| Dockerfile | Instrumentation time (taint, ftrace, events) BEFORE | Instrumentation time (cflog, taint, ftrace, events) BEFORE | Instrumentation time (cflog, taint) AFTER | Instrumentation time (taint only) AFTER |
57-
| -- | -- | -- | -- | -- |
58-
| Dockerfile-acropalypse.demo | 26.7\* s | | 30.3\* s | 27.3\* s |
59-
| Dockerfile-daedalus-pdf.demo | 34.2 s | 39.1 s | 37.5 s | 35.2 s |
60-
| Dockerfile-ffmpeg.demo | 150.7 s | | 156.5 s | 158.3 s |
61-
| Dockerfile-file.demo | 12.1 s | | 12.4 s | 12.6 s |
62-
| Dockerfile-libjpeg.demo | 22.7 s | | 21.2 s | 23.6 s |
63-
| Dockerfile-mupdf.demo | 152.4 s | | 129.2 s | 154.8 s |
64-
| Dockerfile-nitro-nitf.demo | 30 s | 33.7 s | 33.8 s | 29.5 s |
65-
| Dockerfile-openjpeg.demo | 45.3\* s | | 51.3\* s | 49.6\* s |
66-
| Dockerfile-poppler.demo `pdftops` | 291.2 s | 279.1 s | 290 s | 305.9 s |
67-
| Dockerfile-poppler.demo `pdftotext` | 255.5 s | 249 s | 255.3 s | 268.5 s |
68-
| Dockerfile-qpdf.demo | 382.9 s | | 393.8 s | 391.9 s |
69-
| Dockerfile-xpdf.demo `pdfinfo` | 154.5 s | 141.9 s | 143.3 s | 164.2 s |
70-
| Dockerfile-xpdf.demo `pdftops` | 206.9 s | 189.9 s | 187.2 s | 217.2 s |
71-
| Dockerfile-xpdf.demo `pdftotext` | 169.1 s | 157.1 s | 154.4 s | 184.3 s |
55+
56+
"Instrumentation time" here refers either to the time Docker takes to run `polytracker instrument-targets`, which includes how long it takes to do both cflog and taint label instrumentation placement as well as executable creation, or the time to do equivalent steps.
57+
58+
Also note that some dockerfiles did not compile on the `master` branch prior to these changes with the `--cflog` option and I'm not sure why, but because of this I did not record cflog-inclusive instrumentation time for them on `master`.
59+
60+
As measured by Docker:
61+
62+
| Dockerfile | Instrumentation time (taint, ftrace, events) BEFORE | Instrumentation time (cflog, taint, ftrace, events) BEFORE | Instrumentation time (cflog, taint) AFTER | Instrumentation time (taint only) AFTER |
63+
| ----------------------------------- | --------------------------------------------------- | ---------------------------------------------------------- | ----------------------------------------- | --------------------------------------- |
64+
| Dockerfile-acropalypse.demo | 26.7\* s | | 30.3\* s | 27.3\* s |
65+
| Dockerfile-daedalus-pdf.demo | 34.2 s | 39.1 s | 37.5 s | 35.2 s |
66+
| Dockerfile-ffmpeg.demo | 150.7 s | | 156.5 s | 158.3 s |
67+
| Dockerfile-file.demo | 12.1 s | | 12.4 s | 12.6 s |
68+
| Dockerfile-libjpeg.demo | 22.7 s | | 21.2 s | 23.6 s |
69+
| Dockerfile-mupdf.demo | 152.4 s | | 129.2 s | 154.8 s |
70+
| Dockerfile-nitro-nitf.demo | 30 s | 33.7 s | 33.8 s | 29.5 s |
71+
| Dockerfile-openjpeg.demo | 45.3\* s | | 51.3\* s | 49.6\* s |
72+
| Dockerfile-poppler.demo `pdftops` | 291.2 s | 279.1 s | 290 s | 305.9 s |
73+
| Dockerfile-poppler.demo `pdftotext` | 255.5 s | 249 s | 255.3 s | 268.5 s |
74+
| Dockerfile-qpdf.demo | 382.9 s | | 393.8 s | 391.9 s |
75+
| Dockerfile-xpdf.demo `pdfinfo` | 154.5 s | 141.9 s | 143.3 s | 164.2 s |
76+
| Dockerfile-xpdf.demo `pdftops` | 206.9 s | 189.9 s | 187.2 s | 217.2 s |
77+
| Dockerfile-xpdf.demo `pdftotext` | 169.1 s | 157.1 s | 154.4 s | 184.3 s |
7278

7379
# What's weird here
80+
7481
The sizes of bitcode when instrumented with all our passes before AND after these changes seem like they could be indicative of extra instrumentation (perhaps the labels pass instrumenting the cflog and/or functions pass?), though I haven't dug into whether this is truly happening yet. It doesn't _seem like_ this is exactly hurting anything at the moment, but I would be curious if others notice the same.
7582

7683
## Notes

0 commit comments

Comments
 (0)