Chromium Code Reviews| Index: chrome/nacl/nacl_broker_listener.cc |
| =================================================================== |
| --- chrome/nacl/nacl_broker_listener.cc (revision 188735) |
| +++ chrome/nacl/nacl_broker_listener.cc (working copy) |
| @@ -18,6 +18,7 @@ |
| #include "content/public/common/sandbox_init.h" |
| #include "ipc/ipc_channel.h" |
| #include "ipc/ipc_switches.h" |
| +#include "sandbox/win/src/sandbox_policy.h" |
| namespace { |
| @@ -45,6 +46,21 @@ |
| MessageLoop::current()->Run(); |
| } |
| +// NOTE: changes to this method need to be reviewed by the security team. |
| +void NaClBrokerListener::PreSpawnTarget(sandbox::TargetPolicy* policy, |
| + bool* success) { |
| + // This code is duplicated in chrome_browser_main_win.cc. |
|
cpu_(ooo_6.6-7.5)
2013/03/19 21:22:55
is the comment of line 52 correct?
jam
2013/03/19 22:57:29
updated now,thanks
|
| + |
| + // Allow the server side of a pipe restricted to the "chrome.nacl." |
| + // namespace so that it cannot impersonate other system or other chrome |
| + // service pipes. |
| + sandbox::ResultCode result = policy->AddRule( |
| + sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, |
| + sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, |
| + L"\\\\.\\pipe\\chrome.nacl.*"); |
| + *success = (result == sandbox::SBOX_ALL_OK); |
| +} |
| + |
| void NaClBrokerListener::OnChannelConnected(int32 peer_pid) { |
| bool res = base::OpenProcessHandle(peer_pid, &browser_handle_); |
| CHECK(res); |
| @@ -87,8 +103,7 @@ |
| cmd_line->AppendSwitchASCII(switches::kProcessChannelID, |
| loader_channel_id); |
| - loader_process = |
| - content::StartProcessWithAccess(cmd_line, base::FilePath()); |
| + loader_process = content::StartSandboxedProcess(this, cmd_line); |
| if (loader_process) { |
| DuplicateHandle(::GetCurrentProcess(), loader_process, |
| browser_handle_, &loader_handle_in_browser, |