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/common/sandbox_policy.h" | 5 #include "content/common/sandbox_policy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 sandbox::ResultCode result; | 316 sandbox::ResultCode result; |
317 | 317 |
318 // Add the policy for the client side of a pipe. It is just a file | 318 // Add the policy for the client side of a pipe. It is just a file |
319 // in the \pipe\ namespace. We restrict it to pipes that start with | 319 // in the \pipe\ namespace. We restrict it to pipes that start with |
320 // "chrome." so the sandboxed process cannot connect to system services. | 320 // "chrome." so the sandboxed process cannot connect to system services. |
321 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | 321 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
322 sandbox::TargetPolicy::FILES_ALLOW_ANY, | 322 sandbox::TargetPolicy::FILES_ALLOW_ANY, |
323 L"\\??\\pipe\\chrome.*"); | 323 L"\\??\\pipe\\chrome.*"); |
324 if (result != sandbox::SBOX_ALL_OK) | 324 if (result != sandbox::SBOX_ALL_OK) |
325 return false; | 325 return false; |
326 // Allow the server side of a pipe restricted to the "chrome.nacl." | |
327 // namespace so that it cannot impersonate other system or other chrome | |
328 // service pipes. | |
329 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, | |
330 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, | |
331 L"\\\\.\\pipe\\chrome.nacl.*"); | |
332 if (result != sandbox::SBOX_ALL_OK) | |
333 return false; | |
334 // Allow the server side of sync sockets, which are pipes that have | 326 // Allow the server side of sync sockets, which are pipes that have |
335 // the "chrome.sync" namespace and a randomly generated suffix. | 327 // the "chrome.sync" namespace and a randomly generated suffix. |
336 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, | 328 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, |
337 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, | 329 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, |
338 L"\\\\.\\pipe\\chrome.sync.*"); | 330 L"\\\\.\\pipe\\chrome.sync.*"); |
339 if (result != sandbox::SBOX_ALL_OK) | 331 if (result != sandbox::SBOX_ALL_OK) |
340 return false; | 332 return false; |
341 | 333 |
342 // Add the policy for debug message only in debug | 334 // Add the policy for debug message only in debug |
343 #ifndef NDEBUG | 335 #ifndef NDEBUG |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 exposed_files.value().c_str()); | 805 exposed_files.value().c_str()); |
814 if (result != sandbox::SBOX_ALL_OK) | 806 if (result != sandbox::SBOX_ALL_OK) |
815 return 0; | 807 return 0; |
816 } | 808 } |
817 | 809 |
818 if (!AddGenericPolicy(policy)) { | 810 if (!AddGenericPolicy(policy)) { |
819 NOTREACHED(); | 811 NOTREACHED(); |
820 return 0; | 812 return 0; |
821 } | 813 } |
822 | 814 |
815 #if !defined(NACL_WIN64) | |
816 GetContentClient()->AddPolicy(cmd_line, policy); | |
cpu_(ooo_6.6-7.5)
2013/03/15 17:58:53
how about not having this #if here and have it in
jam
2013/03/15 18:06:33
the problem was that the nacl win64 binary doesn't
| |
817 #endif | |
818 | |
823 if (browser_command_line.HasSwitch(switches::kEnableLogging)) { | 819 if (browser_command_line.HasSwitch(switches::kEnableLogging)) { |
824 // If stdout/stderr point to a Windows console, these calls will | 820 // If stdout/stderr point to a Windows console, these calls will |
825 // have no effect. | 821 // have no effect. |
826 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); | 822 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); |
827 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); | 823 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); |
828 } | 824 } |
829 | 825 |
830 TRACE_EVENT_BEGIN_ETW("StartProcessWithAccess::LAUNCHPROCESS", 0, 0); | 826 TRACE_EVENT_BEGIN_ETW("StartProcessWithAccess::LAUNCHPROCESS", 0, 0); |
831 | 827 |
832 result = g_broker_services->SpawnTarget( | 828 result = g_broker_services->SpawnTarget( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
904 } | 900 } |
905 | 901 |
906 return false; | 902 return false; |
907 } | 903 } |
908 | 904 |
909 bool BrokerAddTargetPeer(HANDLE peer_process) { | 905 bool BrokerAddTargetPeer(HANDLE peer_process) { |
910 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 906 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
911 } | 907 } |
912 | 908 |
913 } // namespace content | 909 } // namespace content |
OLD | NEW |