OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/zygote_host/zygote_host_impl_linux.h" | 5 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
6 | 6 |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 if (IsHeapProfilerRunning()) | 418 if (IsHeapProfilerRunning()) |
419 return; | 419 return; |
420 #endif | 420 #endif |
421 std::vector<std::string> adj_oom_score_cmdline; | 421 std::vector<std::string> adj_oom_score_cmdline; |
422 adj_oom_score_cmdline.push_back(sandbox_binary_); | 422 adj_oom_score_cmdline.push_back(sandbox_binary_); |
423 adj_oom_score_cmdline.push_back(sandbox::kAdjustOOMScoreSwitch); | 423 adj_oom_score_cmdline.push_back(sandbox::kAdjustOOMScoreSwitch); |
424 adj_oom_score_cmdline.push_back(base::Int64ToString(pid)); | 424 adj_oom_score_cmdline.push_back(base::Int64ToString(pid)); |
425 adj_oom_score_cmdline.push_back(base::IntToString(score)); | 425 adj_oom_score_cmdline.push_back(base::IntToString(score)); |
426 | 426 |
427 base::ProcessHandle sandbox_helper_process; | 427 base::ProcessHandle sandbox_helper_process; |
428 if (base::LaunchProcess(adj_oom_score_cmdline, base::LaunchOptions(), | 428 base::LaunchOptions options; |
| 429 |
| 430 // sandbox_helper_process is a setuid binary. |
| 431 options.allow_new_privs = true; |
| 432 |
| 433 if (base::LaunchProcess(adj_oom_score_cmdline, options, |
429 &sandbox_helper_process)) { | 434 &sandbox_helper_process)) { |
430 base::EnsureProcessGetsReaped(sandbox_helper_process); | 435 base::EnsureProcessGetsReaped(sandbox_helper_process); |
431 } | 436 } |
432 } else if (!using_suid_sandbox_) { | 437 } else if (!using_suid_sandbox_) { |
433 if (!base::AdjustOOMScore(pid, score)) | 438 if (!base::AdjustOOMScore(pid, score)) |
434 PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid; | 439 PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid; |
435 } | 440 } |
436 } | 441 } |
437 #endif | 442 #endif |
438 | 443 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 return RenderSandboxHostLinux::GetInstance()->pid(); | 510 return RenderSandboxHostLinux::GetInstance()->pid(); |
506 } | 511 } |
507 | 512 |
508 int ZygoteHostImpl::GetSandboxStatus() const { | 513 int ZygoteHostImpl::GetSandboxStatus() const { |
509 if (have_read_sandbox_status_word_) | 514 if (have_read_sandbox_status_word_) |
510 return sandbox_status_; | 515 return sandbox_status_; |
511 return 0; | 516 return 0; |
512 } | 517 } |
513 | 518 |
514 } // namespace content | 519 } // namespace content |
OLD | NEW |