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 add20a2f81d66e51e1be5a3f3b35ef6b340b4cc3..31a2a14a95540477297943df9b09b1e4659a884d 100644
  8. --- a/content/browser/child_process_launcher_helper_linux.cc
  9. +++ b/content/browser/child_process_launcher_helper_linux.cc
  10. @@ -64,6 +64,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());