diff options
Diffstat (limited to 'DESIGN')
| -rw-r--r-- | DESIGN | 35 |
1 files changed, 35 insertions, 0 deletions
| @@ -103,6 +103,41 @@ ordinary announce interval is a constant too and an operator has nothing to | |||
| 103 | measure a different value against. Over HTTP a refusal stays a failure | 103 | measure a different value against. Over HTTP a refusal stays a failure |
| 104 | reason, which is the only place a user is told why. | 104 | reason, which is the only place a user is told why. |
| 105 | 105 | ||
| 106 | The state file keeps a wall clock minute, and it is the only thing in the | ||
| 107 | tracker that reads that clock. Everything else runs off a monotonic one, | ||
| 108 | where a time step cannot evict a swarm, but a file outlives the process that | ||
| 109 | wrote it and minutes since this boot mean nothing to the next run. So the | ||
| 110 | dump converts on the way out and load_state converts on the way back in, and | ||
| 111 | what lands on disk is the format opentracker has written for years. A step | ||
| 112 | between writing and reading mis-dates a torrent by the size of the step, | ||
| 113 | which costs it part of its last day and nothing else. | ||
| 114 | |||
| 115 | Build hardening the shipped binary | ||
| 116 | ---------------------------------- | ||
| 117 | |||
| 118 | The production and debug binaries carry -fstack-protector-strong, -fPIE and | ||
| 119 | _FORTIFY_SOURCE=2 on every platform; the GNU-style linkers also get -pie and | ||
| 120 | full RELRO (-z relro,-z now). Measured cost on | ||
| 121 | the announce hot path is 300 to 305 nanoseconds, under two per cent, and the | ||
| 122 | individual flags sit inside the run-to-run noise: add_peer has few stack | ||
| 123 | buffers, most buffer sizes are known at compile time so FORTIFY emits no | ||
| 124 | runtime check, and PIE on arm64 is almost free. On x86-64 PIE costs a little | ||
| 125 | more. End to end it is invisible, since a UDP announce is mostly kernel time. | ||
| 126 | |||
| 127 | The link flags -pie and RELRO are gated on the operating system: Apple's | ||
| 128 | linker rejects -z, and flags a bare -pie in the combined compile-and-link as | ||
| 129 | unused, while macOS links executables PIE by default, so leaving both off | ||
| 130 | there costs no hardening. The branch runs in the shell through a != assignment, | ||
| 131 | the one form both bmake and GNU make 4 accept; $(shell) is GNU only and GNU | ||
| 132 | make 3.81, which stock macOS ships, has neither. On that old make the != line | ||
| 133 | is inert and leaves the flags empty, which is the right answer for macOS | ||
| 134 | anyway, so every platform resolves correctly without a make conditional. | ||
| 135 | |||
| 136 | The flags are not in OT_CFLAGS, so the sanitizer test builds do not inherit | ||
| 137 | them. AddressSanitizer checks harder than FORTIFY does, and the two clash on | ||
| 138 | FreeBSD, where a FORTIFY plus ASan build aborted a multi hash scrape that the | ||
| 139 | hardened production binary serves without complaint. | ||
| 140 | |||
| 106 | Startup and teardown order | 141 | Startup and teardown order |
| 107 | -------------------------- | 142 | -------------------------- |
| 108 | 143 | ||
