|
40 | 40 | #include <utility> |
41 | 41 | #include <vector> |
42 | 42 |
|
43 | | -#include "absl/algorithm/container.h" |
44 | 43 | #include "absl/base/attributes.h" |
45 | 44 | #include "absl/container/flat_hash_map.h" |
46 | 45 | #include "absl/container/flat_hash_set.h" |
@@ -263,39 +262,6 @@ bool IsLikelyChrooted() { |
263 | 262 | return *self_root_id != *init_root_id; |
264 | 263 | } |
265 | 264 |
|
266 | | -template <typename C, typename AddFn> |
267 | | -void DisableCompressStackDepotImpl(C& envs, AddFn&& add_env) { |
268 | | - auto disable_compress_stack_depot = [&envs, |
269 | | - &add_env](absl::string_view sanitizer) { |
270 | | - auto prefix = absl::StrCat(sanitizer, "_OPTIONS="); |
271 | | - constexpr absl::string_view option = "compress_stack_depot=0"; |
272 | | - auto it = absl::c_find_if(envs, [&prefix](const std::string& env) { |
273 | | - return absl::StartsWith(env, prefix); |
274 | | - }); |
275 | | - if (it != envs.end()) { |
276 | | - // If it's already there, the last value will be used. |
277 | | - absl::StrAppend(&*it, ":", option); |
278 | | - return; |
279 | | - } |
280 | | - add_env(absl::StrCat(prefix, option)); |
281 | | - }; |
282 | | - if constexpr (sapi::sanitizers::IsASan()) { |
283 | | - disable_compress_stack_depot("ASAN"); |
284 | | - } |
285 | | - if constexpr (sapi::sanitizers::IsMSan()) { |
286 | | - disable_compress_stack_depot("MSAN"); |
287 | | - } |
288 | | - if constexpr (sapi::sanitizers::IsLSan()) { |
289 | | - disable_compress_stack_depot("LSAN"); |
290 | | - } |
291 | | - if constexpr (sapi::sanitizers::IsHwASan()) { |
292 | | - disable_compress_stack_depot("HWSAN"); |
293 | | - } |
294 | | - if constexpr (sapi::sanitizers::IsTSan()) { |
295 | | - disable_compress_stack_depot("TSAN"); |
296 | | - } |
297 | | -} |
298 | | - |
299 | 265 | } // namespace |
300 | 266 |
|
301 | 267 | void ForkServer::PrepareExecveArgs(const ForkRequest& request, |
@@ -325,12 +291,6 @@ void ForkServer::PrepareExecveArgs(const ForkRequest& request, |
325 | 291 | absl::StrJoin(*envp, "', '").c_str()); |
326 | 292 | } |
327 | 293 |
|
328 | | -void ForkServer::DisableCompressStackDepot(std::vector<std::string>& envs) { |
329 | | - DisableCompressStackDepotImpl(envs, [&envs](absl::string_view value) { |
330 | | - envs.push_back(std::string(value)); |
331 | | - }); |
332 | | -} |
333 | | - |
334 | 294 | void ForkServer::LaunchChild(const ForkRequest& request, int execve_fd, |
335 | 295 | uid_t uid, gid_t gid, FDCloser signaling_fd, |
336 | 296 | FDCloser status_fd, bool avoid_pivot_root) const { |
@@ -448,14 +408,6 @@ pid_t ForkServer::ServeRequest() { |
448 | 408 | SAPI_RAW_CHECK(comms_->RecvFD(&exec_fd), "Failed to receive Exec FD"); |
449 | 409 | } |
450 | 410 |
|
451 | | - // Disable optimization to avoid related syscalls. |
452 | | - if constexpr (sapi::sanitizers::IsAny()) { |
453 | | - DisableCompressStackDepotImpl(*fork_request.mutable_envs(), |
454 | | - [&fork_request](absl::string_view value) { |
455 | | - fork_request.add_envs(value); |
456 | | - }); |
457 | | - } |
458 | | - |
459 | 411 | // Make the kernel notify us with SIGCHLD when the process terminates. |
460 | 412 | // We use sigaction(SIGCHLD, flags=SA_NOCLDWAIT) in combination with |
461 | 413 | // this to make sure the zombie process is reaped immediately. |
|
0 commit comments