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

Unified Diff: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc

Issue 2707763002: Fix unprivileged user namespace regression (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
index b7cc45a8b536650f06a1eaa3352356793256857f..8e3d85ea7b9a3b72c0b914921b804709014e5b32 100644
--- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
+++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
@@ -4,6 +4,14 @@
#include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
+#if defined(OS_LINUX)
Tom (Use chromium acct) 2017/02/19 19:16:06 Move ifdef'ed includes to the bottom
Kevin Cernekee 2017/02/19 19:33:46 Done.
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#include <utility>
+
#include "base/memory/ptr_util.h"
#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
#include "chrome/browser/ui/views/chrome_views_delegate.h"
@@ -77,6 +85,12 @@ void ChromeBrowserMainExtraPartsViews::PreProfileInit() {
if (geteuid() != 0)
return;
+ // Allow running inside an unprivileged user namespace. In that case, /
Tom (Use chromium acct) 2017/02/19 19:16:06 remove / ?
Kevin Cernekee 2017/02/19 19:33:46 I changed it to "the root directory" to make the c
+ // will be owned by an unmapped UID and GID.
+ struct stat st;
+ if (stat("/", &st) == 0 && st.st_uid != 0)
+ return;
+
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kNoSandbox))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698