Commit f8b143e
committed
Consolidate security-related compiler flags
Update and extend the list of hardening-related compiler flags
used by HHVM to better represent modern distro defaults.
* Convert the existing `ENABLE_SSP` build option into a new
`ENABLE_HARDENING` option and put an updated list of security flags behind it.
Both clang and GCC have been supporting these options for a while now,
so we can set them irrespective of the compiler.
* Put PIE-related options behind a separate `ENABLE_PIE` build option
so that we can produce and compare non-PIE and PIE builds once we fix
compatibility with PIE.
* Forward `CMAKE_BUILD_TYPE` to the mcrouter extension. Lack of this
was causing mcrouter to be built without compiler optimizations,
which doesn't play well with `FORTIFY_SOURCE`.
HHVM runs fine with these flags, requiring only a small fix to folly/Subprocess.cpp
to fix compatibility with the overloaded `openat()` syscall from `FORTIFY_SOURCE`.
The overhead from these flags is likely to be limited, as many of them
have been set by default for distribution packages for several years now.[1]
[1] https://github.com/jvoisin/compiler-flags-distro1 parent 4ee0291 commit f8b143e
4 files changed
Lines changed: 42 additions & 20 deletions
File tree
- CMake
- third-party
- folly/src/folly
- mcrouter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
92 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
93 | 125 | | |
94 | 126 | | |
95 | 127 | | |
| |||
110 | 142 | | |
111 | 143 | | |
112 | 144 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 145 | | |
121 | 146 | | |
122 | 147 | | |
| |||
150 | 175 | | |
151 | 176 | | |
152 | 177 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | 178 | | |
163 | 179 | | |
164 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
0 commit comments