summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 17:05:18 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 17:05:18 +0000
commite5bf919de97cab42aa719a13a939487cf9f18242 (patch)
tree4f1e7e3a3a7fe7448e94d2133f18690fd2985ab6 /sandbox
parentd5db36157268e246c048e69db46f680283e02667 (diff)
downloadchromium_src-e5bf919de97cab42aa719a13a939487cf9f18242.zip
chromium_src-e5bf919de97cab42aa719a13a939487cf9f18242.tar.gz
chromium_src-e5bf919de97cab42aa719a13a939487cf9f18242.tar.bz2
Linux: propagate LD_LIBRARY_PATH through the SUID sandbox.
With the SUID sandbox, certain environment variables (esp LD_LIBRARY_PATH) are cleared for security reasons. This means that the child zygote process isn't run with the correct environment and can fail to start. BUG=16815 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20733 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/linux/suid/sandbox.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sandbox/linux/suid/sandbox.cc b/sandbox/linux/suid/sandbox.cc
index b594d21..30b8426 100644
--- a/sandbox/linux/suid/sandbox.cc
+++ b/sandbox/linux/suid/sandbox.cc
@@ -218,6 +218,19 @@ static bool DropRoot() {
return true;
}
+static bool SetupChildEnvironment() {
+ // ld.so will have cleared LD_LIBRARY_PATH because we are SUID. However, the
+ // child process might need this so zygote_host_linux.cc saved a copy in
+ // SANDBOX_LD_LIBRARY_PATH.
+ const char* sandbox_ld_library_path = getenv("SANDBOX_LD_LIBRARY_PATH");
+ if (sandbox_ld_library_path) {
+ setenv("LD_LIBRARY_PATH", sandbox_ld_library_path, 1 /* overwrite */);
+ unsetenv("SANDBOX_LD_LIBRARY_PATH");
+ }
+
+ return true;
+}
+
int main(int argc, char **argv) {
if (argc == 1) {
fprintf(stderr, "Usage: %s <renderer process> <args...>\n", argv[0]);
@@ -281,6 +294,8 @@ int main(int argc, char **argv) {
return 1;
if (!DropRoot())
return 1;
+ if (!SetupChildEnvironment())
+ return 1;
execv(argv[1], &argv[1]);
FatalError("execv failed");