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

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: Created 8 years, 7 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
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());
+ 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 "

Powered by Google App Engine
This is Rietveld 408576698