diff options
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/linux/suid/sandbox.cc | 15 |
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"); |