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

Unified Diff: content/browser/zygote_host_impl_linux.cc

Issue 10492006: Setuid sandbox API versioning (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch return value logic in CheckAndExportApiVersion Created 8 years, 6 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 | « base/linux_util.h ('k') | content/zygote/zygote_main_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/zygote_host_impl_linux.cc
diff --git a/content/browser/zygote_host_impl_linux.cc b/content/browser/zygote_host_impl_linux.cc
index 10214ec4e940c2b39696db68c011d8a83abcf37f..6d73a2e2033b1fd92c588dfb208673c04e85480e 100644
--- a/content/browser/zygote_host_impl_linux.cc
+++ b/content/browser/zygote_host_impl_linux.cc
@@ -38,6 +38,14 @@
#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
#endif
+// Set an environment variable that reflects the API version we expect from the
+// setuid sandbox. Old versions of the sandbox will ignore this.
+static void SetSandboxAPIEnvironmentVariable() {
+ scoped_ptr<base::Environment> env(base::Environment::Create());
brettw 2012/06/04 23:21:59 You got 3 space indents here. Undent one.
+ env->SetVar(base::kSandboxEnvironmentApiRequest,
+ base::IntToString(base::kSUIDSandboxApiNumber));
+}
+
static void SaveSUIDUnsafeEnvironmentVariables() {
// The ELF loader will clear many environment variables so we save them to
// different names here so that the SUID sandbox can resolve them for the
@@ -146,6 +154,7 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
cmd_line.PrependWrapper(sandbox_binary_);
SaveSUIDUnsafeEnvironmentVariables();
+ SetSandboxAPIEnvironmentVariable();
} else {
LOG(FATAL) << "The SUID sandbox helper binary was found, but is not "
"configured correctly. Rather than run without sandboxing "
« no previous file with comments | « base/linux_util.h ('k') | content/zygote/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698