Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: content/common/sandbox_policy.cc

Issue 9585001: Cleanup: Remove deprecated version of file_util::AppendToPath(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/mini_installer_test/installer_test_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 if (!PathService::Get(base::DIR_MODULE, &app_dir)) 283 if (!PathService::Get(base::DIR_MODULE, &app_dir))
284 return false; 284 return false;
285 285
286 wchar_t long_path_buf[MAX_PATH]; 286 wchar_t long_path_buf[MAX_PATH];
287 DWORD long_path_return_value = GetLongPathName(app_dir.value().c_str(), 287 DWORD long_path_return_value = GetLongPathName(app_dir.value().c_str(),
288 long_path_buf, 288 long_path_buf,
289 MAX_PATH); 289 MAX_PATH);
290 if (long_path_return_value == 0 || long_path_return_value >= MAX_PATH) 290 if (long_path_return_value == 0 || long_path_return_value >= MAX_PATH)
291 return false; 291 return false;
292 292
293 string16 debug_message(long_path_buf); 293 FilePath debug_message(long_path_buf);
294 file_util::AppendToPath(&debug_message, L"debug_message.exe"); 294 debug_message = debug_message.AppendASCII("debug_message.exe");
295 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS, 295 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS,
296 sandbox::TargetPolicy::PROCESS_MIN_EXEC, 296 sandbox::TargetPolicy::PROCESS_MIN_EXEC,
297 debug_message.c_str()); 297 debug_message.value().c_str());
298 if (result != sandbox::SBOX_ALL_OK) 298 if (result != sandbox::SBOX_ALL_OK)
299 return false; 299 return false;
300 #endif // NDEBUG 300 #endif // NDEBUG
301 301
302 return true; 302 return true;
303 } 303 }
304 304
305 // For the GPU process we gotten as far as USER_LIMITED. The next level 305 // For the GPU process we gotten as far as USER_LIMITED. The next level
306 // which is USER_RESTRICTED breaks both the DirectX backend and the OpenGL 306 // which is USER_RESTRICTED breaks both the DirectX backend and the OpenGL
307 // backend. Note that the GPU process is connected to the interactive 307 // backend. Note that the GPU process is connected to the interactive
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 // For Native Client sel_ldr processes on 32-bit Windows, reserve 1 GB of 573 // For Native Client sel_ldr processes on 32-bit Windows, reserve 1 GB of
574 // address space to prevent later failure due to address space fragmentation 574 // address space to prevent later failure due to address space fragmentation
575 // from .dll loading. The NaCl process will attempt to locate this space by 575 // from .dll loading. The NaCl process will attempt to locate this space by
576 // scanning the address space using VirtualQuery. 576 // scanning the address space using VirtualQuery.
577 // TODO(bbudge) Handle the --no-sandbox case. 577 // TODO(bbudge) Handle the --no-sandbox case.
578 // http://code.google.com/p/nativeclient/issues/detail?id=2131 578 // http://code.google.com/p/nativeclient/issues/detail?id=2131
579 if (type == content::PROCESS_TYPE_NACL_LOADER && 579 if (type == content::PROCESS_TYPE_NACL_LOADER &&
580 (base::win::OSInfo::GetInstance()->wow64_status() == 580 (base::win::OSInfo::GetInstance()->wow64_status() ==
581 base::win::OSInfo::WOW64_DISABLED)) { 581 base::win::OSInfo::WOW64_DISABLED)) {
582 const SIZE_T kOneGigabyte = 1 << 30; 582 const SIZE_T kOneGigabyte = 1 << 30;
583 void *nacl_mem = VirtualAllocEx(target.hProcess, 583 void* nacl_mem = VirtualAllocEx(target.hProcess,
584 NULL, 584 NULL,
585 kOneGigabyte, 585 kOneGigabyte,
586 MEM_RESERVE, 586 MEM_RESERVE,
587 PAGE_NOACCESS); 587 PAGE_NOACCESS);
588 if (!nacl_mem) { 588 if (!nacl_mem) {
589 DLOG(WARNING) << "Failed to reserve address space for Native Client"; 589 DLOG(WARNING) << "Failed to reserve address space for Native Client";
590 } 590 }
591 } 591 }
592 592
593 ResumeThread(target.hThread); 593 ResumeThread(target.hThread);
594 CloseHandle(target.hThread); 594 CloseHandle(target.hThread);
595 process = target.hProcess; 595 process = target.hProcess;
596 596
597 // Help the process a little. It can't start the debugger by itself if 597 // Help the process a little. It can't start the debugger by itself if
598 // the process is in a sandbox. 598 // the process is in a sandbox.
599 if (child_needs_help) 599 if (child_needs_help)
600 base::debug::SpawnDebuggerOnProcess(target.dwProcessId); 600 base::debug::SpawnDebuggerOnProcess(target.dwProcessId);
601 601
602 return process; 602 return process;
603 } 603 }
604 604
605 } // namespace sandbox 605 } // namespace sandbox
OLDNEW
« no previous file with comments | « chrome/test/mini_installer_test/installer_test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698