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

Unified Diff: sandbox/linux/suid/sandbox.c

Issue 197213015: [Linux] Use PR_SET_NO_NEW_PRIVS by default in base/process/launch.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add function Created 6 years, 9 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 | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/suid/sandbox.c
diff --git a/sandbox/linux/suid/sandbox.c b/sandbox/linux/suid/sandbox.c
index f6e6c495d9d3557857268c555b32bd550074dfe7..d91c147daeaa495aa4d9dac507ba17a7339ce042 100644
--- a/sandbox/linux/suid/sandbox.c
+++ b/sandbox/linux/suid/sandbox.c
@@ -303,13 +303,14 @@ static bool MoveToNewNamespaces() {
// something went wrong, hence we bail with an error message rather then
// provide less security.
if (errno != EINVAL) {
+ fprintf(stderr, "Failed to move to new namespace:");
if (kCloneExtraFlags[i] & CLONE_NEWPID) {
- fprintf(stderr, " PID namespaces supported");
+ fprintf(stderr, " PID namespaces supported,");
}
if (kCloneExtraFlags[i] & CLONE_NEWNET) {
- fprintf(stderr, " Network namespace supported");
+ fprintf(stderr, " Network namespace supported,");
}
- fprintf(stderr, "but failed: errno = %s\n", strerror(clone_errno));
+ fprintf(stderr, " but failed: errno = %s\n", strerror(clone_errno));
return false;
}
}
@@ -486,6 +487,13 @@ int main(int argc, char **argv) {
return 1;
}
+ if (geteuid() != 0) {
+ fprintf(stderr,
+ "The setuid sandbox is not running as root. Common causes:\n"
+ " * An unprivileged process using ptrace on it, like a debugger.\n"
+ " * A parent process set prctl(PR_SET_NO_NEW_PRIVS, ...)\n");
+ }
+
if (!MoveToNewNamespaces())
return 1;
if (!SpawnChrootHelper())
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698