summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 21:44:17 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 21:44:17 +0000
commit24d432c88be43fb774df1971a6148648d1ea29a2 (patch)
tree3af1965f17f1da463dd7c8ada36379dc1ef757d4 /chrome
parentf9067a66d5efc23c6384f2dc2aadd4ec8f35943e (diff)
downloadchromium_src-24d432c88be43fb774df1971a6148648d1ea29a2.zip
chromium_src-24d432c88be43fb774df1971a6148648d1ea29a2.tar.gz
chromium_src-24d432c88be43fb774df1971a6148648d1ea29a2.tar.bz2
linux: use /proc/self/exe when exec'ing ourselves
We don't want to ever go out to disk when looking for data after startup, since they can be changed by an update. We *should* just be using the zygote, but the zygote is sandboxed-only for now, and fixing that has a lengthy dependency graph. In the interim, /proc/self/exe is the correct executable and exec'ing it should work as long as the subprocess doesn't need any other files from the Chrome directory. BUG=22703 TEST=Start Chrome. Move away the entire Chrome directory; plugins should still work. Review URL: http://codereview.chromium.org/403018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32410 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/child_process_host.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index d4a9eda..2e0f1f6 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -93,16 +93,20 @@ FilePath ChildProcessHost::GetChildPath() {
if (!child_path.empty())
return child_path;
-#if !defined(OS_MACOSX)
- // On most platforms, the child executable is the same as the current
- // executable.
- PathService::Get(base::FILE_EXE, &child_path);
-#else
+#if defined(OS_LINUX)
+ // Use /proc/self/exe rather than our known binary path so updates
+ // can't swap out the binary from underneath us.
+ child_path = FilePath("/proc/self/exe");
+#elif defined(OS_MACOSX)
// On the Mac, the child executable lives at a predefined location within
// the app bundle's versioned directory.
child_path = chrome::GetVersionedDirectory().
Append(chrome::kHelperProcessExecutablePath);
-#endif // OS_MACOSX
+#else
+ // On most platforms, the child executable is the same as the current
+ // executable.
+ PathService::Get(base::FILE_EXE, &child_path);
+#endif
return child_path;
}