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

Unified Diff: chrome/app/chrome_main.cc

Issue 7714018: Give plug-in processes an executable heap and disable PIE/ASLR for Native (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/mac/make_heap_non_executable_from_xcode.sh ('k') | chrome/app/helper-Info.plist » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_main.cc
===================================================================
--- chrome/app/chrome_main.cc (revision 97969)
+++ chrome/app/chrome_main.cc (working copy)
@@ -764,11 +764,37 @@
// The helper's Info.plist marks it as a background only app.
if (base::mac::IsBackgroundOnlyProcess()) {
- CHECK(command_line.HasSwitch(switches::kProcessType))
+ CHECK(command_line.HasSwitch(switches::kProcessType) &&
+ !process_type.empty())
<< "Helper application requires --type.";
+
+ // In addition, some helper flavors only work with certain process types.
+ FilePath executable;
+ if (PathService::Get(base::FILE_EXE, &executable) &&
+ executable.value().size() >= 3) {
+ std::string last_three =
+ executable.value().substr(executable.value().size() - 3);
+
+ if (last_three == " EH") {
+ CHECK_EQ(switches::kPluginProcess, process_type)
+ << "Executable-heap process requires --type="
+ << switches::kPluginProcess << ", saw " << process_type;
+ } else if (last_three == " NP") {
+ CHECK_EQ(switches::kNaClLoaderProcess, process_type)
+ << "Non-PIE process requires --type="
+ << switches::kNaClLoaderProcess << ", saw " << process_type;
+ } else {
+ CHECK(process_type != switches::kPluginProcess &&
+ process_type != switches::kNaClLoaderProcess)
+ << "Non-executable-heap PIE process is intolerant of --type="
+ << switches::kPluginProcess << " and "
+ << switches::kNaClLoaderProcess << ", saw " << process_type;
+ }
+ }
} else {
- CHECK(!command_line.HasSwitch(switches::kProcessType))
- << "Main application forbids --type, saw \"" << process_type << "\".";
+ CHECK(!command_line.HasSwitch(switches::kProcessType) &&
+ process_type.empty())
+ << "Main application forbids --type, saw " << process_type;
}
if (IsCrashReporterEnabled())
« no previous file with comments | « build/mac/make_heap_non_executable_from_xcode.sh ('k') | chrome/app/helper-Info.plist » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698