diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-06 19:09:43 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-06 19:09:43 +0100 |
| commit | 4a01fea4a96374a1359d43a280a236a3ea042a1c (patch) | |
| tree | 5d57ca6b632728f94815bececbc7a22e716bd02b /DESIGN | |
| parent | 99a706ded2a79768ce5b850be0d4262d321aa296 (diff) | |
Enable RELRO everywhere than macos
Diffstat (limited to 'DESIGN')
| -rw-r--r-- | DESIGN | 9 |
1 files changed, 8 insertions, 1 deletions
| @@ -116,13 +116,20 @@ Build hardening the shipped binary | |||
| 116 | ---------------------------------- | 116 | ---------------------------------- |
| 117 | 117 | ||
| 118 | The production and debug binaries carry -fstack-protector-strong, PIE and | 118 | The production and debug binaries carry -fstack-protector-strong, PIE and |
| 119 | _FORTIFY_SOURCE=2; a GNU-style linker also gets full RELRO. Measured cost on | 119 | _FORTIFY_SOURCE=2; every linker but Apple's also gets full RELRO (-z relro,-z now). Measured cost on |
| 120 | the announce hot path is 300 to 305 nanoseconds, under two per cent, and the | 120 | the announce hot path is 300 to 305 nanoseconds, under two per cent, and the |
| 121 | individual flags sit inside the run-to-run noise: add_peer has few stack | 121 | individual flags sit inside the run-to-run noise: add_peer has few stack |
| 122 | buffers, most buffer sizes are known at compile time so FORTIFY emits no | 122 | buffers, most buffer sizes are known at compile time so FORTIFY emits no |
| 123 | runtime check, and PIE on arm64 is almost free. On x86-64 PIE costs a little | 123 | runtime check, and PIE on arm64 is almost free. On x86-64 PIE costs a little |
| 124 | more. End to end it is invisible, since a UDP announce is mostly kernel time. | 124 | more. End to end it is invisible, since a UDP announce is mostly kernel time. |
| 125 | 125 | ||
| 126 | RELRO is gated on the operating system because Apple's linker rejects -z. The | ||
| 127 | branch runs in the shell through a != assignment, the one form both bmake and | ||
| 128 | GNU make 4 accept; $(shell) is GNU only and GNU make 3.81, which stock macOS | ||
| 129 | ships, has neither. On that old make the != line is inert and leaves RELRO | ||
| 130 | empty, which is the right answer for macOS anyway, so every platform resolves | ||
| 131 | correctly without a make conditional. | ||
| 132 | |||
| 126 | The flags are not in OT_CFLAGS, so the sanitizer test builds do not inherit | 133 | The flags are not in OT_CFLAGS, so the sanitizer test builds do not inherit |
| 127 | them. AddressSanitizer checks harder than FORTIFY does, and the two clash on | 134 | them. AddressSanitizer checks harder than FORTIFY does, and the two clash on |
| 128 | FreeBSD, where a FORTIFY plus ASan build aborted a multi hash scrape that the | 135 | FreeBSD, where a FORTIFY plus ASan build aborted a multi hash scrape that the |
