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

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

Issue 155584: Merge 20733 - Linux: propagate LD_LIBRARY_PATH through the SUID sandbox.... (Closed) Base URL: svn://chrome-svn/chrome/branches/194/src/
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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/suid/sandbox.cc
===================================================================
--- sandbox/linux/suid/sandbox.cc (revision 20732)
+++ sandbox/linux/suid/sandbox.cc (working copy)
@@ -218,6 +218,19 @@
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]);
@@ -235,6 +248,8 @@
return 1;
if (!DropRoot())
return 1;
+ if (!SetupChildEnvironment())
+ return 1;
execv(argv[1], &argv[1]);
FatalError("execv failed");
Property changes on: sandbox\linux\suid\sandbox.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/sandbox/linux/suid/sandbox.cc:r69-2775
Merged /trunk/src/sandbox/linux/suid/sandbox.cc:r20733
« no previous file with comments | « chrome/browser/zygote_host_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698