allow_new_privileges_in_unsandboxed_child_processes.patch 1.3 KB

123456789101112131415161718192021222324252627
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Jeremy Apthorp <[email protected]>
  3. Date: Mon, 26 Aug 2019 12:02:51 -0700
  4. Subject: allow new privileges in unsandboxed child processes
  5. This allows unsandboxed child process to launch setuid processes on Linux.
  6. diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc
  7. index 31ccdd899b06f91ab73ab27380ad0712b23fd563..b8147fce70f90191f9d4a794f69f32b23eac0e08 100644
  8. --- a/content/browser/child_process_launcher_helper_linux.cc
  9. +++ b/content/browser/child_process_launcher_helper_linux.cc
  10. @@ -62,6 +62,15 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
  11. options->fds_to_remap.emplace_back(sandbox_fd, GetSandboxFD());
  12. }
  13. + // (For Electron), if we're launching without zygote, that means we're
  14. + // launching an unsandboxed process (since all sandboxed processes are
  15. + // forked from the zygote). Relax the allow_new_privs option to permit
  16. + // launching suid processes from unsandboxed child processes.
  17. + if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) &&
  18. + delegate_->GetZygote() == nullptr) {
  19. + options->allow_new_privs = true;
  20. + }
  21. +
  22. options->environment = delegate_->GetEnvironment();
  23. } else {
  24. DCHECK(GetZygoteForLaunch());