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

Unified Diff: chrome/browser/zygote_main_linux.cc

Issue 149230: Linux: SUID sandbox support (Closed)
Patch Set: ... Created 11 years, 5 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 | « chrome/browser/zygote_host_linux.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/zygote_main_linux.cc
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 3f9b5707dc6924d47b2522b577835e5562e70530..8e4fb55e51df1e0b6b45589bdcbb30ea53b76999 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -13,6 +13,7 @@
#include "base/eintr_wrapper.h"
#include "base/global_descriptors_posix.h"
#include "base/pickle.h"
+#include "base/rand_util.h"
#include "base/unix_domain_socket_posix.h"
#include "chrome/browser/zygote_host_linux.h"
@@ -207,6 +208,10 @@ static bool MaybeEnterChroot() {
return false;
const int fd = fd_long;
+ // Before entering the sandbox, "prime" any systems that need to open
+ // files and cache the results or the descriptors.
+ base::RandUint64();
+
static const char kChrootMe = 'C';
static const char kChrootMeSuccess = 'O';
@@ -221,9 +226,18 @@ static bool MaybeEnterChroot() {
if (chdir("/") == -1)
return false;
- static const int kMagicSandboxIPCDescriptor = 4;
+ static const int kMagicSandboxIPCDescriptor = 5;
SkiaFontConfigUseIPCImplementation(kMagicSandboxIPCDescriptor);
+ if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0)) {
+ LOG(ERROR) << "CRITICAL: The SUID sandbox is being used, but the chrome "
+ "binary is also marked as readable. This means that the "
+ "process starts up dumpable. That means that there's a "
+ "window where another renderer process can ptrace this "
+ "process and sequestrate it. This is a packaging error. "
+ "Please report it as such.";
+ }
+
prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);
if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0))
return false;
« no previous file with comments | « chrome/browser/zygote_host_linux.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698