|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Jeremy Apthorp <nornagon@nornagon.net> |
| 3 | +Date: Mon, 26 Aug 2019 12:02:51 -0700 |
| 4 | +Subject: allow new privileges in unsandboxed child processes |
| 5 | + |
| 6 | +This allows unsandboxed renderers to launch setuid processes on Linux. |
| 7 | + |
| 8 | +diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc |
| 9 | +index 720b92a1a3a7ab5512f839005b272e4989d2ac65..b1759109627cd00053489dcdd397e942fa9d289f 100644 |
| 10 | +--- a/content/browser/child_process_launcher_helper_linux.cc |
| 11 | ++++ b/content/browser/child_process_launcher_helper_linux.cc |
| 12 | +@@ -54,6 +54,18 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( |
| 13 | + const int sandbox_fd = SandboxHostLinux::GetInstance()->GetChildSocket(); |
| 14 | + options->fds_to_remap.push_back( |
| 15 | + std::make_pair(sandbox_fd, service_manager::GetSandboxFD())); |
| 16 | ++ |
| 17 | ++ // (For Electron), if we're launching without zygote, that means we're |
| 18 | ++ // launching an unsandboxed process (since all sandboxed processes are |
| 19 | ++ // forked from the zygote). Relax the allow_new_privs option to permit |
| 20 | ++ // launching suid processes from unsandboxed renderers. |
| 21 | ++ service_manager::ZygoteHandle zygote_handle = |
| 22 | ++ base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) |
| 23 | ++ ? nullptr |
| 24 | ++ : delegate_->GetZygote(); |
| 25 | ++ if (!zygote_handle) { |
| 26 | ++ options->allow_new_privs = true; |
| 27 | ++ } |
| 28 | + } |
| 29 | + |
| 30 | + options->environment = delegate_->GetEnvironment(); |
0 commit comments