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

Side by Side Diff: sandbox/linux/suid/sandbox.cc

Issue 149689: Linux: move hardcoded paths to GYP variables. (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandbox 5 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandbox
6 6
7 #include <asm/unistd.h> 7 #include <asm/unistd.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sched.h> 10 #include <sched.h>
11 #include <signal.h> 11 #include <signal.h>
12 #include <stdarg.h> 12 #include <stdarg.h>
13 #include <stdio.h> 13 #include <stdio.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 #include <string.h> 15 #include <string.h>
16 #include <sys/prctl.h> 16 #include <sys/prctl.h>
17 #include <sys/resource.h> 17 #include <sys/resource.h>
18 #include <sys/socket.h> 18 #include <sys/socket.h>
19 #include <sys/stat.h> 19 #include <sys/stat.h>
20 #include <sys/time.h> 20 #include <sys/time.h>
21 #include <sys/types.h> 21 #include <sys/types.h>
22 #include <unistd.h> 22 #include <unistd.h>
23 23
24 #if !defined(CLONE_NEWPID) 24 #if !defined(CLONE_NEWPID)
25 #define CLONE_NEWPID 0x20000000 25 #define CLONE_NEWPID 0x20000000
26 #endif 26 #endif
27 27
28 static const char kChromeBinary[] = "/opt/google/chrome/chrome"; 28 #if !defined(LINUX_SANDBOX_CHROME_PATH) && \
29 !defined(CHROME_DEVEL_SANDBOX)
30 #error LINUX_SANDBOX_CHROME_PATH must be defined to be the location of the \
31 Chrome binary, or CHROME_DEVEL_SANDBOX must be defined
32 #endif
33
34 #if defined(LINUX_SANDBOX_CHROME_PATH)
35 static const char kChromeBinary[] = LINUX_SANDBOX_CHROME_PATH;
36 #endif
37
29 static const char kSandboxDescriptorEnvironmentVarName[] = "SBX_D"; 38 static const char kSandboxDescriptorEnvironmentVarName[] = "SBX_D";
30 39
31 // These are the magic byte values which the sandboxed process uses to request 40 // These are the magic byte values which the sandboxed process uses to request
32 // that it be chrooted. 41 // that it be chrooted.
33 static const char kMsgChrootMe = 'C'; 42 static const char kMsgChrootMe = 'C';
34 static const char kMsgChrootSuccessful = 'O'; 43 static const char kMsgChrootSuccessful = 'O';
35 44
36 static void FatalError(const char *msg, ...) 45 static void FatalError(const char *msg, ...)
37 __attribute__((noreturn, format(printf,1,2))); 46 __attribute__((noreturn, format(printf,1,2)));
38 47
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (!DropRoot()) 306 if (!DropRoot())
298 return 1; 307 return 1;
299 if (!SetupChildEnvironment()) 308 if (!SetupChildEnvironment())
300 return 1; 309 return 1;
301 310
302 execv(argv[1], &argv[1]); 311 execv(argv[1], &argv[1]);
303 FatalError("execv failed"); 312 FatalError("execv failed");
304 313
305 return 1; 314 return 1;
306 } 315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698